@zipify/wysiwyg 1.0.0-dev.1

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 (255) hide show
  1. package/.editorconfig +18 -0
  2. package/.eslintrc.js +253 -0
  3. package/.github/actions/deploy-example/action.yaml +61 -0
  4. package/.github/actions/lint-css/action.yaml +15 -0
  5. package/.github/actions/lint-js/action.yaml +22 -0
  6. package/.github/actions/setup/action.yaml +19 -0
  7. package/.github/actions/unit-tests/action.yaml +13 -0
  8. package/.github/actions/unit-tests/jest.config.js +8 -0
  9. package/.github/dependabot.yaml +17 -0
  10. package/.github/pull_request_template.md +17 -0
  11. package/.github/workflows/frontend-ci.yaml +120 -0
  12. package/.husky/pre-commit +4 -0
  13. package/.lintstagedrc +12 -0
  14. package/.release-it.json +6 -0
  15. package/.stylelintrc +110 -0
  16. package/README.md +61 -0
  17. package/babel.config.js +15 -0
  18. package/ci/example/deploy.sh +25 -0
  19. package/config/jest/TestEnvironment.js +27 -0
  20. package/config/jest/matchers/index.js +6 -0
  21. package/config/jest/matchers/toElementHasStyle.js +27 -0
  22. package/config/jest/matchers/toVueContainComponent.js +20 -0
  23. package/config/jest/matchers/toVueContainElement.js +34 -0
  24. package/config/jest/matchers/toVueContainLazyComponent.js +19 -0
  25. package/config/jest/matchers/toVueEmpty.js +16 -0
  26. package/config/jest/matchers/toVuexActionHasBeenDispatched.js +19 -0
  27. package/config/jest/setupMatchers.js +4 -0
  28. package/config/jest/setupTests.js +32 -0
  29. package/config/jest/typing.d.ts +14 -0
  30. package/config/svgo.js +22 -0
  31. package/config/webpack/example.config.js +86 -0
  32. package/config/webpack/loaders/index.js +6 -0
  33. package/config/webpack/loaders/js-loader.js +5 -0
  34. package/config/webpack/loaders/style-loader.js +7 -0
  35. package/config/webpack/loaders/svg-loader.js +4 -0
  36. package/config/webpack/loaders/vue-loader.js +4 -0
  37. package/config/webpack/settings.js +9 -0
  38. package/example/ExampleApp.vue +136 -0
  39. package/example/example.html +17 -0
  40. package/example/example.js +19 -0
  41. package/example/fonts.js +474 -0
  42. package/example/presets.js +245 -0
  43. package/example/tooltip/Tooltip.js +241 -0
  44. package/example/tooltip/TooltipManager.js +132 -0
  45. package/example/tooltip/index.js +3 -0
  46. package/example/tooltip/modifiers/TooltipCloseOnScrollModifier.js +73 -0
  47. package/example/tooltip/modifiers/index.js +1 -0
  48. package/example/tooltip/tooltip.css +95 -0
  49. package/jest.config.js +17 -0
  50. package/lib/Wysiwyg.vue +156 -0
  51. package/lib/__mocks__/svgMock.js +1 -0
  52. package/lib/__tests__/utils/NodeFactory.js +67 -0
  53. package/lib/__tests__/utils/index.js +4 -0
  54. package/lib/__tests__/utils/setReadonlyProperty.js +9 -0
  55. package/lib/__tests__/utils/waitAsyncOperation.js +6 -0
  56. package/lib/__tests__/utils/withComponentContext.js +14 -0
  57. package/lib/assets/icons.svg +69 -0
  58. package/lib/components/base/Button.vue +117 -0
  59. package/lib/components/base/ButtonToggle.vue +40 -0
  60. package/lib/components/base/FieldLabel.vue +28 -0
  61. package/lib/components/base/Icon.vue +67 -0
  62. package/lib/components/base/Modal.vue +116 -0
  63. package/lib/components/base/NumberField.vue +242 -0
  64. package/lib/components/base/Range.vue +196 -0
  65. package/lib/components/base/ScrollView.vue +60 -0
  66. package/lib/components/base/__tests__/Button.test.js +50 -0
  67. package/lib/components/base/__tests__/Icon.test.js +56 -0
  68. package/lib/components/base/__tests__/Modal.test.js +69 -0
  69. package/lib/components/base/__tests__/Range.test.js +39 -0
  70. package/lib/components/base/colorPicker/ColorPicker.vue +93 -0
  71. package/lib/components/base/colorPicker/composables/__tests__/usePickerApi.test.js +81 -0
  72. package/lib/components/base/colorPicker/composables/index.js +2 -0
  73. package/lib/components/base/colorPicker/composables/usePickerApi.js +35 -0
  74. package/lib/components/base/colorPicker/composables/usePickerHotkeys.js +25 -0
  75. package/lib/components/base/colorPicker/index.js +1 -0
  76. package/lib/components/base/composables/__tests__/useActivatedListener.test.js +89 -0
  77. package/lib/components/base/composables/__tests__/useDeselectionLock.test.js +80 -0
  78. package/lib/components/base/composables/__tests__/useElementRef.test.js +29 -0
  79. package/lib/components/base/composables/__tests__/useModalToggler.test.js +55 -0
  80. package/lib/components/base/composables/__tests__/useNumberValue.test.js +153 -0
  81. package/lib/components/base/composables/__tests__/useScrollView.test.js +43 -0
  82. package/lib/components/base/composables/__tests__/useTempValue.test.js +38 -0
  83. package/lib/components/base/composables/index.js +7 -0
  84. package/lib/components/base/composables/useActivatedListener.js +23 -0
  85. package/lib/components/base/composables/useDeselectionLock.js +35 -0
  86. package/lib/components/base/composables/useElementRef.js +5 -0
  87. package/lib/components/base/composables/useModalToggler.js +58 -0
  88. package/lib/components/base/composables/useNumberValue.js +53 -0
  89. package/lib/components/base/composables/useScrollView.js +22 -0
  90. package/lib/components/base/composables/useTempValue.js +11 -0
  91. package/lib/components/base/dropdown/Dropdown.vue +88 -0
  92. package/lib/components/base/dropdown/DropdownActivator.vue +81 -0
  93. package/lib/components/base/dropdown/DropdownDivider.vue +21 -0
  94. package/lib/components/base/dropdown/DropdownGroup.vue +55 -0
  95. package/lib/components/base/dropdown/DropdownMenu.vue +62 -0
  96. package/lib/components/base/dropdown/DropdownOption.vue +91 -0
  97. package/lib/components/base/dropdown/__tests__/DropdownActivator.test.js +54 -0
  98. package/lib/components/base/dropdown/__tests__/DropdownMenu.test.js +67 -0
  99. package/lib/components/base/dropdown/__tests__/DropdownOption.test.js +81 -0
  100. package/lib/components/base/dropdown/composables/__tests__/useActiveOptionManager.test.js +41 -0
  101. package/lib/components/base/dropdown/composables/__tests__/useDropdownEntityTitle.test.js +24 -0
  102. package/lib/components/base/dropdown/composables/index.js +2 -0
  103. package/lib/components/base/dropdown/composables/useActiveOptionManager.js +25 -0
  104. package/lib/components/base/dropdown/composables/useDropdownEntityTitle.js +5 -0
  105. package/lib/components/base/dropdown/index.js +2 -0
  106. package/lib/components/base/dropdown/injectionTokens.js +5 -0
  107. package/lib/components/base/index.js +11 -0
  108. package/lib/components/index.js +1 -0
  109. package/lib/components/toolbar/Toolbar.vue +56 -0
  110. package/lib/components/toolbar/ToolbarDevice.vue +35 -0
  111. package/lib/components/toolbar/ToolbarDivider.vue +50 -0
  112. package/lib/components/toolbar/ToolbarFull.vue +94 -0
  113. package/lib/components/toolbar/ToolbarGroup.vue +18 -0
  114. package/lib/components/toolbar/ToolbarRow.vue +19 -0
  115. package/lib/components/toolbar/__tests__/Toolbar.test.js +33 -0
  116. package/lib/components/toolbar/__tests__/ToolbarDivider.test.js +26 -0
  117. package/lib/components/toolbar/controls/AlignmentControl.vue +72 -0
  118. package/lib/components/toolbar/controls/AlignmentDeviceControl.vue +67 -0
  119. package/lib/components/toolbar/controls/BackgroundColorControl.vue +48 -0
  120. package/lib/components/toolbar/controls/CaseStyleControl.vue +54 -0
  121. package/lib/components/toolbar/controls/FontColorControl.vue +48 -0
  122. package/lib/components/toolbar/controls/FontFamilyControl.vue +96 -0
  123. package/lib/components/toolbar/controls/FontSizeControl.vue +45 -0
  124. package/lib/components/toolbar/controls/FontWeightControl.vue +43 -0
  125. package/lib/components/toolbar/controls/ItalicControl.vue +47 -0
  126. package/lib/components/toolbar/controls/LineHeightControl.vue +102 -0
  127. package/lib/components/toolbar/controls/ListControl.vue +86 -0
  128. package/lib/components/toolbar/controls/RemoveFormatControl.vue +37 -0
  129. package/lib/components/toolbar/controls/StrikeThroughControl.vue +44 -0
  130. package/lib/components/toolbar/controls/StylePresetControl.vue +95 -0
  131. package/lib/components/toolbar/controls/SuperscriptControl.vue +44 -0
  132. package/lib/components/toolbar/controls/UnderlineControl.vue +44 -0
  133. package/lib/components/toolbar/controls/__tests__/AlignmentControl.test.js +51 -0
  134. package/lib/components/toolbar/controls/__tests__/AlignmentDeviceControl.test.js +77 -0
  135. package/lib/components/toolbar/controls/__tests__/BackgroundColorControl.test.js +59 -0
  136. package/lib/components/toolbar/controls/__tests__/CaseStyleControl.test.js +43 -0
  137. package/lib/components/toolbar/controls/__tests__/FontColorControl.test.js +59 -0
  138. package/lib/components/toolbar/controls/__tests__/FontFamilyControl.test.js +57 -0
  139. package/lib/components/toolbar/controls/__tests__/FontSizeControl.test.js +47 -0
  140. package/lib/components/toolbar/controls/__tests__/FontWeightControl.test.js +45 -0
  141. package/lib/components/toolbar/controls/__tests__/ItalicControl.test.js +63 -0
  142. package/lib/components/toolbar/controls/__tests__/LineHeightControl.test.js +120 -0
  143. package/lib/components/toolbar/controls/__tests__/ListControl.test.js +82 -0
  144. package/lib/components/toolbar/controls/__tests__/RemoveFormatControl.test.js +34 -0
  145. package/lib/components/toolbar/controls/__tests__/StrikeThroughControl.test.js +44 -0
  146. package/lib/components/toolbar/controls/__tests__/StylePresetControl.test.js +129 -0
  147. package/lib/components/toolbar/controls/__tests__/SuperscriptControl.test.js +44 -0
  148. package/lib/components/toolbar/controls/__tests__/UnderlineControl.test.js +44 -0
  149. package/lib/components/toolbar/controls/composables/__tests__/useRecentFonts.test.js +69 -0
  150. package/lib/components/toolbar/controls/composables/index.js +1 -0
  151. package/lib/components/toolbar/controls/composables/useRecentFonts.js +18 -0
  152. package/lib/components/toolbar/controls/index.js +16 -0
  153. package/lib/components/toolbar/index.js +1 -0
  154. package/lib/composables/__tests__/__snapshots__/useEditor.test.js.snap +24 -0
  155. package/lib/composables/__tests__/useEditor.test.js +67 -0
  156. package/lib/composables/__tests__/useToolbar.test.js +56 -0
  157. package/lib/composables/index.js +2 -0
  158. package/lib/composables/useEditor.js +21 -0
  159. package/lib/composables/useToolbar.js +44 -0
  160. package/lib/directives/__tests__/outClick.test.js +86 -0
  161. package/lib/directives/__tests__/tooltip.test.js +39 -0
  162. package/lib/directives/index.js +2 -0
  163. package/lib/directives/outClick.js +37 -0
  164. package/lib/directives/tooltip.js +7 -0
  165. package/lib/enums/Alignments.js +6 -0
  166. package/lib/enums/CaseStyles.js +5 -0
  167. package/lib/enums/Devices.js +15 -0
  168. package/lib/enums/ListTypes.js +23 -0
  169. package/lib/enums/NodeTypes.js +12 -0
  170. package/lib/enums/TextSettings.js +30 -0
  171. package/lib/enums/index.js +6 -0
  172. package/lib/extensions/Alignment.js +67 -0
  173. package/lib/extensions/BackgroundColor.js +28 -0
  174. package/lib/extensions/CaseStyle.js +36 -0
  175. package/lib/extensions/DeviceManager.js +16 -0
  176. package/lib/extensions/FontColor.js +36 -0
  177. package/lib/extensions/FontFamily.js +62 -0
  178. package/lib/extensions/FontSize.js +74 -0
  179. package/lib/extensions/FontStyle.js +62 -0
  180. package/lib/extensions/FontWeight.js +56 -0
  181. package/lib/extensions/LineHeight.js +60 -0
  182. package/lib/extensions/StylePreset.js +168 -0
  183. package/lib/extensions/Superscript.js +5 -0
  184. package/lib/extensions/TextDecoration.js +97 -0
  185. package/lib/extensions/__tests__/Alignment.test.js +107 -0
  186. package/lib/extensions/__tests__/BackgroundColor.test.js +75 -0
  187. package/lib/extensions/__tests__/CaseStyle.test.js +58 -0
  188. package/lib/extensions/__tests__/FontColor.test.js +85 -0
  189. package/lib/extensions/__tests__/FontFamily.test.js +171 -0
  190. package/lib/extensions/__tests__/FontSize.test.js +183 -0
  191. package/lib/extensions/__tests__/FontStyle.test.js +136 -0
  192. package/lib/extensions/__tests__/FontWeight.test.js +151 -0
  193. package/lib/extensions/__tests__/LineHeight.test.js +106 -0
  194. package/lib/extensions/__tests__/StylePreset.test.js +400 -0
  195. package/lib/extensions/__tests__/TextDecoration.test.js +258 -0
  196. package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +29 -0
  197. package/lib/extensions/__tests__/__snapshots__/BackgroundColor.test.js.snap +28 -0
  198. package/lib/extensions/__tests__/__snapshots__/CaseStyle.test.js.snap +69 -0
  199. package/lib/extensions/__tests__/__snapshots__/FontColor.test.js.snap +28 -0
  200. package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +158 -0
  201. package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +140 -0
  202. package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +87 -0
  203. package/lib/extensions/__tests__/__snapshots__/FontWeight.test.js.snap +140 -0
  204. package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +29 -0
  205. package/lib/extensions/__tests__/__snapshots__/StylePreset.test.js.snap +310 -0
  206. package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +206 -0
  207. package/lib/extensions/core/NodeProcessor.js +32 -0
  208. package/lib/extensions/core/SelectionProcessor.js +37 -0
  209. package/lib/extensions/core/TextProcessor.js +57 -0
  210. package/lib/extensions/core/__tests__/NodeProcessor.test.js +120 -0
  211. package/lib/extensions/core/__tests__/SelectionProcessor.test.js +78 -0
  212. package/lib/extensions/core/__tests__/TextProcessor.test.js +61 -0
  213. package/lib/extensions/core/__tests__/__snapshots__/NodeProcessor.test.js.snap +93 -0
  214. package/lib/extensions/core/__tests__/__snapshots__/TextProcessor.test.js.snap +43 -0
  215. package/lib/extensions/core/index.js +17 -0
  216. package/lib/extensions/core/inputRules/closeDoubleQuote.js +6 -0
  217. package/lib/extensions/core/inputRules/closeSingleQuote.js +6 -0
  218. package/lib/extensions/core/inputRules/copyright.js +6 -0
  219. package/lib/extensions/core/inputRules/ellipsis.js +6 -0
  220. package/lib/extensions/core/inputRules/emDash.js +6 -0
  221. package/lib/extensions/core/inputRules/index.js +9 -0
  222. package/lib/extensions/core/inputRules/openDoubleQuote.js +6 -0
  223. package/lib/extensions/core/inputRules/openSingleQuote.js +6 -0
  224. package/lib/extensions/core/inputRules/registeredTrademark.js +6 -0
  225. package/lib/extensions/core/inputRules/trademark.js +6 -0
  226. package/lib/extensions/index.js +49 -0
  227. package/lib/extensions/list/List.js +81 -0
  228. package/lib/extensions/list/ListItem.js +12 -0
  229. package/lib/extensions/list/__tests__/List.test.js +130 -0
  230. package/lib/extensions/list/__tests__/__snapshots__/List.test.js.snap +212 -0
  231. package/lib/extensions/list/index.js +1 -0
  232. package/lib/index.js +1 -0
  233. package/lib/injectionTokens.js +7 -0
  234. package/lib/models/Font.js +37 -0
  235. package/lib/models/__tests__/Font.test.js +58 -0
  236. package/lib/models/index.js +1 -0
  237. package/lib/services/FavoriteColors.js +6 -0
  238. package/lib/services/JsonSerializer.js +15 -0
  239. package/lib/services/Storage.js +49 -0
  240. package/lib/services/index.js +3 -0
  241. package/lib/styles/content.css +39 -0
  242. package/lib/styles/helpers/common.css +3 -0
  243. package/lib/styles/helpers/offsets.css +3 -0
  244. package/lib/styles/helpers/text.css +6 -0
  245. package/lib/styles/main.css +5 -0
  246. package/lib/styles/variables.css +57 -0
  247. package/lib/utils/__tests__/__snapshots__/renderInlineSetting.test.js.snap +40 -0
  248. package/lib/utils/__tests__/capitalize.test.js +11 -0
  249. package/lib/utils/__tests__/renderInlineSetting.test.js +39 -0
  250. package/lib/utils/capitalize.js +3 -0
  251. package/lib/utils/createCommand.js +3 -0
  252. package/lib/utils/createKeyboardShortcut.js +6 -0
  253. package/lib/utils/index.js +4 -0
  254. package/lib/utils/renderInlineSetting.js +17 -0
  255. package/package.json +75 -0
@@ -0,0 +1,140 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`apply font size should change font size 1`] = `
4
+ Object {
5
+ "content": Array [
6
+ Object {
7
+ "content": Array [
8
+ Object {
9
+ "marks": Array [
10
+ Object {
11
+ "attrs": Object {
12
+ "desktop": "16",
13
+ "mobile": null,
14
+ "tablet": null,
15
+ },
16
+ "type": "font_size",
17
+ },
18
+ ],
19
+ "text": "hello world",
20
+ "type": "text",
21
+ },
22
+ ],
23
+ "type": "paragraph",
24
+ },
25
+ ],
26
+ "type": "doc",
27
+ }
28
+ `;
29
+
30
+ exports[`apply font size should decrease font size 1`] = `
31
+ Object {
32
+ "content": Array [
33
+ Object {
34
+ "content": Array [
35
+ Object {
36
+ "marks": Array [
37
+ Object {
38
+ "attrs": Object {
39
+ "desktop": "13",
40
+ "mobile": null,
41
+ "tablet": null,
42
+ },
43
+ "type": "font_size",
44
+ },
45
+ ],
46
+ "text": "hello world",
47
+ "type": "text",
48
+ },
49
+ ],
50
+ "type": "paragraph",
51
+ },
52
+ ],
53
+ "type": "doc",
54
+ }
55
+ `;
56
+
57
+ exports[`apply font size should increase font size 1`] = `
58
+ Object {
59
+ "content": Array [
60
+ Object {
61
+ "content": Array [
62
+ Object {
63
+ "marks": Array [
64
+ Object {
65
+ "attrs": Object {
66
+ "desktop": "15",
67
+ "mobile": null,
68
+ "tablet": null,
69
+ },
70
+ "type": "font_size",
71
+ },
72
+ ],
73
+ "text": "hello world",
74
+ "type": "text",
75
+ },
76
+ ],
77
+ "type": "paragraph",
78
+ },
79
+ ],
80
+ "type": "doc",
81
+ }
82
+ `;
83
+
84
+ exports[`apply font size should not decrease font size if reached limit 1`] = `
85
+ Object {
86
+ "content": Array [
87
+ Object {
88
+ "content": Array [
89
+ Object {
90
+ "marks": Array [
91
+ Object {
92
+ "attrs": Object {
93
+ "desktop": "5",
94
+ "mobile": null,
95
+ "tablet": null,
96
+ },
97
+ "type": "font_size",
98
+ },
99
+ ],
100
+ "text": "hello world",
101
+ "type": "text",
102
+ },
103
+ ],
104
+ "type": "paragraph",
105
+ },
106
+ ],
107
+ "type": "doc",
108
+ }
109
+ `;
110
+
111
+ exports[`apply font size should not increase font size if reached limit 1`] = `
112
+ Object {
113
+ "content": Array [
114
+ Object {
115
+ "content": Array [
116
+ Object {
117
+ "marks": Array [
118
+ Object {
119
+ "attrs": Object {
120
+ "desktop": "20",
121
+ "mobile": null,
122
+ "tablet": null,
123
+ },
124
+ "type": "font_size",
125
+ },
126
+ ],
127
+ "text": "hello world",
128
+ "type": "text",
129
+ },
130
+ ],
131
+ "type": "paragraph",
132
+ },
133
+ ],
134
+ "type": "doc",
135
+ }
136
+ `;
137
+
138
+ exports[`rendering should render all devices 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-mobile-font-size: 12px; --zw-tablet-font-size: 14px; --zw-desktop-font-size: 16px;\\" class=\\"zw-style\\">hello world</span></p>"`;
139
+
140
+ exports[`rendering should render only desktop 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-desktop-font-size: 14px;\\" class=\\"zw-style\\">hello world</span></p>"`;
@@ -0,0 +1,87 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`apply font style should make italic 1`] = `
4
+ Object {
5
+ "content": Array [
6
+ Object {
7
+ "content": Array [
8
+ Object {
9
+ "marks": Array [
10
+ Object {
11
+ "attrs": Object {
12
+ "italic": true,
13
+ },
14
+ "type": "font_style",
15
+ },
16
+ ],
17
+ "text": "hello world",
18
+ "type": "text",
19
+ },
20
+ ],
21
+ "type": "paragraph",
22
+ },
23
+ ],
24
+ "type": "doc",
25
+ }
26
+ `;
27
+
28
+ exports[`apply font style should remove italic 1`] = `
29
+ Object {
30
+ "content": Array [
31
+ Object {
32
+ "content": Array [
33
+ Object {
34
+ "text": "hello world",
35
+ "type": "text",
36
+ },
37
+ ],
38
+ "type": "paragraph",
39
+ },
40
+ ],
41
+ "type": "doc",
42
+ }
43
+ `;
44
+
45
+ exports[`apply font style should toggle italic to removed 1`] = `
46
+ Object {
47
+ "content": Array [
48
+ Object {
49
+ "content": Array [
50
+ Object {
51
+ "text": "hello world",
52
+ "type": "text",
53
+ },
54
+ ],
55
+ "type": "paragraph",
56
+ },
57
+ ],
58
+ "type": "doc",
59
+ }
60
+ `;
61
+
62
+ exports[`apply font style should toggle italic to used 1`] = `
63
+ Object {
64
+ "content": Array [
65
+ Object {
66
+ "content": Array [
67
+ Object {
68
+ "marks": Array [
69
+ Object {
70
+ "attrs": Object {
71
+ "italic": true,
72
+ },
73
+ "type": "font_style",
74
+ },
75
+ ],
76
+ "text": "hello world",
77
+ "type": "text",
78
+ },
79
+ ],
80
+ "type": "paragraph",
81
+ },
82
+ ],
83
+ "type": "doc",
84
+ }
85
+ `;
86
+
87
+ exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-style: italic;\\" class=\\"zw-style\\">hello world</span></p>"`;
@@ -0,0 +1,140 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`apply font weight should change font weight 1`] = `
4
+ Object {
5
+ "content": Array [
6
+ Object {
7
+ "content": Array [
8
+ Object {
9
+ "marks": Array [
10
+ Object {
11
+ "attrs": Object {
12
+ "value": "700",
13
+ },
14
+ "type": "font_weight",
15
+ },
16
+ ],
17
+ "text": "hello world",
18
+ "type": "text",
19
+ },
20
+ ],
21
+ "type": "paragraph",
22
+ },
23
+ ],
24
+ "type": "doc",
25
+ }
26
+ `;
27
+
28
+ exports[`apply font weight should toggle weight to bold 1`] = `
29
+ Object {
30
+ "content": Array [
31
+ Object {
32
+ "content": Array [
33
+ Object {
34
+ "marks": Array [
35
+ Object {
36
+ "attrs": Object {
37
+ "value": "700",
38
+ },
39
+ "type": "font_weight",
40
+ },
41
+ ],
42
+ "text": "hello world",
43
+ "type": "text",
44
+ },
45
+ ],
46
+ "type": "paragraph",
47
+ },
48
+ ],
49
+ "type": "doc",
50
+ }
51
+ `;
52
+
53
+ exports[`apply font weight should toggle weight to closest bold 1`] = `
54
+ Object {
55
+ "content": Array [
56
+ Object {
57
+ "content": Array [
58
+ Object {
59
+ "marks": Array [
60
+ Object {
61
+ "attrs": Object {
62
+ "value": "Bungee",
63
+ },
64
+ "type": "font_family",
65
+ },
66
+ Object {
67
+ "attrs": Object {
68
+ "value": "800",
69
+ },
70
+ "type": "font_weight",
71
+ },
72
+ ],
73
+ "text": "hello world",
74
+ "type": "text",
75
+ },
76
+ ],
77
+ "type": "paragraph",
78
+ },
79
+ ],
80
+ "type": "doc",
81
+ }
82
+ `;
83
+
84
+ exports[`apply font weight should toggle weight to closest medium 1`] = `
85
+ Object {
86
+ "content": Array [
87
+ Object {
88
+ "content": Array [
89
+ Object {
90
+ "marks": Array [
91
+ Object {
92
+ "attrs": Object {
93
+ "value": "Bungee",
94
+ },
95
+ "type": "font_family",
96
+ },
97
+ Object {
98
+ "attrs": Object {
99
+ "value": "300",
100
+ },
101
+ "type": "font_weight",
102
+ },
103
+ ],
104
+ "text": "hello world",
105
+ "type": "text",
106
+ },
107
+ ],
108
+ "type": "paragraph",
109
+ },
110
+ ],
111
+ "type": "doc",
112
+ }
113
+ `;
114
+
115
+ exports[`apply font weight should toggle weight to medium 1`] = `
116
+ Object {
117
+ "content": Array [
118
+ Object {
119
+ "content": Array [
120
+ Object {
121
+ "marks": Array [
122
+ Object {
123
+ "attrs": Object {
124
+ "value": "400",
125
+ },
126
+ "type": "font_weight",
127
+ },
128
+ ],
129
+ "text": "hello world",
130
+ "type": "text",
131
+ },
132
+ ],
133
+ "type": "paragraph",
134
+ },
135
+ ],
136
+ "type": "doc",
137
+ }
138
+ `;
139
+
140
+ exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-weight: 700;\\" class=\\"zw-style\\">hello world</span></p>"`;
@@ -0,0 +1,29 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`apply value should change value 1`] = `
4
+ Object {
5
+ "content": Array [
6
+ Object {
7
+ "attrs": Object {
8
+ "line_height": Object {
9
+ "desktop": "1.41",
10
+ "mobile": null,
11
+ "tablet": null,
12
+ },
13
+ },
14
+ "content": Array [
15
+ Object {
16
+ "text": "hello world",
17
+ "type": "text",
18
+ },
19
+ ],
20
+ "type": "paragraph",
21
+ },
22
+ ],
23
+ "type": "doc",
24
+ }
25
+ `;
26
+
27
+ exports[`rendering should render all devices 1`] = `"<p class=\\"zw-style\\" style=\\"--zw-mobile-line-height: 1.21; --zw-tablet-line-height: 1.4; --zw-desktop-line-height: 1.6;\\">hello world</p>"`;
28
+
29
+ exports[`rendering should render only desktop 1`] = `"<p class=\\"zw-style\\" style=\\"--zw-desktop-line-height: 1.3;\\">hello world</p>"`;
@@ -0,0 +1,310 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`apply preset should apply default preset 1`] = `
4
+ Object {
5
+ "content": Array [
6
+ Object {
7
+ "attrs": Object {
8
+ "alignment": null,
9
+ "preset": Object {
10
+ "id": "regular-1",
11
+ },
12
+ },
13
+ "content": Array [
14
+ Object {
15
+ "text": "test",
16
+ "type": "text",
17
+ },
18
+ ],
19
+ "type": "paragraph",
20
+ },
21
+ ],
22
+ "type": "doc",
23
+ }
24
+ `;
25
+
26
+ exports[`apply preset should apply heading to list 1`] = `
27
+ Object {
28
+ "content": Array [
29
+ Object {
30
+ "attrs": Object {
31
+ "alignment": null,
32
+ "level": 1,
33
+ "preset": Object {
34
+ "id": "h1",
35
+ },
36
+ },
37
+ "content": Array [
38
+ Object {
39
+ "text": "Item 1",
40
+ "type": "text",
41
+ },
42
+ ],
43
+ "type": "heading",
44
+ },
45
+ Object {
46
+ "attrs": Object {
47
+ "alignment": null,
48
+ "level": 1,
49
+ "preset": Object {
50
+ "id": "h1",
51
+ },
52
+ },
53
+ "content": Array [
54
+ Object {
55
+ "text": "Item 2",
56
+ "type": "text",
57
+ },
58
+ ],
59
+ "type": "heading",
60
+ },
61
+ ],
62
+ "type": "doc",
63
+ }
64
+ `;
65
+
66
+ exports[`apply preset should apply heading to text 1`] = `
67
+ Object {
68
+ "content": Array [
69
+ Object {
70
+ "attrs": Object {
71
+ "alignment": null,
72
+ "level": 1,
73
+ "preset": Object {
74
+ "id": "h1",
75
+ },
76
+ },
77
+ "content": Array [
78
+ Object {
79
+ "text": "test",
80
+ "type": "text",
81
+ },
82
+ ],
83
+ "type": "heading",
84
+ },
85
+ ],
86
+ "type": "doc",
87
+ }
88
+ `;
89
+
90
+ exports[`apply preset should apply preset to text 1`] = `
91
+ Object {
92
+ "content": Array [
93
+ Object {
94
+ "attrs": Object {
95
+ "alignment": null,
96
+ "preset": Object {
97
+ "id": "regular-1",
98
+ },
99
+ },
100
+ "content": Array [
101
+ Object {
102
+ "text": "test",
103
+ "type": "text",
104
+ },
105
+ ],
106
+ "type": "paragraph",
107
+ },
108
+ ],
109
+ "type": "doc",
110
+ }
111
+ `;
112
+
113
+ exports[`apply preset should apply regular to list 1`] = `
114
+ Object {
115
+ "content": Array [
116
+ Object {
117
+ "attrs": Object {
118
+ "alignment": null,
119
+ "preset": Object {
120
+ "id": "regular-1",
121
+ },
122
+ },
123
+ "content": Array [
124
+ Object {
125
+ "text": "Item 1",
126
+ "type": "text",
127
+ },
128
+ ],
129
+ "type": "paragraph",
130
+ },
131
+ Object {
132
+ "attrs": Object {
133
+ "alignment": null,
134
+ "preset": Object {
135
+ "id": "regular-1",
136
+ },
137
+ },
138
+ "content": Array [
139
+ Object {
140
+ "text": "Item 2",
141
+ "type": "text",
142
+ },
143
+ ],
144
+ "type": "paragraph",
145
+ },
146
+ ],
147
+ "type": "doc",
148
+ }
149
+ `;
150
+
151
+ exports[`apply preset should change paragraph to heading 1`] = `
152
+ Object {
153
+ "content": Array [
154
+ Object {
155
+ "attrs": Object {
156
+ "alignment": null,
157
+ "level": 1,
158
+ "preset": Object {
159
+ "id": "h1",
160
+ },
161
+ },
162
+ "content": Array [
163
+ Object {
164
+ "text": "test",
165
+ "type": "text",
166
+ },
167
+ ],
168
+ "type": "heading",
169
+ },
170
+ ],
171
+ "type": "doc",
172
+ }
173
+ `;
174
+
175
+ exports[`apply preset should keep text attributes on apply 1`] = `
176
+ Object {
177
+ "content": Array [
178
+ Object {
179
+ "attrs": Object {
180
+ "alignment": Object {
181
+ "value": "center",
182
+ },
183
+ "preset": Object {
184
+ "id": "regular-2",
185
+ },
186
+ },
187
+ "content": Array [
188
+ Object {
189
+ "text": "test",
190
+ "type": "text",
191
+ },
192
+ ],
193
+ "type": "paragraph",
194
+ },
195
+ ],
196
+ "type": "doc",
197
+ }
198
+ `;
199
+
200
+ exports[`get preset customization should find attributes 1`] = `
201
+ Object {
202
+ "attributes": Array [
203
+ "alignment",
204
+ ],
205
+ "marks": Array [],
206
+ }
207
+ `;
208
+
209
+ exports[`get preset customization should find marks 1`] = `
210
+ Object {
211
+ "attributes": Array [],
212
+ "marks": Array [
213
+ "font_size",
214
+ "font_weight",
215
+ ],
216
+ }
217
+ `;
218
+
219
+ exports[`get preset customization should return empty customization 1`] = `
220
+ Object {
221
+ "attributes": Array [],
222
+ "marks": Array [],
223
+ }
224
+ `;
225
+
226
+ exports[`get preset should get preset from selection 1`] = `
227
+ Object {
228
+ "common": Object {
229
+ "font_weight": "400",
230
+ },
231
+ "desktop": Object {
232
+ "font_size": "16",
233
+ },
234
+ "id": "regular-1",
235
+ "mobile": Object {
236
+ "font_size": "12",
237
+ },
238
+ "tablet": Object {
239
+ "font_size": "14",
240
+ },
241
+ }
242
+ `;
243
+
244
+ exports[`remove preset customization should remove all attributes 1`] = `
245
+ Object {
246
+ "content": Array [
247
+ Object {
248
+ "attrs": Object {
249
+ "alignment": null,
250
+ "level": 1,
251
+ "preset": Object {
252
+ "id": "regular-1",
253
+ },
254
+ },
255
+ "content": Array [
256
+ Object {
257
+ "text": "heading",
258
+ "type": "text",
259
+ },
260
+ ],
261
+ "type": "heading",
262
+ },
263
+ Object {
264
+ "attrs": Object {
265
+ "alignment": null,
266
+ "preset": Object {
267
+ "id": "regular-1",
268
+ },
269
+ },
270
+ "content": Array [
271
+ Object {
272
+ "text": "paragraph",
273
+ "type": "text",
274
+ },
275
+ ],
276
+ "type": "paragraph",
277
+ },
278
+ ],
279
+ "type": "doc",
280
+ }
281
+ `;
282
+
283
+ exports[`remove preset customization should remove all marks in block 1`] = `
284
+ Object {
285
+ "content": Array [
286
+ Object {
287
+ "attrs": Object {
288
+ "alignment": null,
289
+ "preset": Object {
290
+ "id": "regular-1",
291
+ },
292
+ },
293
+ "content": Array [
294
+ Object {
295
+ "text": "test test",
296
+ "type": "text",
297
+ },
298
+ ],
299
+ "type": "paragraph",
300
+ },
301
+ ],
302
+ "type": "doc",
303
+ }
304
+ `;
305
+
306
+ exports[`render preset styles should render node without preset 1`] = `"<p class=\\"zw-style\\">test</p>"`;
307
+
308
+ exports[`render preset styles should render preset class 1`] = `"<p class=\\"zw-style zw-preset--regular-1\\">test</p>"`;
309
+
310
+ exports[`render preset styles should render styles 1`] = `" .zw-preset--regular-1 { --zw-preset-font-weight: var(--common-regular-1-font-weight, inherit); --zw-preset-mobile-font-size: var(--mobile-regular-1-font-size, inherit); --zw-preset-tablet-font-size: var(--tablet-regular-1-font-size, inherit); --zw-preset-desktop-font-size: var(--desktop-regular-1-font-size, inherit); }"`;