@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.
Files changed (78) hide show
  1. package/README.md +71 -3
  2. package/html/index.server.html +1 -8
  3. package/package.json +53 -53
  4. package/src/client-entry.ts +8 -8
  5. package/src/components/partials/error.partial.vue +19 -19
  6. package/src/components/partials/main-components.partial.vue +75 -70
  7. package/src/components/partials/qrcode.partial.vue +8 -8
  8. package/src/functions/AuthProviderFactory.ts +30 -0
  9. package/src/functions/PaymenyProviderFactory.ts +11 -11
  10. package/src/functions/auth0.provider.ts +75 -0
  11. package/src/functions/keycloak.provider.ts +228 -0
  12. package/src/functions/lila-dom.ts +50 -50
  13. package/src/functions/shopify.provider.ts +176 -154
  14. package/src/functions/stripe.provider.ts +120 -108
  15. package/src/globals.d.ts +1 -2
  16. package/src/index.ts +9 -7
  17. package/src/interfaces/AuthCallbackResult.interface.ts +5 -0
  18. package/src/interfaces/AuthConfig.interface.ts +13 -0
  19. package/src/interfaces/AuthProvider.interface.ts +15 -0
  20. package/src/interfaces/FrontendConfig.interface.ts +11 -40
  21. package/src/interfaces/GenericEvents.interface.ts +1 -1
  22. package/src/interfaces/IdTokenExtended.interface.ts +13 -4
  23. package/src/interfaces/PaymentProvider.interface.ts +2 -2
  24. package/src/interfaces/RenderOptions.interface.ts +12 -0
  25. package/src/libs/ActionNotice.ts +125 -125
  26. package/src/libs/Models.class.ts +219 -221
  27. package/src/main.ts +41 -36
  28. package/src/mixins/createCookieString.ts +50 -36
  29. package/src/mixins/createModelDeclaration.ts +22 -19
  30. package/src/mixins/createRouter.ts +12 -12
  31. package/src/mixins/date.ts +4 -2
  32. package/src/mixins/formatSize.ts +5 -5
  33. package/src/mixins/getAnchor.ts +1 -1
  34. package/src/mixins/getRoutes.ts +13 -25
  35. package/src/mixins/hasSlotContent.ts +22 -16
  36. package/src/mixins/hooks.ts +101 -60
  37. package/src/mixins/loadComponents.ts +60 -58
  38. package/src/mixins/logger.ts +17 -13
  39. package/src/mixins/replaceVariables.ts +10 -8
  40. package/src/mixins/scroll.ts +61 -45
  41. package/src/models/Address.model.ts +7 -7
  42. package/src/models/Contact.model.ts +14 -14
  43. package/src/plugins/analytics.ts +198 -0
  44. package/src/plugins/auth.ts +74 -60
  45. package/src/plugins/currency.ts +10 -10
  46. package/src/plugins/events.ts +101 -97
  47. package/src/plugins/filters.ts +21 -18
  48. package/src/plugins/replacer.ts +7 -6
  49. package/src/plugins/signupFlow.ts +45 -43
  50. package/src/plugins/traceable.ts +28 -26
  51. package/src/plugins/translations.ts +9 -9
  52. package/src/plugins/youtube.ts +39 -34
  53. package/src/routes.ts +108 -108
  54. package/src/server-entry.ts +75 -77
  55. package/src/stores/calls.store.ts +14 -14
  56. package/src/stores/cart.store.ts +116 -107
  57. package/src/stores/content.store.ts +87 -45
  58. package/src/stores/editor.store.ts +16 -16
  59. package/src/stores/files.store.ts +72 -72
  60. package/src/stores/main.store.ts +155 -109
  61. package/src/stores/user.store.ts +72 -68
  62. package/src/translations/de.ts +127 -127
  63. package/src/views/content.view.vue +81 -143
  64. package/src/views/download.view.vue +25 -23
  65. package/src/views/editor.view.vue +150 -125
  66. package/src/views/login.view.vue +35 -36
  67. package/src/views/signup-account.view.vue +14 -14
  68. package/tooling/cypress/config.ts +68 -54
  69. package/tooling/cypress/manifest-utils.mjs +34 -22
  70. package/tooling/cypress/run-parallel.mjs +41 -35
  71. package/tooling/cypress/support/commands.ts +458 -300
  72. package/tooling/eslint.config.js +1 -223
  73. package/tooling/preview.plugin.js +68 -68
  74. package/tooling/ssr-test/index.mjs +205 -203
  75. package/tooling/vite.d.ts +0 -6
  76. package/tooling/vite.js +170 -162
  77. package/src/interfaces/EditorConfiguration.interface.ts +0 -15
  78. 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 (mode) {
12
+ function resolveTarget(mode) {
13
13
 
14
- if(mode === 'production') return 'live';
15
- if(mode === 'next') return 'next';
14
+ if(mode === 'production') return 'live';
15
+ if(mode === 'next') return 'next';
16
16
 
17
- return 'local';
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 (root, name) {
26
+ function resolveTemplate(root, name) {
27
27
 
28
- const projectTemplate = resolve(root, name);
28
+ const projectTemplate = resolve(root, name);
29
29
 
30
- if(existsSync(projectTemplate)) return projectTemplate;
30
+ if(existsSync(projectTemplate)) return projectTemplate;
31
31
 
32
- return fileURLToPath(new URL(`../html/${name}`, import.meta.url));
32
+ return fileURLToPath(new URL(`../html/${name}`, import.meta.url));
33
33
 
34
34
  }
35
35
 
36
- export function createViteConfig (options) {
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
- 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';
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
- return defineConfig((settings) => {
47
+ return defineConfig((settings) => {
48
48
 
49
- const target = resolveTarget(settings.mode);
50
- const isProduction = target === 'live';
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
- const isPreview = settings.mode === 'preview';
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
- const isSsrTest = settings.mode === 'ssr-test';
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
- 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',
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
- assetFileNames: (assetInfo) => {
107
- if (assetInfo.name?.endsWith('woff') || assetInfo.name?.endsWith('png')) {
108
- return '[name][extname]';
109
- }
110
-
111
- return '[name]-[hash][extname]';
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
- chunkFileNames: '[name]-[hash].js',
114
- entryFileNames: '[name]-[hash].js',
115
- }
116
- }
117
- },
118
- css: {
119
- devSourcemap : true,
120
- preprocessorOptions: {
121
- less: {
122
- sourceMap : true,
123
- globalVars: {
124
- globalVariables: `true; @import (reference) "${lessDir}/variables.less";`,
125
- globalMixins : `true; @import (reference) "${lessDir}/mixins.less";`,
126
- globalFonts : `true; @import (reference) "${lessDir}/fonts.less";`,
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
- resolve: {
132
- alias: {
133
- '~fonts': resolve(options.root, 'src/assets/fonts'),
134
- '@' : resolve(options.root, 'src'),
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
- dedupe: [
143
- 'vue',
144
- 'vue-router',
145
- 'vue-i18n',
146
- 'pinia',
147
- // holds a static request cache, so a second copy would cache twice
148
- '@lilaquadrat/sdk',
149
- // resize and inview are singletons: a second copy means a second
150
- // scroll listener and a second set of refs nobody reads
151
- '@lilaquadrat/frontend',
152
- '@auth0/auth0-spa-js',
153
- 'axios',
154
- 'dayjs',
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
- define: {
165
- '__FRONTEND_CONFIG__' : JSON.stringify(config),
166
- '__TARGET__' : JSON.stringify(target),
167
- '__PREVIEW__' : JSON.stringify(isPreview),
168
- __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: isOptimized ? 'false' : 'true',
169
- __VUE_PROD_DEVTOOLS__ : isOptimized ? 'false' : 'true',
170
- ...options.define
171
- }
172
- };
173
-
174
- if (isPreview) {
175
-
176
- viteConfig.build = previewBuildOptions(viteConfig.build);
177
-
178
- }
179
-
180
- if (settings.isSsrBuild) {
181
-
182
- viteConfig.build = {
183
- ...viteConfig.build,
184
- rolldownOptions: {
185
- input : isSsrTest ? ssrFixturesEntry : ssrEntry,
186
- plugins: isSsrTest ? [] : [
187
- {
188
- name: 'emit-html-templates',
189
- async generateBundle () {
190
- const { readFile } = await import('node:fs/promises');
191
- const [mailHtml, serverHtml] = await Promise.all([
192
- readFile(resolveTemplate(options.root, 'index.mail.html'), 'utf-8'),
193
- readFile(resolveTemplate(options.root, 'index.server.html'), 'utf-8'),
194
- ]);
195
-
196
- this.emitFile({ type: 'asset', fileName: 'index.mail.html', source: mailHtml });
197
- this.emitFile({ type: 'asset', fileName: 'index.server.html', source: serverHtml });
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
- output: {
202
- ...viteConfig.build?.rolldownOptions?.output,
203
- codeSplitting : false,
204
- inlineDynamicImports: true,
205
- dir : isSsrTest ? 'dist/ssr-test' : 'dist/server',
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
- }