@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
@@ -12,68 +12,82 @@ type CypressConfig = Parameters<typeof defineConfig>[0];
12
12
  * pass overrides for anything project specific (baseUrl, viewport, extra
13
13
  * setupNodeEvents).
14
14
  */
15
- export function createCypressConfig (overrides: CypressConfig = {}) {
15
+ export function createCypressConfig(overrides: CypressConfig = {}) {
16
16
 
17
- const { e2e: e2eOverrides, ...rest } = overrides;
17
+ const { e2e: e2eOverrides, ...rest } = overrides;
18
18
 
19
- return defineConfig({
20
- e2e: {
21
- baseUrl : 'http://localhost:5173/test',
22
- /**
19
+ return defineConfig({
20
+ e2e: {
21
+ baseUrl: 'http://localhost:5173/test',
22
+ /**
23
23
  * the shared commands live in the package, so a project does not need a
24
24
  * cypress/support folder of its own
25
25
  */
26
- supportFile : fileURLToPath(new URL('./support/e2e.ts', import.meta.url)),
27
- viewportHeight: 1920,
28
- viewportWidth : 1080,
29
- video : false,
30
- testIsolation : false,
31
- ...e2eOverrides,
32
- /**
26
+ supportFile: fileURLToPath(new URL('./support/e2e.ts', import.meta.url)),
27
+ viewportHeight: 1920,
28
+ viewportWidth: 1080,
29
+ video: false,
30
+ testIsolation: false,
31
+ ...e2eOverrides,
32
+ /**
33
33
  * always the framework handler: it chains into an override at the end, so
34
34
  * a project can add its own tasks without losing the manifest wiring
35
35
  */
36
- setupNodeEvents (on, config) {
37
- const root = process.cwd();
38
- const files = rebuildManifest(root);
39
-
40
- console.log(`[manifest] seeded with ${files.length} existing screenshots`);
41
-
42
- on('after:screenshot', (details) => {
43
- files.push(screenshotToManifestPath(root, details.path));
44
- writeManifest(root, files);
45
- });
46
-
47
- on('before:browser:launch', (browser, launchOptions) => {
48
- if (browser.name === 'electron') {
49
- launchOptions.preferences.width = 1920
50
- launchOptions.preferences.height = 3000
51
- }
52
-
53
- if (browser.family === 'chromium' && browser.name !== 'electron') {
54
- launchOptions.args.push('--window-size=1920,1080');
55
- }
56
-
57
- if (browser.name === 'firefox') {
58
- launchOptions.args.push('--width=1920')
59
- launchOptions.args.push('--height=3000')
60
-
61
- launchOptions.preferences['layout.css.devPixelsPerPx'] = '1.0'
62
- }
63
-
64
- if (browser.name === 'chrome' && browser.isHeadless) {
65
- launchOptions.args.push('--window-size=1920,3000');
66
- launchOptions.args.push('--force-device-scale-factor=1');
67
- }
68
-
69
- return launchOptions
70
- })
71
-
72
- return e2eOverrides?.setupNodeEvents?.(on, config);
73
- },
74
- },
75
- ...rest,
76
- })
36
+ setupNodeEvents(on, config) {
37
+
38
+ const root = process.cwd();
39
+ const files = rebuildManifest(root);
40
+
41
+ console.log(`[manifest] seeded with ${files.length} existing screenshots`);
42
+
43
+ on('after:screenshot', (details) => {
44
+
45
+ files.push(screenshotToManifestPath(root, details.path));
46
+ writeManifest(root, files);
47
+
48
+ });
49
+
50
+ on('before:browser:launch', (browser, launchOptions) => {
51
+
52
+ if (browser.name === 'electron') {
53
+
54
+ launchOptions.preferences.width = 1920
55
+ launchOptions.preferences.height = 3000
56
+
57
+ }
58
+
59
+ if (browser.family === 'chromium' && browser.name !== 'electron') {
60
+
61
+ launchOptions.args.push('--window-size=1920,1080');
62
+
63
+ }
64
+
65
+ if (browser.name === 'firefox') {
66
+
67
+ launchOptions.args.push('--width=1920')
68
+ launchOptions.args.push('--height=3000')
69
+
70
+ launchOptions.preferences['layout.css.devPixelsPerPx'] = '1.0'
71
+
72
+ }
73
+
74
+ if (browser.name === 'chrome' && browser.isHeadless) {
75
+
76
+ launchOptions.args.push('--window-size=1920,3000');
77
+ launchOptions.args.push('--force-device-scale-factor=1');
78
+
79
+ }
80
+
81
+ return launchOptions
82
+
83
+ })
84
+
85
+ return e2eOverrides?.setupNodeEvents?.(on, config);
86
+
87
+ },
88
+ },
89
+ ...rest,
90
+ })
77
91
 
78
92
  }
79
93
 
@@ -1,40 +1,52 @@
1
1
  import { writeFileSync, readdirSync, statSync, existsSync } from 'fs';
2
2
  import { resolve, join, relative } from 'path';
3
3
 
4
- export function walkImages (dir, base = dir) {
5
- return readdirSync(dir).flatMap((entry) => {
6
- const full = join(dir, entry);
7
-
8
- if (statSync(full).isDirectory()) return walkImages(full, base);
9
- if (/\.(png|jpe?g)$/i.test(entry)) return [full.slice(base.length + 1).replace(/\\/g, '/')];
10
- return [];
11
- });
4
+ export function walkImages(dir, base = dir) {
5
+
6
+ return readdirSync(dir).flatMap((entry) => {
7
+
8
+ const full = join(dir, entry);
9
+
10
+ if (statSync(full).isDirectory()) return walkImages(full, base);
11
+ if (/\.(png|jpe?g)$/i.test(entry)) return [full.slice(base.length + 1).replace(/\\/g, '/')];
12
+ return [];
13
+
14
+ });
15
+
12
16
  }
13
17
 
14
- export function writeManifest (root, files) {
15
- const content = `window.__SCREENSHOTS__ = ${JSON.stringify(files.slice().sort(), null, 2)};\n`;
18
+ export function writeManifest(root, files) {
19
+
20
+ const content = `window.__SCREENSHOTS__ = ${JSON.stringify(files.slice().sort(), null, 2)};\n`;
21
+
22
+ writeFileSync(resolve(root, 'cypress/manifest.js'), content, 'utf-8');
16
23
 
17
- writeFileSync(resolve(root, 'cypress/manifest.js'), content, 'utf-8');
18
24
  }
19
25
 
20
- export function scanScreenshots (root) {
21
- const screenshotsDir = resolve(root, 'cypress/screenshots');
26
+ export function scanScreenshots(root) {
22
27
 
23
- if (!existsSync(screenshotsDir)) return [];
28
+ const screenshotsDir = resolve(root, 'cypress/screenshots');
29
+
30
+ if (!existsSync(screenshotsDir)) return [];
31
+
32
+ return walkImages(screenshotsDir).map((f) => `screenshots/${f}`);
24
33
 
25
- return walkImages(screenshotsDir).map((f) => `screenshots/${f}`);
26
34
  }
27
35
 
28
- export function rebuildManifest (root = process.cwd()) {
29
- const files = scanScreenshots(root);
36
+ export function rebuildManifest(root = process.cwd()) {
37
+
38
+ const files = scanScreenshots(root);
30
39
 
31
- writeManifest(root, files);
40
+ writeManifest(root, files);
41
+
42
+ return files;
32
43
 
33
- return files;
34
44
  }
35
45
 
36
- export function screenshotToManifestPath (root, absolutePath) {
37
- const screenshotsDir = resolve(root, 'cypress/screenshots');
46
+ export function screenshotToManifestPath(root, absolutePath) {
47
+
48
+ const screenshotsDir = resolve(root, 'cypress/screenshots');
49
+
50
+ return `screenshots/${relative(screenshotsDir, absolutePath).replace(/\\/g, '/')}`;
38
51
 
39
- return `screenshots/${relative(screenshotsDir, absolutePath).replace(/\\/g, '/')}`;
40
52
  }
@@ -9,33 +9,33 @@ import { resolve } from 'path';
9
9
  // gallery) run 3-6x longer than the rest and would otherwise dominate one shard.
10
10
  // Unlisted specs (new ones added later) fall back to the average below.
11
11
  const KNOWN_DURATIONS = {
12
- 'blog-intro.cy.ts' : 41,
13
- 'event.cy.ts' : 25,
14
- 'gallery.cy.ts' : 194,
15
- 'navigation.cy.ts' : 64,
16
- 'prices.cy.ts' : 19,
17
- 'contact.cy.ts' : 94,
18
- 'facts.cy.ts' : 103,
19
- 'location.cy.ts' : 3,
20
- 'pictureandtext.cy.ts': 152,
21
- 'text.cy.ts' : 29,
22
- 'compare.cy.ts' : 39,
23
- 'eventlist.cy.ts' : 44,
24
- 'index.cy.ts' : 79,
25
- 'picture.cy.ts' : 376,
26
- 'quote.cy.ts' : 40,
27
- 'FAQ.cy.ts' : 95,
28
- 'emotion.cy.ts' : 197,
29
- 'footer.cy.ts' : 26,
30
- 'menu.cy.ts' : 31,
31
- 'picturegroup.cy.ts' : 300,
32
- 'timeline.cy.ts' : 256,
12
+ 'blog-intro.cy.ts': 41,
13
+ 'event.cy.ts': 25,
14
+ 'gallery.cy.ts': 194,
15
+ 'navigation.cy.ts': 64,
16
+ 'prices.cy.ts': 19,
17
+ 'contact.cy.ts': 94,
18
+ 'facts.cy.ts': 103,
19
+ 'location.cy.ts': 3,
20
+ 'pictureandtext.cy.ts': 152,
21
+ 'text.cy.ts': 29,
22
+ 'compare.cy.ts': 39,
23
+ 'eventlist.cy.ts': 44,
24
+ 'index.cy.ts': 79,
25
+ 'picture.cy.ts': 376,
26
+ 'quote.cy.ts': 40,
27
+ 'FAQ.cy.ts': 95,
28
+ 'emotion.cy.ts': 197,
29
+ 'footer.cy.ts': 26,
30
+ 'menu.cy.ts': 31,
31
+ 'picturegroup.cy.ts': 300,
32
+ 'timeline.cy.ts': 256,
33
33
  };
34
34
  const root = process.cwd();
35
35
  const durationsFile = resolve(root, 'cypress/durations.json');
36
36
  const DURATIONS = existsSync(durationsFile)
37
- ? { ...KNOWN_DURATIONS, ...JSON.parse(readFileSync(durationsFile, 'utf-8')) }
38
- : KNOWN_DURATIONS;
37
+ ? { ...KNOWN_DURATIONS, ...JSON.parse(readFileSync(durationsFile, 'utf-8')) }
38
+ : KNOWN_DURATIONS;
39
39
  const AVG_DURATION = Object.values(DURATIONS).reduce((a, b) => a + b, 0) / Object.keys(DURATIONS).length;
40
40
  const cypressBin = resolve(root, 'node_modules/.bin/cypress');
41
41
  const specsDir = resolve(root, 'cypress/e2e');
@@ -46,14 +46,16 @@ const shards = Array.from({ length: shardCount }, () => ({ specs: [], total: 0 }
46
46
  // Longest-processing-time-first: sort heaviest specs first, always drop the next
47
47
  // spec into whichever shard currently has the least total weight.
48
48
  specNames
49
- .map((name) => ({ name, duration: DURATIONS[name] ?? AVG_DURATION }))
50
- .sort((a, b) => b.duration - a.duration)
51
- .forEach(({ name, duration }) => {
52
- const lightest = shards.reduce((min, s) => (s.total < min.total ? s : min), shards[0]);
49
+ .map((name) => ({ name, duration: DURATIONS[name] ?? AVG_DURATION }))
50
+ .sort((a, b) => b.duration - a.duration)
51
+ .forEach(({ name, duration }) => {
53
52
 
54
- lightest.specs.push(`cypress/e2e/${name}`);
55
- lightest.total += duration;
56
- });
53
+ const lightest = shards.reduce((min, s) => (s.total < min.total ? s : min), shards[0]);
54
+
55
+ lightest.specs.push(`cypress/e2e/${name}`);
56
+ lightest.total += duration;
57
+
58
+ });
57
59
 
58
60
  console.log(`[parallel] running ${specNames.length} specs across ${shardCount} shards (est. longest shard ~${Math.round(Math.max(...shards.map((s) => s.total)) / 60)}m)`);
59
61
 
@@ -62,12 +64,16 @@ console.log(`[parallel] running ${specNames.length} specs across ${shardCount} s
62
64
  // every shard has finished — the "cy:parallel" script always follows this up with
63
65
  // a single authoritative `generate-manifest.js` rebuild over the full directory.
64
66
  const runs = shards.map(({ specs }, i) => new Promise((resolveRun, rejectRun) => {
65
- const child = spawn(cypressBin, ['run', '--spec', specs.join(',')], { stdio: 'inherit' });
66
67
 
67
- child.on('exit', (code) => {
68
- if (code === 0) resolveRun();
69
- else rejectRun(new Error(`shard ${i} failed (exit code ${code})`));
70
- });
68
+ const child = spawn(cypressBin, ['run', '--spec', specs.join(',')], { stdio: 'inherit' });
69
+
70
+ child.on('exit', (code) => {
71
+
72
+ if (code === 0) resolveRun();
73
+ else rejectRun(new Error(`shard ${i} failed (exit code ${code})`));
74
+
75
+ });
76
+
71
77
  }));
72
78
  const results = await Promise.allSettled(runs);
73
79
  const failed = results.filter((r) => r.status === 'rejected');