@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/vite.js
CHANGED
|
@@ -9,12 +9,12 @@ import { visualizer } from 'rollup-plugin-visualizer';
|
|
|
9
9
|
|
|
10
10
|
import previewBundle, { dropPreviewAssets, previewBuildOptions } from './preview.plugin.js';
|
|
11
11
|
|
|
12
|
-
function resolveTarget
|
|
12
|
+
function resolveTarget(mode) {
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
if(mode === 'production') return 'live';
|
|
15
|
+
if(mode === 'next') return 'next';
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
return 'local';
|
|
18
18
|
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -23,202 +23,210 @@ function resolveTarget (mode) {
|
|
|
23
23
|
* override either by keeping a file of the same name in its root, otherwise the
|
|
24
24
|
* package template is used.
|
|
25
25
|
*/
|
|
26
|
-
function resolveTemplate
|
|
26
|
+
function resolveTemplate(root, name) {
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
const projectTemplate = resolve(root, name);
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
if(existsSync(projectTemplate)) return projectTemplate;
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
return fileURLToPath(new URL(`../html/${name}`, import.meta.url));
|
|
33
33
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export function createViteConfig
|
|
36
|
+
export function createViteConfig(options) {
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
39
|
* absolute on purpose: the globalVars below are prepended to every less file,
|
|
40
40
|
* including the ones inside the package, where a project relative path would
|
|
41
41
|
* resolve against node_modules
|
|
42
42
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const lessDir = resolve(options.root, options.lessDir ?? './src/assets/less');
|
|
44
|
+
const ssrEntry = options.ssrEntry ?? '/src/server-entry.ts';
|
|
45
|
+
const ssrFixturesEntry = options.ssrFixturesEntry ?? '/src/ssr-test.fixtures.ts';
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
return defineConfig((settings) => {
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
const target = resolveTarget(settings.mode);
|
|
50
|
+
const isProduction = target === 'live';
|
|
51
|
+
/**
|
|
52
52
|
* shareable static module gallery: preview routes, hash history, no auth and
|
|
53
53
|
* inlined assets, so the output runs from file:// without a server
|
|
54
54
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
const isPreview = settings.mode === 'preview';
|
|
56
|
+
/**
|
|
57
57
|
* a second ssr bundle holding nothing but the design's fixtures, so the ssr
|
|
58
58
|
* preflight can read viewData and the registries while still rendering
|
|
59
59
|
* through the real dist/server build
|
|
60
60
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
const isSsrTest = settings.mode === 'ssr-test';
|
|
62
|
+
/**
|
|
63
63
|
* builds meant to be handed out rather than debugged: minified, no
|
|
64
64
|
* sourcemaps, no vue dev instrumentation
|
|
65
65
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
optimizeDeps: {
|
|
79
|
-
// design-core ships source, and its less needs the project variables
|
|
80
|
-
// injected below - a prebundle would not see them.
|
|
81
|
-
//
|
|
82
|
-
// @lilaquadrat/frontend rides along because design-core imports it:
|
|
83
|
-
// prebundling it there and serving it raw here would give the resize and
|
|
84
|
-
// inview singletons two module identities, and a second scroll listener
|
|
85
|
-
// with it
|
|
86
|
-
exclude: ['@lilaquadrat/design-core', '@lilaquadrat/frontend']
|
|
87
|
-
},
|
|
88
|
-
build: {
|
|
89
|
-
cssCodeSplit : false,
|
|
90
|
-
cssMinify : isOptimized,
|
|
91
|
-
sourcemap : !isOptimized,
|
|
92
|
-
minify : isOptimized,
|
|
93
|
-
rolldownOptions: {
|
|
94
|
-
output: {
|
|
95
|
-
dir : 'dist/app',
|
|
96
|
-
// rolldown manual chunking: split deps into a vendor chunk, but
|
|
97
|
-
// never emit a chunk smaller than minSize - small groups fall back
|
|
98
|
-
// into the entry instead of producing hundreds of tiny files.
|
|
99
|
-
codeSplitting: {
|
|
100
|
-
minSize: 30_000,
|
|
101
|
-
groups : [
|
|
102
|
-
{ name: 'qrcode', test: /[\\/]node_modules[\\/]qrcode[\\/]/, minSize: 0 },
|
|
103
|
-
{ name: 'vendor', test: /[\\/]node_modules[\\/]/ },
|
|
104
|
-
],
|
|
66
|
+
const isOptimized = isProduction || isPreview;
|
|
67
|
+
// const config = options.config[target];
|
|
68
|
+
const viteConfig = {
|
|
69
|
+
plugins: [
|
|
70
|
+
vue(),
|
|
71
|
+
visualizer(),
|
|
72
|
+
...isPreview ? [previewBundle()] : [dropPreviewAssets()]
|
|
73
|
+
],
|
|
74
|
+
base: './',
|
|
75
|
+
server: {
|
|
76
|
+
host: '0.0.0.0',
|
|
105
77
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
78
|
+
optimizeDeps: {
|
|
79
|
+
// design-core ships source, and its less needs the project variables
|
|
80
|
+
// injected below - a prebundle would not see them.
|
|
81
|
+
//
|
|
82
|
+
// @lilaquadrat/frontend rides along because design-core imports it:
|
|
83
|
+
// prebundling it there and serving it raw here would give the resize and
|
|
84
|
+
// inview singletons two module identities, and a second scroll listener
|
|
85
|
+
// with it
|
|
86
|
+
exclude: ['@lilaquadrat/design-core', '@lilaquadrat/frontend']
|
|
112
87
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
88
|
+
build: {
|
|
89
|
+
cssCodeSplit: false,
|
|
90
|
+
cssMinify: isOptimized,
|
|
91
|
+
sourcemap: !isOptimized,
|
|
92
|
+
minify: isOptimized,
|
|
93
|
+
rolldownOptions: {
|
|
94
|
+
output: {
|
|
95
|
+
dir: 'dist/app',
|
|
96
|
+
// rolldown chunking: only auth0 and qrcode get their own files,
|
|
97
|
+
// every other dependency stays in the entry. minSize 0 forces a
|
|
98
|
+
// group to be captured regardless of size; the global minSize keeps
|
|
99
|
+
// automatic grouping from emitting hundreds of tiny chunks.
|
|
100
|
+
codeSplitting: {
|
|
101
|
+
minSize: 30_000,
|
|
102
|
+
groups: [
|
|
103
|
+
{ name: 'auth0', test: /[\\/]node_modules[\\/]@auth0[\\/]/, minSize: 0 },
|
|
104
|
+
{ name: 'qrcode', test: /[\\/]node_modules[\\/]qrcode[\\/]/, minSize: 0 },
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
assetFileNames: (assetInfo) => {
|
|
108
|
+
|
|
109
|
+
if (assetInfo.name?.endsWith('woff') || assetInfo.name?.endsWith('png')) {
|
|
110
|
+
|
|
111
|
+
return '[name][extname]';
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return '[name]-[hash][extname]';
|
|
116
|
+
|
|
117
|
+
},
|
|
118
|
+
chunkFileNames: '[name]-[hash].js',
|
|
119
|
+
entryFileNames: '[name]-[hash].js',
|
|
120
|
+
}
|
|
121
|
+
}
|
|
127
122
|
},
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
123
|
+
css: {
|
|
124
|
+
devSourcemap: true,
|
|
125
|
+
preprocessorOptions: {
|
|
126
|
+
less: {
|
|
127
|
+
sourceMap: true,
|
|
128
|
+
globalVars: {
|
|
129
|
+
globalVariables: `true; @import (reference) "${lessDir}/variables.less";`,
|
|
130
|
+
globalMixins: `true; @import (reference) "${lessDir}/mixins.less";`,
|
|
131
|
+
globalFonts: `true; @import (reference) "${lessDir}/fonts.less";`,
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
resolve: {
|
|
137
|
+
alias: {
|
|
138
|
+
'~fonts': resolve(options.root, 'src/assets/fonts'),
|
|
139
|
+
'@': resolve(options.root, 'src'),
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
137
142
|
* a linked @lilaquadrat/design-core resolves these from its own
|
|
138
143
|
* node_modules, which would give the app a second vue and a second
|
|
139
144
|
* pinia - one app instance registering into a store nobody reads.
|
|
140
145
|
* dedupe pins every shared runtime to the project copy.
|
|
141
146
|
*/
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
147
|
+
dedupe: [
|
|
148
|
+
'vue',
|
|
149
|
+
'vue-router',
|
|
150
|
+
'vue-i18n',
|
|
151
|
+
'pinia',
|
|
152
|
+
// holds a static request cache, so a second copy would cache twice
|
|
153
|
+
'@lilaquadrat/sdk',
|
|
154
|
+
// resize and inview are singletons: a second copy means a second
|
|
155
|
+
// scroll listener and a second set of refs nobody reads
|
|
156
|
+
'@lilaquadrat/frontend',
|
|
157
|
+
'@auth0/auth0-spa-js',
|
|
158
|
+
'axios',
|
|
159
|
+
'dayjs',
|
|
160
|
+
],
|
|
161
|
+
/**
|
|
157
162
|
* @lilaquadrat/studio is deliberately NOT deduped: it is the backend
|
|
158
163
|
* package and a project may still hold a copy for other reasons, while
|
|
159
164
|
* a second one costs nothing here.
|
|
160
165
|
*
|
|
161
166
|
* @lilaquadrat/interfaces is types only, so it has nothing to dedupe.
|
|
162
167
|
*/
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
168
|
+
},
|
|
169
|
+
define: {
|
|
170
|
+
// '__FRONTEND_CONFIG__' : JSON.stringify(config),
|
|
171
|
+
'__TARGET__': JSON.stringify(target),
|
|
172
|
+
'__PREVIEW__': JSON.stringify(isPreview),
|
|
173
|
+
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: isOptimized ? 'false' : 'true',
|
|
174
|
+
__VUE_PROD_DEVTOOLS__: isOptimized ? 'false' : 'true',
|
|
175
|
+
...options.define
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
if (isPreview) {
|
|
180
|
+
|
|
181
|
+
viteConfig.build = previewBuildOptions(viteConfig.build);
|
|
182
|
+
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (settings.isSsrBuild) {
|
|
186
|
+
|
|
187
|
+
viteConfig.build = {
|
|
188
|
+
...viteConfig.build,
|
|
189
|
+
rolldownOptions: {
|
|
190
|
+
input: isSsrTest ? ssrFixturesEntry : ssrEntry,
|
|
191
|
+
plugins: isSsrTest
|
|
192
|
+
? []
|
|
193
|
+
: [
|
|
194
|
+
{
|
|
195
|
+
name: 'emit-html-templates',
|
|
196
|
+
async generateBundle() {
|
|
197
|
+
|
|
198
|
+
const { readFile } = await import('node:fs/promises');
|
|
199
|
+
const [mailHtml, serverHtml] = await Promise.all([
|
|
200
|
+
readFile(resolveTemplate(options.root, 'index.mail.html'), 'utf-8'),
|
|
201
|
+
readFile(resolveTemplate(options.root, 'index.server.html'), 'utf-8'),
|
|
202
|
+
]);
|
|
203
|
+
|
|
204
|
+
this.emitFile({ type: 'asset', fileName: 'index.mail.html', source: mailHtml });
|
|
205
|
+
this.emitFile({ type: 'asset', fileName: 'index.server.html', source: serverHtml });
|
|
206
|
+
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
output: {
|
|
211
|
+
...viteConfig.build?.rolldownOptions?.output,
|
|
212
|
+
codeSplitting: false,
|
|
213
|
+
dir: isSsrTest ? 'dist/ssr-test' : 'dist/server',
|
|
214
|
+
entryFileNames: '[name].js',
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
ssrManifest: !isSsrTest,
|
|
218
|
+
}
|
|
219
|
+
viteConfig.ssr = {
|
|
220
|
+
target: 'webworker',
|
|
221
|
+
noExternal: true,
|
|
222
|
+
external: ['node:stream', 'http', 'https', 'crypto', 'path', 'highlight.js'],
|
|
199
223
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
entryFileNames : '[name].js',
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
ssrManifest: !isSsrTest,
|
|
210
|
-
}
|
|
211
|
-
viteConfig.ssr = {
|
|
212
|
-
target : 'webworker',
|
|
213
|
-
noExternal: true,
|
|
214
|
-
external : ['node:stream', 'http', 'https', 'crypto', 'path', 'highlight.js'],
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
return viteConfig;
|
|
220
|
-
|
|
221
|
-
});
|
|
224
|
+
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return viteConfig;
|
|
228
|
+
|
|
229
|
+
});
|
|
222
230
|
|
|
223
231
|
}
|
|
224
232
|
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface EditorTitleDescription {
|
|
2
|
-
short?: string
|
|
3
|
-
full?: string
|
|
4
|
-
}
|
|
5
|
-
export default interface EditorConfiguration {
|
|
6
|
-
|
|
7
|
-
editorUrl?: string
|
|
8
|
-
breakpointTablet?: string
|
|
9
|
-
breakpointDesktop?: string
|
|
10
|
-
breakpointWide?: string
|
|
11
|
-
preloadImages?: boolean
|
|
12
|
-
title?: EditorTitleDescription
|
|
13
|
-
description?: EditorTitleDescription
|
|
14
|
-
|
|
15
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** @type {import('stylelint').Config} */
|
|
2
|
-
export default {
|
|
3
|
-
'extends': [
|
|
4
|
-
'stylelint-config-html',
|
|
5
|
-
'stylelint-config-recommended-vue'
|
|
6
|
-
],
|
|
7
|
-
'plugins': [
|
|
8
|
-
'stylelint-order'
|
|
9
|
-
],
|
|
10
|
-
'overrides': [
|
|
11
|
-
{
|
|
12
|
-
'files' : ['*.vue', '**/*.vue'],
|
|
13
|
-
'customSyntax': 'postcss-html'
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
'files' : ['*.less', '**/*.less'],
|
|
17
|
-
'customSyntax': 'postcss-less'
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
'rules': {
|
|
21
|
-
'media-query-no-invalid' : null,
|
|
22
|
-
'declaration-property-value-no-unknown': null
|
|
23
|
-
}
|
|
24
|
-
}
|