@dso-toolkit/core 34.2.1 → 35.0.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 (85) hide show
  1. package/dist/cjs/dso-autosuggest.cjs.entry.js +5 -1
  2. package/dist/cjs/dso-image-overlay.cjs.entry.js +62 -0
  3. package/dist/cjs/dso-ozon-content.cjs.entry.js +281 -423
  4. package/dist/cjs/dso-toolkit.cjs.js +1 -1
  5. package/dist/cjs/dso-viewer-grid.cjs.entry.js +5 -711
  6. package/dist/cjs/focus-trap.esm-8d3e3fb6.js +712 -0
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/collection/collection-manifest.json +1 -0
  9. package/dist/collection/components/autosuggest/autosuggest.js +6 -2
  10. package/dist/collection/components/highlight-box/highlight-box.template.js +4 -1
  11. package/dist/collection/components/image-overlay/image-overlay.css +263 -0
  12. package/dist/collection/components/image-overlay/image-overlay.js +72 -0
  13. package/dist/collection/components/image-overlay/image-overlay.template.js +7 -0
  14. package/dist/collection/components/ozon-content/nodes/al.node.js +13 -0
  15. package/dist/collection/components/ozon-content/nodes/document.node.js +9 -0
  16. package/dist/collection/components/ozon-content/nodes/ext-ref.node.js +15 -0
  17. package/dist/collection/components/ozon-content/nodes/fallback.node.js +10 -0
  18. package/dist/collection/components/ozon-content/nodes/illustratie.node.js +13 -0
  19. package/dist/collection/components/ozon-content/nodes/inhoud.node.js +14 -0
  20. package/dist/collection/components/ozon-content/nodes/inline.nodes.js +21 -0
  21. package/dist/collection/components/ozon-content/nodes/int-ref.node.js +26 -0
  22. package/dist/collection/components/ozon-content/nodes/noot.node.js +27 -0
  23. package/dist/collection/components/ozon-content/nodes/table.node/colspec/colspec-mapper.js +39 -0
  24. package/dist/collection/components/ozon-content/nodes/table.node/colspec/colspec.interface.js +2 -0
  25. package/dist/collection/components/ozon-content/nodes/table.node/index.js +1 -0
  26. package/dist/collection/components/ozon-content/nodes/table.node/table-cell.js +25 -0
  27. package/dist/collection/components/ozon-content/nodes/table.node/table-colgroup.js +4 -0
  28. package/dist/collection/components/ozon-content/nodes/table.node/table-rows.js +5 -0
  29. package/dist/collection/components/ozon-content/nodes/table.node/table.node.js +32 -0
  30. package/dist/collection/components/ozon-content/nodes/text.node.js +9 -0
  31. package/dist/collection/components/ozon-content/ozon-content-context.interface.js +1 -0
  32. package/dist/collection/components/ozon-content/ozon-content-mapper.js +76 -0
  33. package/dist/collection/components/ozon-content/ozon-content-node-context.interface.js +1 -0
  34. package/dist/collection/components/ozon-content/ozon-content-node-state.interface.js +1 -0
  35. package/dist/collection/components/ozon-content/ozon-content-node.interface.js +1 -0
  36. package/dist/collection/components/ozon-content/ozon-content.css +15 -7
  37. package/dist/collection/components/ozon-content/ozon-content.js +21 -33
  38. package/dist/collection/components/viewer-grid/viewer-grid.css +30 -2
  39. package/dist/custom-elements/index.d.ts +6 -0
  40. package/dist/custom-elements/index.js +3022 -3103
  41. package/dist/dso-toolkit/dso-toolkit.css +1 -1
  42. package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
  43. package/dist/dso-toolkit/{p-de3ab027.entry.js → p-225bbb28.entry.js} +1 -5
  44. package/dist/dso-toolkit/p-44905fb1.js +5 -0
  45. package/dist/dso-toolkit/p-c6f467b3.entry.js +1 -0
  46. package/dist/dso-toolkit/p-f193c258.entry.js +1 -0
  47. package/dist/esm/dso-autosuggest.entry.js +5 -1
  48. package/dist/esm/dso-image-overlay.entry.js +58 -0
  49. package/dist/esm/dso-ozon-content.entry.js +282 -424
  50. package/dist/esm/dso-toolkit.js +1 -1
  51. package/dist/esm/dso-viewer-grid.entry.js +3 -709
  52. package/dist/esm/focus-trap.esm-299989f2.js +710 -0
  53. package/dist/esm/loader.js +1 -1
  54. package/dist/types/components/autosuggest/autosuggest.d.ts +15 -1
  55. package/dist/types/components/image-overlay/image-overlay.d.ts +15 -0
  56. package/dist/types/components/image-overlay/image-overlay.template.d.ts +2 -0
  57. package/dist/types/components/ozon-content/nodes/al.node.d.ts +6 -0
  58. package/dist/types/components/ozon-content/nodes/document.node.d.ts +6 -0
  59. package/dist/types/components/ozon-content/nodes/ext-ref.node.d.ts +6 -0
  60. package/dist/types/components/ozon-content/nodes/fallback.node.d.ts +6 -0
  61. package/dist/types/components/ozon-content/nodes/illustratie.node.d.ts +5 -0
  62. package/dist/types/components/ozon-content/nodes/inhoud.node.d.ts +6 -0
  63. package/dist/types/components/ozon-content/nodes/inline.nodes.d.ts +6 -0
  64. package/dist/types/components/ozon-content/nodes/int-ref.node.d.ts +6 -0
  65. package/dist/types/components/ozon-content/nodes/noot.node.d.ts +8 -0
  66. package/dist/types/components/ozon-content/nodes/table.node/colspec/colspec-mapper.d.ts +2 -0
  67. package/dist/types/components/ozon-content/nodes/table.node/colspec/colspec.interface.d.ts +10 -0
  68. package/dist/types/components/ozon-content/nodes/table.node/index.d.ts +1 -0
  69. package/dist/types/components/ozon-content/nodes/table.node/table-cell.d.ts +8 -0
  70. package/dist/types/components/ozon-content/nodes/table.node/table-colgroup.d.ts +5 -0
  71. package/dist/types/components/ozon-content/nodes/table.node/table-rows.d.ts +8 -0
  72. package/dist/types/components/ozon-content/nodes/table.node/table.node.d.ts +7 -0
  73. package/dist/types/components/ozon-content/nodes/text.node.d.ts +5 -0
  74. package/dist/types/components/ozon-content/ozon-content-context.interface.d.ts +8 -0
  75. package/dist/types/components/ozon-content/ozon-content-mapper.d.ts +12 -0
  76. package/dist/types/components/ozon-content/ozon-content-node-context.interface.d.ts +8 -0
  77. package/dist/types/components/ozon-content/ozon-content-node-state.interface.d.ts +3 -0
  78. package/dist/types/components/ozon-content/ozon-content-node.interface.d.ts +8 -0
  79. package/dist/types/components/ozon-content/ozon-content.d.ts +8 -10
  80. package/dist/types/components/ozon-content/ozon-content.interfaces.d.ts +2 -2
  81. package/dist/types/components.d.ts +19 -6
  82. package/package.json +2 -2
  83. package/dist/collection/components/ozon-content/ozon-content.transformer.js +0 -105
  84. package/dist/dso-toolkit/p-20856f91.entry.js +0 -1
  85. package/dist/types/components/ozon-content/ozon-content.transformer.d.ts +0 -15
@@ -0,0 +1,32 @@
1
+ import { h } from '@stencil/core';
2
+ import { mapColspecs } from './colspec/colspec-mapper';
3
+ import { Colgroup } from './table-colgroup';
4
+ import { Rows } from './table-rows';
5
+ function mapData(node) {
6
+ var _a, _b, _c;
7
+ const tgroup = node.querySelector(':scope > tgroup');
8
+ const colAttribute = (_a = tgroup === null || tgroup === void 0 ? void 0 : tgroup.getAttribute('cols')) !== null && _a !== void 0 ? _a : undefined;
9
+ const columnCount = colAttribute ? parseInt(colAttribute, 10) : undefined;
10
+ return {
11
+ caption: (_c = (_b = node.querySelector(':scope > title')) === null || _b === void 0 ? void 0 : _b.textContent) !== null && _c !== void 0 ? _c : undefined,
12
+ colspecs: tgroup && columnCount ? mapColspecs(columnCount, tgroup.querySelectorAll(':scope > colspec')) : undefined,
13
+ headRows: Array.from(node.querySelectorAll(':scope > tgroup > thead > row')),
14
+ bodyRows: Array.from(node.querySelectorAll(':scope > tgroup > tbody > row'))
15
+ };
16
+ }
17
+ export class OzonContentTableNode {
18
+ constructor() {
19
+ this.name = 'table';
20
+ this.handles = ['title', 'tgroup', 'colspec', 'thead', 'tbody', 'row', 'cell'];
21
+ }
22
+ render(node, context) {
23
+ const { caption, colspecs, headRows, bodyRows } = mapData(node);
24
+ return (h("table", { class: "table" },
25
+ caption && (h("caption", null, caption)),
26
+ colspecs && (h(Colgroup, { colspecs: colspecs })),
27
+ headRows.length > 0 && (h("thead", null,
28
+ h(Rows, { rows: headRows, colspecs: colspecs, context: context }))),
29
+ bodyRows.length > 0 && (h("tbody", null,
30
+ h(Rows, { rows: bodyRows, colspecs: colspecs, context: context })))));
31
+ }
32
+ }
@@ -0,0 +1,9 @@
1
+ import { Fragment, h } from '@stencil/core';
2
+ export class OzonContentTextNode {
3
+ constructor() {
4
+ this.name = '#text';
5
+ }
6
+ render(node) {
7
+ return h(Fragment, null, node.textContent);
8
+ }
9
+ }
@@ -0,0 +1,76 @@
1
+ import { Fragment, h } from '@stencil/core';
2
+ import { OzonContentAlNode } from './nodes/al.node';
3
+ import { OzonContentDocumentNode } from './nodes/document.node';
4
+ import { OzonContentExtRefNode } from './nodes/ext-ref.node';
5
+ import { OzonContentIllustratieNode } from './nodes/illustratie.node';
6
+ import { OzonContentInhoudNode } from './nodes/inhoud.node';
7
+ import { OzonContentInlineNodes } from './nodes/inline.nodes';
8
+ import { OzonContentIntRefNode } from './nodes/int-ref.node';
9
+ import { OzonContentNootNode } from './nodes/noot.node';
10
+ import { OzonContentTableNode } from './nodes/table.node';
11
+ import { OzonContentTextNode } from './nodes/text.node';
12
+ import { OzonContentFallbackNode } from './nodes/fallback.node';
13
+ export class Mapper {
14
+ constructor() {
15
+ this.mappers = [
16
+ new OzonContentTextNode(),
17
+ new OzonContentDocumentNode(),
18
+ new OzonContentInhoudNode(),
19
+ new OzonContentIntRefNode(),
20
+ new OzonContentExtRefNode(),
21
+ new OzonContentAlNode(),
22
+ new OzonContentInlineNodes(),
23
+ new OzonContentIllustratieNode(),
24
+ new OzonContentNootNode(),
25
+ new OzonContentTableNode()
26
+ ];
27
+ this.skip = this.mappers.reduce((t, m) => {
28
+ if (m.handles) {
29
+ t.push(...m.handles);
30
+ }
31
+ return t;
32
+ }, []);
33
+ this.fallbackNode = new OzonContentFallbackNode();
34
+ this.domParser = new DOMParser();
35
+ }
36
+ findMapper(name) {
37
+ var _a;
38
+ if (this.skip.includes(name)) {
39
+ return undefined;
40
+ }
41
+ return (_a = this.mappers.find(m => {
42
+ if (Array.isArray(m.name)) {
43
+ return m.name.includes(name);
44
+ }
45
+ return m.name === name;
46
+ })) !== null && _a !== void 0 ? _a : this.fallbackNode;
47
+ }
48
+ mapNodeToJsx(node, context, path) {
49
+ var _a, _b;
50
+ if (node instanceof NodeList) {
51
+ return h(Fragment, null, Array.from(node).map(n => this.mapNodeToJsx(n, context, path)));
52
+ }
53
+ if (Array.isArray(node)) {
54
+ return h(Fragment, null, node.map(n => this.mapNodeToJsx(n, context, path)));
55
+ }
56
+ const nodeName = node instanceof Element ? node.localName : node.nodeName;
57
+ const mapper = this.findMapper(nodeName);
58
+ const identity = (_a = mapper === null || mapper === void 0 ? void 0 : mapper.identify) === null || _a === void 0 ? void 0 : _a.call(mapper, node);
59
+ const state = identity ? context.state[identity] : undefined;
60
+ const setState = identity ? (state) => context.setState(Object.assign(Object.assign({}, context.state), { [identity]: state })) : undefined;
61
+ return (_b = mapper === null || mapper === void 0 ? void 0 : mapper.render(node, {
62
+ mapNodeToJsx: n => this.mapNodeToJsx(n, context, [...path, node]),
63
+ emitAnchorClick: context.emitAnchorClick,
64
+ setState,
65
+ state,
66
+ path
67
+ })) !== null && _b !== void 0 ? _b : h(Fragment, null);
68
+ }
69
+ transform(xml, context) {
70
+ if (!this.cache || this.cache.xml !== xml) {
71
+ this.cache = { xml, document: this.domParser.parseFromString(xml, 'text/xml') };
72
+ }
73
+ const xmlDocument = this.cache.document;
74
+ return this.mapNodeToJsx(xmlDocument.getRootNode(), context, []);
75
+ }
76
+ }
@@ -1,22 +1,22 @@
1
- dso-ozon-content {
1
+ :host {
2
2
  display: block;
3
3
  }
4
4
 
5
5
  .noot {
6
6
  text-decoration: none;
7
7
  }
8
- .noot:not(.dso-open) + .od-Al {
8
+ .noot:not(.dso-open) + * {
9
9
  display: none;
10
10
  }
11
- .noot.dso-open + .od-Al {
11
+ .noot.dso-open + * {
12
12
  display: block;
13
13
  }
14
- .noot + .od-Al {
14
+ .noot + * {
15
15
  margin: 4px 0;
16
16
  padding: 8px 32px 8px 8px;
17
17
  position: relative;
18
18
  }
19
- .noot + .od-Al > a {
19
+ .noot + * > a {
20
20
  display: block;
21
21
  height: 24px;
22
22
  position: absolute;
@@ -25,7 +25,7 @@ dso-ozon-content {
25
25
  top: 0;
26
26
  width: 24px;
27
27
  }
28
- .noot + .od-Al > a::before {
28
+ .noot + * > a::before {
29
29
  background: var(--dso-icon, var(--di-times-zwart)) no-repeat;
30
30
  background-position: center;
31
31
  background-size: cover;
@@ -35,10 +35,18 @@ dso-ozon-content {
35
35
  content: "";
36
36
  display: block;
37
37
  }
38
- .noot + .od-Al {
38
+ .noot + * {
39
39
  background-color: #ebf3e6;
40
40
  }
41
41
 
42
+ span[role=paragraph] {
43
+ display: block;
44
+ }
45
+
46
+ .fallback {
47
+ display: block;
48
+ }
49
+
42
50
  .od-Term {
43
51
  font-weight: 700;
44
52
  }
@@ -1,29 +1,21 @@
1
- import { h, Event, Component, Prop, Listen } from '@stencil/core';
2
- import { OzonContentTransformer } from './ozon-content.transformer';
1
+ import { Component, Event, Prop, State, } from '@stencil/core';
2
+ import { Mapper } from './ozon-content-mapper';
3
3
  export class OzonContent {
4
- handleClick(event) {
5
- this.transformer.handleClickEvent(event);
6
- }
7
- componentWillLoad() {
8
- this.transformer = new OzonContentTransformer(this.anchorClick);
9
- }
10
- componentWillRender() {
11
- this.transformer.setContent(this.content);
4
+ constructor() {
5
+ this.state = {};
6
+ this.mapper = new Mapper();
12
7
  }
13
8
  render() {
14
- return h("div", { class: "dso-rich-content", ref: el => this.container = el });
15
- }
16
- componentDidRender() {
17
9
  var _a;
18
- const content = this.transformer.content;
19
- if (this.container && content) {
20
- this.container.replaceChildren(...Array.from(content));
21
- }
22
- else {
23
- (_a = this.container) === null || _a === void 0 ? void 0 : _a.replaceChildren();
24
- }
10
+ const context = {
11
+ state: this.state,
12
+ setState: state => this.state = state,
13
+ emitAnchorClick: this.anchorClick.emit
14
+ };
15
+ return this.mapper.transform((_a = this.content) !== null && _a !== void 0 ? _a : '', context);
25
16
  }
26
17
  static get is() { return "dso-ozon-content"; }
18
+ static get encapsulation() { return "scoped"; }
27
19
  static get originalStyleUrls() { return {
28
20
  "$": ["ozon-content.scss"]
29
21
  }; }
@@ -35,11 +27,11 @@ export class OzonContent {
35
27
  "type": "string",
36
28
  "mutable": false,
37
29
  "complexType": {
38
- "original": "string",
39
- "resolved": "string",
30
+ "original": "string | undefined",
31
+ "resolved": "string | undefined",
40
32
  "references": {}
41
33
  },
42
- "required": true,
34
+ "required": false,
43
35
  "optional": false,
44
36
  "docs": {
45
37
  "tags": [],
@@ -49,6 +41,9 @@ export class OzonContent {
49
41
  "reflect": false
50
42
  }
51
43
  }; }
44
+ static get states() { return {
45
+ "state": {}
46
+ }; }
52
47
  static get events() { return [{
53
48
  "method": "anchorClick",
54
49
  "name": "anchorClick",
@@ -60,21 +55,14 @@ export class OzonContent {
60
55
  "text": ""
61
56
  },
62
57
  "complexType": {
63
- "original": "ContentAnchor",
64
- "resolved": "ContentAnchor",
58
+ "original": "OzonContentAnchorClick",
59
+ "resolved": "OzonContentAnchorClick",
65
60
  "references": {
66
- "ContentAnchor": {
61
+ "OzonContentAnchorClick": {
67
62
  "location": "import",
68
63
  "path": "./ozon-content.interfaces"
69
64
  }
70
65
  }
71
66
  }
72
67
  }]; }
73
- static get listeners() { return [{
74
- "name": "click",
75
- "method": "handleClick",
76
- "target": undefined,
77
- "capture": false,
78
- "passive": false
79
- }]; }
80
68
  }
@@ -24,21 +24,37 @@ h2,
24
24
  .h2,
25
25
  h3,
26
26
  .h3 {
27
+ margin-bottom: 16px;
27
28
  margin-top: 24px;
28
29
  }
29
30
 
31
+ h1,
32
+ .h1 {
33
+ line-height: 1.25;
34
+ }
35
+
30
36
  h1 {
31
37
  color: #275937;
32
38
  font-size: 2rem;
33
39
  font-weight: 700;
34
40
  }
35
41
 
42
+ h2,
43
+ .h2 {
44
+ line-height: 1.33;
45
+ }
46
+
36
47
  h2 {
37
48
  color: #275937;
38
49
  font-size: 1.5rem;
39
50
  font-weight: 700;
40
51
  }
41
52
 
53
+ h3,
54
+ .h3 {
55
+ line-height: 1.2;
56
+ }
57
+
42
58
  h3 {
43
59
  color: #275937;
44
60
  font-size: 1.25rem;
@@ -51,23 +67,35 @@ h5,
51
67
  .h5,
52
68
  h6,
53
69
  .h6 {
70
+ margin-bottom: 16px;
54
71
  margin-top: 12px;
55
72
  }
56
73
 
74
+ h4,
75
+ .h4 {
76
+ line-height: 1.5;
77
+ }
78
+
57
79
  h4 {
58
80
  color: #275937;
59
81
  font-size: 1rem;
60
82
  font-weight: 600;
61
83
  }
62
84
 
85
+ h5,
86
+ .h5 {
87
+ line-height: 1.5;
88
+ }
89
+
63
90
  h5 {
64
91
  color: #191919;
65
92
  font-size: 1rem;
66
93
  font-weight: 600;
67
94
  }
68
95
 
69
- h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
70
- margin-bottom: 12px;
96
+ h6,
97
+ .h6 {
98
+ line-height: 1.5;
71
99
  }
72
100
 
73
101
  *,
@@ -68,6 +68,12 @@ export const DsoIcon: {
68
68
  new (): DsoIcon;
69
69
  };
70
70
 
71
+ interface DsoImageOverlay extends Components.DsoImageOverlay, HTMLElement {}
72
+ export const DsoImageOverlay: {
73
+ prototype: DsoImageOverlay;
74
+ new (): DsoImageOverlay;
75
+ };
76
+
71
77
  interface DsoInfo extends Components.DsoInfo, HTMLElement {}
72
78
  export const DsoInfo: {
73
79
  prototype: DsoInfo;