@poadio/app-vue 0.0.0-stage → 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.
- package/CHANGELOG.md +19 -0
- package/LICENSE +22 -0
- package/README.md +16 -2
- package/app-vue.css +107 -0
- package/dist/browser.d.ts +21 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +95 -0
- package/dist/browser.js.map +1 -0
- package/dist/front-view.d.ts +35 -0
- package/dist/front-view.d.ts.map +1 -0
- package/dist/front-view.js +115 -0
- package/dist/front-view.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/lazy.d.ts +40 -0
- package/dist/lazy.d.ts.map +1 -0
- package/dist/lazy.js +35 -0
- package/dist/lazy.js.map +1 -0
- package/dist/messages.d.ts +38 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +66 -0
- package/dist/messages.js.map +1 -0
- package/dist/sections/grid.d.ts +29 -0
- package/dist/sections/grid.d.ts.map +1 -0
- package/dist/sections/grid.js +19 -0
- package/dist/sections/grid.js.map +1 -0
- package/dist/sections/under-construction.d.ts +25 -0
- package/dist/sections/under-construction.d.ts.map +1 -0
- package/dist/sections/under-construction.js +32 -0
- package/dist/sections/under-construction.js.map +1 -0
- package/package.json +71 -4
- package/runtime-dist/app.css +461 -0
- package/runtime-dist/app.js +2 -0
- package/runtime-dist/c-7dddcgt2.js +2 -0
- package/runtime-dist/c-9a0nzf53.js +2 -0
- package/runtime-dist/c-c1e1x3y1.js +1 -0
- package/runtime-dist/c-fg782zf4.js +1 -0
- package/runtime-dist/c-fnkq09db.js +1 -0
- package/runtime-dist/c-j29w8z15.js +1 -0
- package/runtime-dist/c-mmxqs2mz.js +1 -0
- package/runtime-dist/c-ns42txax.js +2 -0
- package/runtime-dist/c-pgxy0etb.js +1 -0
- package/runtime-dist/c-xsq12y6b.js +1 -0
- package/runtime-dist/index.html +14 -0
- package/runtime-dist/version.json +1 -0
- package/src/browser.ts +107 -0
- package/src/front-view.ts +132 -0
- package/src/index.ts +4 -0
- package/src/lazy.ts +39 -0
- package/src/messages.ts +74 -0
- package/src/sections/grid.ts +21 -0
- package/src/sections/under-construction.ts +34 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog — @poadio/app-vue
|
|
2
|
+
|
|
3
|
+
## 0.1.0 — 2026-11-28
|
|
4
|
+
|
|
5
|
+
Première version : le rendu Vue 3 des fronts dessinés dans poad, sur `@poadio/app-core` et `@poadio/ui-vue`.
|
|
6
|
+
|
|
7
|
+
- `PoadFrontView` : barre du front (nom, pages, utilisateur, Se déconnecter), page « En construction » (nom du
|
|
8
|
+
front et du projet), grille vide (canevas), formulaire de connexion (`PoadField`, `PoadInput`, `PoadButton`,
|
|
9
|
+
`PoadMessage`), « Pas encore publié », « Page introuvable », badge « Connexion requise » / « Sans connexion » en
|
|
10
|
+
canevas. Clair et sombre (`.theme-dark` / `.theme-light`), 390 px. Français et anglais (langue du navigateur).
|
|
11
|
+
- `bootFront` : démarrage d'un front servi par l'engine (`/_poad/front.json`, client poad, aperçu piloté par la
|
|
12
|
+
console, journaux envoyés au puits, erreurs JavaScript et de rendu comprises).
|
|
13
|
+
- Chargement à la demande (`src/lazy.ts`) : chaque composant de `@poadio/ui-vue` par son export profond, chaque
|
|
14
|
+
type de section par son module (`sections/`), chargés quand une page les emploie ; `runtime/build.mjs` découpe le
|
|
15
|
+
moteur en morceaux. La page « En construction » charge ~50 Ko gzip (moteur 24 Ko + Vue 25 Ko + sa section), contre
|
|
16
|
+
114 Ko d'un seul tenant avant ; le formulaire de connexion (champs, bouton, message) ne part que si une page
|
|
17
|
+
l'exige.
|
|
18
|
+
- `runtime-dist/` : le moteur compilé que l'engine sert à l'origine de chaque front (`bun runtime/build.mjs` :
|
|
19
|
+
un module, aucun script en ligne, aucune évaluation de code — CSP `script-src 'self'`).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CEREMA — Stéphane Zuccatti (original work: @cadriciel/ui, @cadriciel/core)
|
|
4
|
+
Copyright (c) 2026 poad contributors (@poadio/ui-core, @poadio/ui-angular)
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @poadio/app-vue
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Le rendu Vue 3 des fronts dessinés dans [poad](https://poad.io), sur `@poadio/app-core` (toute la logique) et
|
|
4
|
+
`@poadio/ui-vue` (les composants). Fonctions de rendu en TypeScript : ni JSX, ni SFC.
|
|
5
|
+
|
|
6
|
+
- `PoadFrontView` : dessine l'état d'un front (`createFrontApp`).
|
|
7
|
+
- `bootFront` : démarre un front tel que l'engine le sert.
|
|
8
|
+
- `runtime-dist/` (`@poadio/app-vue/runtime/*`) : le moteur compilé, copié dans l'image de l'engine
|
|
9
|
+
(`poadio/apps`) et servi à l'origine de chaque front (`http://localhost:<port>` en local,
|
|
10
|
+
`https://<id>.app.poad.io` sur poad.io).
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
bun run build # dist/ (bibliothèque) puis runtime-dist/ (moteur)
|
|
14
|
+
bun run test
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Licence MIT.
|
package/app-vue.css
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/* Rendu des fronts (@poadio/app-vue) : mise en page du moteur, sur les jetons de @poadio/ui-core.
|
|
2
|
+
Règle poad : rien de collé — chaque panneau a son remplissage, chaque bloc sa marge. */
|
|
3
|
+
/* Thème : les variables « studio » que reprennent les jetons --poad-* de @poadio/ui-core (même palette que
|
|
4
|
+
ui/site/src/styles/theme.css et la console). Sans elles, ui-core n'a pas de surfaces sombres : un front en
|
|
5
|
+
.theme-dark restait blanc. La classe est posée sur <html> par le moteur (thème du système, ou celui de la
|
|
6
|
+
console dans un aperçu). */
|
|
7
|
+
:root, .theme-light {
|
|
8
|
+
--surface-ground: #ffffff; --surface-section: #f8fafc; --surface-card: #ffffff; --surface-overlay: #ffffff;
|
|
9
|
+
--surface-border: #e2e8f0; --surface-hover: #f1f5f9;
|
|
10
|
+
--text-primary: #1e293b; --text-secondary: #475569; --text-muted: #64748b;
|
|
11
|
+
--bg-elevated: #e2e8f0; --border-light: #cbd5e1;
|
|
12
|
+
--shadow-sm: 0 1px 2px rgba(0,0,0,.05); --shadow-md: 0 4px 6px rgba(0,0,0,.07); --shadow-lg: 0 12px 24px rgba(15,23,42,.08);
|
|
13
|
+
--input-bg: #ffffff; --input-border: #cbd5e1;
|
|
14
|
+
color-scheme: light;
|
|
15
|
+
}
|
|
16
|
+
.theme-dark {
|
|
17
|
+
--surface-ground: #0d1117; --surface-section: #161b22; --surface-card: #161b22; --surface-overlay: #21262d;
|
|
18
|
+
--surface-border: #30363d; --surface-hover: #21262d;
|
|
19
|
+
--text-primary: #f0f6fc; --text-secondary: #9ba5b0; --text-muted: #7d8590;
|
|
20
|
+
--bg-elevated: #30363d; --border-light: #484f58;
|
|
21
|
+
--shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow-md: 0 4px 6px rgba(0,0,0,.4); --shadow-lg: 0 12px 24px rgba(0,0,0,.5);
|
|
22
|
+
--input-bg: #0d1117; --input-border: #30363d;
|
|
23
|
+
color-scheme: dark;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
html, body { margin: 0; min-height: 100%; background: var(--poad-bg); color: var(--poad-fg); }
|
|
27
|
+
body { font-family: var(--poad-font); font-size: 15px; line-height: 1.5; }
|
|
28
|
+
|
|
29
|
+
.poad-front { min-height: 100vh; display: flex; flex-direction: column; background: var(--poad-bg); color: var(--poad-fg); box-sizing: border-box; }
|
|
30
|
+
.poad-front *, .poad-front *::before, .poad-front *::after { box-sizing: border-box; }
|
|
31
|
+
|
|
32
|
+
.poad-front__bar {
|
|
33
|
+
display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
|
|
34
|
+
min-height: 56px; padding: 10px 24px;
|
|
35
|
+
background: var(--poad-surface); border-bottom: 1px solid var(--poad-border);
|
|
36
|
+
}
|
|
37
|
+
.poad-front__brand { font-weight: 600; font-size: 16px; color: var(--poad-fg); text-decoration: none; white-space: nowrap; }
|
|
38
|
+
.poad-front__nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; min-width: 0; }
|
|
39
|
+
.poad-front__spacer { flex: 1; }
|
|
40
|
+
.poad-front__nav-link {
|
|
41
|
+
padding: 6px 12px; border-radius: var(--poad-radius); color: var(--poad-fg-secondary); text-decoration: none; font-size: 14px;
|
|
42
|
+
}
|
|
43
|
+
.poad-front__nav-link:hover { background: var(--poad-hover); color: var(--poad-fg); }
|
|
44
|
+
.poad-front__nav-link.is-current { background: var(--poad-accent-soft); color: var(--poad-accent); font-weight: 500; }
|
|
45
|
+
.poad-front__user { display: flex; align-items: center; gap: 12px; }
|
|
46
|
+
.poad-front__user-email { color: var(--poad-fg-secondary); font-size: 13px; }
|
|
47
|
+
|
|
48
|
+
.poad-front__page { flex: 1; display: flex; flex-direction: column; gap: 24px; padding: 24px; }
|
|
49
|
+
|
|
50
|
+
.poad-front__center { flex: 1; display: grid; place-items: center; padding: 32px 16px; }
|
|
51
|
+
.poad-front__loading { color: var(--poad-fg-muted); }
|
|
52
|
+
.poad-front__panel {
|
|
53
|
+
width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 16px;
|
|
54
|
+
padding: 28px 28px 32px; background: var(--poad-surface); border: 1px solid var(--poad-border);
|
|
55
|
+
border-radius: var(--poad-radius-lg); box-shadow: var(--poad-shadow-sm);
|
|
56
|
+
}
|
|
57
|
+
.poad-front__panel-title { margin: 0; font-size: 22px; font-weight: 600; }
|
|
58
|
+
.poad-front__panel-text { margin: 0; color: var(--poad-fg-secondary); }
|
|
59
|
+
.poad-front__signin .poad-button { margin-top: 8px; }
|
|
60
|
+
|
|
61
|
+
.poad-front__under {
|
|
62
|
+
flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px;
|
|
63
|
+
min-height: 60vh; padding: 48px 24px;
|
|
64
|
+
background: var(--poad-surface); border: 1px dashed var(--poad-border-strong); border-radius: var(--poad-radius-lg);
|
|
65
|
+
}
|
|
66
|
+
.poad-front__under-mark { color: var(--poad-accent); margin-bottom: 8px; }
|
|
67
|
+
.poad-front__under-title { margin: 0; font-size: 32px; font-weight: 600; letter-spacing: -0.01em; }
|
|
68
|
+
.poad-front__under-front { margin: 0; font-size: 18px; color: var(--poad-fg); }
|
|
69
|
+
.poad-front__under-text { margin: 0; max-width: 46ch; color: var(--poad-fg-secondary); }
|
|
70
|
+
.poad-front__under-project {
|
|
71
|
+
margin: 12px 0 0; padding: 8px 14px; border-radius: var(--poad-radius-pill);
|
|
72
|
+
background: var(--poad-bg-subtle); border: 1px solid var(--poad-border); color: var(--poad-fg-secondary); font-size: 14px;
|
|
73
|
+
}
|
|
74
|
+
.poad-front__under-project strong { color: var(--poad-fg); font-weight: 600; }
|
|
75
|
+
|
|
76
|
+
.poad-front__grid { min-height: calc(var(--poad-front-row, 40px) * 6); border-radius: var(--poad-radius-lg); }
|
|
77
|
+
.poad-front__grid.is-canvas {
|
|
78
|
+
padding: 16px; border: 1px dashed var(--poad-border-strong);
|
|
79
|
+
background-image: linear-gradient(to right, var(--poad-border) 1px, transparent 1px), linear-gradient(to bottom, var(--poad-border) 1px, transparent 1px);
|
|
80
|
+
background-size: calc(100% / 24) var(--poad-front-row, 40px);
|
|
81
|
+
}
|
|
82
|
+
.poad-front__grid:not(.is-canvas) { display: grid; place-items: center; padding: 24px; border: 1px dashed var(--poad-border); }
|
|
83
|
+
.poad-front__grid-empty { margin: 0; padding: 10px 14px; display: inline-block; background: var(--poad-surface); border-radius: var(--poad-radius); color: var(--poad-fg-muted); font-size: 13px; }
|
|
84
|
+
|
|
85
|
+
/* Canevas de la console : aperçu non interactif (la console choisit la page) */
|
|
86
|
+
.poad-front.is-canvas .poad-front__bar a, .poad-front.is-canvas .poad-front__page { cursor: default; }
|
|
87
|
+
|
|
88
|
+
@media (max-width: 600px) {
|
|
89
|
+
.poad-front__bar { padding: 10px 16px; gap: 10px; }
|
|
90
|
+
.poad-front__page { padding: 16px; }
|
|
91
|
+
.poad-front__panel { padding: 22px 20px 24px; }
|
|
92
|
+
.poad-front__under { padding: 40px 20px; min-height: 50vh; }
|
|
93
|
+
.poad-front__under-title { font-size: 26px; }
|
|
94
|
+
.poad-front__user-email { display: none; }
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Lecture du brouillon depuis la console : bandeau discret, fermable */
|
|
98
|
+
.poad-front__draft {
|
|
99
|
+
position: fixed; left: 16px; bottom: 16px; z-index: 50; max-width: calc(100vw - 32px);
|
|
100
|
+
display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px;
|
|
101
|
+
background: var(--poad-surface); color: var(--poad-fg-secondary); font-size: 13px;
|
|
102
|
+
border: 1px solid var(--poad-border); border-radius: var(--poad-radius-lg); box-shadow: var(--poad-shadow-md);
|
|
103
|
+
}
|
|
104
|
+
.poad-front__draft-badge { padding: 2px 8px; border-radius: var(--poad-radius-pill); background: var(--poad-warning-soft); color: var(--poad-warning); font-weight: 600; font-size: 12px; }
|
|
105
|
+
.poad-front__draft-close { all: unset; cursor: pointer; width: 24px; height: 24px; display: grid; place-items: center; border-radius: var(--poad-radius); font-size: 16px; color: var(--poad-fg-muted); }
|
|
106
|
+
.poad-front__draft-close:hover { background: var(--poad-hover); color: var(--poad-fg); }
|
|
107
|
+
.poad-front__draft-close:focus-visible { outline: 2px solid var(--poad-ring); }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type App } from 'vue';
|
|
2
|
+
import { type BrowserLogLine, type FrontApp, type HistoryPort, type PoadAuthLike, type Theme } from '@poadio/app-core';
|
|
3
|
+
export declare const browserHistory: () => HistoryPort;
|
|
4
|
+
/** Envoi des lignes à l'origine du front (POST /_poad/log) ; à la fermeture de la page, sendBeacon */
|
|
5
|
+
export declare const logSender: (endpoint?: string) => (lines: BrowserLogLine[], { final }: {
|
|
6
|
+
final: boolean;
|
|
7
|
+
}) => void;
|
|
8
|
+
export declare const applyTheme: (theme: Theme | null) => void;
|
|
9
|
+
export type BootOptions = {
|
|
10
|
+
el: Element;
|
|
11
|
+
/** Fabrique du client poad (createClient de @poadio/client-js) : url et clé anon viennent de front.json */
|
|
12
|
+
createClient: (url: string, anonKey: string) => PoadAuthLike;
|
|
13
|
+
configUrl?: string;
|
|
14
|
+
fetchConfig?: () => Promise<unknown>;
|
|
15
|
+
};
|
|
16
|
+
/** Démarre un front servi par l'engine : config, client poad, journaux, aperçu de la console, rendu */
|
|
17
|
+
export declare const bootFront: (opts: BootOptions) => Promise<{
|
|
18
|
+
app: FrontApp;
|
|
19
|
+
vue: App;
|
|
20
|
+
} | null>;
|
|
21
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,EAEU,KAAK,cAAc,EAAE,KAAK,QAAQ,EAAoB,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,KAAK,EACrH,MAAM,kBAAkB,CAAC;AAK1B,eAAO,MAAM,cAAc,QAAO,WAShC,CAAC;AAEH,sGAAsG;AACtG,eAAO,MAAM,SAAS,GAAI,iBAAuB,MAAM,OAAO,cAAc,EAAE,EAAE,WAAW;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,SAW5G,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,OAAO,KAAK,GAAG,IAAI,SAM7C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,OAAO,CAAC;IACZ,2GAA2G;IAC3G,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,YAAY,CAAC;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACtC,CAAC;AAEF,uGAAuG;AACvG,eAAO,MAAM,SAAS,GAAU,MAAM,WAAW,KAAG,OAAO,CAAC;IAAE,GAAG,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAE,GAAG,IAAI,CAqD7F,CAAC"}
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// Ce qui touche au navigateur : historique, envoi des journaux, thème, démarrage complet d'un front servi par
|
|
2
|
+
// l'engine (bootFront). Rien ici ne s'exécute à l'import : les fonctions lisent `window` quand on les appelle.
|
|
3
|
+
import { createApp } from 'vue';
|
|
4
|
+
import { createFrontApp, createFrontLogger, createPreviewBridge, isFrontConfig, poadAuth, previewModeOf, } from '@poadio/app-core';
|
|
5
|
+
import { PoadFrontView } from './front-view.js';
|
|
6
|
+
import { langOf } from './messages.js';
|
|
7
|
+
import { preloadPage } from './lazy.js';
|
|
8
|
+
export const browserHistory = () => ({
|
|
9
|
+
location: () => ({ pathname: window.location.pathname, search: window.location.search }),
|
|
10
|
+
push: (p) => window.history.pushState(null, '', p),
|
|
11
|
+
// En aperçu, ?poad_preview=… reste dans l'adresse (un rechargement de l'iframe garde son mode)
|
|
12
|
+
replace: (p) => window.history.replaceState(null, '', p + (previewModeOf(window.location.search) ? window.location.search : '')),
|
|
13
|
+
listen: (cb) => {
|
|
14
|
+
window.addEventListener('popstate', cb);
|
|
15
|
+
return () => window.removeEventListener('popstate', cb);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
/** Envoi des lignes à l'origine du front (POST /_poad/log) ; à la fermeture de la page, sendBeacon */
|
|
19
|
+
export const logSender = (endpoint = '/_poad/log') => (lines, { final }) => {
|
|
20
|
+
const body = JSON.stringify({ lines });
|
|
21
|
+
try {
|
|
22
|
+
if (final && navigator.sendBeacon) {
|
|
23
|
+
navigator.sendBeacon(endpoint, new Blob([body], { type: 'application/json' }));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
void fetch(endpoint, { method: 'POST', headers: { 'content-type': 'application/json' }, body, keepalive: true, credentials: 'omit' }).catch(() => { });
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
/* jamais d'erreur à cause du journal */
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export const applyTheme = (theme) => {
|
|
33
|
+
const t = theme ?? (window.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
|
|
34
|
+
const root = document.documentElement;
|
|
35
|
+
root.classList.remove('theme-dark', 'theme-light');
|
|
36
|
+
root.classList.add(`theme-${t}`);
|
|
37
|
+
root.style.colorScheme = t;
|
|
38
|
+
};
|
|
39
|
+
/** Démarre un front servi par l'engine : config, client poad, journaux, aperçu de la console, rendu */
|
|
40
|
+
export const bootFront = async (opts) => {
|
|
41
|
+
const logger = createFrontLogger(logSender());
|
|
42
|
+
window.addEventListener('pagehide', () => logger.flush(true));
|
|
43
|
+
window.addEventListener('error', (e) => logger.error(`erreur JavaScript : ${e.message}`, { event: 'app_js_error', attrs: { source: String(e.filename ?? '').split('?')[0], line: e.lineno } }));
|
|
44
|
+
window.addEventListener('unhandledrejection', (e) => logger.error(`promesse rejetée : ${String(e.reason?.message ?? e.reason)}`, { event: 'app_js_error' }));
|
|
45
|
+
setInterval(() => logger.flush(), 2000);
|
|
46
|
+
let config;
|
|
47
|
+
try {
|
|
48
|
+
const raw = opts.fetchConfig ? await opts.fetchConfig() : await (await fetch(opts.configUrl ?? '/_poad/front.json', { credentials: 'same-origin', cache: 'no-store' })).json();
|
|
49
|
+
if (!isFrontConfig(raw))
|
|
50
|
+
throw new Error('front.json illisible');
|
|
51
|
+
config = raw;
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
logger.error(`configuration du front illisible : ${e.message}`, { event: 'app_config_error' });
|
|
55
|
+
logger.flush();
|
|
56
|
+
opts.el.textContent = 'poad : configuration du front illisible.';
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const mode = previewModeOf(window.location.search) ?? 'live';
|
|
60
|
+
const auth = poadAuth(opts.createClient(config.api.url, config.api.anonKey));
|
|
61
|
+
let bridge = null;
|
|
62
|
+
const app = createFrontApp({ config, auth, history: browserHistory(), logger, mode, onNavigate: (page) => bridge?.navigate(page) });
|
|
63
|
+
applyTheme(null);
|
|
64
|
+
app.subscribe((s) => {
|
|
65
|
+
// Les modules de la page (sections, formulaire de connexion) partent avant le rendu
|
|
66
|
+
void preloadPage(s.page, s.needsLogin);
|
|
67
|
+
if (s.theme)
|
|
68
|
+
applyTheme(s.theme);
|
|
69
|
+
if (s.front)
|
|
70
|
+
document.title = s.page ? `${s.page.title} · ${s.front.name}` : s.front.name;
|
|
71
|
+
});
|
|
72
|
+
if (mode !== 'live') {
|
|
73
|
+
bridge = createPreviewBridge(window, config.console.origins, {
|
|
74
|
+
load: (front, page, m, theme, options) => app.loadPreview(front, page, m, theme, options),
|
|
75
|
+
page: (page) => app.showPage(page),
|
|
76
|
+
theme: (theme) => app.setTheme(theme),
|
|
77
|
+
});
|
|
78
|
+
// Taille rendue de la page, pour que le canevas cadre l'aperçu
|
|
79
|
+
const report = () => {
|
|
80
|
+
const s = app.state();
|
|
81
|
+
if (s.page)
|
|
82
|
+
bridge.rendered(s.page.id, document.documentElement.scrollWidth, document.documentElement.scrollHeight);
|
|
83
|
+
};
|
|
84
|
+
new ResizeObserver(report).observe(document.body);
|
|
85
|
+
app.subscribe(() => requestAnimationFrame(report));
|
|
86
|
+
}
|
|
87
|
+
await app.start();
|
|
88
|
+
const vue = createApp(PoadFrontView, { app, lang: langOf(navigator.languages) });
|
|
89
|
+
vue.config.errorHandler = (err) => logger.error(`erreur de rendu : ${err?.message ?? String(err)}`, { event: 'app_render_error' });
|
|
90
|
+
vue.mount(opts.el);
|
|
91
|
+
bridge?.ready();
|
|
92
|
+
logger.info(mode === 'live' ? 'front démarré' : `aperçu démarré (${mode})`, { event: 'app_boot', attrs: { mode, version: config.published?.version ?? null } });
|
|
93
|
+
return { app, vue };
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,+GAA+G;AAC/G,OAAO,EAAE,SAAS,EAAY,MAAM,KAAK,CAAC;AAC1C,OAA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C;IACjF,GAAG,CAAC,MAAM,CAAC,YAAY,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAsB,GAAa,EAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC9I,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,mBAAmB,IAAI,GAAG,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;IAChK,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <PoadFrontView :app="app" lang="fr" />
|
|
3
|
+
*
|
|
4
|
+
* Le rendu Vue d'un front : il dessine l'état du cœur (@poadio/app-core, `createFrontApp`) et lui renvoie les
|
|
5
|
+
* gestes (navigation, connexion, déconnexion). Aucune logique ici : ce qui décide (page, connexion exigée, page
|
|
6
|
+
* introuvable, front pas encore publié) est dans le cœur, testé sans navigateur. Composants de @poadio/ui-vue,
|
|
7
|
+
* styles de @poadio/ui-core (+ `app-vue.css`), clair et sombre par `.theme-dark` / `.theme-light` sur la racine.
|
|
8
|
+
*/
|
|
9
|
+
import { type PropType, type VNode } from 'vue';
|
|
10
|
+
import type { FrontApp } from '@poadio/app-core';
|
|
11
|
+
import { type Lang } from './messages.js';
|
|
12
|
+
export declare const PoadFrontView: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
13
|
+
app: {
|
|
14
|
+
type: PropType<FrontApp>;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
lang: {
|
|
18
|
+
type: PropType<Lang>;
|
|
19
|
+
default: string;
|
|
20
|
+
};
|
|
21
|
+
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
|
+
app: {
|
|
25
|
+
type: PropType<FrontApp>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
lang: {
|
|
29
|
+
type: PropType<Lang>;
|
|
30
|
+
default: string;
|
|
31
|
+
};
|
|
32
|
+
}>> & Readonly<{}>, {
|
|
33
|
+
lang: Lang;
|
|
34
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
35
|
+
//# sourceMappingURL=front-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"front-view.d.ts","sourceRoot":"","sources":["../src/front-view.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAkE,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,KAAK,CAAC;AAChH,OAAO,KAAK,EAAY,QAAQ,EAAiB,MAAM,kBAAkB,CAAC;AAE1E,OAAO,EAAc,KAAK,IAAI,EAAmB,MAAM,eAAe,CAAC;AAevE,eAAO,MAAM,aAAa;;cAGC,QAAQ,CAAC,QAAQ,CAAC;;;;cACjB,QAAQ,CAAC,IAAI,CAAC;;;;;;;cADf,QAAQ,CAAC,QAAQ,CAAC;;;;cACjB,QAAQ,CAAC,IAAI,CAAC;;;;;4EAqGxC,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <PoadFrontView :app="app" lang="fr" />
|
|
3
|
+
*
|
|
4
|
+
* Le rendu Vue d'un front : il dessine l'état du cœur (@poadio/app-core, `createFrontApp`) et lui renvoie les
|
|
5
|
+
* gestes (navigation, connexion, déconnexion). Aucune logique ici : ce qui décide (page, connexion exigée, page
|
|
6
|
+
* introuvable, front pas encore publié) est dans le cœur, testé sans navigateur. Composants de @poadio/ui-vue,
|
|
7
|
+
* styles de @poadio/ui-core (+ `app-vue.css`), clair et sombre par `.theme-dark` / `.theme-light` sur la racine.
|
|
8
|
+
*/
|
|
9
|
+
import { computed, defineComponent, h, onBeforeUnmount, ref, shallowRef } from 'vue';
|
|
10
|
+
import { PoadButton, PoadField, PoadInput, PoadMessage, PoadTag, sectionComponent } from './lazy.js';
|
|
11
|
+
import { translator } from './messages.js';
|
|
12
|
+
const panel = (t, title, text, extra = []) => h('div', { class: 'poad-front__center' }, [
|
|
13
|
+
h('div', { class: 'poad-front__panel' }, [h('h1', { class: 'poad-front__panel-title' }, t(title)), h('p', { class: 'poad-front__panel-text' }, t(text)), ...extra]),
|
|
14
|
+
]);
|
|
15
|
+
/** Une section : son module, chargé à la demande (lazy.ts) ; un type inconnu n'affiche rien */
|
|
16
|
+
const section = (t, s, canvas) => {
|
|
17
|
+
const c = sectionComponent(s.type);
|
|
18
|
+
return c ? h(c, { key: s.id, section: s, t, canvas }) : null;
|
|
19
|
+
};
|
|
20
|
+
export const PoadFrontView = defineComponent({
|
|
21
|
+
name: 'PoadFrontView',
|
|
22
|
+
props: {
|
|
23
|
+
app: { type: Object, required: true },
|
|
24
|
+
lang: { type: String, default: 'fr' },
|
|
25
|
+
},
|
|
26
|
+
setup(props) {
|
|
27
|
+
const state = shallowRef(props.app.state());
|
|
28
|
+
const off = props.app.subscribe((s) => (state.value = s));
|
|
29
|
+
onBeforeUnmount(off);
|
|
30
|
+
const t = computed(() => translator(props.lang));
|
|
31
|
+
const email = ref('');
|
|
32
|
+
const draftHidden = ref(false);
|
|
33
|
+
/** Lecture du brouillon : un petit bandeau discret, fermable, absent de la version publiée */
|
|
34
|
+
const draftBanner = () => state.value.draft && !draftHidden.value
|
|
35
|
+
? h('div', { class: 'poad-front__draft', role: 'status' }, [
|
|
36
|
+
h('span', { class: 'poad-front__draft-badge' }, t.value('draft.badge')),
|
|
37
|
+
h('span', { class: 'poad-front__draft-text' }, t.value('draft.text')),
|
|
38
|
+
h('button', { type: 'button', class: 'poad-front__draft-close', 'aria-label': t.value('draft.close'), onClick: () => (draftHidden.value = true) }, '×'),
|
|
39
|
+
])
|
|
40
|
+
: null;
|
|
41
|
+
const password = ref('');
|
|
42
|
+
const signInForm = () => {
|
|
43
|
+
const s = state.value;
|
|
44
|
+
const code = s.signIn.error;
|
|
45
|
+
return h('div', { class: 'poad-front__center' }, [
|
|
46
|
+
h('form', {
|
|
47
|
+
class: 'poad-front__panel poad-front__signin',
|
|
48
|
+
novalidate: true,
|
|
49
|
+
onSubmit: (e) => {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
void props.app.signIn(email.value, password.value).then(() => {
|
|
52
|
+
if (!props.app.state().signIn.error)
|
|
53
|
+
password.value = '';
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
}, [
|
|
57
|
+
h('h1', { class: 'poad-front__panel-title' }, t.value('signin.title')),
|
|
58
|
+
h('p', { class: 'poad-front__panel-text' }, t.value('signin.text')),
|
|
59
|
+
code ? h(PoadMessage, { severity: 'danger', class: 'poad-front__signin-error', text: t.value(code === 'invalid_credentials' ? 'signin.invalid_credentials' : 'signin.error') }) : null,
|
|
60
|
+
h(PoadField, { label: t.value('signin.email') }, () => h(PoadInput, { type: 'email', autocomplete: 'username', modelValue: email.value, 'onUpdate:modelValue': (v) => (email.value = String(v)) })),
|
|
61
|
+
h(PoadField, { label: t.value('signin.password') }, () => h(PoadInput, { type: 'password', autocomplete: 'current-password', modelValue: password.value, 'onUpdate:modelValue': (v) => (password.value = String(v)) })),
|
|
62
|
+
h(PoadButton, { type: 'submit', severity: 'primary', block: true, loading: s.signIn.busy }, () => t.value('signin.submit')),
|
|
63
|
+
]),
|
|
64
|
+
]);
|
|
65
|
+
};
|
|
66
|
+
const link = (p, current) => h('a', {
|
|
67
|
+
class: ['poad-front__nav-link', current?.id === p.id && 'is-current'],
|
|
68
|
+
href: props.app.pathOf(p.id),
|
|
69
|
+
'aria-current': current?.id === p.id ? 'page' : undefined,
|
|
70
|
+
onClick: (e) => {
|
|
71
|
+
if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0)
|
|
72
|
+
return;
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
props.app.navigate(p.id);
|
|
75
|
+
},
|
|
76
|
+
}, p.title);
|
|
77
|
+
const header = () => {
|
|
78
|
+
const s = state.value;
|
|
79
|
+
const front = s.front;
|
|
80
|
+
return h('header', { class: 'poad-front__bar' }, [
|
|
81
|
+
h('a', { class: 'poad-front__brand', href: props.app.pathOf(front.home), onClick: (e) => (e.preventDefault(), props.app.navigate(front.home)) }, front.name),
|
|
82
|
+
front.pages.length > 1 && !s.single ? h('nav', { class: 'poad-front__nav', 'aria-label': t.value('nav') }, front.pages.map((p) => link(p, s.page))) : h('span', { class: 'poad-front__spacer' }),
|
|
83
|
+
s.mode !== 'live'
|
|
84
|
+
// Aperçu de la console : un rappel discret de la règle d'accès de la page
|
|
85
|
+
? h(PoadTag, { size: 'sm', severity: s.authRequired ? 'warning' : 'success', value: t.value(s.authRequired ? (s.needsLogin ? 'badge.visitor' : 'badge.auth') : 'badge.public') })
|
|
86
|
+
: s.user
|
|
87
|
+
? h('div', { class: 'poad-front__user' }, [
|
|
88
|
+
s.user.email ? h('span', { class: 'poad-front__user-email' }, s.user.email) : null,
|
|
89
|
+
h(PoadButton, { size: 'sm', variant: 'outline', onClick: () => void props.app.signOut() }, () => t.value('signout')),
|
|
90
|
+
])
|
|
91
|
+
: null,
|
|
92
|
+
]);
|
|
93
|
+
};
|
|
94
|
+
return () => {
|
|
95
|
+
const s = state.value;
|
|
96
|
+
const tt = t.value;
|
|
97
|
+
const themeClass = s.theme ? `theme-${s.theme}` : null;
|
|
98
|
+
let body;
|
|
99
|
+
if (s.status === 'loading' || s.status === 'waiting-preview')
|
|
100
|
+
body = h('div', { class: 'poad-front__center poad-front__loading', role: 'status' }, tt('loading'));
|
|
101
|
+
else if (s.status === 'unpublished')
|
|
102
|
+
body = panel(tt, 'unpublished.title', 'unpublished.text');
|
|
103
|
+
else if (s.status === 'error')
|
|
104
|
+
body = panel(tt, 'error.title', 'error.text');
|
|
105
|
+
else if (s.status === 'not-found')
|
|
106
|
+
body = [header(), panel(tt, 'notfound.title', 'notfound.text', [h(PoadButton, { variant: 'outline', onClick: () => props.app.navigate(s.front.home) }, () => tt('notfound.home'))])];
|
|
107
|
+
else if (s.needsLogin)
|
|
108
|
+
body = [header(), signInForm()];
|
|
109
|
+
else
|
|
110
|
+
body = [header(), h('main', { class: 'poad-front__page', 'data-page': s.page.id }, s.page.sections.map((sec) => section(tt, sec, s.mode === 'canvas')))];
|
|
111
|
+
return h('div', { class: ['poad-front', themeClass, `is-${s.mode}`], 'data-status': s.status }, [draftBanner(), ...(Array.isArray(body) ? body : [body])]);
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
//# sourceMappingURL=front-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"front-view.js","sourceRoot":"","sources":["../src/front-view.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,EAA6B,MAAM,KAAK,CAAC;AAEhH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACrG,OAAO,EAAE,UAAU,EAA8B,MAAM,eAAe,CAAC;AAIvE,MAAM,KAAK,GAAG,CAAC,CAAI,EAAE,KAAiB,EAAE,IAAgB,EAAE,QAAiB,EAAE,EAAE,EAAE,CAC/E,CAAC,C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,CAAC,CAAC,CAAC;YAChK,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7J,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { PoadFrontView } from './front-view.js';
|
|
2
|
+
export { browserHistory, logSender, applyTheme, bootFront, type BootOptions } from './browser.js';
|
|
3
|
+
export { MESSAGES, langOf, translator, type Lang, type MessageKey } from './messages.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @poadio/app-vue : le rendu Vue des fronts dessinés dans poad, sur @poadio/app-core et @poadio/ui-vue.
|
|
2
|
+
export { PoadFrontView } from './front-view.js';
|
|
3
|
+
export { browserHistory, logSender, applyTheme, bootFront } from './browser.js';
|
|
4
|
+
export { MESSAGES, langOf, translator } from './messages.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAA8B,MAAM,eAAe,CAAC"}
|
package/dist/lazy.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Component } from 'vue';
|
|
2
|
+
import type { Page } from '@poadio/app-core';
|
|
3
|
+
export declare const PoadButton: import("vue").ComponentOptions<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, import("vue").ComponentProvideOptions> | import("vue").FunctionalComponent<any, {}, any, {}> | {
|
|
4
|
+
new (...args: any[]): any;
|
|
5
|
+
__isFragment?: never;
|
|
6
|
+
__isTeleport?: never;
|
|
7
|
+
__isSuspense?: never;
|
|
8
|
+
};
|
|
9
|
+
export declare const PoadField: import("vue").ComponentOptions<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, import("vue").ComponentProvideOptions> | import("vue").FunctionalComponent<any, {}, any, {}> | {
|
|
10
|
+
new (...args: any[]): any;
|
|
11
|
+
__isFragment?: never;
|
|
12
|
+
__isTeleport?: never;
|
|
13
|
+
__isSuspense?: never;
|
|
14
|
+
};
|
|
15
|
+
export declare const PoadInput: import("vue").ComponentOptions<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, import("vue").ComponentProvideOptions> | import("vue").FunctionalComponent<any, {}, any, {}> | {
|
|
16
|
+
new (...args: any[]): any;
|
|
17
|
+
__isFragment?: never;
|
|
18
|
+
__isTeleport?: never;
|
|
19
|
+
__isSuspense?: never;
|
|
20
|
+
};
|
|
21
|
+
export declare const PoadMessage: import("vue").ComponentOptions<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, import("vue").ComponentProvideOptions> | import("vue").FunctionalComponent<any, {}, any, {}> | {
|
|
22
|
+
new (...args: any[]): any;
|
|
23
|
+
__isFragment?: never;
|
|
24
|
+
__isTeleport?: never;
|
|
25
|
+
__isSuspense?: never;
|
|
26
|
+
};
|
|
27
|
+
export declare const PoadTag: import("vue").ComponentOptions<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, any, any, any, string, {}, {}, string, {}, {}, {}, string, import("vue").ComponentProvideOptions> | import("vue").FunctionalComponent<any, {}, any, {}> | {
|
|
28
|
+
new (...args: any[]): any;
|
|
29
|
+
__isFragment?: never;
|
|
30
|
+
__isTeleport?: never;
|
|
31
|
+
__isSuspense?: never;
|
|
32
|
+
};
|
|
33
|
+
/** Un module par type de section : ajouter un type, c'est ajouter une ligne ici et son module dans sections/ */
|
|
34
|
+
export declare const SECTION_LOADERS: Record<string, () => Promise<Component>>;
|
|
35
|
+
export declare const sectionComponent: (type: string) => Component | null;
|
|
36
|
+
/** Types de section d'une page (sans doublon) : ce qu'il faut charger pour l'afficher */
|
|
37
|
+
export declare const sectionTypes: (page: Page | null | undefined) => string[];
|
|
38
|
+
/** Charge d'avance les modules d'une page (navigation, connexion demandée) ; les erreurs restent au rendu */
|
|
39
|
+
export declare const preloadPage: (page: Page | null | undefined, needsLogin?: boolean) => Promise<unknown>;
|
|
40
|
+
//# sourceMappingURL=lazy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../src/lazy.ts"],"names":[],"mappings":"AAMA,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,KAAK,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI7C,eAAO,MAAM,UAAU;;;;;CAAwE,CAAC;AAChG,eAAO,MAAM,SAAS;;;;;CAAsE,CAAC;AAC7F,eAAO,MAAM,SAAS;;;;;CAAsE,CAAC;AAC7F,eAAO,MAAM,WAAW;;;;;CAA0E,CAAC;AACnG,eAAO,MAAM,OAAO;;;;;CAAkE,CAAC;AAEvF,gHAAgH;AAChH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAGpE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,SAAS,GAAG,IAK3D,CAAC;AAEF,yFAAyF;AACzF,eAAO,MAAM,YAAY,GAAI,MAAM,IAAI,GAAG,IAAI,GAAG,SAAS,KAAG,MAAM,EAA6D,CAAC;AAEjI,6GAA6G;AAC7G,eAAO,MAAM,WAAW,GAAI,MAAM,IAAI,GAAG,IAAI,GAAG,SAAS,EAAE,oBAAkB,KAAG,OAAO,CAAC,OAAO,CAI3F,CAAC"}
|
package/dist/lazy.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Chargement à la demande : le moteur ne télécharge que ce que la page affichée emploie.
|
|
2
|
+
// - composants de @poadio/ui-vue : un module par composant (exports profonds @poadio/ui-vue/<composant>,
|
|
3
|
+
// ui-vue 0.10.0), chargé au premier rendu qui en a besoin (formulaire de connexion, badge du canevas…) ;
|
|
4
|
+
// - sections d'une page : un module par type de section présent dans la définition (SECTIONS).
|
|
5
|
+
// Le bundle du moteur (runtime/build.mjs, découpage en morceaux) en fait des fichiers à part : la page
|
|
6
|
+
// « En construction » ne charge ni le formulaire de connexion, ni les champs, ni les composants qu'elle n'a pas.
|
|
7
|
+
import { defineAsyncComponent } from 'vue';
|
|
8
|
+
const lazy = (load) => defineAsyncComponent({ loader: load, delay: 0 });
|
|
9
|
+
export const PoadButton = lazy(() => import('@poadio/ui-vue/button').then((m) => m.PoadButton));
|
|
10
|
+
export const PoadField = lazy(() => import('@poadio/ui-vue/field').then((m) => m.PoadField));
|
|
11
|
+
export const PoadInput = lazy(() => import('@poadio/ui-vue/field').then((m) => m.PoadInput));
|
|
12
|
+
export const PoadMessage = lazy(() => import('@poadio/ui-vue/message').then((m) => m.PoadMessage));
|
|
13
|
+
export const PoadTag = lazy(() => import('@poadio/ui-vue/tag').then((m) => m.PoadTag));
|
|
14
|
+
/** Un module par type de section : ajouter un type, c'est ajouter une ligne ici et son module dans sections/ */
|
|
15
|
+
export const SECTION_LOADERS = {
|
|
16
|
+
'under-construction': () => import('./sections/under-construction.js').then((m) => m.UnderConstructionSection),
|
|
17
|
+
grid: () => import('./sections/grid.js').then((m) => m.GridSection),
|
|
18
|
+
};
|
|
19
|
+
const sectionComponents = new Map();
|
|
20
|
+
export const sectionComponent = (type) => {
|
|
21
|
+
const load = SECTION_LOADERS[type];
|
|
22
|
+
if (!load)
|
|
23
|
+
return null;
|
|
24
|
+
if (!sectionComponents.has(type))
|
|
25
|
+
sectionComponents.set(type, lazy(load));
|
|
26
|
+
return sectionComponents.get(type);
|
|
27
|
+
};
|
|
28
|
+
/** Types de section d'une page (sans doublon) : ce qu'il faut charger pour l'afficher */
|
|
29
|
+
export const sectionTypes = (page) => [...new Set((page?.sections ?? []).map((s) => s.type))];
|
|
30
|
+
/** Charge d'avance les modules d'une page (navigation, connexion demandée) ; les erreurs restent au rendu */
|
|
31
|
+
export const preloadPage = (page, needsLogin = false) => Promise.allSettled([
|
|
32
|
+
...sectionTypes(page).map((t) => SECTION_LOADERS[t]?.()),
|
|
33
|
+
...(needsLogin ? [import('@poadio/ui-vue/field'), import('@poadio/ui-vue/button'), import('@poadio/ui-vue/message')] : []),
|
|
34
|
+
]);
|
|
35
|
+
//# sourceMappingURL=lazy.js.map
|
package/dist/lazy.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.js","sourceRoot":"","sources":["../src/lazy.ts"],"names":[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