@zipify/wysiwyg 4.1.0 → 4.2.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 (210) hide show
  1. package/.editorconfig +1 -1
  2. package/.eslintignore +1 -0
  3. package/.eslintrc.js +63 -4
  4. package/.github/actions/lint-css/action.yaml +2 -2
  5. package/.github/actions/lint-js/action.yaml +7 -7
  6. package/.github/actions/setup/action.yaml +6 -12
  7. package/.github/actions/unit-tests/action.yaml +2 -2
  8. package/.github/dependabot.yaml +12 -12
  9. package/.github/workflows/frontend-ci.yaml +58 -56
  10. package/config/build/cli.config.js +15 -12
  11. package/config/build/{example.config.mjs → example.config.ts} +4 -11
  12. package/config/build/{lib.config.mjs → lib.config.ts} +9 -14
  13. package/config/build/settings.js +9 -3
  14. package/dist/cli.js +17 -2
  15. package/dist/types/Wysiwyg.vue.d.ts +176 -0
  16. package/dist/types/cli/NodeDomParser.d.ts +7 -0
  17. package/dist/types/cli/commands/Command.d.ts +9 -0
  18. package/dist/types/cli/commands/ToJsonCommand.d.ts +18 -0
  19. package/dist/types/cli/commands/VersionCommand.d.ts +5 -0
  20. package/dist/types/cli/commands/index.d.ts +2 -0
  21. package/dist/types/cli/index.d.ts +1 -0
  22. package/dist/types/components/base/Button.vue.d.ts +19 -0
  23. package/dist/types/components/base/ButtonToggle.vue.d.ts +19 -0
  24. package/dist/types/components/base/Checkbox.vue.d.ts +10 -0
  25. package/dist/types/components/base/FieldLabel.vue.d.ts +12 -0
  26. package/dist/types/components/base/Icon.vue.d.ts +11 -0
  27. package/dist/types/components/base/Modal.vue.d.ts +28 -0
  28. package/dist/types/components/base/ModalFloating.vue.d.ts +20 -0
  29. package/dist/types/components/base/NumberField.vue.d.ts +22 -0
  30. package/dist/types/components/base/Range.vue.d.ts +16 -0
  31. package/dist/types/components/base/ScrollView.vue.d.ts +7 -0
  32. package/dist/types/components/base/TextField.vue.d.ts +14 -0
  33. package/dist/types/components/base/colorPicker/ColorPicker.vue.d.ts +18 -0
  34. package/dist/types/components/base/colorPicker/composables/index.d.ts +2 -0
  35. package/dist/types/components/base/colorPicker/composables/usePickerApi.d.ts +14 -0
  36. package/dist/types/components/base/colorPicker/composables/usePickerHotkeys.d.ts +5 -0
  37. package/dist/types/components/base/colorPicker/index.d.ts +1 -0
  38. package/dist/types/components/base/composables/index.d.ts +8 -0
  39. package/dist/types/components/base/composables/useActivatedListener.d.ts +7 -0
  40. package/dist/types/components/base/composables/useDeselectionLock.d.ts +4 -0
  41. package/dist/types/components/base/composables/useElementRef.d.ts +1 -0
  42. package/dist/types/components/base/composables/useModalToggler.d.ts +9 -0
  43. package/dist/types/components/base/composables/useNumberValue.d.ts +12 -0
  44. package/dist/types/components/base/composables/useScrollView.d.ts +6 -0
  45. package/dist/types/components/base/composables/useTempValue.d.ts +4 -0
  46. package/dist/types/components/base/composables/useValidator.d.ts +7 -0
  47. package/dist/types/components/base/dropdown/Dropdown.vue.d.ts +22 -0
  48. package/dist/types/components/base/dropdown/DropdownActivator.vue.d.ts +17 -0
  49. package/dist/types/components/base/dropdown/DropdownDivider.vue.d.ts +2 -0
  50. package/dist/types/components/base/dropdown/DropdownGroup.vue.d.ts +14 -0
  51. package/dist/types/components/base/dropdown/DropdownMenu.vue.d.ts +14 -0
  52. package/dist/types/components/base/dropdown/DropdownOption.vue.d.ts +12 -0
  53. package/dist/types/components/base/dropdown/composables/index.d.ts +2 -0
  54. package/dist/types/components/base/dropdown/composables/useActiveOptionManager.d.ts +11 -0
  55. package/dist/types/components/base/dropdown/composables/useDropdownEntityTitle.d.ts +1 -0
  56. package/dist/types/components/base/dropdown/index.d.ts +1 -0
  57. package/dist/types/components/base/dropdown/injectionTokens.d.ts +5 -0
  58. package/dist/types/components/base/index.d.ts +3 -0
  59. package/dist/types/components/index.d.ts +1 -0
  60. package/dist/types/components/toolbar/Toolbar.vue.d.ts +17 -0
  61. package/dist/types/components/toolbar/ToolbarFloating.vue.d.ts +14 -0
  62. package/dist/types/components/toolbar/base/ToolbarDivider.vue.d.ts +32 -0
  63. package/dist/types/components/toolbar/base/ToolbarGroup.vue.d.ts +2 -0
  64. package/dist/types/components/toolbar/base/ToolbarRow.vue.d.ts +2 -0
  65. package/dist/types/components/toolbar/base/index.d.ts +1 -0
  66. package/dist/types/components/toolbar/controls/AlignmentControl.vue.d.ts +4 -0
  67. package/dist/types/components/toolbar/controls/BackgroundColorControl.vue.d.ts +2 -0
  68. package/dist/types/components/toolbar/controls/CaseStyleControl.vue.d.ts +2 -0
  69. package/dist/types/components/toolbar/controls/FontColorControl.vue.d.ts +2 -0
  70. package/dist/types/components/toolbar/controls/FontFamilyControl.vue.d.ts +2 -0
  71. package/dist/types/components/toolbar/controls/FontSizeControl.vue.d.ts +2 -0
  72. package/dist/types/components/toolbar/controls/FontWeightControl.vue.d.ts +2 -0
  73. package/dist/types/components/toolbar/controls/ItalicControl.vue.d.ts +2 -0
  74. package/dist/types/components/toolbar/controls/LineHeightControl.vue.d.ts +2 -0
  75. package/dist/types/components/toolbar/controls/ListControl.vue.d.ts +2 -0
  76. package/dist/types/components/toolbar/controls/RemoveFormatControl.vue.d.ts +2 -0
  77. package/dist/types/components/toolbar/controls/StrikeThroughControl.vue.d.ts +2 -0
  78. package/dist/types/components/toolbar/controls/SuperscriptControl.vue.d.ts +2 -0
  79. package/dist/types/components/toolbar/controls/UnderlineControl.vue.d.ts +2 -0
  80. package/dist/types/components/toolbar/controls/composables/index.d.ts +1 -0
  81. package/dist/types/components/toolbar/controls/composables/useRecentFonts.d.ts +7 -0
  82. package/dist/types/components/toolbar/controls/index.d.ts +2 -0
  83. package/dist/types/components/toolbar/controls/link/LinkControl.vue.d.ts +2 -0
  84. package/dist/types/components/toolbar/controls/link/LinkControlHeader.vue.d.ts +4 -0
  85. package/dist/types/components/toolbar/controls/link/composables/index.d.ts +1 -0
  86. package/dist/types/components/toolbar/controls/link/composables/useLink.d.ts +22 -0
  87. package/dist/types/components/toolbar/controls/link/destination/LinkControlDestination.vue.d.ts +10 -0
  88. package/dist/types/components/toolbar/controls/link/destination/LinkControlPageBlock.vue.d.ts +8 -0
  89. package/dist/types/components/toolbar/controls/link/destination/LinkControlUrl.vue.d.ts +12 -0
  90. package/dist/types/components/toolbar/controls/link/destination/index.d.ts +1 -0
  91. package/dist/types/components/toolbar/controls/link/index.d.ts +1 -0
  92. package/dist/types/components/toolbar/controls/stylePreset/StylePresetControl.vue.d.ts +2 -0
  93. package/dist/types/components/toolbar/controls/stylePreset/StylePresetOption.vue.d.ts +22 -0
  94. package/dist/types/components/toolbar/controls/stylePreset/index.d.ts +1 -0
  95. package/dist/types/components/toolbar/index.d.ts +1 -0
  96. package/dist/types/components/toolbar/layouts/ToolbarDesktop.vue.d.ts +7 -0
  97. package/dist/types/components/toolbar/layouts/ToolbarMobile.vue.d.ts +2 -0
  98. package/dist/types/components/toolbar/layouts/ToolbarPopup.vue.d.ts +7 -0
  99. package/dist/types/components/toolbar/layouts/index.d.ts +1 -0
  100. package/dist/types/composables/index.d.ts +2 -0
  101. package/dist/types/composables/useEditor.d.ts +15 -0
  102. package/dist/types/directives/index.d.ts +2 -0
  103. package/dist/types/directives/outClick.d.ts +9 -0
  104. package/dist/types/directives/tooltip.d.ts +4 -0
  105. package/{lib/entryLib.js → dist/types/entryLib.d.ts} +1 -1
  106. package/dist/types/enums/Alignments.d.ts +7 -0
  107. package/dist/types/enums/CaseStyles.d.ts +5 -0
  108. package/dist/types/enums/Devices.d.ts +7 -0
  109. package/dist/types/enums/LinkDestinations.d.ts +4 -0
  110. package/dist/types/enums/LinkTargets.d.ts +4 -0
  111. package/dist/types/enums/ListTypes.d.ts +10 -0
  112. package/dist/types/enums/MarkGroups.d.ts +4 -0
  113. package/dist/types/enums/NodeTypes.d.ts +9 -0
  114. package/dist/types/enums/TextSettings.d.ts +19 -0
  115. package/dist/types/enums/index.d.ts +9 -0
  116. package/dist/types/extensions/Alignment.d.ts +2 -0
  117. package/dist/types/extensions/BackgroundColor.d.ts +2 -0
  118. package/dist/types/extensions/CaseStyle.d.ts +2 -0
  119. package/dist/types/extensions/DeviceManager.d.ts +2 -0
  120. package/dist/types/extensions/FontColor.d.ts +2 -0
  121. package/dist/types/extensions/FontFamily.d.ts +4 -0
  122. package/dist/types/extensions/FontSize.d.ts +5 -0
  123. package/dist/types/extensions/FontStyle.d.ts +2 -0
  124. package/dist/types/extensions/FontWeight.d.ts +2 -0
  125. package/dist/types/extensions/LineHeight.d.ts +2 -0
  126. package/dist/types/extensions/Link.d.ts +1 -0
  127. package/dist/types/extensions/Margin.d.ts +2 -0
  128. package/dist/types/extensions/StylePreset.d.ts +2 -0
  129. package/dist/types/extensions/Superscript.d.ts +2 -0
  130. package/dist/types/extensions/TextDecoration.d.ts +2 -0
  131. package/dist/types/extensions/core/Document.d.ts +1 -0
  132. package/dist/types/extensions/core/Heading.d.ts +6 -0
  133. package/dist/types/extensions/core/NodeProcessor.d.ts +2 -0
  134. package/dist/types/extensions/core/Paragraph.d.ts +5 -0
  135. package/dist/types/extensions/core/SelectionProcessor.d.ts +4 -0
  136. package/dist/types/extensions/core/TextProcessor.d.ts +2 -0
  137. package/dist/types/extensions/core/index.d.ts +2 -0
  138. package/dist/types/extensions/index.d.ts +1 -0
  139. package/dist/types/extensions/list/List.d.ts +5 -0
  140. package/dist/types/extensions/list/ListItem.d.ts +5 -0
  141. package/dist/types/extensions/list/index.d.ts +1 -0
  142. package/dist/types/extensions/proseMirror/PasteLinkPlugin.d.ts +8 -0
  143. package/dist/types/extensions/proseMirror/PastePlugin.d.ts +22 -0
  144. package/dist/types/extensions/proseMirror/PlaceholderPlugin.d.ts +12 -0
  145. package/dist/types/extensions/proseMirror/ProseMirrorPlugin.d.ts +9 -0
  146. package/dist/types/extensions/proseMirror/index.d.ts +3 -0
  147. package/dist/types/extensions/steps/SetDocAttr.d.ts +19 -0
  148. package/dist/types/extensions/steps/index.d.ts +1 -0
  149. package/dist/types/injectionTokens.d.ts +8 -0
  150. package/dist/types/models/Font.d.ts +17 -0
  151. package/dist/types/models/index.d.ts +2 -0
  152. package/dist/types/regExps.d.ts +6 -0
  153. package/dist/types/services/ContentSerializer.d.ts +15 -0
  154. package/dist/types/services/ContextWindow.d.ts +8 -0
  155. package/dist/types/services/FavoriteColors.d.ts +8 -0
  156. package/dist/types/services/HtmlToJsonParser.d.ts +6 -0
  157. package/dist/types/services/JsonSerializer.d.ts +4 -0
  158. package/dist/types/services/NodeFactory.d.ts +128 -0
  159. package/dist/types/services/NodeSelector.d.ts +9 -0
  160. package/dist/types/services/Storage.d.ts +10 -0
  161. package/dist/types/services/StylePresetRenderer.d.ts +15 -0
  162. package/dist/types/services/index.d.ts +10 -0
  163. package/dist/types/services/normalizer/BaseNormalizer.d.ts +7 -0
  164. package/dist/types/services/normalizer/BrowserDomParser.d.ts +5 -0
  165. package/dist/types/services/normalizer/ContentNormalizer.d.ts +8 -0
  166. package/dist/types/services/normalizer/HtmlNormalizer.d.ts +41 -0
  167. package/dist/types/services/normalizer/JsonNormalizer.d.ts +14 -0
  168. package/dist/types/services/normalizer/index.d.ts +1 -0
  169. package/dist/types/utils/capitalize.d.ts +1 -0
  170. package/dist/types/utils/convertAlignment.d.ts +1 -0
  171. package/dist/types/utils/convertColor.d.ts +1 -0
  172. package/dist/types/utils/convertFontSize.d.ts +1 -0
  173. package/dist/types/utils/convertLineHeight.d.ts +1 -0
  174. package/dist/types/utils/copyMark.d.ts +1 -0
  175. package/dist/types/utils/createCommand.d.ts +1 -0
  176. package/dist/types/utils/createKeyboardShortcut.d.ts +3 -0
  177. package/dist/types/utils/findMarkByType.d.ts +1 -0
  178. package/dist/types/utils/importIcon.d.ts +1 -0
  179. package/{lib/utils/index.js → dist/types/utils/index.d.ts} +1 -0
  180. package/dist/types/utils/isMarkAppliedToParent.d.ts +1 -0
  181. package/dist/types/utils/isNodeFullySelected.d.ts +1 -0
  182. package/dist/types/utils/isWysiwygContent.d.ts +7 -0
  183. package/dist/types/utils/renderInlineSetting.d.ts +4 -0
  184. package/dist/types/utils/resolvePositionOffset.d.ts +1 -0
  185. package/dist/types/utils/resolveTextPosition.d.ts +4 -0
  186. package/dist/wysiwyg.d.ts +1 -0
  187. package/dist/wysiwyg.mjs +194 -152
  188. package/example/ExampleApp.vue +1 -1
  189. package/example/{example.js → example.ts} +1 -1
  190. package/example/index.html +1 -1
  191. package/jest.config.js +20 -5
  192. package/lib/Wysiwyg.vue +16 -12
  193. package/lib/components/base/__tests__/Modal.test.js +2 -2
  194. package/lib/composables/index.ts +2 -0
  195. package/lib/composables/{useEditor.js → useEditor.ts} +24 -7
  196. package/lib/entryLib.ts +6 -0
  197. package/lib/extensions/StylePreset.js +3 -3
  198. package/lib/models/{Font.js → Font.ts} +19 -8
  199. package/lib/models/index.ts +2 -0
  200. package/lib/utils/importIcon.js +1 -1
  201. package/lib/utils/index.ts +17 -0
  202. package/lib/utils/isWysiwygContent.ts +18 -0
  203. package/package.json +47 -32
  204. package/tsconfig.json +32 -0
  205. package/tsconfig.types.json +22 -0
  206. package/lib/composables/index.js +0 -1
  207. package/lib/models/index.js +0 -1
  208. package/lib/utils/isWysiwygContent.js +0 -12
  209. /package/lib/{entryCli.js → entryCli.ts} +0 -0
  210. /package/lib/models/__tests__/{Font.test.js → Font.test.ts} +0 -0
package/.editorconfig CHANGED
@@ -10,7 +10,7 @@ charset = utf-8
10
10
  trim_trailing_whitespace = true
11
11
  insert_final_newline = true
12
12
 
13
- [*.{js,html,vue,css,svg}]
13
+ [*.{js,ts,html,vue,css,svg}]
14
14
  indent_size = 4
15
15
  tab_width = 4
16
16
 
package/.eslintignore CHANGED
@@ -1 +1,2 @@
1
1
  dist/**
2
+ .eslintrc.js
package/.eslintrc.js CHANGED
@@ -1,21 +1,42 @@
1
+ require('@rushstack/eslint-patch/modern-module-resolution');
2
+
1
3
  const appPackage = require('./package.json');
2
4
 
3
5
  const jestVersion = appPackage.devDependencies.jest.replace('^', '');
4
6
  const jestMajorVersion = Number(jestVersion.split('.')[0]);
5
7
 
8
+ const tsParserOptions = {
9
+ project: './tsconfig.json',
10
+ extraFileExtensions: ['.vue']
11
+ };
12
+
6
13
  module.exports = {
14
+ root: true,
7
15
  settings: {
8
16
  'import/resolver': {
17
+ alias: {
18
+ map: {
19
+ '@': './lib'
20
+ }
21
+ },
9
22
  node: {
10
- extensions: ['.js', '.css', '.vue', '.html']
23
+ extensions: [
24
+ '.js',
25
+ '.ts',
26
+ '.css',
27
+ '.vue',
28
+ '.html'
29
+ ]
11
30
  }
12
31
  },
13
32
  jest: {
14
33
  version: jestMajorVersion
15
34
  }
16
35
  },
36
+ env: {
37
+ jest: true
38
+ },
17
39
  globals: {
18
- jest: true,
19
40
  globalThis: true,
20
41
  ZW_UPDATED_AT: true
21
42
  },
@@ -25,12 +46,50 @@ module.exports = {
25
46
  extends: ['@zipify/eslint-config/preset-js']
26
47
  },
27
48
  {
28
- files: '*.test.js',
49
+ files: '*.ts',
50
+ extends: ['@zipify/eslint-config/preset-ts']
51
+ },
52
+ {
53
+ files: '*.test.{js,ts}',
29
54
  extends: ['@zipify/eslint-config/preset-jest']
30
55
  },
31
56
  {
32
57
  files: '*.vue',
33
- extends: ['@zipify/eslint-config/preset-vue3']
58
+ extends: ['@zipify/eslint-config/preset-vue3-ts'],
59
+ parserOptions: {
60
+ parser: '@typescript-eslint/parser',
61
+ parserOptions: tsParserOptions
62
+ },
63
+ rules: {
64
+ // Temporary disable rules for js to ts migration
65
+ '@typescript-eslint/explicit-function-return-type': 'off',
66
+ 'import/extensions': 'off'
67
+ }
68
+ },
69
+ {
70
+ files: '*.{js,ts,vue}',
71
+ parserOptions: tsParserOptions,
72
+ rules: {
73
+ 'import/order': [
74
+ 'error',
75
+ {
76
+ pathGroups: [
77
+ {
78
+ pattern: '@/**',
79
+ group: 'external',
80
+ position: 'after'
81
+ }
82
+ ],
83
+ groups: [
84
+ 'builtin',
85
+ 'external',
86
+ 'internal',
87
+ 'parent',
88
+ 'sibling'
89
+ ]
90
+ }
91
+ ]
92
+ }
34
93
  }
35
94
  ]
36
95
  };
@@ -9,5 +9,5 @@ inputs:
9
9
  runs:
10
10
  using: "composite"
11
11
  steps:
12
- - run: npx stylelint -f github --config .stylelintrc ${{ inputs.files }}
13
- shell: sh
12
+ - run: npx stylelint -f github --config .stylelintrc ${{ inputs.files }}
13
+ shell: sh
@@ -12,11 +12,11 @@ inputs:
12
12
  runs:
13
13
  using: "composite"
14
14
  steps:
15
- - run: npx eslint --config .eslintrc.js --output-file ./eslint_report.json --format json ${{ inputs.files }}
16
- shell: sh
15
+ - run: npx eslint --config .eslintrc.js --output-file ./eslint_report.json --format json ${{ inputs.files }}
16
+ shell: sh
17
17
 
18
- - uses: ataylorme/eslint-annotate-action@1.2.0
19
- if: ${{ always() }}
20
- with:
21
- repo-token: ${{ inputs.github-token }}
22
- report-json: ./eslint_report.json
18
+ - uses: ataylorme/eslint-annotate-action@1.2.0
19
+ if: ${{ always() }}
20
+ with:
21
+ repo-token: ${{ inputs.github-token }}
22
+ report-json: ./eslint_report.json
@@ -4,16 +4,10 @@ description: Setup Environment
4
4
  runs:
5
5
  using: "composite"
6
6
  steps:
7
- - uses: actions/setup-node@v2
8
- with:
9
- node-version: 18.12.1
7
+ - uses: actions/setup-node@v4
8
+ with:
9
+ node-version: 20.10.0
10
+ cache: 'npm'
10
11
 
11
- - id: npm-cache
12
- uses: actions/cache@v3
13
- with:
14
- path: node_modules
15
- key: node-modules-${{ hashFiles('**/package-lock.json') }}
16
-
17
- - if: steps.npm-cache.outputs.cache-hit != 'true'
18
- run: npm install
19
- shell: sh
12
+ - run: npm ci
13
+ shell: sh
@@ -9,5 +9,5 @@ inputs:
9
9
  runs:
10
10
  using: "composite"
11
11
  steps:
12
- - run: npx jest --ci --config ./.github/actions/unit-tests/jest.config.js .
13
- shell: sh
12
+ - run: npx jest --ci --config ./.github/actions/unit-tests/jest.config.js .
13
+ shell: sh
@@ -4,15 +4,15 @@ version: 2
4
4
  # https://github.com/dependabot/dependabot-core/issues/2127
5
5
 
6
6
  updates:
7
- - package-ecosystem: "npm"
8
- directory: "/"
9
- schedule:
10
- interval: "weekly"
11
- day: "monday"
12
- timezone: "Europe/Kiev"
13
- time: "09:00"
14
- versioning-strategy: "increase"
15
- pull-request-branch-name:
16
- separator: "_"
17
- labels:
18
- - "Dependencies"
7
+ - package-ecosystem: "npm"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "weekly"
11
+ day: "monday"
12
+ timezone: "Europe/Kiev"
13
+ time: "09:00"
14
+ versioning-strategy: "increase"
15
+ pull-request-branch-name:
16
+ separator: "_"
17
+ labels:
18
+ - "Dependencies"
@@ -3,10 +3,10 @@ name: Front-end CI
3
3
  on:
4
4
  pull_request:
5
5
  types:
6
- - opened
7
- - reopened
8
- - synchronize
9
- - ready_for_review
6
+ - opened
7
+ - reopened
8
+ - synchronize
9
+ - ready_for_review
10
10
 
11
11
  concurrency:
12
12
  group: ${{ github.ref }}
@@ -18,26 +18,27 @@ jobs:
18
18
  runs-on: ubuntu-latest
19
19
  if: github.event.pull_request.draft == false
20
20
  steps:
21
- - uses: dorny/paths-filter@v2
22
- id: changes_filter
23
- with:
24
- list-files: 'shell'
25
- filters: |
26
- lint:
27
- - added|modified: 'lib/**/*.js'
28
- - added|modified: 'lib/**/*.vue'
21
+ - id: changes_filter
22
+ uses: dorny/paths-filter@v2
23
+ with:
24
+ list-files: 'shell'
25
+ filters: |
26
+ lint:
27
+ - added|modified: 'lib/**/*.js'
28
+ - added|modified: 'lib/**/*.ts'
29
+ - added|modified: 'lib/**/*.vue'
29
30
 
30
- - if: ${{ steps.changes_filter.outputs.lint == 'true' }}
31
- uses: actions/checkout@v3
31
+ - if: ${{ steps.changes_filter.outputs.lint == 'true' }}
32
+ uses: actions/checkout@v4
32
33
 
33
- - if: ${{ steps.changes_filter.outputs.lint == 'true' }}
34
- uses: ./.github/actions/setup
34
+ - if: ${{ steps.changes_filter.outputs.lint == 'true' }}
35
+ uses: ./.github/actions/setup
35
36
 
36
- - if: ${{ steps.changes_filter.outputs.lint == 'true' }}
37
- uses: ./.github/actions/lint-js
38
- with:
39
- files: ${{ steps.changes_filter.outputs.lint_files }}
40
- github-token: ${{ secrets.GITHUB_TOKEN }}
37
+ - if: ${{ steps.changes_filter.outputs.lint == 'true' }}
38
+ uses: ./.github/actions/lint-js
39
+ with:
40
+ files: ${{ steps.changes_filter.outputs.lint_files }}
41
+ github-token: ${{ secrets.GITHUB_TOKEN }}
41
42
 
42
43
 
43
44
  lint_css:
@@ -45,25 +46,25 @@ jobs:
45
46
  runs-on: ubuntu-latest
46
47
  if: github.event.pull_request.draft == false
47
48
  steps:
48
- - uses: dorny/paths-filter@v2
49
- id: changes_filter
50
- with:
51
- list-files: 'shell'
52
- filters: |
53
- lint:
54
- - added|modified: 'lib/**/*.css'
55
- - added|modified: 'lib/**/*.vue'
49
+ - id: changes_filter
50
+ uses: dorny/paths-filter@v2
51
+ with:
52
+ list-files: 'shell'
53
+ filters: |
54
+ lint:
55
+ - added|modified: 'lib/**/*.css'
56
+ - added|modified: 'lib/**/*.vue'
56
57
 
57
- - if: ${{ steps.changes_filter.outputs.lint == 'true' }}
58
- uses: actions/checkout@v3
58
+ - if: ${{ steps.changes_filter.outputs.lint == 'true' }}
59
+ uses: actions/checkout@v4
59
60
 
60
- - if: ${{ steps.changes_filter.outputs.lint == 'true' }}
61
- uses: ./.github/actions/setup
61
+ - if: ${{ steps.changes_filter.outputs.lint == 'true' }}
62
+ uses: ./.github/actions/setup
62
63
 
63
- - if: ${{ steps.changes_filter.outputs.lint == 'true' }}
64
- uses: ./.github/actions/lint-css
65
- with:
66
- files: ${{ steps.changes_filter.outputs.lint_files }}
64
+ - if: ${{ steps.changes_filter.outputs.lint == 'true' }}
65
+ uses: ./.github/actions/lint-css
66
+ with:
67
+ files: ${{ steps.changes_filter.outputs.lint_files }}
67
68
 
68
69
 
69
70
  unit_tests:
@@ -71,22 +72,23 @@ jobs:
71
72
  runs-on: ubuntu-latest
72
73
  if: github.event.pull_request.draft == false
73
74
  steps:
74
- - uses: dorny/paths-filter@v2
75
- id: changes_filter
76
- with:
77
- list-files: 'shell'
78
- filters: |
79
- tests:
80
- - 'lib/**/*.js'
81
- - 'lib/**/*.vue'
82
-
83
- - if: ${{ steps.changes_filter.outputs.tests == 'true' }}
84
- uses: actions/checkout@v3
85
-
86
- - if: ${{ steps.changes_filter.outputs.tests == 'true' }}
87
- uses: ./.github/actions/setup
88
-
89
- - if: ${{ steps.changes_filter.outputs.tests == 'true' }}
90
- uses: ./.github/actions/unit-tests
91
- with:
92
- github-token: ${{ secrets.GITHUB_TOKEN }}
75
+ - id: changes_filter
76
+ uses: dorny/paths-filter@v2
77
+ with:
78
+ list-files: 'shell'
79
+ filters: |
80
+ tests:
81
+ - 'lib/**/*.js'
82
+ - 'lib/**/*.ts'
83
+ - 'lib/**/*.vue'
84
+
85
+ - if: ${{ steps.changes_filter.outputs.tests == 'true' }}
86
+ uses: actions/checkout@v4
87
+
88
+ - if: ${{ steps.changes_filter.outputs.tests == 'true' }}
89
+ uses: ./.github/actions/setup
90
+
91
+ - if: ${{ steps.changes_filter.outputs.tests == 'true' }}
92
+ uses: ./.github/actions/unit-tests
93
+ with:
94
+ github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -1,40 +1,43 @@
1
- import { nodeResolve } from '@rollup/plugin-node-resolve';
2
- import { getBabelOutputPlugin } from '@rollup/plugin-babel';
1
+ import resolve from '@rollup/plugin-node-resolve';
2
+ import esbuild from 'rollup-plugin-esbuild';
3
3
  import terser from '@rollup/plugin-terser';
4
4
  import commonjs from '@rollup/plugin-commonjs';
5
5
  import replace from '@rollup/plugin-replace';
6
6
  import json from '@rollup/plugin-json';
7
- import { resolvePath, isDevelopment } from './settings';
7
+ import alias from '@rollup/plugin-alias';
8
+ import { resolvePath, isDevelopment, aliases } from './settings';
8
9
 
9
10
  const productionPlugins = isDevelopment ? [] : [
10
11
  terser({ toplevel: true })
11
12
  ];
12
13
 
13
14
  export default {
14
- input: resolvePath('./lib/entryCli.js'),
15
+ input: resolvePath('./lib/entryCli.ts'),
15
16
 
16
17
  output: {
17
18
  file: resolvePath('./dist/cli.js'),
18
19
  format: 'cjs',
19
20
  plugins: [
20
- getBabelOutputPlugin({
21
- presets: [
22
- ['@babel/preset-env', { targets: { node: 18 } }]
23
- ]
24
- }),
25
21
  ...productionPlugins
26
22
  ]
27
23
  },
28
24
 
29
25
  plugins: [
26
+ esbuild.default({
27
+ target: 'node20'
28
+ }),
30
29
  replace({
31
30
  preventAssignment: true,
32
31
  values: { 'import.meta.glob': '(() => ({}))' }
33
32
  }),
34
- nodeResolve({
35
- extensions: ['*', '.js', '.json'],
36
- preferBuiltins: true
33
+ alias({
34
+ entries: aliases,
35
+ customResolver: resolve({
36
+ extensions: ['*', '.js', '.ts', '.json'],
37
+ preferBuiltins: true
38
+ })
37
39
  }),
40
+ resolve(),
38
41
  commonjs({ ignore: ['canvas'] }),
39
42
  json()
40
43
  ],
@@ -1,6 +1,6 @@
1
1
  import { defineConfig } from 'vite';
2
2
  import vue from '@vitejs/plugin-vue';
3
- import { resolvePath } from './settings';
3
+ import { aliases, resolvePath } from './settings';
4
4
 
5
5
  export default defineConfig({
6
6
  root: resolvePath('./example'),
@@ -14,19 +14,12 @@ export default defineConfig({
14
14
  clearScreen: false,
15
15
 
16
16
  resolve: {
17
- extensions: ['*', '.js', '.vue', '.json']
17
+ extensions: ['*', '.ts', '.js', '.vue', '.json'],
18
+ alias: aliases
18
19
  },
19
20
 
20
21
  plugins: [
21
- vue({
22
- template: {
23
- compilerOptions: {
24
- compatConfig: {
25
- MODE: 2
26
- }
27
- }
28
- }
29
- })
22
+ vue()
30
23
  ],
31
24
 
32
25
  define: {
@@ -1,22 +1,24 @@
1
1
  import { defineConfig } from 'vite';
2
2
  import vue from '@vitejs/plugin-vue';
3
3
  import { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';
4
- import { resolvePath } from './settings';
4
+ import type { PreRenderedAsset } from 'rollup';
5
+ import { aliases, resolvePath } from './settings';
5
6
 
6
7
  export default defineConfig({
7
8
  build: {
8
9
  minify: false,
10
+ emptyOutDir: false,
9
11
 
10
12
  lib: {
11
- entry: resolvePath('./lib/entryLib.js'),
13
+ entry: resolvePath('./lib/entryLib.ts'),
12
14
  fileName: 'wysiwyg',
13
15
  formats: ['es']
14
16
  },
15
17
 
16
18
  rollupOptions: {
17
19
  output: {
18
- assetFileNames: (asset) => {
19
- return asset.name === 'style.css' ? 'wysiwyg.css' : asset.name;
20
+ assetFileNames: (asset: PreRenderedAsset): string => {
21
+ return asset.name === 'style.css' ? 'wysiwyg.css' : asset.name!;
20
22
  }
21
23
  },
22
24
  external: ['vue', '@zipify/colorpicker']
@@ -24,19 +26,12 @@ export default defineConfig({
24
26
  },
25
27
 
26
28
  resolve: {
27
- extensions: ['*', '.js', '.vue', '.json']
29
+ extensions: ['*', '.ts', '.js', '.vue', '.json'],
30
+ alias: aliases
28
31
  },
29
32
 
30
33
  plugins: [
31
- vue({
32
- template: {
33
- compilerOptions: {
34
- compatConfig: {
35
- MODE: 2
36
- }
37
- }
38
- }
39
- }),
34
+ vue(),
40
35
  optimizeLodashImports()
41
36
  ]
42
37
  });
@@ -1,5 +1,11 @@
1
- import path from 'path';
1
+ import { resolve } from 'path';
2
+ import tsconfig from '../../tsconfig.json';
2
3
 
3
- export const root = path.resolve(__dirname, '../..');
4
- export const resolvePath = (...parts) => path.resolve(root, ...parts);
4
+ export const root = resolve(__dirname, '../..');
5
+ export const resolvePath = (...parts) => resolve(root, ...parts);
5
6
  export const isDevelopment = process.env.NODE_ENV === 'development';
7
+
8
+ export const aliases = Object.entries(tsconfig.compilerOptions.paths).map(([name, [path]]) => ({
9
+ find: name.replace('/*', ''),
10
+ replacement: resolvePath(path.replace('/*', ''))
11
+ }));