@lilaquadrat/design-core 0.2.2 → 0.3.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.
- package/README.md +71 -3
- package/html/index.server.html +1 -8
- package/package.json +53 -53
- package/src/client-entry.ts +8 -8
- package/src/components/partials/error.partial.vue +19 -19
- package/src/components/partials/main-components.partial.vue +75 -70
- package/src/components/partials/qrcode.partial.vue +8 -8
- package/src/functions/AuthProviderFactory.ts +30 -0
- package/src/functions/PaymenyProviderFactory.ts +11 -11
- package/src/functions/auth0.provider.ts +75 -0
- package/src/functions/keycloak.provider.ts +228 -0
- package/src/functions/lila-dom.ts +50 -50
- package/src/functions/shopify.provider.ts +176 -154
- package/src/functions/stripe.provider.ts +120 -108
- package/src/globals.d.ts +1 -2
- package/src/index.ts +9 -7
- package/src/interfaces/AuthCallbackResult.interface.ts +5 -0
- package/src/interfaces/AuthConfig.interface.ts +13 -0
- package/src/interfaces/AuthProvider.interface.ts +15 -0
- package/src/interfaces/FrontendConfig.interface.ts +11 -40
- package/src/interfaces/GenericEvents.interface.ts +1 -1
- package/src/interfaces/IdTokenExtended.interface.ts +13 -4
- package/src/interfaces/PaymentProvider.interface.ts +2 -2
- package/src/interfaces/RenderOptions.interface.ts +12 -0
- package/src/libs/ActionNotice.ts +125 -125
- package/src/libs/Models.class.ts +219 -221
- package/src/main.ts +41 -36
- package/src/mixins/createCookieString.ts +50 -36
- package/src/mixins/createModelDeclaration.ts +22 -19
- package/src/mixins/createRouter.ts +12 -12
- package/src/mixins/date.ts +4 -2
- package/src/mixins/formatSize.ts +5 -5
- package/src/mixins/getAnchor.ts +1 -1
- package/src/mixins/getRoutes.ts +13 -25
- package/src/mixins/hasSlotContent.ts +22 -16
- package/src/mixins/hooks.ts +101 -60
- package/src/mixins/loadComponents.ts +60 -58
- package/src/mixins/logger.ts +17 -13
- package/src/mixins/replaceVariables.ts +10 -8
- package/src/mixins/scroll.ts +61 -45
- package/src/models/Address.model.ts +7 -7
- package/src/models/Contact.model.ts +14 -14
- package/src/plugins/analytics.ts +198 -0
- package/src/plugins/auth.ts +74 -60
- package/src/plugins/currency.ts +10 -10
- package/src/plugins/events.ts +101 -97
- package/src/plugins/filters.ts +21 -18
- package/src/plugins/replacer.ts +7 -6
- package/src/plugins/signupFlow.ts +45 -43
- package/src/plugins/traceable.ts +28 -26
- package/src/plugins/translations.ts +9 -9
- package/src/plugins/youtube.ts +39 -34
- package/src/routes.ts +108 -108
- package/src/server-entry.ts +75 -77
- package/src/stores/calls.store.ts +14 -14
- package/src/stores/cart.store.ts +116 -107
- package/src/stores/content.store.ts +87 -45
- package/src/stores/editor.store.ts +16 -16
- package/src/stores/files.store.ts +72 -72
- package/src/stores/main.store.ts +155 -109
- package/src/stores/user.store.ts +72 -68
- package/src/translations/de.ts +127 -127
- package/src/views/content.view.vue +81 -143
- package/src/views/download.view.vue +25 -23
- package/src/views/editor.view.vue +150 -125
- package/src/views/login.view.vue +35 -36
- package/src/views/signup-account.view.vue +14 -14
- package/tooling/cypress/config.ts +68 -54
- package/tooling/cypress/manifest-utils.mjs +34 -22
- package/tooling/cypress/run-parallel.mjs +41 -35
- package/tooling/cypress/support/commands.ts +458 -300
- package/tooling/eslint.config.js +1 -223
- package/tooling/preview.plugin.js +68 -68
- package/tooling/ssr-test/index.mjs +205 -203
- package/tooling/vite.d.ts +0 -6
- package/tooling/vite.js +170 -162
- package/src/interfaces/EditorConfiguration.interface.ts +0 -15
- package/tooling/stylelint.config.mjs +0 -24
package/tooling/eslint.config.js
CHANGED
|
@@ -1,223 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
3
|
-
import pluginVue from 'eslint-plugin-vue'
|
|
4
|
-
import typescriptParser from '@typescript-eslint/parser';
|
|
5
|
-
import vueParser from 'vue-eslint-parser';
|
|
6
|
-
import globals from 'globals';
|
|
7
|
-
|
|
8
|
-
export default [
|
|
9
|
-
// Default ignores - including all patterns from .eslintignore
|
|
10
|
-
{
|
|
11
|
-
ignores: [
|
|
12
|
-
// Project specific ignores
|
|
13
|
-
'src/views/viewData/*',
|
|
14
|
-
'config.ts',
|
|
15
|
-
'stats.html',
|
|
16
|
-
|
|
17
|
-
// Build outputs
|
|
18
|
-
'dist/**',
|
|
19
|
-
'dist-ssr/**',
|
|
20
|
-
'coverage/**',
|
|
21
|
-
'*.local',
|
|
22
|
-
|
|
23
|
-
// Logs
|
|
24
|
-
'logs/**',
|
|
25
|
-
'*.log',
|
|
26
|
-
'npm-debug.log*',
|
|
27
|
-
'yarn-debug.log*',
|
|
28
|
-
'yarn-error.log*',
|
|
29
|
-
'pnpm-debug.log*',
|
|
30
|
-
'lerna-debug.log*',
|
|
31
|
-
|
|
32
|
-
// Dependencies
|
|
33
|
-
'node_modules/**',
|
|
34
|
-
'.yarn/**',
|
|
35
|
-
'*.tsbuildinfo',
|
|
36
|
-
'.lila/**',
|
|
37
|
-
|
|
38
|
-
// System files
|
|
39
|
-
'.DS_Store',
|
|
40
|
-
|
|
41
|
-
// Editor directories and files
|
|
42
|
-
'.vscode/**',
|
|
43
|
-
'!.vscode/extensions.json',
|
|
44
|
-
'.idea/**',
|
|
45
|
-
'*.suo',
|
|
46
|
-
'*.ntvs*',
|
|
47
|
-
'*.njsproj',
|
|
48
|
-
'*.sln',
|
|
49
|
-
'*.sw?',
|
|
50
|
-
|
|
51
|
-
// Test files
|
|
52
|
-
'/cypress/videos/',
|
|
53
|
-
'/cypress/screenshots/',
|
|
54
|
-
]
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
// Cypress test files
|
|
58
|
-
{
|
|
59
|
-
files : ['cypress/**/*.{cy,spec}.{js,jsx,ts,tsx}', 'cypress/support/**/*.{js,jsx,ts,tsx}'],
|
|
60
|
-
languageOptions: {
|
|
61
|
-
parser : typescriptParser,
|
|
62
|
-
globals: {
|
|
63
|
-
...globals.browser,
|
|
64
|
-
...globals.node,
|
|
65
|
-
...globals.mocha,
|
|
66
|
-
cy : 'readonly',
|
|
67
|
-
Cypress: 'readonly',
|
|
68
|
-
expect : 'readonly',
|
|
69
|
-
assert : 'readonly',
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
// Base eslint recommended config
|
|
75
|
-
eslint.configs.recommended,
|
|
76
|
-
...pluginVue.configs['flat/recommended'],
|
|
77
|
-
|
|
78
|
-
// Common environment settings for all files
|
|
79
|
-
{
|
|
80
|
-
languageOptions: {
|
|
81
|
-
ecmaVersion: 'latest',
|
|
82
|
-
globals : {
|
|
83
|
-
...globals.browser,
|
|
84
|
-
// Browser globals
|
|
85
|
-
console : 'readonly',
|
|
86
|
-
document : 'readonly',
|
|
87
|
-
window : 'readonly',
|
|
88
|
-
navigator: 'readonly',
|
|
89
|
-
|
|
90
|
-
// Timer functions
|
|
91
|
-
setTimeout : 'readonly',
|
|
92
|
-
clearTimeout : 'readonly',
|
|
93
|
-
setInterval : 'readonly',
|
|
94
|
-
clearInterval: 'readonly',
|
|
95
|
-
|
|
96
|
-
// JS objects
|
|
97
|
-
Promise: 'readonly',
|
|
98
|
-
|
|
99
|
-
// DOM elements and types
|
|
100
|
-
HTMLElement : 'readonly',
|
|
101
|
-
HTMLInputElement: 'readonly',
|
|
102
|
-
Element : 'readonly',
|
|
103
|
-
Node : 'readonly',
|
|
104
|
-
NodeList : 'readonly',
|
|
105
|
-
Event : 'readonly',
|
|
106
|
-
MouseEvent : 'readonly',
|
|
107
|
-
KeyboardEvent : 'readonly',
|
|
108
|
-
CustomEvent : 'readonly',
|
|
109
|
-
DOMParser : 'readonly',
|
|
110
|
-
|
|
111
|
-
// Web APIs
|
|
112
|
-
localStorage : 'readonly',
|
|
113
|
-
sessionStorage: 'readonly',
|
|
114
|
-
fetch : 'readonly',
|
|
115
|
-
XMLHttpRequest: 'readonly',
|
|
116
|
-
|
|
117
|
-
// compile time defines, injected by vite.config.ts
|
|
118
|
-
__FRONTEND_CONFIG__: 'readonly',
|
|
119
|
-
__TARGET__ : 'readonly',
|
|
120
|
-
__PREVIEW__ : 'readonly'
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
// the build config runs in node, not in the browser
|
|
126
|
-
{
|
|
127
|
-
files : ['vite.config.ts', 'build/**/*.ts', 'build/**/*.mjs'],
|
|
128
|
-
languageOptions: {
|
|
129
|
-
globals: {
|
|
130
|
-
...globals.node
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
// Vue plugin config
|
|
136
|
-
{
|
|
137
|
-
files : ['**/*.vue'],
|
|
138
|
-
languageOptions: {
|
|
139
|
-
parser : vueParser,
|
|
140
|
-
parserOptions: {
|
|
141
|
-
ecmaVersion: 'latest',
|
|
142
|
-
parser : typescriptParser,
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
rules: {
|
|
146
|
-
'vue/multi-word-component-names': 'off',
|
|
147
|
-
'vue/max-len' : ['warn', {
|
|
148
|
-
code : 250,
|
|
149
|
-
template : 350,
|
|
150
|
-
tabWidth : 2,
|
|
151
|
-
ignoreComments : true,
|
|
152
|
-
ignoreUrls : true,
|
|
153
|
-
ignoreStrings : true,
|
|
154
|
-
ignoreTemplateLiterals : true,
|
|
155
|
-
ignoreRegExpLiterals : true,
|
|
156
|
-
ignoreHTMLAttributeValues: false,
|
|
157
|
-
ignoreHTMLTextContents : false,
|
|
158
|
-
}],
|
|
159
|
-
'vue/max-attributes-per-line' : 'off',
|
|
160
|
-
'vue/first-attribute-linebreak' : 'off',
|
|
161
|
-
'vue/html-closing-bracket-newline': 'off',
|
|
162
|
-
'vue/require-default-prop' : 'off',
|
|
163
|
-
'vue/html-indent' : ['error', 4],
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
// TypeScript files
|
|
168
|
-
{
|
|
169
|
-
files : ['**/*.ts', '**/*.tsx'],
|
|
170
|
-
plugins: {
|
|
171
|
-
'@typescript-eslint': tseslint,
|
|
172
|
-
},
|
|
173
|
-
languageOptions: {
|
|
174
|
-
parser : typescriptParser,
|
|
175
|
-
parserOptions: {
|
|
176
|
-
ecmaVersion: 'latest',
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
// Common config for all files
|
|
182
|
-
{
|
|
183
|
-
languageOptions: {
|
|
184
|
-
ecmaVersion: 'latest',
|
|
185
|
-
},
|
|
186
|
-
rules: {
|
|
187
|
-
semi : 'off',
|
|
188
|
-
'brace-style' : ['error', '1tbs', { allowSingleLine: true }],
|
|
189
|
-
'multiline-ternary': ['error', 'always-multiline'],
|
|
190
|
-
'no-param-reassign': ['error', { props: false }],
|
|
191
|
-
'import/no-cycle' : 'off',
|
|
192
|
-
'max-len' : [
|
|
193
|
-
'warn',
|
|
194
|
-
{
|
|
195
|
-
code: 250, // Updated this from 240 to 250 for consistency
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
curly : [2, 'multi-line'],
|
|
199
|
-
'prefer-destructuring' : 'off',
|
|
200
|
-
'no-multiple-empty-lines' : [1, { max: 1 }],
|
|
201
|
-
'no-multi-spaces' : ['error', { ignoreEOLComments: false }],
|
|
202
|
-
'arrow-spacing' : ['error', { 'before': true, 'after': true }],
|
|
203
|
-
'space-before-function-paren': ['error', {
|
|
204
|
-
'anonymous' : 'never',
|
|
205
|
-
'named' : 'never',
|
|
206
|
-
'asyncArrow': 'always'
|
|
207
|
-
}],
|
|
208
|
-
'one-var' : ['error', 'never'],
|
|
209
|
-
'comma-spacing' : ['error', { 'before': false, 'after': true }],
|
|
210
|
-
'key-spacing' : ['error', { 'afterColon': true }],
|
|
211
|
-
'indent' : ['error', 4],
|
|
212
|
-
quotes : ['error', 'single'],
|
|
213
|
-
'arrow-body-style': ['error', 'as-needed'],
|
|
214
|
-
'prefer-const' : 'error'
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
// Fully disable eslint-plugin-vue (template/html linting) - script rules above still apply
|
|
219
|
-
{
|
|
220
|
-
files: ['**/*.vue'],
|
|
221
|
-
rules: Object.fromEntries(Object.keys(pluginVue.rules).map(name => [`vue/${name}`, 'off'])),
|
|
222
|
-
},
|
|
223
|
-
];
|
|
1
|
+
export { default } from '@lilaquadrat/frontend/eslint';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const OUTPUT_DIR = 'dist/preview';
|
|
2
2
|
const PREVIEW_ASSET_DIR = 'previewAssets';
|
|
3
3
|
|
|
4
|
-
function escapeRegExp
|
|
4
|
+
function escapeRegExp(input) {
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
return input.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
7
7
|
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -14,28 +14,28 @@ function escapeRegExp (input) {
|
|
|
14
14
|
* while transforming - so even though rolldown tree shakes preview.view.vue out
|
|
15
15
|
* of the app bundle, the images survive as orphans nobody references.
|
|
16
16
|
*/
|
|
17
|
-
export function dropPreviewAssets
|
|
17
|
+
export function dropPreviewAssets() {
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
return {
|
|
20
|
+
name: 'drop-preview-assets',
|
|
21
|
+
enforce: 'post',
|
|
22
|
+
apply: 'build',
|
|
23
|
+
generateBundle(_options, bundle) {
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Object.keys(bundle).forEach((fileName) => {
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
const single = bundle[fileName];
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
if(single.type !== 'asset') return;
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
const origins = [single.originalFileName, ...single.originalFileNames ?? []].filter(Boolean);
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
if(origins.some((origin) => origin.includes(PREVIEW_ASSET_DIR))) delete bundle[fileName];
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
});
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
39
|
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -45,27 +45,27 @@ export function dropPreviewAssets () {
|
|
|
45
45
|
* everything here exists because the output is opened straight from disk, where
|
|
46
46
|
* each file is its own opaque origin.
|
|
47
47
|
*/
|
|
48
|
-
export function previewBuildOptions
|
|
48
|
+
export function previewBuildOptions(base) {
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
return {
|
|
51
|
+
...base,
|
|
52
|
+
/**
|
|
53
53
|
* inline fonts and images as data URIs: browsers block the font fetches a
|
|
54
54
|
* separate .woff would need
|
|
55
55
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
assetsInlineLimit: 512 * 1024,
|
|
57
|
+
rolldownOptions: {
|
|
58
|
+
...base?.rolldownOptions,
|
|
59
|
+
output: {
|
|
60
|
+
...base?.rolldownOptions?.output,
|
|
61
|
+
// a single classic script: file:// blocks `type="module"` as cross origin
|
|
62
|
+
dir: OUTPUT_DIR,
|
|
63
|
+
format: 'iife',
|
|
64
|
+
codeSplitting: false,
|
|
65
|
+
entryFileNames: '[name].js',
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
69
|
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -73,60 +73,60 @@ export function previewBuildOptions (base) {
|
|
|
73
73
|
* folds the script and the stylesheet into index.html, so the preview is a self
|
|
74
74
|
* contained file that opens over file:// with no server.
|
|
75
75
|
*/
|
|
76
|
-
export default function previewBundle
|
|
76
|
+
export default function previewBundle() {
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
return {
|
|
79
|
+
name: 'preview-bundle',
|
|
80
|
+
enforce: 'post',
|
|
81
|
+
apply: 'build',
|
|
82
|
+
generateBundle(_options, bundle) {
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
const html = bundle['index.html'];
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
if(!html) return;
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
let source = html.source.toString();
|
|
89
|
+
let script = '';
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
Object.keys(bundle).forEach((fileName) => {
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
const single = bundle[fileName];
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
if(fileName === 'index.html') return;
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
if(single.type === 'chunk') {
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
// a literal </script> inside the code would end the tag early
|
|
100
|
+
script += single.code.replace(/<\/script>/gi, '<\\/script>');
|
|
101
|
+
source = source.replace(new RegExp(`<script[^>]*src="[^"]*${escapeRegExp(fileName)}"[^>]*></script>\\s*`), '');
|
|
102
|
+
delete bundle[fileName];
|
|
103
|
+
return;
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
}
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
if(fileName.endsWith('.css')) {
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
// replacer functions only: a replacement string would expand $& and
|
|
110
|
+
// $\` in the asset as substitution patterns
|
|
111
|
+
source = source.replace(new RegExp(`<link[^>]*href="[^"]*${escapeRegExp(fileName)}"[^>]*>`), () => `<style>${single.source}</style>`);
|
|
112
|
+
delete bundle[fileName];
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
}
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
});
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
source = source.replace(/<link[^>]*rel="modulepreload"[^>]*>\s*/g, '');
|
|
119
|
+
// the manifest is the one head asset a file:// origin cannot fetch
|
|
120
|
+
source = source.replace(/<link[^>]*rel="manifest"[^>]*>\s*/g, '');
|
|
121
|
+
Object.keys(bundle).filter((fileName) => fileName.endsWith('.webmanifest')).forEach((fileName) => delete bundle[fileName]);
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
/**
|
|
124
124
|
* at the end of the body, not in place: an inline script has no `defer`,
|
|
125
125
|
* so in the head it would run before #app exists
|
|
126
126
|
*/
|
|
127
|
-
|
|
127
|
+
html.source = source.replace('</body>', () => `<script>${script}</script>\n</body>`);
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
131
|
|
|
132
132
|
}
|