@gouvfr/dsfr-roller 1.0.7 → 1.0.8
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 +2 -2
- package/src/component/components/button.js +2 -2
- package/src/component/components/header.js +1 -1
- package/src/node/directive/{doc → components/accordion}/accordion-container-directive.js +4 -4
- package/src/node/directive/{doc → components/accordion}/accordions-group-container-directive.js +1 -1
- package/src/node/directive/{doc → components/button}/button-leaf-directive.js +3 -3
- package/src/node/directive/components/card/card-container-directive.js +114 -0
- package/src/node/directive/{doc → components/table}/table-container-directive.js +7 -7
- package/src/node/directive/{doc → components/tabs}/tab-container-directive.js +1 -1
- package/src/node/directive/{doc → components/tabs}/tabs-container-directive.js +1 -1
- package/src/node/directive/components/tile/tile-container-directive.js +135 -0
- package/src/node/directive/core/grid-container-directive.js +15 -0
- package/src/node/directive/doc/{anatomy-container-directive.js → guidance/anatomy-container-directive.js} +2 -2
- package/src/node/directive/doc/{guideline-container-directive.js → guidance/guideline-container-directive.js} +3 -3
- package/src/node/directive/doc/{guidelines-container-directive.js → guidance/guidelines-container-directive.js} +1 -1
- package/src/node/directive/doc/{pin-leaf-directive.js → guidance/pin-leaf-directive.js} +1 -1
- package/src/node/directive/doc/page-item-card-container-directive.js +53 -0
- package/src/node/directive/doc/page-item-list-leaf-directive.js +33 -0
- package/src/node/directive/doc/tab-navigation-container-directive.js +1 -1
- package/src/node/directive/doc/video-leaf-directive.js +44 -0
- package/src/node/directive/home/hp-analytics-container-directive.js +67 -0
- package/src/node/directive/home/hp-community-container-directive.js +78 -0
- package/src/node/directive/home/hp-community-tile-container-directive.js +57 -0
- package/src/node/directive/home/hp-discover-container-directive.js +41 -0
- package/src/node/directive/home/hp-discover-tile-container-directive.js +81 -0
- package/src/node/directive/home/hp-faq-container-directive.js +60 -0
- package/src/node/directive/home/hp-goals-container-directive.js +37 -0
- package/src/node/directive/home/hp-hero-container-directive.js +54 -0
- package/src/node/directive/home/hp-news-container-directive.js +53 -0
- package/src/node/directive/home/hp-showcase-card-container-directive.js +81 -0
- package/src/node/directive/home/hp-showcase-container-directive.js +55 -0
- package/src/node/directive/home/hp-slice-video-container-directive.js +246 -0
- package/src/node/generic/link-node.js +1 -1
- package/src/node/node-factory.js +45 -11
- package/src/page/head/head.js +3 -0
- package/src/page/head/resource.js +17 -0
- package/src/page/head/share.js +23 -5
- package/src/page/head/stylesheets.js +2 -1
- package/src/page/page.js +3 -1
- package/src/page/scripts/scripts.js +2 -1
- package/src/script/home/index.js +10 -0
- package/src/script/home/inject-svg.js +28 -0
- package/src/script/home/show-on-scroll.js +24 -0
- package/src/script/home/stop-video-on-close.js +20 -0
- package/src/script/main/cmp/index.js +72 -0
- package/src/script/main/cmp/tarteaucitron/config.js +34 -0
- package/src/script/main/cmp/tarteaucitron/lang.js +14 -0
- package/src/script/main/cmp/tarteaucitron/services.js +9142 -0
- package/src/script/main/cmp/tarteaucitron/tarteaucitron.js +3301 -0
- package/src/script/main/core/element.js +7 -3
- package/src/script/main/core/get-current-repo.js +6 -0
- package/src/script/main/core/get-query.js +12 -0
- package/src/script/main/core/replace-fragments.js +4 -0
- package/src/script/main/elements/pagination/index.js +23 -0
- package/src/script/main/elements/pagination/pagination-item.js +94 -0
- package/src/script/main/elements/pagination/pagination-list.js +131 -0
- package/src/script/main/elements/search-bar/index.js +64 -0
- package/src/script/main/elements/search-bar/results/result-item.js +13 -0
- package/src/script/main/elements/search-bar/results/results-button.js +20 -0
- package/src/script/main/elements/search-bar/results/results-dropdown.js +48 -0
- package/src/script/main/elements/search-bar/results/results-empty.js +21 -0
- package/src/script/main/elements/search-bar/results/results-list.js +19 -0
- package/src/script/main/index.js +11 -5
- package/src/script/main/minisearch/index.js +46 -0
- package/src/script/search/elements/result-card.js +46 -0
- package/src/script/search/elements/results-count.js +21 -0
- package/src/script/search/elements/results-empty.js +21 -0
- package/src/script/search/elements/results-list.js +25 -0
- package/src/script/search/elements/search-page.js +44 -0
- package/src/script/search/index.js +9 -0
- package/src/style/home/_analytics.scss +105 -0
- package/src/style/home/_community.scss +222 -0
- package/src/style/home/_discover.scss +208 -0
- package/src/style/home/_faq.scss +24 -0
- package/src/style/home/_goals.scss +53 -0
- package/src/style/home/_hero.scss +135 -0
- package/src/style/home/_news.scss +26 -0
- package/src/style/home/_showcase.scss +129 -0
- package/src/style/home/_slice-video.scss +168 -0
- package/src/style/home/index.scss +13 -0
- package/src/style/main/components/_dsfr-doc-pagination.scss +4 -0
- package/src/style/main/components/_dsfr-doc-searchbar.scss +54 -0
- package/src/style/main/components/_index.scss +3 -1
- package/src/style/search/_search-page.scss +0 -0
- package/src/style/search/index.scss +1 -0
- package/src/template/templates/home-template.js +4 -3
- package/src/template/templates/search-template.js +15 -8
- package/static/img/placeholder.16x9.png +0 -0
- package/src/script/main/elements/searchbar.js +0 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gouvfr/dsfr-roller",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
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.
|
|
59
|
+
"@gouvfr/dsfr-forge": "=1.0.8",
|
|
60
60
|
"@gouvfr/dsfr-publisher": "npm:@gouvfr/dsfr@1.13.1",
|
|
61
61
|
"deepmerge": "^4.3.1",
|
|
62
62
|
"ejs": "^3.1.10",
|
|
@@ -26,8 +26,8 @@ class Button extends Component {
|
|
|
26
26
|
blank,
|
|
27
27
|
self: !blank || this.data.self === 'true',
|
|
28
28
|
disabled: this.data.disabled === 'true',
|
|
29
|
-
classes: this.data.classes.split(','),
|
|
30
|
-
attributes: yaml.parse(this.data.attributes),
|
|
29
|
+
classes: typeof this.data.classes === 'string' ? this.data.classes.split(',') : this.data.classes,
|
|
30
|
+
attributes: typeof this.data.attributes === 'string' ? yaml.parse(this.data.attributes) : this.data.attributes,
|
|
31
31
|
icon: this.data.icon,
|
|
32
32
|
iconPlace: this.data['icon-place'],
|
|
33
33
|
}
|
|
@@ -21,7 +21,7 @@ class Header extends Component {
|
|
|
21
21
|
id: 'search',
|
|
22
22
|
modalId: 'search-modal',
|
|
23
23
|
input: { placeholder: this.data.search.label, label: this.data.search.label },
|
|
24
|
-
button: { id: 'search-button', label: this.data.search.label, title: this.data.search.title ?? this.data.search.label, attributes: { 'data-href': this.data.search.url } }
|
|
24
|
+
button: { id: 'search-button', label: this.data.search.label, title: this.data.search.title ?? this.data.search.label, markup: 'a', href: this.data.search.url, attributes: { 'data-href': this.data.search.url } }
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
return {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Node } from '
|
|
1
|
+
import { Node } from '../../../node.js'
|
|
2
2
|
import { log } from '@gouvfr/dsfr-forge';
|
|
3
3
|
|
|
4
4
|
class AccordionContainerDirective extends Node {
|
|
5
5
|
structure (data) {
|
|
6
|
-
if (!data.
|
|
6
|
+
if (!data.properties.id) {
|
|
7
7
|
log.warn('AccordionContainerDirective: missing "accordion id"');
|
|
8
8
|
return data;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const accordionId = data.
|
|
11
|
+
const accordionId = data.properties.id;
|
|
12
12
|
const titleChildren = data.children.filter(child => child?.data?.directiveLabel)?.[0]?.children;
|
|
13
13
|
const contentChildren = data.children.filter(child => !child?.data?.directiveLabel);
|
|
14
14
|
const titleType = titleChildren[0].value.startsWith('#') ? 'heading' : 'paragraph';
|
|
@@ -33,7 +33,7 @@ class AccordionContainerDirective extends Node {
|
|
|
33
33
|
classes: ['fr-accordion__btn'],
|
|
34
34
|
attributes: {
|
|
35
35
|
type: 'button',
|
|
36
|
-
'aria-expanded': data.
|
|
36
|
+
'aria-expanded': data.properties['aria-expanded'] || false,
|
|
37
37
|
'aria-controls': accordionId
|
|
38
38
|
},
|
|
39
39
|
children: titleChildren
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Node } from '
|
|
2
|
-
import { Button } from '
|
|
1
|
+
import { Node } from '../../../node.js';
|
|
2
|
+
import { Button } from '../../../../component/components/button.js';
|
|
3
3
|
|
|
4
4
|
class ButtonLeafDirective extends Node {
|
|
5
5
|
constructor (data) {
|
|
6
6
|
super(data);
|
|
7
|
-
this.button = new Button(this.data.
|
|
7
|
+
this.button = new Button(this.data.properties);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
structure (data) {
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { Node } from '../../../node.js'
|
|
2
|
+
|
|
3
|
+
class CardContainerDirective extends Node {
|
|
4
|
+
structure (data) {
|
|
5
|
+
this._data = data;
|
|
6
|
+
const horizontal = data.properties.horizontal === true;
|
|
7
|
+
const download = data.properties.download === true;
|
|
8
|
+
const image = Node.getImageChild(data);
|
|
9
|
+
const contentChildren = data.children.filter(child => !Node.getImageChild(child));
|
|
10
|
+
const contentTitle = contentChildren.find(child => child.type === 'heading');
|
|
11
|
+
const contentDescription = contentChildren.find(child => child.type === 'paragraph');
|
|
12
|
+
const hintStart = this.structureHintStart;
|
|
13
|
+
const hintEnd = this.structureHintEnd;
|
|
14
|
+
|
|
15
|
+
return super.structure({
|
|
16
|
+
type: 'htmlContainer',
|
|
17
|
+
tagName: 'div',
|
|
18
|
+
classes: ['fr-card', 'fr-enlarge-link', horizontal ? 'fr-card--horizontal' : '', download ? 'fr-card--download' : ''],
|
|
19
|
+
children: [
|
|
20
|
+
{
|
|
21
|
+
type: 'htmlContainer',
|
|
22
|
+
tagName: 'div',
|
|
23
|
+
classes: ['fr-card__body'],
|
|
24
|
+
children: [
|
|
25
|
+
{
|
|
26
|
+
type: 'htmlContainer',
|
|
27
|
+
tagName: 'div',
|
|
28
|
+
classes: ['fr-card__content'],
|
|
29
|
+
children: [
|
|
30
|
+
{
|
|
31
|
+
classes: ['fr-card__title'],
|
|
32
|
+
...contentTitle,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
classes: ['fr-card__desc'],
|
|
36
|
+
...contentDescription
|
|
37
|
+
},
|
|
38
|
+
hintStart,
|
|
39
|
+
hintEnd
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: 'htmlContainer',
|
|
46
|
+
tagName: 'div',
|
|
47
|
+
classes: ['fr-card__header'],
|
|
48
|
+
children: [
|
|
49
|
+
{
|
|
50
|
+
type: 'htmlContainer',
|
|
51
|
+
tagName: 'div',
|
|
52
|
+
classes: ['fr-card__img'],
|
|
53
|
+
children: [
|
|
54
|
+
{
|
|
55
|
+
classes: ['fr-responsive-img'],
|
|
56
|
+
...image
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
get structureHintStart() {
|
|
67
|
+
let structureHintStart = {};
|
|
68
|
+
if (this._data.properties.hintStart) {
|
|
69
|
+
structureHintStart = {
|
|
70
|
+
type: 'htmlContainer',
|
|
71
|
+
tagName: 'div',
|
|
72
|
+
classes: ['fr-card__start'],
|
|
73
|
+
children: [
|
|
74
|
+
{
|
|
75
|
+
type: 'paragraph',
|
|
76
|
+
classes: ['fr-card__detail'],
|
|
77
|
+
children: {
|
|
78
|
+
type: 'text',
|
|
79
|
+
value: this._data.properties.hintStart
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return structureHintStart;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
get structureHintEnd() {
|
|
89
|
+
let structureHintStart = {};
|
|
90
|
+
if (this._data.properties.hintEnd) {
|
|
91
|
+
structureHintStart = {
|
|
92
|
+
type: 'htmlContainer',
|
|
93
|
+
tagName: 'div',
|
|
94
|
+
classes: ['fr-card__end'],
|
|
95
|
+
children: [
|
|
96
|
+
{
|
|
97
|
+
type: 'paragraph',
|
|
98
|
+
classes: ['fr-card__detail'],
|
|
99
|
+
children: {
|
|
100
|
+
type: 'text',
|
|
101
|
+
value: this._data.properties.hintEnd
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return structureHintStart;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
CardContainerDirective.NAME = 'fr-card';
|
|
113
|
+
|
|
114
|
+
export { CardContainerDirective };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Node } from '
|
|
1
|
+
import { Node } from '../../../node.js';
|
|
2
2
|
import { log } from '@gouvfr/dsfr-forge';
|
|
3
3
|
|
|
4
4
|
const VALIGN = new Map([
|
|
@@ -9,7 +9,7 @@ const VALIGN = new Map([
|
|
|
9
9
|
class TableContainerDirective extends Node {
|
|
10
10
|
constructor (data) {
|
|
11
11
|
super(data);
|
|
12
|
-
this.
|
|
12
|
+
this.applyProperties(data.properties);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
structure (data) {
|
|
@@ -26,16 +26,16 @@ class TableContainerDirective extends Node {
|
|
|
26
26
|
return data;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
applyProperties (properties) {
|
|
30
30
|
const table = this.findDescendantsByType('table')[0];
|
|
31
31
|
if (!table) return;
|
|
32
32
|
|
|
33
|
-
if (
|
|
34
|
-
if (
|
|
33
|
+
if (properties.scroll === 'false') table.attributes.addClass('fr-table--no-scroll');
|
|
34
|
+
if (properties.caption === 'false') table.attributes.addClass('fr-table--no-caption');
|
|
35
35
|
|
|
36
36
|
const cellCount = table.children[0].children.length;
|
|
37
37
|
|
|
38
|
-
const valign =
|
|
38
|
+
const valign = properties.valign ? properties.valign.split(',') : null;
|
|
39
39
|
if (valign?.length === 1 && VALIGN.has(valign[0])) {
|
|
40
40
|
valign.length = cellCount;
|
|
41
41
|
valign.fill(valign[0]);
|
|
@@ -51,6 +51,6 @@ class TableContainerDirective extends Node {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
TableContainerDirective.NAME = 'dsfr-doc-table';
|
|
54
|
+
TableContainerDirective.NAME = 'dsfr-doc-table'; //TODO: fr-table ?
|
|
55
55
|
|
|
56
56
|
export { TableContainerDirective };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Node } from '../../../node.js'
|
|
2
|
+
|
|
3
|
+
class TileContainerDirective extends Node {
|
|
4
|
+
structure (data) {
|
|
5
|
+
const col = data.properties.col || '';
|
|
6
|
+
const colSm = data.properties.colSm || '';
|
|
7
|
+
const colMd = data.properties.colMd || '';
|
|
8
|
+
const colLg = data.properties.colLg || '';
|
|
9
|
+
|
|
10
|
+
return super.structure(
|
|
11
|
+
col || colSm || colMd || colLg ? {
|
|
12
|
+
type: 'htmlContainer',
|
|
13
|
+
tagName: 'div',
|
|
14
|
+
classes: [
|
|
15
|
+
col ? `fr-col-${col}` : '',
|
|
16
|
+
colSm ? `fr-col-sm-${colSm}` : '',
|
|
17
|
+
colMd ? `fr-col-md-${colMd}` : '',
|
|
18
|
+
colLg ? `fr-col-lg-${colLg}` : ''
|
|
19
|
+
],
|
|
20
|
+
children: [this.structureTile(data)]
|
|
21
|
+
} : this.structureTile(data)
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
structureTile(data) {
|
|
26
|
+
const noBorder = data.properties.noBorder || false;
|
|
27
|
+
const pictogramUrl = data.properties.pictogram;
|
|
28
|
+
const image = Node.getImageChild(data);
|
|
29
|
+
const contentChildren = data.children.filter(child => !Node.getImageChild(child));
|
|
30
|
+
const title = contentChildren[0];
|
|
31
|
+
const description = contentChildren[1];
|
|
32
|
+
const details = contentChildren[2];
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
type: 'htmlContainer',
|
|
36
|
+
tagName: 'div',
|
|
37
|
+
classes: ['fr-tile', noBorder ? 'fr-tile--no-border' : ''],
|
|
38
|
+
children: [
|
|
39
|
+
{
|
|
40
|
+
type: 'htmlContainer',
|
|
41
|
+
tagName: 'div',
|
|
42
|
+
classes: ['fr-tile__body'],
|
|
43
|
+
children: [
|
|
44
|
+
{
|
|
45
|
+
type: 'htmlContainer',
|
|
46
|
+
tagName: 'div',
|
|
47
|
+
classes: ['fr-tile__content'],
|
|
48
|
+
children: [
|
|
49
|
+
{
|
|
50
|
+
classes: ['fr-tile__title'],
|
|
51
|
+
...title
|
|
52
|
+
},
|
|
53
|
+
description ? {
|
|
54
|
+
classes: ['fr-tile__desc'],
|
|
55
|
+
...description
|
|
56
|
+
} : {},
|
|
57
|
+
details ? {
|
|
58
|
+
classes: ['fr-tile__detail'],
|
|
59
|
+
...details
|
|
60
|
+
} : {},
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
pictogramUrl || image ? {
|
|
66
|
+
type: 'htmlContainer',
|
|
67
|
+
tagName: 'div',
|
|
68
|
+
classes: ['fr-tile__header'],
|
|
69
|
+
children: [
|
|
70
|
+
pictogramUrl ? {
|
|
71
|
+
type: 'htmlContainer',
|
|
72
|
+
tagName: 'div',
|
|
73
|
+
classes: ['fr-tile__pictogram'],
|
|
74
|
+
children: [
|
|
75
|
+
{
|
|
76
|
+
type: 'htmlContainer',
|
|
77
|
+
classes: ['fr-artwork'],
|
|
78
|
+
tagName: 'svg',
|
|
79
|
+
attributes: {
|
|
80
|
+
'aria-hidden': true,
|
|
81
|
+
viewBox: '0 0 80 80',
|
|
82
|
+
width: '80px',
|
|
83
|
+
height: '80px'
|
|
84
|
+
},
|
|
85
|
+
children: [
|
|
86
|
+
{
|
|
87
|
+
type: 'htmlContainer',
|
|
88
|
+
classes: ['fr-artwork-decorative'],
|
|
89
|
+
tagName: 'use',
|
|
90
|
+
attributes: {
|
|
91
|
+
href: pictogramUrl + '#artwork-decorative'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: 'htmlContainer',
|
|
96
|
+
classes: ['fr-artwork-minor'],
|
|
97
|
+
tagName: 'use',
|
|
98
|
+
attributes: {
|
|
99
|
+
href: pictogramUrl + '#artwork-minor'
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
type: 'htmlContainer',
|
|
104
|
+
classes: ['fr-artwork-major'],
|
|
105
|
+
tagName: 'use',
|
|
106
|
+
attributes: {
|
|
107
|
+
href: pictogramUrl + '#artwork-major'
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
} : {},
|
|
114
|
+
image ? {
|
|
115
|
+
type: 'htmlContainer',
|
|
116
|
+
tagName: 'div',
|
|
117
|
+
classes: ['fr-tile__img'],
|
|
118
|
+
children: [
|
|
119
|
+
{
|
|
120
|
+
classe: ['fr-responsive-img'],
|
|
121
|
+
...image
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
} : {},
|
|
125
|
+
]
|
|
126
|
+
} : {},
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
TileContainerDirective.NAME = 'fr-tile';
|
|
134
|
+
|
|
135
|
+
export { TileContainerDirective };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Node } from '../../node.js'
|
|
2
|
+
|
|
3
|
+
class GridContainerDirective extends Node {
|
|
4
|
+
constructor (data) {
|
|
5
|
+
super(data, 'div');
|
|
6
|
+
this.attributes.addClass('fr-grid-row');
|
|
7
|
+
if (data.properties.gutters !== false) this.attributes.addClass('fr-grid-row--gutters');
|
|
8
|
+
if (data.properties.alignV) this.attributes.addClass(`fr-grid-row--${data.properties.alignV}`);
|
|
9
|
+
if (data.properties.alignH) this.attributes.addClass(`fr-grid-row--${data.properties.alignH}`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
GridContainerDirective.NAME = 'fr-grid';
|
|
14
|
+
|
|
15
|
+
export { GridContainerDirective };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Node } from '
|
|
1
|
+
import { Node } from '../../../node.js'
|
|
2
2
|
import { log } from '@gouvfr/dsfr-forge';
|
|
3
3
|
|
|
4
4
|
class AnatomyContainerDirective extends Node {
|
|
5
5
|
structure (data) {
|
|
6
6
|
const image = Node.getImageChild(data);
|
|
7
|
-
const col = data.
|
|
7
|
+
const col = data.properties?.col ?? 12;
|
|
8
8
|
|
|
9
9
|
if (!image) {
|
|
10
10
|
log.warn('GuidelineContainerDirective: missing image');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Node } from '
|
|
1
|
+
import { Node } from '../../../node.js'
|
|
2
2
|
import { log } from '@gouvfr/dsfr-forge';
|
|
3
3
|
|
|
4
4
|
class GuidelineContainerDirective extends Node {
|
|
@@ -10,8 +10,8 @@ class GuidelineContainerDirective extends Node {
|
|
|
10
10
|
return data;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const valid = data.
|
|
14
|
-
const col = data.
|
|
13
|
+
const valid = data.properties.valid.toLowerCase() === 'true';
|
|
14
|
+
const col = data.properties.col || '12';
|
|
15
15
|
const description = data.children.filter(child => {
|
|
16
16
|
switch (true) {
|
|
17
17
|
case child?.data?.directiveLabel === true:
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CardContainerDirective } from '../components/card/card-container-directive.js';
|
|
2
|
+
|
|
3
|
+
class PageItemCardContainerDirective extends CardContainerDirective {
|
|
4
|
+
structure (data) {
|
|
5
|
+
data.properties = {
|
|
6
|
+
horizontal: false,
|
|
7
|
+
download: false,
|
|
8
|
+
...data.properties,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
data.children = [
|
|
12
|
+
{
|
|
13
|
+
type: 'image',
|
|
14
|
+
url: data.cover ?? '/static/img/placeholder.16x9.png',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: 'heading',
|
|
18
|
+
depth: 2,
|
|
19
|
+
children: [
|
|
20
|
+
{
|
|
21
|
+
type: 'link',
|
|
22
|
+
url: data.url,
|
|
23
|
+
children: [
|
|
24
|
+
{
|
|
25
|
+
type: 'text',
|
|
26
|
+
value: data.text
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
if (data.shortDescription || data.excerpt) {
|
|
35
|
+
data.children.push({
|
|
36
|
+
type: 'paragraph',
|
|
37
|
+
children: [
|
|
38
|
+
{
|
|
39
|
+
type: 'text',
|
|
40
|
+
value: data.shortDescription || data.excerpt,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return super.structure(data);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
PageItemCardContainerDirective.NAME = 'dsfr-doc-page-item-card';
|
|
52
|
+
|
|
53
|
+
export { PageItemCardContainerDirective };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Node } from '../../node.js';
|
|
2
|
+
|
|
3
|
+
class PageItemListLeafDirective extends Node {
|
|
4
|
+
structure (data) {
|
|
5
|
+
const children = data.items.map((item) => ({
|
|
6
|
+
type: 'htmlContainer',
|
|
7
|
+
tagName: 'div',
|
|
8
|
+
classes: ['fr-col-12', 'fr-col-sm-6', 'fr-col-lg-4'],
|
|
9
|
+
children: [
|
|
10
|
+
{
|
|
11
|
+
...item,
|
|
12
|
+
type: 'containerDirective',
|
|
13
|
+
name: data.itemDirectiveName ?? 'dsfr-doc-page-item-card'
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
return super.structure({
|
|
19
|
+
type: 'htmlContainer',
|
|
20
|
+
tagName: 'div',
|
|
21
|
+
classes: [
|
|
22
|
+
'fr-grid-row',
|
|
23
|
+
'fr-grid-row--gutters',
|
|
24
|
+
'fr-mb-12v',
|
|
25
|
+
],
|
|
26
|
+
children: children,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
PageItemListLeafDirective.NAME = 'dsfr-doc-page-item-list';
|
|
32
|
+
|
|
33
|
+
export { PageItemListLeafDirective };
|
|
@@ -4,7 +4,7 @@ import { HtmlNode } from '../../generic/html-node.js';
|
|
|
4
4
|
class TabNavigationContainerDirective extends Node {
|
|
5
5
|
constructor(data) {
|
|
6
6
|
super(data);
|
|
7
|
-
this._id = data.
|
|
7
|
+
this._id = data.properties.id || 'dsfr-doc-tab-navigation--collapse';
|
|
8
8
|
const list = this.findDescendantsByType('list')[0];
|
|
9
9
|
list.attributes.setAttribute('role', 'tablist');
|
|
10
10
|
const items = list.findDescendantsByType('listItem');
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Node } from '../../node.js';
|
|
2
|
+
|
|
3
|
+
class VideoLeafDirective extends Node {
|
|
4
|
+
structure(data) {
|
|
5
|
+
let videoAttributes = {};
|
|
6
|
+
switch (data.properties.provider) {
|
|
7
|
+
case 'youtube':
|
|
8
|
+
videoAttributes = {
|
|
9
|
+
rel: 0,
|
|
10
|
+
controls: 1,
|
|
11
|
+
autoplay: 0,
|
|
12
|
+
mute: 0,
|
|
13
|
+
loop: 0,
|
|
14
|
+
loading: 1,
|
|
15
|
+
};
|
|
16
|
+
break;
|
|
17
|
+
|
|
18
|
+
case 'vimeo':
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
data.attributes = {
|
|
23
|
+
...(data.attributes || {}),
|
|
24
|
+
...videoAttributes,
|
|
25
|
+
'data-videoid': data.properties.videoId,
|
|
26
|
+
width: data.properties.width || '100%',
|
|
27
|
+
height: data.properties.height || '100%',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return super.structure(data);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
constructor(data) {
|
|
34
|
+
super(data, 'div');
|
|
35
|
+
|
|
36
|
+
this.attributes.addClass('fr-responsive-vid');
|
|
37
|
+
if (data.properties.provider)
|
|
38
|
+
this.attributes.addClass(`${data.properties.provider}_player`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
VideoLeafDirective.NAME = 'dsfr-doc-video';
|
|
43
|
+
|
|
44
|
+
export { VideoLeafDirective };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Node } from '../../node.js';
|
|
2
|
+
|
|
3
|
+
class HpAnalyticsContainerDirective extends Node {
|
|
4
|
+
constructor (data) {
|
|
5
|
+
super(data);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
structure (data) {
|
|
9
|
+
const title = data.children[0];
|
|
10
|
+
const description = data.children[1];
|
|
11
|
+
const link = data.children[2];
|
|
12
|
+
|
|
13
|
+
return super.structure({
|
|
14
|
+
type: 'htmlContainer',
|
|
15
|
+
tagName: 'div',
|
|
16
|
+
classes: ['dsfr-doc-hp-analytics', 'fr-background-alt--blue-france'],
|
|
17
|
+
children: [
|
|
18
|
+
{
|
|
19
|
+
type: 'htmlContainer',
|
|
20
|
+
tagName: 'div',
|
|
21
|
+
classes: ['fr-container'],
|
|
22
|
+
children: [
|
|
23
|
+
{
|
|
24
|
+
type: 'htmlContainer',
|
|
25
|
+
tagName: 'div',
|
|
26
|
+
classes: ['dsfr-doc-hp-analytics__img'],
|
|
27
|
+
children: [
|
|
28
|
+
{
|
|
29
|
+
type: 'image',
|
|
30
|
+
classes: ['fr-responsive-img'],
|
|
31
|
+
tagName: 'img',
|
|
32
|
+
attributes: {
|
|
33
|
+
src: data.imgUrl,
|
|
34
|
+
alt: ''
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: 'htmlContainer',
|
|
41
|
+
tagName: 'div',
|
|
42
|
+
classes: ['dsfr-doc-hp-analytics__content'],
|
|
43
|
+
children: [
|
|
44
|
+
{
|
|
45
|
+
classes: ['dsfr-doc-hp-analytics__title'],
|
|
46
|
+
...title
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
classes: ['dsfr-doc-hp-analytics__desc'],
|
|
50
|
+
...description
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
classes: ['dsfr-doc-hp-analytics__link', 'fr-btn', 'fr-btn--secondary'],
|
|
54
|
+
...link.children[0],
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
HpAnalyticsContainerDirective.NAME = 'hp-analytics';
|
|
66
|
+
|
|
67
|
+
export { HpAnalyticsContainerDirective };
|