@gouvfr/dsfr-roller 1.0.44 → 1.0.46

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.44",
3
+ "version": "1.0.46",
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.44",
59
+ "@gouvfr/dsfr-forge": "=1.0.46",
60
60
  "@gouvfr/dsfr-publisher": "npm:@gouvfr/dsfr@1.14.0",
61
61
  "deepmerge": "^4.3.1",
62
62
  "ejs": "^3.1.10",
@@ -1,5 +1,6 @@
1
1
  class Edit {
2
2
  constructor(data) {
3
+ console.debug('Edit', data);
3
4
  this._node = {
4
5
  type: 'htmlContainer',
5
6
  tagName: 'div',
@@ -33,8 +34,8 @@ class Edit {
33
34
  {
34
35
  type: 'link',
35
36
  classes: ['fr-link'],
37
+ url: data.editUrl,
36
38
  attributes: {
37
- href: data.editUrl,
38
39
  target: '_blank',
39
40
  title: `${data.link} - ${data.blankLabel}`
40
41
  },
@@ -3,6 +3,7 @@ import { Canonical } from './canonical.js';
3
3
  import { Stylesheets } from './stylesheets.js';
4
4
  import { Renderable } from '../../core/renderable.js';
5
5
  import { Favicon } from './favicon.js';
6
+ import { Scheme } from './scheme.js';
6
7
  import { Resource } from './resource.js';
7
8
  import { Share } from './share.js';
8
9
  class Head extends Renderable {
@@ -12,9 +13,10 @@ class Head extends Renderable {
12
13
  this._title = new Title(data);
13
14
  this._canonical = new Canonical(data);
14
15
  this._favicon = new Favicon(data);
15
- this._resource = new Resource(data);
16
16
  this._share = new Share(data);
17
+ this._scheme = new Scheme(data);
17
18
  this._stylesheets = new Stylesheets(data);
19
+ this._resource = new Resource(data);
18
20
  }
19
21
 
20
22
  async render () {
@@ -24,9 +26,11 @@ class Head extends Renderable {
24
26
  <meta charset="utf-8">
25
27
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
26
28
  <meta name="format-detection" content="telephone=no,date=no,address=no,email=no,url=no">
29
+ <meta name="generator" content="@gouvfr/dsfr-roller">
27
30
  ${await this._canonical.render()}
28
31
  ${await this._favicon.render()}
29
32
  ${await this._share.render()}
33
+ ${await this._scheme.render()}
30
34
  ${await this._stylesheets.render()}
31
35
  ${await this._resource.render()}
32
36
  </head>
@@ -6,7 +6,7 @@ class Share extends Renderable {
6
6
  this._resource = data.resource || {};
7
7
  this._title = `${data.title} - ${this._resource?.meta?.title}`;
8
8
  this._description = data.description || this._resource?.meta?.description;
9
- this._cover = data.cover || '/static/img/placeholder.16x9.png';
9
+ this._cover = data.cover || '/static/img/cover.png';
10
10
  this._url = this._resource?.meta?.baseUrl + data.url;
11
11
  this._locale = `${data.lang}_${data.lang.toUpperCase()}`;
12
12
  }
package/src/page/html.js CHANGED
@@ -3,7 +3,6 @@ import { Footer } from '../component/components/footer.js';
3
3
  import { DisplayModal } from '../component/components/display-modal.js';
4
4
  import { Skiplink } from '../component/components/skiplink.js';
5
5
  import { CustomHeader } from './body/custom-header.js';
6
- import { Scheme } from './body/scheme.js';
7
6
  import { Main } from './body/main.js';
8
7
  import { Scripts } from './scripts/scripts.js';
9
8
  import { AnalyticsConfig } from './scripts/analytics-config.js';
@@ -14,7 +13,6 @@ class Html extends HtmlRenderable {
14
13
  super(data);
15
14
 
16
15
  this._head = new Head(data);
17
- this._scheme = new Scheme(data);
18
16
  this._skiplink = new Skiplink(data);
19
17
  this._header = new CustomHeader(data);
20
18
  this._main = new Main(data);
@@ -29,7 +27,6 @@ class Html extends HtmlRenderable {
29
27
  <html lang="${this.data.lang}" data-fr-theme>
30
28
  ${await this._head.render()}
31
29
  <body>
32
- ${await this._scheme.render()}
33
30
  ${await this._skiplink.render()}
34
31
  ${await this._header.render()}
35
32
  ${await this._main.render()}
@@ -1,4 +1,5 @@
1
1
  import { Renderable } from '../../core/renderable.js';
2
+ import ENV from '../../../env/prod/env.json' with { type: "json" };
2
3
 
3
4
  class AnalyticsConfig extends Renderable {
4
5
  constructor (data) {
@@ -18,7 +19,11 @@ class AnalyticsConfig extends Renderable {
18
19
  if (xhr.status === 200) {
19
20
  const env = JSON.parse(xhr.responseText);
20
21
  const analytics = ${JSON.stringify(this._analytics).replace('"$(1)"', 'env.domain').replace('"$(2)"', 'env.env')};
21
- window.dsfr = { analytics };
22
+ const dsfr = { analytics };
23
+ if (env.env === ENV.env) {
24
+ dsfr.production = true;
25
+ }
26
+ window.dsfr = dsfr;
22
27
  } else {
23
28
  console.error('Failed to load JSON:', xhr.status, xhr.statusText);
24
29
  }
File without changes