@lilaquadrat/design-core 0.1.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 (86) hide show
  1. package/README.md +236 -0
  2. package/html/index.html +25 -0
  3. package/html/index.mail.html +15 -0
  4. package/html/index.server.html +29 -0
  5. package/package.json +148 -0
  6. package/src/client-entry.ts +28 -0
  7. package/src/components/partials/action.partial.vue +30 -0
  8. package/src/components/partials/client-only.partial.vue +11 -0
  9. package/src/components/partials/error.partial.vue +73 -0
  10. package/src/components/partials/main-components.partial.vue +167 -0
  11. package/src/components/partials/mediadetection.partial.vue +71 -0
  12. package/src/components/partials/qrcode.partial.vue +35 -0
  13. package/src/customs.ts +12 -0
  14. package/src/env.d.ts +1 -0
  15. package/src/functions/PaymenyProviderFactory.ts +27 -0
  16. package/src/functions/lila-dom.ts +100 -0
  17. package/src/functions/shopify.provider.ts +378 -0
  18. package/src/functions/stripe.provider.ts +181 -0
  19. package/src/globals.d.ts +19 -0
  20. package/src/index.ts +47 -0
  21. package/src/interfaces/AppState.interface.ts +4 -0
  22. package/src/interfaces/EditorConfiguration.interface.ts +15 -0
  23. package/src/interfaces/EventDeclaration.interface.ts +19 -0
  24. package/src/interfaces/FrontendConfig.interface.ts +42 -0
  25. package/src/interfaces/GenericEvents.interface.ts +6 -0
  26. package/src/interfaces/GenericState.interface.ts +5 -0
  27. package/src/interfaces/IconsPartial.ts +9 -0
  28. package/src/interfaces/IdTokenExtended.interface.ts +7 -0
  29. package/src/interfaces/ModuleBaseProps.interface.ts +8 -0
  30. package/src/interfaces/PaymentProvider.interface.ts +13 -0
  31. package/src/libs/ActionNotice.ts +235 -0
  32. package/src/libs/Models.class.ts +482 -0
  33. package/src/main.ts +84 -0
  34. package/src/mixins/createCookieString.ts +78 -0
  35. package/src/mixins/createModelDeclaration.ts +29 -0
  36. package/src/mixins/createRouter.ts +30 -0
  37. package/src/mixins/date.ts +23 -0
  38. package/src/mixins/formatSize.ts +12 -0
  39. package/src/mixins/getAnchor.ts +14 -0
  40. package/src/mixins/getRoutes.ts +50 -0
  41. package/src/mixins/hasSlotContent.ts +32 -0
  42. package/src/mixins/hooks.ts +104 -0
  43. package/src/mixins/loadComponents.ts +107 -0
  44. package/src/mixins/logger.ts +32 -0
  45. package/src/mixins/replaceVariables.ts +19 -0
  46. package/src/mixins/scroll.ts +83 -0
  47. package/src/models/Address.model.ts +24 -0
  48. package/src/models/Contact.model.ts +22 -0
  49. package/src/models.ts +2 -0
  50. package/src/plugins/auth.ts +121 -0
  51. package/src/plugins/currency.ts +26 -0
  52. package/src/plugins/events.ts +156 -0
  53. package/src/plugins/filters.ts +43 -0
  54. package/src/plugins/inview.ts +351 -0
  55. package/src/plugins/replacer.ts +18 -0
  56. package/src/plugins/resize.ts +128 -0
  57. package/src/plugins/signupFlow.ts +89 -0
  58. package/src/plugins/traceable.ts +53 -0
  59. package/src/plugins/translations.ts +29 -0
  60. package/src/plugins/youtube.ts +80 -0
  61. package/src/routes.ts +132 -0
  62. package/src/server-entry.ts +113 -0
  63. package/src/stores/calls.store.ts +33 -0
  64. package/src/stores/cart.store.ts +186 -0
  65. package/src/stores/content.store.ts +83 -0
  66. package/src/stores/editor.store.ts +27 -0
  67. package/src/stores/files.store.ts +166 -0
  68. package/src/stores/main.store.ts +184 -0
  69. package/src/stores/user.store.ts +124 -0
  70. package/src/translations/de.ts +138 -0
  71. package/src/views/content.view.vue +219 -0
  72. package/src/views/download.view.vue +143 -0
  73. package/src/views/editor.view.vue +243 -0
  74. package/src/views/login.view.vue +82 -0
  75. package/src/views/signup-account.view.vue +64 -0
  76. package/tooling/cypress/config.ts +80 -0
  77. package/tooling/cypress/generate-manifest.js +5 -0
  78. package/tooling/cypress/manifest-utils.mjs +40 -0
  79. package/tooling/cypress/run-parallel.mjs +77 -0
  80. package/tooling/cypress/support/commands.ts +436 -0
  81. package/tooling/cypress/support/e2e.ts +17 -0
  82. package/tooling/eslint.config.js +223 -0
  83. package/tooling/preview.plugin.ts +134 -0
  84. package/tooling/ssr-test/index.mjs +391 -0
  85. package/tooling/stylelint.config.mjs +24 -0
  86. package/tooling/vite.ts +246 -0
package/README.md ADDED
@@ -0,0 +1,236 @@
1
+ [![lilaquadrat STUDIO](https://cdn3.lilaquadrat.de/lilaquadrat/homepage/untouched_bannerlinkedin2.png)](https://lilaquadrat.de)
2
+
3
+ # @lilaquadrat/design-core
4
+
5
+ The framework half of a STUDIO design.
6
+
7
+ A design repository used to carry two things at once: the design (modules,
8
+ partials, less, gallery fixtures) and the machinery that makes it an app
9
+ (bootstrap, router, stores, plugins, models, build tooling). Only the first half
10
+ differs between projects. This package is the second half, so a design update no
11
+ longer means porting framework changes by hand into every project.
12
+
13
+ **The design stays in the project. Everything else lives here.**
14
+
15
+ ## What is in here
16
+
17
+ | path | what |
18
+ | --- | --- |
19
+ | `main`, `client-entry`, `server-entry` | app bootstrap for browser, hydration and SSR |
20
+ | `routes`, `mixins/getRoutes`, `mixins/createRouter`, `mixins/hooks` | routing, the auth and signup gate, scroll behaviour |
21
+ | `mixins/loadComponents` | module and partial registration, editor module list |
22
+ | `stores/*` | main, user, content, editor, files, cart, calls |
23
+ | `plugins/*` | auth, currency, events, filters, inview, replacer, resize, signupFlow, traceable, translations, youtube |
24
+ | `libs/*` | `Models.class`, `ActionNotice` |
25
+ | `functions/*` | payment provider factory, shopify and stripe providers, dom helpers |
26
+ | `models/*` | Address and Contact declarations |
27
+ | `mixins/*` | date, formatSize, getAnchor, hasSlotContent, replaceVariables, createCookieString, logger |
28
+ | `views/*` | content, editor, login, signup-account, download |
29
+ | `partials/*` | client-only, main-components, error, qrcode, action, mediadetection |
30
+ | `translations/de` | framework wording only - validation, lists, files, signup, order |
31
+ | `vite`, `eslint`, `stylelint`, `cypress` | build and test tooling |
32
+
33
+ ## What is NOT in here, on purpose
34
+
35
+ Modules, partials, `assets/less` (variables, mixins, fonts, theme), the gallery
36
+ (`preview.view.vue`, `viewData/*`, `preview-controls`, `preview-colors`,
37
+ `previewTheme`, `paletteDerive`), the contrast audit, the module registries
38
+ (`modules.browser.ts`, `partials.browser.ts` and the mail pair), `config.ts`,
39
+ `staticData.ts` and every module-shape interface.
40
+
41
+ Those are the design. They change per project, and a package version has no
42
+ business deciding what they look like.
43
+
44
+ ## Source, not a build
45
+
46
+ The package exports `.ts` and `.vue` **source**. Two of the views carry scoped
47
+ less that uses the project's own variables and mixins, injected by vite's
48
+ `globalVars`. A prebuilt stylesheet would bake this repo's palette into every
49
+ project, so the consumer compiles the source instead:
50
+
51
+ ```ts
52
+ optimizeDeps: { exclude: ['@lilaquadrat/studio', '@lilaquadrat/design-core'] }
53
+ ```
54
+
55
+ `createViteConfig` already sets that.
56
+
57
+ ## Using it in a design
58
+
59
+ ### vite
60
+
61
+ ```ts
62
+ // vite.config.ts
63
+ import { fileURLToPath, URL } from 'node:url';
64
+ import { defineConfig } from 'vite';
65
+ import { createViteConfig } from '@lilaquadrat/design-core/vite';
66
+ import config from './config.ts';
67
+
68
+ export default defineConfig(createViteConfig({
69
+ config,
70
+ root : fileURLToPath(new URL('.', import.meta.url)),
71
+ lessDir: './src/assets/less',
72
+ }));
73
+ ```
74
+
75
+ ### entry
76
+
77
+ The project owns `App.vue` (global styles, editor wiring) and the module
78
+ registries, so it hands them to the package:
79
+
80
+ ```ts
81
+ // src/client-entry.ts
82
+ import { createClientEntry } from '@lilaquadrat/design-core/client-entry';
83
+ import { dynamicRoutes, editorRoutes, createPreviewRoutes } from '@lilaquadrat/design-core/routes';
84
+ import App from './App.vue';
85
+ import PreviewView from '@/views/preview.view.vue';
86
+ import TestView from '@/views/test.view.vue';
87
+ import modules from './modules.browser';
88
+ import partials from './partials.browser';
89
+ import modulesMail from './modules.mail';
90
+ import partialsMail from './partials.mail';
91
+
92
+ createClientEntry({
93
+ components: {
94
+ root : App,
95
+ modules : modules.modules,
96
+ partials,
97
+ modulesMail : modulesMail.modules,
98
+ partialsMail,
99
+ },
100
+ routes: {
101
+ dynamicRoutes,
102
+ editorRoutes,
103
+ previewRoutes: createPreviewRoutes(PreviewView, TestView),
104
+ },
105
+ });
106
+ ```
107
+
108
+ `render` from `@lilaquadrat/design-core/server-entry` takes the same
109
+ `components` object through its options argument.
110
+
111
+ ### translations
112
+
113
+ The package ships the strings it renders itself. Module wording belongs to the
114
+ design and is merged on top:
115
+
116
+ ```ts
117
+ import { addMessages } from '@lilaquadrat/design-core/plugins/translations';
118
+ import de from '@/translations/de';
119
+
120
+ addMessages('de', de);
121
+ ```
122
+
123
+ ### eslint, stylelint, cypress
124
+
125
+ ```js
126
+ // eslint.config.js
127
+ export { default } from '@lilaquadrat/design-core/eslint';
128
+ ```
129
+
130
+ ```ts
131
+ // cypress.config.ts
132
+ import { createCypressConfig } from '@lilaquadrat/design-core/cypress';
133
+
134
+ export default createCypressConfig();
135
+ ```
136
+
137
+ `cy:parallel` bin-packs specs by measured runtime. A project with its own spec
138
+ set overrides the table in `cypress/durations.json`.
139
+
140
+ ## SSR preflight
141
+
142
+ `tooling/ssr-test` renders a whole design through the **real** ssr build and
143
+ fails if anything in it throws, warns or comes back empty. It is the gate before
144
+ publishing.
145
+
146
+ It exists because the production renderer is forgiving in the worst way:
147
+ `RenderClass.renderSingle` collects renders with `Promise.allSettled` and only
148
+ `console.error`s a rejected one, so a page that blows up during SSR is published
149
+ as an empty shell and nobody notices.
150
+
151
+ Offline by construction - the two build artifacts are the only input, nothing
152
+ talks to an api:
153
+
154
+ ```
155
+ dist/server the published ssr build (yarn build-ssr)
156
+ dist/ssr-test the design's fixtures (yarn build:ssr-fixtures)
157
+ ```
158
+
159
+ ```ts
160
+ // src/ssr-test.fixtures.ts - built with: vite build --ssr --mode ssr-test
161
+ import type { Content } from '@lilaquadrat/interfaces';
162
+ import modulesBrowser from './modules.browser';
163
+ import text from './views/viewData/text';
164
+
165
+ export const viewData: Record<string, Content> = { text };
166
+ export const modules = modulesBrowser.modules.map((single) => ({
167
+ name : single.name,
168
+ variants: (single.variants ?? []).map((variant) => ({ key: variant.key })),
169
+ }));
170
+ ```
171
+
172
+ ```js
173
+ // test/ssr.test.mjs - run with: node --test test/*.test.mjs
174
+ import { runSsrSuite } from '@lilaquadrat/design-core/ssr-test';
175
+
176
+ const fixtures = await import('../dist/ssr-test/ssr-test.fixtures.js');
177
+
178
+ await runSsrSuite({ fixtures });
179
+ ```
180
+
181
+ Three passes:
182
+
183
+ | pass | what it renders |
184
+ | --- | --- |
185
+ | viewData | every gallery fixture as its own site, at its own url |
186
+ | empty modules | every registered module with nothing but a type and a uuid, then once per registered variant |
187
+ | empty mail modules | the same for the mail registry, rendered at the `mail` url |
188
+
189
+ Every render is asserted to resolve, to log no `console.error` and no
190
+ `[Vue warn]`, to produce the content module, to return parseable `initialState`,
191
+ and to fill in the html template's placeholders. The context it passes is the
192
+ one `RenderClass.createGenericContext` builds, so what the suite exercises is
193
+ the contract the renderer actually uses.
194
+
195
+ Options:
196
+
197
+ - `allowedConsole` - regexes for output the project expects offline (a module
198
+ that needs a structure declaration or a payment provider from the backend).
199
+ Reported as a diagnostic instead of failing.
200
+ - `markers` - root class overrides for modules whose class does not follow from
201
+ their type.
202
+ - `variants: false` - render each module once instead of once per variant.
203
+ - `paths` - where the build output lives, if not the defaults above.
204
+
205
+ A module that renders nothing for empty data is fine and is reported, not
206
+ failed. A module that *throws* on empty data is the thing this suite is for.
207
+
208
+ ## Migrating an existing design
209
+
210
+ Keep the old import paths working with a one line shim per file, then delete the
211
+ shims per project whenever convenient:
212
+
213
+ ```ts
214
+ // src/stores/main.store.ts
215
+ export * from '@lilaquadrat/design-core/stores/main.store';
216
+ export { default } from '@lilaquadrat/design-core/stores/main.store';
217
+ ```
218
+
219
+ The subpaths mirror the layout a design already had, so the shim is always the
220
+ same two lines and no component import has to change.
221
+
222
+ ### The one seam that matters
223
+
224
+ The package never imports a design component. `main-components.partial.vue` and
225
+ `error.partial.vue` render `lila-content-module` by its **global component
226
+ name**, resolved at runtime from the registry the project passed in. That keeps
227
+ the dependency one-directional: design depends on core, core never on design.
228
+
229
+ ## Known state
230
+
231
+ `yarn type-check` reports the errors this code already had inside the design
232
+ repo - `Models.class`, `main.store`, `action.partial`, the shopify provider and
233
+ `Contact.model`. They were not introduced by the extraction and are unchanged
234
+ from their origin. One extra error in `user.store` is an artifact of this
235
+ repository's own dev tree carrying two copies of `@lilaquadrat/interfaces`; a
236
+ consuming project with a single hoisted copy does not see it.
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <link rel="apple-touch-icon" sizes="180x180" href="./src/assets/apple-touch-icon.png">
8
+ <link rel="icon" type="image/png" sizes="32x32" href="./src/assets/favicon-32x32.png">
9
+ <link rel="icon" type="image/png" sizes="16x16" href="./src/assets/favicon-16x16.png">
10
+ <link rel="manifest" href="./src/assets/site.webmanifest">
11
+ <link rel="mask-icon" href="./src/assets/safari-pinned-tab.svg" color="#5bbad5">
12
+ <meta name="msapplication-TileColor" content="#da532c">
13
+ <meta name="theme-color" content="#ffffff">
14
+
15
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
16
+ <meta name="description" content="lilaquadrat STUDIO design">
17
+ <title>lilaquadrat STUDIO design</title>
18
+ </head>
19
+
20
+ <body>
21
+ <div id="app"></div>
22
+ <script type="module" src="/src/client-entry.ts"></script>
23
+ </body>
24
+
25
+ </html>
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <meta name="description" content="<!--description-->">
8
+ <title><!--sitetitle--></title>
9
+ </head>
10
+
11
+ <body>
12
+ <div id="app"><!--ssr-outlet--></div>
13
+ </body>
14
+
15
+ </html>
@@ -0,0 +1,29 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <link rel="apple-touch-icon" sizes="180x180" href="<!--cdn-->/apple-touch-icon.png">
8
+ <link rel="icon" type="image/png" sizes="32x32" href="<!--cdn-->/favicon-32x32.png">
9
+ <link rel="icon" type="image/png" sizes="16x16" href="<!--cdn-->/favicon-16x16.png">
10
+ <link rel="manifest" href="<!--cdn-->/site.webmanifest">
11
+ <link rel="mask-icon" href="<!--cdn-->/safari-pinned-tab.svg" color="#5bbad5">
12
+ <meta name="msapplication-TileColor" content="#da532c">
13
+ <meta name="theme-color" content="#ffffff">
14
+
15
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
16
+ <meta name="description" content="<!--description-->">
17
+ <title><!--sitetitle--></title>
18
+ <link rel="preconnect" href="<!--cdn-->">
19
+ <link rel="stylesheet" href="<!--style-->">
20
+ <!--preload-links-->
21
+ <script type="module" src="<!--script-->"></script>
22
+ </head>
23
+
24
+ <body>
25
+ <div id="app"><!--ssr-outlet--></div>
26
+ <!--pinia-state-->
27
+ </body>
28
+
29
+ </html>
package/package.json ADDED
@@ -0,0 +1,148 @@
1
+ {
2
+ "name": "@lilaquadrat/design-core",
3
+ "version": "0.1.0",
4
+ "description": "framework layer shared by every lilaquadrat STUDIO design: app bootstrap, router, stores, plugins and build tooling",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": {
8
+ "email": "m.schuebel@lila2.de",
9
+ "name": "Mathias Schübel",
10
+ "url": "https://lilaquadrat.de"
11
+ },
12
+ "homepage": "https://lilaquadrat.de",
13
+ "engines": {
14
+ "node": ">=18"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "files": [
20
+ "src/**/*",
21
+ "tooling/**/*",
22
+ "html/**/*",
23
+ "README.md"
24
+ ],
25
+ "types": "./src/index.ts",
26
+ "exports": {
27
+ ".": "./src/index.ts",
28
+ "./main": "./src/main.ts",
29
+ "./routes": "./src/routes.ts",
30
+ "./client-entry": "./src/client-entry.ts",
31
+ "./server-entry": "./src/server-entry.ts",
32
+ "./models": "./src/models.ts",
33
+ "./customs": "./src/customs.ts",
34
+ "./globals": "./src/globals.d.ts",
35
+ "./mixins/*": "./src/mixins/*.ts",
36
+ "./plugins/*": "./src/plugins/*.ts",
37
+ "./stores/*": "./src/stores/*.ts",
38
+ "./libs/*": "./src/libs/*.ts",
39
+ "./functions/*": "./src/functions/*.ts",
40
+ "./models/*": "./src/models/*.ts",
41
+ "./interfaces/*": "./src/interfaces/*.ts",
42
+ "./translations/*": "./src/translations/*.ts",
43
+ "./views/*": "./src/views/*",
44
+ "./partials/*": "./src/components/partials/*",
45
+ "./html/*": "./html/*",
46
+ "./vite": "./tooling/vite.ts",
47
+ "./eslint": "./tooling/eslint.config.js",
48
+ "./stylelint": "./tooling/stylelint.config.mjs",
49
+ "./cypress": "./tooling/cypress/config.ts",
50
+ "./ssr-test": "./tooling/ssr-test/index.mjs",
51
+ "./cypress/*": "./tooling/cypress/*"
52
+ },
53
+ "scripts": {
54
+ "type-check": "vue-tsc --noEmit",
55
+ "lint": "eslint . --fix",
56
+ "release": "standard-version"
57
+ },
58
+ "peerDependencies": {
59
+ "@auth0/auth0-spa-js": "^2.1.3",
60
+ "@lilaquadrat/interfaces": ">=1.31.0",
61
+ "@lilaquadrat/sdk": "^0.1.2",
62
+ "@lilaquadrat/studio": "^9.14.3",
63
+ "axios": "^1.9.0",
64
+ "cypress": "^15.0.0",
65
+ "dayjs": "^1.11.13",
66
+ "eslint": "^9.25.1",
67
+ "less": "^4.3.0",
68
+ "object-path": "^0.11.8",
69
+ "pinia": "^3.0.2",
70
+ "qrcode": "^1.5.4",
71
+ "rollup-plugin-visualizer": "^5.14.0",
72
+ "stylelint": "^16.19.1",
73
+ "uuid": "^11.1.0",
74
+ "vite": "^8.0.0",
75
+ "vue": "^3.5.13",
76
+ "vue-i18n": "^11.4.4",
77
+ "vue-router": "^4.5.1"
78
+ },
79
+ "peerDependenciesMeta": {
80
+ "cypress": {
81
+ "optional": true
82
+ },
83
+ "eslint": {
84
+ "optional": true
85
+ },
86
+ "less": {
87
+ "optional": true
88
+ },
89
+ "rollup-plugin-visualizer": {
90
+ "optional": true
91
+ },
92
+ "stylelint": {
93
+ "optional": true
94
+ },
95
+ "vite": {
96
+ "optional": true
97
+ }
98
+ },
99
+ "devDependencies": {
100
+ "@auth0/auth0-spa-js": "2.1.3",
101
+ "@eslint/js": "^9.25.1",
102
+ "@lilaquadrat/interfaces": "1.31.0",
103
+ "@lilaquadrat/sdk": "^0.1.2",
104
+ "@lilaquadrat/studio": "9.15.4",
105
+ "@types/node": "^22.15.3",
106
+ "@types/object-path": "^0.11.4",
107
+ "@types/qrcode": "^1.5.5",
108
+ "@types/uuid": "^10.0.0",
109
+ "@types/youtube": "^0.1.0",
110
+ "@typescript-eslint/eslint-plugin": "^8.31.1",
111
+ "@typescript-eslint/parser": "^8.31.1",
112
+ "@vitejs/plugin-vue": "^5.2.3",
113
+ "@vue/eslint-config-typescript": "^14.5.0",
114
+ "@vue/tsconfig": "^0.7.0",
115
+ "axios": "^1.9.0",
116
+ "commitizen": "^4.3.1",
117
+ "cypress": "^15.10.0",
118
+ "cz-conventional-changelog": "^3.3.0",
119
+ "dayjs": "^1.11.13",
120
+ "eslint": "^9.25.1",
121
+ "eslint-plugin-vue": "^10.1.0",
122
+ "globals": "^16.0.0",
123
+ "less": "^4.3.0",
124
+ "object-path": "^0.11.8",
125
+ "pinia": "^3.0.2",
126
+ "qrcode": "^1.5.4",
127
+ "rollup-plugin-visualizer": "^5.14.0",
128
+ "standard-version": "^9.5.0",
129
+ "stylelint": "^16.19.1",
130
+ "typescript": "~5.8.3",
131
+ "uuid": "^11.1.0",
132
+ "vite": "^8.0.15",
133
+ "vue": "^3.5.13",
134
+ "vue-eslint-parser": "^10.1.3",
135
+ "vue-i18n": "^11.4.4",
136
+ "vue-router": "^4.5.1",
137
+ "vue-tsc": "^2.2.10"
138
+ },
139
+ "config": {
140
+ "commitizen": {
141
+ "path": "./node_modules/cz-conventional-changelog"
142
+ }
143
+ },
144
+ "resolutions": {
145
+ "@lilaquadrat/sdk/@lilaquadrat/interfaces": "1.31.0",
146
+ "@lilaquadrat/studio/@lilaquadrat/interfaces": "1.31.0"
147
+ }
148
+ }
@@ -0,0 +1,28 @@
1
+ import './models';
2
+ import hooks from './mixins/hooks';
3
+ import getRoutes, { type RouteSets } from './mixins/getRoutes';
4
+ import './plugins/inview';
5
+ import { getAppInstance, type AppComponents } from './main';
6
+
7
+ /**
8
+ * boots the browser app. the project passes its own root component, module
9
+ * registries and route sets - everything else is framework.
10
+ */
11
+ export function createClientEntry (options: { components: AppComponents, routes: RouteSets, initAuth?: boolean }) {
12
+
13
+ const { app, router } = getAppInstance({}, getRoutes(options.routes), !!window.__INITIAL_STATE__, options.components);
14
+
15
+ // the static preview has no backend: skip the auth0 init and the customer call
16
+ hooks(router, { initAuth: options.initAuth ?? !__PREVIEW__ }, 'client');
17
+
18
+ router.isReady().then(() => {
19
+
20
+ app.mount('#app');
21
+
22
+ });
23
+
24
+ return { app, router };
25
+
26
+ }
27
+
28
+ export default createClientEntry;
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ import type IconsPartial from '../../interfaces/IconsPartial';
3
+
4
+ defineOptions({ inheritAttrs: false });
5
+
6
+ const props = defineProps<{
7
+ link?: string
8
+ event?: string
9
+ text?: string
10
+ icon?: IconsPartial['type']
11
+ attributes?: string[]
12
+ classes?: string[]
13
+ variant?: string[]
14
+ callToAction?: boolean
15
+ additionalData?: string
16
+ button?: boolean
17
+ disabled?: boolean
18
+ mode?: 'internal' | 'external' | 'event'
19
+ [key: string]: any,
20
+ colorScheme?: string
21
+ }>();
22
+
23
+ </script>
24
+ <template>
25
+ <component :is="event ? 'lila-button-partial' : 'lila-link-partial'" v-if="event || link" v-bind="props">
26
+ <slot />
27
+ </component>
28
+ <slot v-if="!link && !event" />
29
+ </template>
30
+
@@ -0,0 +1,11 @@
1
+ <script setup lang="ts">
2
+ import { ref, onMounted } from 'vue';
3
+
4
+ const isClient = ref<boolean>(false);
5
+
6
+ onMounted(() => isClient.value = true);
7
+
8
+ </script>
9
+ <template>
10
+ <slot v-if="isClient" />
11
+ </template>
@@ -0,0 +1,73 @@
1
+ <script setup lang="ts">
2
+ import useMainStore from '../../stores/main.store';
3
+ import type { BasicData, Content } from '@lilaquadrat/interfaces';
4
+ import type { SDKResponse } from '@lilaquadrat/sdk';
5
+ import { prepareContent } from '@lilaquadrat/studio/lib/esm/frontend';
6
+ import { watch } from 'vue';
7
+ import { onBeforeMount } from 'vue';
8
+ import { ref, computed } from 'vue';
9
+
10
+ const props = defineProps<{
11
+ status: number
12
+ type?: 'member' | 'public' | 'restricted'
13
+ hint?: string
14
+ }>();
15
+ const store = useMainStore();
16
+ const data = ref<SDKResponse<BasicData<Content>>>();
17
+
18
+ watch(props, () => getContent());
19
+
20
+ function getFilename () {
21
+
22
+ if(props.hint) return props.hint;
23
+
24
+ const nameArray: string[] = ['error', props.status.toString()];
25
+
26
+ if(props.type) nameArray.push(props.type);
27
+
28
+ return nameArray.join('-');
29
+
30
+ }
31
+
32
+ async function getContent () {
33
+
34
+ data.value = await store.getContent({filename: getFilename()}, 'public') as SDKResponse<BasicData<Content>>;
35
+
36
+ }
37
+
38
+ onBeforeMount(async () => await getContent());
39
+
40
+ const useData = computed(() => {
41
+
42
+ if(data?.value?.data?.modules) return data.value?.data;
43
+
44
+ if(store.staticData) {
45
+
46
+ if(props.hint) {
47
+
48
+ return store.staticData[props.hint];
49
+
50
+ }
51
+
52
+ if(props.status > 0) {
53
+
54
+ return store.staticData[props.status];
55
+
56
+ }
57
+
58
+ }
59
+
60
+ return undefined;
61
+
62
+ });
63
+ const contentMerged = computed(() => {
64
+
65
+ if(useData.value) return prepareContent(useData.value);
66
+ return prepareContent({})
67
+
68
+ });
69
+
70
+ </script>
71
+ <template>
72
+ <lila-content-module v-if="contentMerged" :content="contentMerged" />
73
+ </template>