@lilaquadrat/design-core 0.2.1 → 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 +76 -3
- package/html/index.server.html +1 -8
- package/package.json +54 -54
- 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 +132 -0
- package/tooling/ssr-test/index.mjs +205 -203
- package/tooling/vite.d.ts +36 -0
- package/tooling/vite.js +234 -0
- package/src/interfaces/EditorConfiguration.interface.ts +0 -15
- package/tooling/preview.plugin.ts +0 -134
- package/tooling/stylelint.config.mjs +0 -24
- package/tooling/vite.ts +0 -260
|
@@ -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
|
|
15
|
+
export function createCypressConfig(overrides: CypressConfig = {}) {
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const { e2e: e2eOverrides, ...rest } = overrides;
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
15
|
-
|
|
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
|
|
21
|
-
const screenshotsDir = resolve(root, 'cypress/screenshots');
|
|
26
|
+
export function scanScreenshots(root) {
|
|
22
27
|
|
|
23
|
-
|
|
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
|
|
29
|
-
|
|
36
|
+
export function rebuildManifest(root = process.cwd()) {
|
|
37
|
+
|
|
38
|
+
const files = scanScreenshots(root);
|
|
30
39
|
|
|
31
|
-
|
|
40
|
+
writeManifest(root, files);
|
|
41
|
+
|
|
42
|
+
return files;
|
|
32
43
|
|
|
33
|
-
return files;
|
|
34
44
|
}
|
|
35
45
|
|
|
36
|
-
export function screenshotToManifestPath
|
|
37
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
38
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
55
|
-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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');
|