@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.
- package/.editorconfig +18 -0
- package/.eslintrc.js +253 -0
- package/.github/actions/deploy-example/action.yaml +61 -0
- package/.github/actions/lint-css/action.yaml +15 -0
- package/.github/actions/lint-js/action.yaml +22 -0
- package/.github/actions/setup/action.yaml +19 -0
- package/.github/actions/unit-tests/action.yaml +13 -0
- package/.github/actions/unit-tests/jest.config.js +8 -0
- package/.github/dependabot.yaml +17 -0
- package/.github/pull_request_template.md +17 -0
- package/.github/workflows/frontend-ci.yaml +120 -0
- package/.husky/pre-commit +4 -0
- package/.lintstagedrc +12 -0
- package/.release-it.json +6 -0
- package/.stylelintrc +110 -0
- package/README.md +61 -0
- package/babel.config.js +15 -0
- package/ci/example/deploy.sh +25 -0
- package/config/jest/TestEnvironment.js +27 -0
- package/config/jest/matchers/index.js +6 -0
- package/config/jest/matchers/toElementHasStyle.js +27 -0
- package/config/jest/matchers/toVueContainComponent.js +20 -0
- package/config/jest/matchers/toVueContainElement.js +34 -0
- package/config/jest/matchers/toVueContainLazyComponent.js +19 -0
- package/config/jest/matchers/toVueEmpty.js +16 -0
- package/config/jest/matchers/toVuexActionHasBeenDispatched.js +19 -0
- package/config/jest/setupMatchers.js +4 -0
- package/config/jest/setupTests.js +32 -0
- package/config/jest/typing.d.ts +14 -0
- package/config/svgo.js +22 -0
- package/config/webpack/example.config.js +86 -0
- package/config/webpack/loaders/index.js +6 -0
- package/config/webpack/loaders/js-loader.js +5 -0
- package/config/webpack/loaders/style-loader.js +7 -0
- package/config/webpack/loaders/svg-loader.js +4 -0
- package/config/webpack/loaders/vue-loader.js +4 -0
- package/config/webpack/settings.js +9 -0
- package/example/ExampleApp.vue +136 -0
- package/example/example.html +17 -0
- package/example/example.js +19 -0
- package/example/fonts.js +474 -0
- package/example/presets.js +245 -0
- package/example/tooltip/Tooltip.js +241 -0
- package/example/tooltip/TooltipManager.js +132 -0
- package/example/tooltip/index.js +3 -0
- package/example/tooltip/modifiers/TooltipCloseOnScrollModifier.js +73 -0
- package/example/tooltip/modifiers/index.js +1 -0
- package/example/tooltip/tooltip.css +95 -0
- package/jest.config.js +17 -0
- package/lib/Wysiwyg.vue +156 -0
- package/lib/__mocks__/svgMock.js +1 -0
- package/lib/__tests__/utils/NodeFactory.js +67 -0
- package/lib/__tests__/utils/index.js +4 -0
- package/lib/__tests__/utils/setReadonlyProperty.js +9 -0
- package/lib/__tests__/utils/waitAsyncOperation.js +6 -0
- package/lib/__tests__/utils/withComponentContext.js +14 -0
- package/lib/assets/icons.svg +69 -0
- package/lib/components/base/Button.vue +117 -0
- package/lib/components/base/ButtonToggle.vue +40 -0
- package/lib/components/base/FieldLabel.vue +28 -0
- package/lib/components/base/Icon.vue +67 -0
- package/lib/components/base/Modal.vue +116 -0
- package/lib/components/base/NumberField.vue +242 -0
- package/lib/components/base/Range.vue +196 -0
- package/lib/components/base/ScrollView.vue +60 -0
- package/lib/components/base/__tests__/Button.test.js +50 -0
- package/lib/components/base/__tests__/Icon.test.js +56 -0
- package/lib/components/base/__tests__/Modal.test.js +69 -0
- package/lib/components/base/__tests__/Range.test.js +39 -0
- package/lib/components/base/colorPicker/ColorPicker.vue +93 -0
- package/lib/components/base/colorPicker/composables/__tests__/usePickerApi.test.js +81 -0
- package/lib/components/base/colorPicker/composables/index.js +2 -0
- package/lib/components/base/colorPicker/composables/usePickerApi.js +35 -0
- package/lib/components/base/colorPicker/composables/usePickerHotkeys.js +25 -0
- package/lib/components/base/colorPicker/index.js +1 -0
- package/lib/components/base/composables/__tests__/useActivatedListener.test.js +89 -0
- package/lib/components/base/composables/__tests__/useDeselectionLock.test.js +80 -0
- package/lib/components/base/composables/__tests__/useElementRef.test.js +29 -0
- package/lib/components/base/composables/__tests__/useModalToggler.test.js +55 -0
- package/lib/components/base/composables/__tests__/useNumberValue.test.js +153 -0
- package/lib/components/base/composables/__tests__/useScrollView.test.js +43 -0
- package/lib/components/base/composables/__tests__/useTempValue.test.js +38 -0
- package/lib/components/base/composables/index.js +7 -0
- package/lib/components/base/composables/useActivatedListener.js +23 -0
- package/lib/components/base/composables/useDeselectionLock.js +35 -0
- package/lib/components/base/composables/useElementRef.js +5 -0
- package/lib/components/base/composables/useModalToggler.js +58 -0
- package/lib/components/base/composables/useNumberValue.js +53 -0
- package/lib/components/base/composables/useScrollView.js +22 -0
- package/lib/components/base/composables/useTempValue.js +11 -0
- package/lib/components/base/dropdown/Dropdown.vue +88 -0
- package/lib/components/base/dropdown/DropdownActivator.vue +81 -0
- package/lib/components/base/dropdown/DropdownDivider.vue +21 -0
- package/lib/components/base/dropdown/DropdownGroup.vue +55 -0
- package/lib/components/base/dropdown/DropdownMenu.vue +62 -0
- package/lib/components/base/dropdown/DropdownOption.vue +91 -0
- package/lib/components/base/dropdown/__tests__/DropdownActivator.test.js +54 -0
- package/lib/components/base/dropdown/__tests__/DropdownMenu.test.js +67 -0
- package/lib/components/base/dropdown/__tests__/DropdownOption.test.js +81 -0
- package/lib/components/base/dropdown/composables/__tests__/useActiveOptionManager.test.js +41 -0
- package/lib/components/base/dropdown/composables/__tests__/useDropdownEntityTitle.test.js +24 -0
- package/lib/components/base/dropdown/composables/index.js +2 -0
- package/lib/components/base/dropdown/composables/useActiveOptionManager.js +25 -0
- package/lib/components/base/dropdown/composables/useDropdownEntityTitle.js +5 -0
- package/lib/components/base/dropdown/index.js +2 -0
- package/lib/components/base/dropdown/injectionTokens.js +5 -0
- package/lib/components/base/index.js +11 -0
- package/lib/components/index.js +1 -0
- package/lib/components/toolbar/Toolbar.vue +56 -0
- package/lib/components/toolbar/ToolbarDevice.vue +35 -0
- package/lib/components/toolbar/ToolbarDivider.vue +50 -0
- package/lib/components/toolbar/ToolbarFull.vue +94 -0
- package/lib/components/toolbar/ToolbarGroup.vue +18 -0
- package/lib/components/toolbar/ToolbarRow.vue +19 -0
- package/lib/components/toolbar/__tests__/Toolbar.test.js +33 -0
- package/lib/components/toolbar/__tests__/ToolbarDivider.test.js +26 -0
- package/lib/components/toolbar/controls/AlignmentControl.vue +72 -0
- package/lib/components/toolbar/controls/AlignmentDeviceControl.vue +67 -0
- package/lib/components/toolbar/controls/BackgroundColorControl.vue +48 -0
- package/lib/components/toolbar/controls/CaseStyleControl.vue +54 -0
- package/lib/components/toolbar/controls/FontColorControl.vue +48 -0
- package/lib/components/toolbar/controls/FontFamilyControl.vue +96 -0
- package/lib/components/toolbar/controls/FontSizeControl.vue +45 -0
- package/lib/components/toolbar/controls/FontWeightControl.vue +43 -0
- package/lib/components/toolbar/controls/ItalicControl.vue +47 -0
- package/lib/components/toolbar/controls/LineHeightControl.vue +102 -0
- package/lib/components/toolbar/controls/ListControl.vue +86 -0
- package/lib/components/toolbar/controls/RemoveFormatControl.vue +37 -0
- package/lib/components/toolbar/controls/StrikeThroughControl.vue +44 -0
- package/lib/components/toolbar/controls/StylePresetControl.vue +95 -0
- package/lib/components/toolbar/controls/SuperscriptControl.vue +44 -0
- package/lib/components/toolbar/controls/UnderlineControl.vue +44 -0
- package/lib/components/toolbar/controls/__tests__/AlignmentControl.test.js +51 -0
- package/lib/components/toolbar/controls/__tests__/AlignmentDeviceControl.test.js +77 -0
- package/lib/components/toolbar/controls/__tests__/BackgroundColorControl.test.js +59 -0
- package/lib/components/toolbar/controls/__tests__/CaseStyleControl.test.js +43 -0
- package/lib/components/toolbar/controls/__tests__/FontColorControl.test.js +59 -0
- package/lib/components/toolbar/controls/__tests__/FontFamilyControl.test.js +57 -0
- package/lib/components/toolbar/controls/__tests__/FontSizeControl.test.js +47 -0
- package/lib/components/toolbar/controls/__tests__/FontWeightControl.test.js +45 -0
- package/lib/components/toolbar/controls/__tests__/ItalicControl.test.js +63 -0
- package/lib/components/toolbar/controls/__tests__/LineHeightControl.test.js +120 -0
- package/lib/components/toolbar/controls/__tests__/ListControl.test.js +82 -0
- package/lib/components/toolbar/controls/__tests__/RemoveFormatControl.test.js +34 -0
- package/lib/components/toolbar/controls/__tests__/StrikeThroughControl.test.js +44 -0
- package/lib/components/toolbar/controls/__tests__/StylePresetControl.test.js +129 -0
- package/lib/components/toolbar/controls/__tests__/SuperscriptControl.test.js +44 -0
- package/lib/components/toolbar/controls/__tests__/UnderlineControl.test.js +44 -0
- package/lib/components/toolbar/controls/composables/__tests__/useRecentFonts.test.js +69 -0
- package/lib/components/toolbar/controls/composables/index.js +1 -0
- package/lib/components/toolbar/controls/composables/useRecentFonts.js +18 -0
- package/lib/components/toolbar/controls/index.js +16 -0
- package/lib/components/toolbar/index.js +1 -0
- package/lib/composables/__tests__/__snapshots__/useEditor.test.js.snap +24 -0
- package/lib/composables/__tests__/useEditor.test.js +67 -0
- package/lib/composables/__tests__/useToolbar.test.js +56 -0
- package/lib/composables/index.js +2 -0
- package/lib/composables/useEditor.js +21 -0
- package/lib/composables/useToolbar.js +44 -0
- package/lib/directives/__tests__/outClick.test.js +86 -0
- package/lib/directives/__tests__/tooltip.test.js +39 -0
- package/lib/directives/index.js +2 -0
- package/lib/directives/outClick.js +37 -0
- package/lib/directives/tooltip.js +7 -0
- package/lib/enums/Alignments.js +6 -0
- package/lib/enums/CaseStyles.js +5 -0
- package/lib/enums/Devices.js +15 -0
- package/lib/enums/ListTypes.js +23 -0
- package/lib/enums/NodeTypes.js +12 -0
- package/lib/enums/TextSettings.js +30 -0
- package/lib/enums/index.js +6 -0
- package/lib/extensions/Alignment.js +67 -0
- package/lib/extensions/BackgroundColor.js +28 -0
- package/lib/extensions/CaseStyle.js +36 -0
- package/lib/extensions/DeviceManager.js +16 -0
- package/lib/extensions/FontColor.js +36 -0
- package/lib/extensions/FontFamily.js +62 -0
- package/lib/extensions/FontSize.js +74 -0
- package/lib/extensions/FontStyle.js +62 -0
- package/lib/extensions/FontWeight.js +56 -0
- package/lib/extensions/LineHeight.js +60 -0
- package/lib/extensions/StylePreset.js +168 -0
- package/lib/extensions/Superscript.js +5 -0
- package/lib/extensions/TextDecoration.js +97 -0
- package/lib/extensions/__tests__/Alignment.test.js +107 -0
- package/lib/extensions/__tests__/BackgroundColor.test.js +75 -0
- package/lib/extensions/__tests__/CaseStyle.test.js +58 -0
- package/lib/extensions/__tests__/FontColor.test.js +85 -0
- package/lib/extensions/__tests__/FontFamily.test.js +171 -0
- package/lib/extensions/__tests__/FontSize.test.js +183 -0
- package/lib/extensions/__tests__/FontStyle.test.js +136 -0
- package/lib/extensions/__tests__/FontWeight.test.js +151 -0
- package/lib/extensions/__tests__/LineHeight.test.js +106 -0
- package/lib/extensions/__tests__/StylePreset.test.js +400 -0
- package/lib/extensions/__tests__/TextDecoration.test.js +258 -0
- package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +29 -0
- package/lib/extensions/__tests__/__snapshots__/BackgroundColor.test.js.snap +28 -0
- package/lib/extensions/__tests__/__snapshots__/CaseStyle.test.js.snap +69 -0
- package/lib/extensions/__tests__/__snapshots__/FontColor.test.js.snap +28 -0
- package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +158 -0
- package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +140 -0
- package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +87 -0
- package/lib/extensions/__tests__/__snapshots__/FontWeight.test.js.snap +140 -0
- package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +29 -0
- package/lib/extensions/__tests__/__snapshots__/StylePreset.test.js.snap +310 -0
- package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +206 -0
- package/lib/extensions/core/NodeProcessor.js +32 -0
- package/lib/extensions/core/SelectionProcessor.js +37 -0
- package/lib/extensions/core/TextProcessor.js +57 -0
- package/lib/extensions/core/__tests__/NodeProcessor.test.js +120 -0
- package/lib/extensions/core/__tests__/SelectionProcessor.test.js +78 -0
- package/lib/extensions/core/__tests__/TextProcessor.test.js +61 -0
- package/lib/extensions/core/__tests__/__snapshots__/NodeProcessor.test.js.snap +93 -0
- package/lib/extensions/core/__tests__/__snapshots__/TextProcessor.test.js.snap +43 -0
- package/lib/extensions/core/index.js +17 -0
- package/lib/extensions/core/inputRules/closeDoubleQuote.js +6 -0
- package/lib/extensions/core/inputRules/closeSingleQuote.js +6 -0
- package/lib/extensions/core/inputRules/copyright.js +6 -0
- package/lib/extensions/core/inputRules/ellipsis.js +6 -0
- package/lib/extensions/core/inputRules/emDash.js +6 -0
- package/lib/extensions/core/inputRules/index.js +9 -0
- package/lib/extensions/core/inputRules/openDoubleQuote.js +6 -0
- package/lib/extensions/core/inputRules/openSingleQuote.js +6 -0
- package/lib/extensions/core/inputRules/registeredTrademark.js +6 -0
- package/lib/extensions/core/inputRules/trademark.js +6 -0
- package/lib/extensions/index.js +49 -0
- package/lib/extensions/list/List.js +81 -0
- package/lib/extensions/list/ListItem.js +12 -0
- package/lib/extensions/list/__tests__/List.test.js +130 -0
- package/lib/extensions/list/__tests__/__snapshots__/List.test.js.snap +212 -0
- package/lib/extensions/list/index.js +1 -0
- package/lib/index.js +1 -0
- package/lib/injectionTokens.js +7 -0
- package/lib/models/Font.js +37 -0
- package/lib/models/__tests__/Font.test.js +58 -0
- package/lib/models/index.js +1 -0
- package/lib/services/FavoriteColors.js +6 -0
- package/lib/services/JsonSerializer.js +15 -0
- package/lib/services/Storage.js +49 -0
- package/lib/services/index.js +3 -0
- package/lib/styles/content.css +39 -0
- package/lib/styles/helpers/common.css +3 -0
- package/lib/styles/helpers/offsets.css +3 -0
- package/lib/styles/helpers/text.css +6 -0
- package/lib/styles/main.css +5 -0
- package/lib/styles/variables.css +57 -0
- package/lib/utils/__tests__/__snapshots__/renderInlineSetting.test.js.snap +40 -0
- package/lib/utils/__tests__/capitalize.test.js +11 -0
- package/lib/utils/__tests__/renderInlineSetting.test.js +39 -0
- package/lib/utils/capitalize.js +3 -0
- package/lib/utils/createCommand.js +3 -0
- package/lib/utils/createKeyboardShortcut.js +6 -0
- package/lib/utils/index.js +4 -0
- package/lib/utils/renderInlineSetting.js +17 -0
- package/package.json +75 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
indent_style = space
|
|
5
|
+
indent_size = 2
|
|
6
|
+
tab_width = 2
|
|
7
|
+
|
|
8
|
+
end_of_line = lf
|
|
9
|
+
charset = utf-8
|
|
10
|
+
trim_trailing_whitespace = true
|
|
11
|
+
insert_final_newline = true
|
|
12
|
+
|
|
13
|
+
[*.{js,html,vue,scss,css,svg}]
|
|
14
|
+
indent_size = 4
|
|
15
|
+
tab_width = 4
|
|
16
|
+
|
|
17
|
+
[*.md]
|
|
18
|
+
trim_trailing_whitespace = false
|
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
const JS_PARSER = '@babel/eslint-parser';
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
extends: ['eslint:recommended'],
|
|
5
|
+
plugins: ['import'],
|
|
6
|
+
parser: JS_PARSER,
|
|
7
|
+
parserOptions: {
|
|
8
|
+
ecmaVersion: 8,
|
|
9
|
+
sourceType: 'module',
|
|
10
|
+
allowImportExportEverywhere: true
|
|
11
|
+
},
|
|
12
|
+
settings: {
|
|
13
|
+
'import/resolver': {
|
|
14
|
+
node: {
|
|
15
|
+
extensions: ['.js', '.scss', '.css', '.vue', '.html']
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
env: {
|
|
20
|
+
browser: true,
|
|
21
|
+
es6: true,
|
|
22
|
+
jquery: true,
|
|
23
|
+
node: true,
|
|
24
|
+
jest: true
|
|
25
|
+
},
|
|
26
|
+
globals: {
|
|
27
|
+
noty: false,
|
|
28
|
+
Buffer: false,
|
|
29
|
+
gapi: true,
|
|
30
|
+
ZW_UPDATED_AT: true
|
|
31
|
+
},
|
|
32
|
+
rules: {
|
|
33
|
+
// enable additional rules
|
|
34
|
+
'no-unused-vars': ['warn', { vars: 'local', args: 'after-used' }],
|
|
35
|
+
'no-extra-bind': 'error',
|
|
36
|
+
|
|
37
|
+
// override default options for rules from base configurations
|
|
38
|
+
'no-cond-assign': ['error', 'always'],
|
|
39
|
+
eqeqeq: ['warn', 'smart'],
|
|
40
|
+
|
|
41
|
+
// disable rules from base configurations
|
|
42
|
+
'block-scoped-var': 'error',
|
|
43
|
+
'guard-for-in': 'error',
|
|
44
|
+
'no-loop-func': 'error',
|
|
45
|
+
'no-self-compare': 'error',
|
|
46
|
+
'no-use-before-define': 'error',
|
|
47
|
+
'no-unneeded-ternary': 'error',
|
|
48
|
+
'no-prototype-builtins': 'off',
|
|
49
|
+
'no-extend-native': 'error',
|
|
50
|
+
'padding-line-between-statements': [
|
|
51
|
+
'error',
|
|
52
|
+
// offset after variables
|
|
53
|
+
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
|
|
54
|
+
{ blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] },
|
|
55
|
+
|
|
56
|
+
// offset after imports
|
|
57
|
+
{ blankLine: 'always', prev: 'import', next: '*' },
|
|
58
|
+
{ blankLine: 'any', prev: 'import', next: 'import' },
|
|
59
|
+
|
|
60
|
+
// offset after oneline if statements
|
|
61
|
+
{ blankLine: 'always', prev: 'if', next: '*' },
|
|
62
|
+
{ blankLine: 'any', prev: 'if', next: 'if' },
|
|
63
|
+
{ blankLine: 'any', prev: 'multiline-block-like', next: '*' }
|
|
64
|
+
],
|
|
65
|
+
'no-console': 'error',
|
|
66
|
+
'comma-dangle': ['error', 'never'],
|
|
67
|
+
quotes: ['error', 'single'],
|
|
68
|
+
semi: ['error', 'always'],
|
|
69
|
+
curly: ['error', 'multi-line'],
|
|
70
|
+
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
|
|
71
|
+
'padded-blocks': ['error', 'never'],
|
|
72
|
+
'object-curly-spacing': ['error', 'always'],
|
|
73
|
+
'array-bracket-spacing': ['error', 'never'],
|
|
74
|
+
'comma-spacing': [
|
|
75
|
+
'error',
|
|
76
|
+
{
|
|
77
|
+
before: false,
|
|
78
|
+
after: true
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
'space-infix-ops': 'error',
|
|
82
|
+
'keyword-spacing': 'off',
|
|
83
|
+
'comma-style': ['error', 'last'],
|
|
84
|
+
'space-before-blocks': 'error',
|
|
85
|
+
'arrow-spacing': [
|
|
86
|
+
'error',
|
|
87
|
+
{
|
|
88
|
+
before: true,
|
|
89
|
+
after: true
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
|
93
|
+
'template-curly-spacing': ['error', 'never'],
|
|
94
|
+
'prefer-template': 'error',
|
|
95
|
+
'no-useless-concat': 'error',
|
|
96
|
+
'no-duplicate-imports': 'error',
|
|
97
|
+
'no-param-reassign': ['error', { props: false }],
|
|
98
|
+
'new-parens': ['error', 'always'],
|
|
99
|
+
'default-param-last': 'error',
|
|
100
|
+
'max-params': ['error', 4],
|
|
101
|
+
'no-useless-computed-key': ['error', { enforceForClassMembers: true }],
|
|
102
|
+
'dot-notation': 'error',
|
|
103
|
+
'import/named': 'error',
|
|
104
|
+
'import/default': 'error',
|
|
105
|
+
'import/namespace': 'error',
|
|
106
|
+
'import/no-absolute-path': 'error',
|
|
107
|
+
'import/no-self-import': 'error',
|
|
108
|
+
'import/no-useless-path-segments': 'error',
|
|
109
|
+
'import/export': 'error',
|
|
110
|
+
'import/no-deprecated': 'warn',
|
|
111
|
+
'import/first': 'error',
|
|
112
|
+
'import/no-namespace': 'error',
|
|
113
|
+
'import/extensions': [
|
|
114
|
+
'error',
|
|
115
|
+
'never',
|
|
116
|
+
{ scss: 'always', html: 'always' }
|
|
117
|
+
],
|
|
118
|
+
'import/order': [
|
|
119
|
+
'error',
|
|
120
|
+
{
|
|
121
|
+
groups: [
|
|
122
|
+
'builtin',
|
|
123
|
+
'external',
|
|
124
|
+
'internal',
|
|
125
|
+
'parent',
|
|
126
|
+
'sibling'
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
'import/newline-after-import': 'error',
|
|
131
|
+
'max-len': ['error', {
|
|
132
|
+
code: 120,
|
|
133
|
+
ignoreUrls: true,
|
|
134
|
+
ignoreStrings: true,
|
|
135
|
+
ignoreTemplateLiterals: true,
|
|
136
|
+
ignoreRegExpLiterals: true,
|
|
137
|
+
ignoreComments: true
|
|
138
|
+
}],
|
|
139
|
+
indent: ['error', 4, { SwitchCase: 1 }],
|
|
140
|
+
'linebreak-style': ['error', 'unix'],
|
|
141
|
+
'arrow-parens': ['warn', 'always']
|
|
142
|
+
},
|
|
143
|
+
overrides: [
|
|
144
|
+
{
|
|
145
|
+
files: '*.vue',
|
|
146
|
+
extends: ['plugin:vue/essential'],
|
|
147
|
+
parser: 'vue-eslint-parser',
|
|
148
|
+
parserOptions: {
|
|
149
|
+
parser: JS_PARSER
|
|
150
|
+
},
|
|
151
|
+
plugins: ['vue'],
|
|
152
|
+
rules: {
|
|
153
|
+
'vue/script-indent': ['error', 4, { switchCase: 1 }],
|
|
154
|
+
'vue/html-indent': ['error', 4],
|
|
155
|
+
'vue/prop-name-casing': ['error', 'camelCase'],
|
|
156
|
+
'vue/attribute-hyphenation': 'off', // Breaks slot props
|
|
157
|
+
'vue/component-definition-name-casing': 'error',
|
|
158
|
+
'vue/component-name-in-template-casing': 'error',
|
|
159
|
+
'vue/require-prop-types': 'error',
|
|
160
|
+
'vue/require-default-prop': 'error',
|
|
161
|
+
'vue/mustache-interpolation-spacing': ['error', 'always'],
|
|
162
|
+
'vue/html-self-closing': 'error',
|
|
163
|
+
'vue/html-closing-bracket-spacing': [
|
|
164
|
+
'error',
|
|
165
|
+
{
|
|
166
|
+
startTag: 'never',
|
|
167
|
+
endTag: 'never',
|
|
168
|
+
selfClosingTag: 'always'
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
'vue/html-closing-bracket-newline': [
|
|
172
|
+
'error',
|
|
173
|
+
{
|
|
174
|
+
singleline: 'never',
|
|
175
|
+
multiline: 'always'
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
'vue/no-spaces-around-equal-signs-in-attribute': 'error',
|
|
179
|
+
'vue/singleline-html-element-content-newline': 'error',
|
|
180
|
+
'vue/v-bind-style': 'error',
|
|
181
|
+
'vue/v-on-style': 'error',
|
|
182
|
+
'vue/component-tags-order': [
|
|
183
|
+
'error',
|
|
184
|
+
{
|
|
185
|
+
order: ['template', 'script', 'style']
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
'vue/order-in-components': [
|
|
189
|
+
'error',
|
|
190
|
+
{
|
|
191
|
+
order: [
|
|
192
|
+
'el',
|
|
193
|
+
'name',
|
|
194
|
+
'functional',
|
|
195
|
+
'components',
|
|
196
|
+
'directives',
|
|
197
|
+
'mixins',
|
|
198
|
+
'inheritAttrs',
|
|
199
|
+
'model',
|
|
200
|
+
'props',
|
|
201
|
+
'propsData',
|
|
202
|
+
'data',
|
|
203
|
+
'computed',
|
|
204
|
+
'watch',
|
|
205
|
+
'LIFECYCLE_HOOKS',
|
|
206
|
+
'methods',
|
|
207
|
+
['template', 'render']
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
'vue/this-in-template': 'error',
|
|
212
|
+
'vue/block-tag-newline': [
|
|
213
|
+
'error',
|
|
214
|
+
{
|
|
215
|
+
singleline: 'always',
|
|
216
|
+
multiline: 'always'
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
'vue/match-component-file-name': ['error', { extensions: ['vue'] }],
|
|
220
|
+
'vue/no-empty-component-block': 'error',
|
|
221
|
+
'vue/no-static-inline-styles': 'error',
|
|
222
|
+
'vue/no-useless-mustaches': 'error',
|
|
223
|
+
'vue/no-useless-v-bind': 'error',
|
|
224
|
+
'vue/padding-line-between-blocks': ['error', 'always'],
|
|
225
|
+
'vue/require-name-property': 'error',
|
|
226
|
+
'vue/html-button-has-type': ['error'],
|
|
227
|
+
'vue/no-unused-refs': 'error',
|
|
228
|
+
'vue/no-deprecated-slot-attribute': 'error',
|
|
229
|
+
'vue/no-deprecated-slot-scope-attribute': 'error',
|
|
230
|
+
'vue/no-use-computed-property-like-method': 'error',
|
|
231
|
+
'vue/no-v-text': 'error',
|
|
232
|
+
'object-shorthand': ['error', 'always', { avoidQuotes: true }],
|
|
233
|
+
'max-len': 'off',
|
|
234
|
+
'vue/max-len': [
|
|
235
|
+
'error',
|
|
236
|
+
{
|
|
237
|
+
code: 120,
|
|
238
|
+
template: 120,
|
|
239
|
+
ignoreComments: true,
|
|
240
|
+
ignoreUrls: true,
|
|
241
|
+
ignoreStrings: true,
|
|
242
|
+
ignoreTemplateLiterals: true,
|
|
243
|
+
ignoreRegExpLiterals: true,
|
|
244
|
+
ignoreHTMLAttributeValues: true,
|
|
245
|
+
ignoreHTMLTextContents: true
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
'vue/multi-word-component-names': 'off',
|
|
249
|
+
'vue/no-reserved-component-names': 'off' // Conflicts with base components
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
name: Deploy Example
|
|
2
|
+
description: Deploy Example App
|
|
3
|
+
|
|
4
|
+
inputs:
|
|
5
|
+
folder:
|
|
6
|
+
required: true
|
|
7
|
+
description: bucket folder
|
|
8
|
+
|
|
9
|
+
cache-control:
|
|
10
|
+
required: true
|
|
11
|
+
description: bucket folder
|
|
12
|
+
|
|
13
|
+
aws-region:
|
|
14
|
+
required: true
|
|
15
|
+
description: AWS region
|
|
16
|
+
|
|
17
|
+
aws-bucket:
|
|
18
|
+
required: true
|
|
19
|
+
description: AWS S3 region
|
|
20
|
+
|
|
21
|
+
aws-access-key:
|
|
22
|
+
required: true
|
|
23
|
+
description: AWS access key
|
|
24
|
+
|
|
25
|
+
aws-secret-key:
|
|
26
|
+
required: true
|
|
27
|
+
description: AWS secret access key
|
|
28
|
+
|
|
29
|
+
outputs:
|
|
30
|
+
public-url:
|
|
31
|
+
value: ${{ steps.public-url.outputs.url }}
|
|
32
|
+
description: App public url
|
|
33
|
+
|
|
34
|
+
runs:
|
|
35
|
+
using: "composite"
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/cache@v3
|
|
38
|
+
with:
|
|
39
|
+
path: ./example/dist
|
|
40
|
+
key: example-webpack-${{ github.sha }}
|
|
41
|
+
restore-keys: |
|
|
42
|
+
example-webpack-
|
|
43
|
+
|
|
44
|
+
- run: npm run example:build
|
|
45
|
+
shell: sh
|
|
46
|
+
|
|
47
|
+
- run: npm run gzip ./example/dist
|
|
48
|
+
shell: sh
|
|
49
|
+
|
|
50
|
+
- uses: aws-actions/configure-aws-credentials@v1
|
|
51
|
+
with:
|
|
52
|
+
aws-access-key-id: ${{ inputs.aws-access-key }}
|
|
53
|
+
aws-secret-access-key: ${{ inputs.aws-secret-key }}
|
|
54
|
+
aws-region: ${{ inputs.aws-region }}
|
|
55
|
+
|
|
56
|
+
- run: aws s3 sync --acl public-read --cache-control '${{ inputs.cache-control }}' './example/dist' 's3://${{ inputs.aws-bucket }}/${{ inputs.folder }}'
|
|
57
|
+
shell: sh
|
|
58
|
+
|
|
59
|
+
- id: public-url
|
|
60
|
+
run: echo "::set-output name=url::https://${{ inputs.aws-bucket }}.s3.${{ inputs.aws-region }}.amazonaws.com/${{ inputs.folder }}/index.html"
|
|
61
|
+
shell: sh
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
name: Lint CSS
|
|
2
|
+
description: Lint CSS files
|
|
3
|
+
|
|
4
|
+
inputs:
|
|
5
|
+
files:
|
|
6
|
+
description: list of changed files
|
|
7
|
+
required: true
|
|
8
|
+
|
|
9
|
+
runs:
|
|
10
|
+
using: "composite"
|
|
11
|
+
steps:
|
|
12
|
+
- uses: xt0rted/stylelint-problem-matcher@v1.3.0
|
|
13
|
+
|
|
14
|
+
- run: npx stylelint --config .stylelintrc ${{ inputs.files }}
|
|
15
|
+
shell: sh
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: Lint JS
|
|
2
|
+
description: Lint JS files
|
|
3
|
+
|
|
4
|
+
inputs:
|
|
5
|
+
files:
|
|
6
|
+
description: list of changed files
|
|
7
|
+
required: true
|
|
8
|
+
github-token:
|
|
9
|
+
description: GitHub API token
|
|
10
|
+
required: true
|
|
11
|
+
|
|
12
|
+
runs:
|
|
13
|
+
using: "composite"
|
|
14
|
+
steps:
|
|
15
|
+
- run: npx eslint --config .eslintrc.js --output-file ./eslint_report.json --format json ${{ inputs.files }}
|
|
16
|
+
shell: sh
|
|
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
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: Setup
|
|
2
|
+
description: Setup Environment
|
|
3
|
+
|
|
4
|
+
runs:
|
|
5
|
+
using: "composite"
|
|
6
|
+
steps:
|
|
7
|
+
- uses: actions/setup-node@v2
|
|
8
|
+
with:
|
|
9
|
+
node-version: 14.18.1
|
|
10
|
+
|
|
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
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
name: Unit Tests
|
|
2
|
+
description: Run unit tests
|
|
3
|
+
|
|
4
|
+
inputs:
|
|
5
|
+
github-token:
|
|
6
|
+
description: GitHub API token
|
|
7
|
+
required: true
|
|
8
|
+
|
|
9
|
+
runs:
|
|
10
|
+
using: "composite"
|
|
11
|
+
steps:
|
|
12
|
+
- run: npx jest --ci --config ./.github/actions/unit-tests/jest.config.js .
|
|
13
|
+
shell: sh
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
|
|
3
|
+
# dependabot doesn't support YAML aliases
|
|
4
|
+
# https://github.com/dependabot/dependabot-core/issues/2127
|
|
5
|
+
|
|
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
|
+
pull-request-branch-name:
|
|
15
|
+
separator: "_"
|
|
16
|
+
labels:
|
|
17
|
+
- "Dependencies"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## What does the MR do?
|
|
2
|
+
<!--
|
|
3
|
+
Write here about your changes in this merge request.
|
|
4
|
+
Add here text description and URLs to screenshots
|
|
5
|
+
-->
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Additional comments
|
|
9
|
+
<!--
|
|
10
|
+
This section contains links to external resources and other things
|
|
11
|
+
that you cannot place in previous sections
|
|
12
|
+
-->
|
|
13
|
+
- [Jira Ticket](url-to-jira-ticket)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Checklist
|
|
17
|
+
<!-- Checklist for QAs -->
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
name: Front-end CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types:
|
|
6
|
+
- opened
|
|
7
|
+
- reopened
|
|
8
|
+
- synchronize
|
|
9
|
+
- ready_for_review
|
|
10
|
+
|
|
11
|
+
concurrency:
|
|
12
|
+
group: ${{ github.ref }}
|
|
13
|
+
cancel-in-progress: true
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
lint_js:
|
|
17
|
+
name: eslint
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
if: github.event.pull_request.draft == false
|
|
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'
|
|
29
|
+
|
|
30
|
+
- if: ${{ steps.changes_filter.outputs.lint == 'true' }}
|
|
31
|
+
uses: actions/checkout@v3
|
|
32
|
+
|
|
33
|
+
- if: ${{ steps.changes_filter.outputs.lint == 'true' }}
|
|
34
|
+
uses: ./.github/actions/setup
|
|
35
|
+
|
|
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 }}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
lint_css:
|
|
44
|
+
name: stylelint
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
if: github.event.pull_request.draft == false
|
|
47
|
+
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'
|
|
56
|
+
|
|
57
|
+
- if: ${{ steps.changes_filter.outputs.lint == 'true' }}
|
|
58
|
+
uses: actions/checkout@v3
|
|
59
|
+
|
|
60
|
+
- if: ${{ steps.changes_filter.outputs.lint == 'true' }}
|
|
61
|
+
uses: ./.github/actions/setup
|
|
62
|
+
|
|
63
|
+
- if: ${{ steps.changes_filter.outputs.lint == 'true' }}
|
|
64
|
+
uses: ./.github/actions/lint-css
|
|
65
|
+
with:
|
|
66
|
+
files: ${{ steps.changes_filter.outputs.lint_files }}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
unit_tests:
|
|
70
|
+
name: Unit Tests
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
if: github.event.pull_request.draft == false
|
|
73
|
+
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 }}
|
|
93
|
+
|
|
94
|
+
deploy_example:
|
|
95
|
+
name: Deploy Example
|
|
96
|
+
if: github.event.pull_request.draft == false
|
|
97
|
+
runs-on: ubuntu-latest
|
|
98
|
+
needs:
|
|
99
|
+
- lint_js
|
|
100
|
+
- lint_css
|
|
101
|
+
- unit_tests
|
|
102
|
+
steps:
|
|
103
|
+
- uses: actions/checkout@v3
|
|
104
|
+
- uses: ./.github/actions/setup
|
|
105
|
+
|
|
106
|
+
- id: deploy
|
|
107
|
+
uses: ./.github/actions/deploy-example
|
|
108
|
+
with:
|
|
109
|
+
folder: ${{ github.head_ref }}
|
|
110
|
+
cache-control: max-age=0,no-cache,no-store,must-revalidate
|
|
111
|
+
aws-region: eu-central-1
|
|
112
|
+
aws-bucket: zipify-wysiwyg
|
|
113
|
+
aws-access-key: ${{ secrets.AWS_EXAMPLE_ACCESS_KEY_ID }}
|
|
114
|
+
aws-secret-key: ${{ secrets.AWS_EXAMPLE_SECRET_ACCESS_KEY }}
|
|
115
|
+
|
|
116
|
+
- uses: thollander/actions-comment-pull-request@v1
|
|
117
|
+
with:
|
|
118
|
+
message: "**:rocket: ExampleApp:** Line on [${{ github.head_ref }}](${{ steps.deploy.outputs.public-url }})"
|
|
119
|
+
comment_includes: "ExampleApp"
|
|
120
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/.lintstagedrc
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"*.{vue,scss}": [
|
|
3
|
+
"stylelint --config .stylelintrc"
|
|
4
|
+
],
|
|
5
|
+
"*.{vue,js}": [
|
|
6
|
+
"eslint --fix --fix-type layout --fix-type suggestion --config .eslintrc.js",
|
|
7
|
+
"jest --passWithNoTests --findRelatedTests"
|
|
8
|
+
],
|
|
9
|
+
"*.svg": [
|
|
10
|
+
"svgo --config ./config/svgo.js"
|
|
11
|
+
]
|
|
12
|
+
}
|