@gouvfr/dsfr-roller 1.0.28 → 1.0.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gouvfr/dsfr-roller",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "Le module `dsfr-roller` permet de publier le site de documentation du Système de Design de l’État - DSFR",
5
5
  "keywords": [
6
6
  "Système de Design de l'État",
@@ -56,7 +56,7 @@
56
56
  ],
57
57
  "main": "./index.js",
58
58
  "dependencies": {
59
- "@gouvfr/dsfr-forge": "=1.0.28",
59
+ "@gouvfr/dsfr-forge": "=1.0.29",
60
60
  "@gouvfr/dsfr-publisher": "npm:@gouvfr/dsfr@1.13.1",
61
61
  "deepmerge": "^4.3.1",
62
62
  "ejs": "^3.1.10",
@@ -5,8 +5,6 @@ import { Renderable } from '../../core/renderable.js';
5
5
  import { Favicon } from './favicon.js';
6
6
  import { Resource } from './resource.js';
7
7
  import { Share } from './share.js';
8
- import { AnalyticsConfig } from './analytics-config.js';
9
-
10
8
  class Head extends Renderable {
11
9
 
12
10
  constructor (data) {
@@ -17,7 +15,6 @@ class Head extends Renderable {
17
15
  this._resource = new Resource(data);
18
16
  this._share = new Share(data);
19
17
  this._stylesheets = new Stylesheets(data);
20
- this._analyticsConfig = new AnalyticsConfig(data);
21
18
  }
22
19
 
23
20
  async render () {
@@ -32,7 +29,6 @@ class Head extends Renderable {
32
29
  ${await this._share.render()}
33
30
  ${await this._stylesheets.render()}
34
31
  ${await this._resource.render()}
35
- ${await this._analyticsConfig.render()}
36
32
  </head>
37
33
  `;
38
34
  }
package/src/page/html.js CHANGED
@@ -6,6 +6,7 @@ import { CustomHeader } from './body/custom-header.js';
6
6
  import { Scheme } from './body/scheme.js';
7
7
  import { Main } from './body/main.js';
8
8
  import { Scripts } from './scripts/scripts.js';
9
+ import { AnalyticsConfig } from './scripts/analytics-config.js';
9
10
  import { HtmlRenderable } from '../core/html-renderable.js';
10
11
 
11
12
  class Html extends HtmlRenderable {
@@ -20,6 +21,7 @@ class Html extends HtmlRenderable {
20
21
  this._footer = new Footer(data.resource.footer);
21
22
  this._displayModal = new DisplayModal(data);
22
23
  this._scripts = new Scripts(data);
24
+ this._analyticsConfig = new AnalyticsConfig(data);
23
25
  }
24
26
 
25
27
  async render () {
@@ -33,6 +35,7 @@ class Html extends HtmlRenderable {
33
35
  ${await this._main.render()}
34
36
  ${await this._footer.render()}
35
37
  ${await this._displayModal.render()}
38
+ ${await this._analyticsConfig.render()}
36
39
  ${await this._scripts.render()}
37
40
  </body>
38
41
  </html>`);
@@ -12,22 +12,17 @@ class Storybook extends Element {
12
12
  }
13
13
 
14
14
  handleMessage(event) {
15
- const eventType = JSON.parse(event.data)?.event?.type;
16
- if (!eventType) return;
17
-
18
- if (eventType === 'storyRendered') {
19
- this._iframeDoc = this.iframe.contentDocument;
20
- if (!this._iframeDoc) return;
21
- this.resize();
15
+ if (event.data?.type === 'storybook-height-change') {
16
+ this.setIframeHeight(event.data.height);
22
17
  }
23
18
  }
24
19
 
25
- resize() {
26
- const height =
27
- this._iframeDoc.body?.scrollHeight ??
28
- this._iframeDoc.documentElement?.scrollHeight;
29
- this.iframe.style.height =
30
- isNaN(height) || !height ? '100%' : height + 'px';
20
+ setIframeHeight(height) {
21
+ if (isNaN(height) || !height) {
22
+ this.iframe.style.height = '100%';
23
+ } else {
24
+ this.iframe.style.height = height + 'px';
25
+ }
31
26
  }
32
27
 
33
28
  setIframeTheme() {
@@ -0,0 +1,5 @@
1
+ .dsfr-doc-storybook-leaf {
2
+ iframe {
3
+ border: 1px solid var(--border-default-grey);
4
+ }
5
+ }
@@ -7,3 +7,4 @@
7
7
  @use 'dsfr-doc-searchbar';
8
8
  @use 'dsfr-doc-pagination';
9
9
  @use 'dsfr-doc-edit';
10
+ @use 'dsfr-doc-storybook';
@@ -2,7 +2,7 @@
2
2
  --block-spacing: 1.5rem;
3
3
  }
4
4
 
5
- .fr-container {
5
+ #content-editorial {
6
6
  img {
7
7
  max-width: 100%;
8
8
  height: auto;
@@ -1,11 +1,13 @@
1
1
  import { HomeTemplate } from './templates/home-template.js';
2
2
  import { EditorialTemplate } from './templates/editorial-template.js';
3
3
  import { SearchTemplate } from './templates/search-template.js'
4
+ import { ErrorTemplate } from './templates/error-template.js'
4
5
 
5
6
  const TEMPLATES = [
6
7
  EditorialTemplate,
7
8
  HomeTemplate,
8
- SearchTemplate
9
+ SearchTemplate,
10
+ ErrorTemplate
9
11
  ];
10
12
 
11
13
  const templatesMap = new Map(TEMPLATES.map((Template) => [Template.NAME, Template]));
@@ -9,7 +9,7 @@ class EditorialTemplate extends Template {
9
9
  super(data);
10
10
 
11
11
  this._hasSidemenu = data?.resource?.navigation?.sidemenu !== undefined;
12
-
12
+
13
13
  this._hasEditUrl = data?.editUrl !== undefined;
14
14
 
15
15
  if (this._hasSidemenu) this._sidemenu = new Sidemenu(data.resource.navigation.sidemenu, data.resource.badge);
@@ -32,7 +32,7 @@ class EditorialTemplate extends Template {
32
32
  }
33
33
 
34
34
  cols.push(`
35
- <div class="fr-col-12 fr-col-md-8">
35
+ <div class="fr-col-12 fr-col-md-8" id="content-editorial">
36
36
  ${await this._breadcrumb.render()}
37
37
  ${await this._toc.render()}
38
38
  ${await super.render()}
@@ -0,0 +1,33 @@
1
+ import { Template } from '../template.js';
2
+
3
+ class ErrorTemplate extends Template {
4
+ constructor (data) {
5
+ super(data);
6
+ }
7
+
8
+ async render () {
9
+ return `
10
+ <div class="fr-container">
11
+ <div class="fr-my-14v fr-mt-md-24v fr-mb-md-20v fr-grid-row fr-grid-row--gutters fr-grid-row--middle fr-grid-row--center">
12
+ <div class="fr-py-0 fr-col-12 fr-col-md-6">
13
+ ${await super.render()}
14
+ </div>
15
+ <div class="fr-col-12 fr-col-md-3 fr-col-offset-md-1 fr-px-6w fr-px-md-0 fr-py-0">
16
+ <svg xmlns="http://www.w3.org/2000/svg" class="fr-responsive-img fr-artwork" aria-hidden="true" width="160" height="200" viewBox="0 0 160 200">
17
+ <use class="fr-artwork-motif" href="/dist/artwork/background/ovoid.svg#artwork-motif"></use>
18
+ <use class="fr-artwork-background" href="/dist/artwork/background/ovoid.svg#artwork-background"></use>
19
+ <g transform="translate(40, 60)">
20
+ <use class="fr-artwork-decorative" href="/dist/artwork/pictograms/system/technical-error.svg#artwork-decorative"></use>
21
+ <use class="fr-artwork-minor" href="/dist/artwork/pictograms/system/technical-error.svg#artwork-minor"></use>
22
+ <use class="fr-artwork-major" href="/dist/artwork/pictograms/system/technical-error.svg#artwork-major"></use>
23
+ </g>
24
+ </svg>
25
+ </div>
26
+ </div>
27
+ </div>`;
28
+ }
29
+ }
30
+
31
+ ErrorTemplate.NAME = 'error';
32
+
33
+ export { ErrorTemplate };
File without changes