@parameter1/base-cms-marko-web 3.8.0 → 3.13.0
Sign up to get free protection for your applications and to get access to all the features.
- package/components/browser-component.marko.js +86 -0
- package/components/document/components/body-wrapper.marko.js +33 -0
- package/components/document/components/error.marko.js +85 -0
- package/components/document/components/live-reload.marko.js +30 -0
- package/components/document/container.marko.js +54 -0
- package/components/document/index.marko.js +118 -0
- package/components/element/array.marko.js +67 -0
- package/components/element/block.marko.js +44 -0
- package/components/element/clear.marko.js +32 -0
- package/components/element/components/image.marko.js +62 -0
- package/components/element/components/text.marko.js +37 -0
- package/components/element/content/address1.marko.js +40 -0
- package/components/element/content/address2.marko.js +40 -0
- package/components/element/content/authors.marko.js +43 -0
- package/components/element/content/body.marko.js +62 -0
- package/components/element/content/byline.marko.js +41 -0
- package/components/element/content/city-state-zip.marko.js +40 -0
- package/components/element/content/contributors.marko.js +43 -0
- package/components/element/content/country.marko.js +40 -0
- package/components/element/content/embed-code.marko.js +41 -0
- package/components/element/content/end-date.marko.js +42 -0
- package/components/element/content/fax.marko.js +40 -0
- package/components/element/content/mobile.marko.js +40 -0
- package/components/element/content/name.marko.js +41 -0
- package/components/element/content/phone.marko.js +40 -0
- package/components/element/content/photographers.marko.js +43 -0
- package/components/element/content/public-email.marko.js +47 -0
- package/components/element/content/published.marko.js +42 -0
- package/components/element/content/short-name.marko.js +41 -0
- package/components/element/content/sidebars.marko.js +63 -0
- package/components/element/content/source.marko.js +40 -0
- package/components/element/content/sponsors.marko.js +43 -0
- package/components/element/content/start-date.marko.js +42 -0
- package/components/element/content/teaser.marko.js +41 -0
- package/components/element/content/title.marko.js +40 -0
- package/components/element/content/tollfree.marko.js +40 -0
- package/components/element/content/website.marko.js +51 -0
- package/components/element/date.marko.js +27 -0
- package/components/element/image/caption.marko.js +41 -0
- package/components/element/image/credit.marko.js +41 -0
- package/components/element/image/display-name.marko.js +40 -0
- package/components/element/img.marko.js +43 -0
- package/components/element/index.marko.js +47 -0
- package/components/element/link.marko.js +54 -0
- package/components/element/obj-array.marko.js +56 -0
- package/components/element/obj-date.marko.js +54 -0
- package/components/element/obj-nodes.marko.js +62 -0
- package/components/element/obj-text.marko.js +53 -0
- package/components/element/obj.marko.js +61 -0
- package/components/element/picture.marko.js +85 -0
- package/components/element/text.marko.js +76 -0
- package/components/element/website-section/name.marko.js +46 -0
- package/components/load-more/index.marko.js +119 -0
- package/components/load-more/trigger.marko.js +40 -0
- package/components/node/body.marko.js +112 -0
- package/components/node/element.marko.js +39 -0
- package/components/node/footer.marko.js +63 -0
- package/components/node/header.marko.js +63 -0
- package/components/node/image-inner-wrapper.marko.js +116 -0
- package/components/node/image-wrapper.marko.js +98 -0
- package/components/node/image.marko.js +93 -0
- package/components/node/index.marko.js +100 -0
- package/components/node-list/body.marko.js +50 -0
- package/components/node-list/element.marko.js +35 -0
- package/components/node-list/footer.marko.js +50 -0
- package/components/node-list/header.marko.js +50 -0
- package/components/node-list/index.marko.js +93 -0
- package/components/node-list/node.marko.js +49 -0
- package/components/node-list/nodes.marko.js +126 -0
- package/components/page/container.marko.js +46 -0
- package/components/page/description.marko.js +26 -0
- package/components/page/image.marko.js +122 -0
- package/components/page/layouts/content.marko.js +63 -0
- package/components/page/layouts/default.marko.js +61 -0
- package/components/page/layouts/website-section.marko.js +78 -0
- package/components/page/metadata/components/common.marko.js +108 -0
- package/components/page/metadata/content.marko.js +201 -0
- package/components/page/metadata/default.marko.js +29 -0
- package/components/page/metadata/website-section.marko.js +79 -0
- package/components/page/rel-canonical.marko.js +42 -0
- package/components/page/title.marko.js +46 -0
- package/components/page/wrapper.marko.js +63 -0
- package/components/resolve/page.marko.js +49 -0
- package/components/rss/website-section.marko.js +46 -0
- package/middleware/page-node/index.js +15 -2
- package/middleware/with-content.js +2 -0
- package/package.json +4 -4
@@ -0,0 +1,201 @@
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var marko_template = module.exports = require("marko/src/html").t(__filename),
|
5
|
+
marko_componentType = "/@parameter1/base-cms-marko-web$3.11.0/components/page/metadata/content.marko",
|
6
|
+
marko_component = require("./content.marko"),
|
7
|
+
marko_renderer = require("marko/src/runtime/components/renderer"),
|
8
|
+
module_gql = require("graphql-tag"),
|
9
|
+
gql = module_gql.default || module_gql,
|
10
|
+
module_baseCmsObjectPath_module = require("@parameter1/base-cms-object-path"),
|
11
|
+
baseCmsObjectPath_module = module_baseCmsObjectPath_module.default || module_baseCmsObjectPath_module,
|
12
|
+
get = module_baseCmsObjectPath_module.get,
|
13
|
+
module_baseCmsUtils_module = require("@parameter1/base-cms-utils"),
|
14
|
+
baseCmsUtils_module = module_baseCmsUtils_module.default || module_baseCmsUtils_module,
|
15
|
+
warn = module_baseCmsUtils_module.warn,
|
16
|
+
isFunction = module_baseCmsUtils_module.isFunction,
|
17
|
+
module_utils_module = require("@parameter1/base-cms-web-common/src/utils"),
|
18
|
+
utils_module = module_utils_module.default || module_utils_module,
|
19
|
+
extractFragmentData = module_utils_module.extractFragmentData,
|
20
|
+
module_defaultBuildStructuredData = require("./google-structured-data/content"),
|
21
|
+
defaultBuildStructuredData = module_defaultBuildStructuredData.default || module_defaultBuildStructuredData,
|
22
|
+
common_template = require("./components/common.marko"),
|
23
|
+
marko_loadTag = require("marko/src/runtime/helpers/load-tag"),
|
24
|
+
common_tag = marko_loadTag(common_template),
|
25
|
+
marko_attr = require("marko/src/runtime/html/helpers/attr"),
|
26
|
+
helpers_escape_xml = require("marko/src/runtime/html/helpers/escape-xml"),
|
27
|
+
marko_escapeXml = helpers_escape_xml.x,
|
28
|
+
marko_escapeScript = require("marko/src/runtime/html/helpers/escape-script-placeholder"),
|
29
|
+
marko_web_query_template = require("@parameter1/base-cms-marko-core/components/queries/index.marko"),
|
30
|
+
marko_web_query_tag = marko_loadTag(marko_web_query_template);
|
31
|
+
|
32
|
+
function render(input, out, __component, component, state) {
|
33
|
+
var data = input;
|
34
|
+
|
35
|
+
const { id, structuredDataQueryFragment } = input;
|
36
|
+
|
37
|
+
const { spreadFragmentName, processedFragment } = extractFragmentData(structuredDataQueryFragment);
|
38
|
+
|
39
|
+
const queryFragment = gql`
|
40
|
+
fragment ContentPageMetadataFragment on Content {
|
41
|
+
id
|
42
|
+
type
|
43
|
+
siteContext {
|
44
|
+
url
|
45
|
+
path
|
46
|
+
canonicalUrl
|
47
|
+
noIndex
|
48
|
+
}
|
49
|
+
published
|
50
|
+
updated
|
51
|
+
metadata {
|
52
|
+
title
|
53
|
+
description
|
54
|
+
publishedDate
|
55
|
+
updatedDate
|
56
|
+
expiresDate
|
57
|
+
image {
|
58
|
+
id
|
59
|
+
src(input: { options: { auto: "format,compress", w: "1200", fit: "max", q: 70 } })
|
60
|
+
}
|
61
|
+
}
|
62
|
+
... on ContentVideo {
|
63
|
+
embedSrc
|
64
|
+
}
|
65
|
+
... on ContentPodcast {
|
66
|
+
fileSrc
|
67
|
+
fileName
|
68
|
+
}
|
69
|
+
... on Authorable {
|
70
|
+
authors {
|
71
|
+
edges {
|
72
|
+
node {
|
73
|
+
id
|
74
|
+
name
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
... on Addressable {
|
80
|
+
address1
|
81
|
+
address2
|
82
|
+
city
|
83
|
+
state
|
84
|
+
zip
|
85
|
+
country
|
86
|
+
}
|
87
|
+
... on Contactable {
|
88
|
+
phone
|
89
|
+
tollfree
|
90
|
+
fax
|
91
|
+
website
|
92
|
+
title
|
93
|
+
mobile
|
94
|
+
publicEmail
|
95
|
+
}
|
96
|
+
... on ContentCompany {
|
97
|
+
email
|
98
|
+
}
|
99
|
+
images(input:{ pagination: { limit: 0 }, sort: { order: values } }) {
|
100
|
+
edges {
|
101
|
+
node {
|
102
|
+
id
|
103
|
+
src(input: { options: { auto: "format,compress", w: "1200", fit: "max", q: 70 } })
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
${spreadFragmentName}
|
108
|
+
}
|
109
|
+
${processedFragment}
|
110
|
+
`;
|
111
|
+
|
112
|
+
const buildStructuredData = isFunction(input.buildStructuredData) ? input.buildStructuredData : defaultBuildStructuredData;
|
113
|
+
|
114
|
+
if (id) {
|
115
|
+
marko_web_query_tag({
|
116
|
+
collapsible: true,
|
117
|
+
name: "content",
|
118
|
+
params: {
|
119
|
+
id: id,
|
120
|
+
queryFragment: queryFragment
|
121
|
+
},
|
122
|
+
whenEmpty: {
|
123
|
+
renderBody: function(out) {
|
124
|
+
warn(`Unable to create content metadata: no content found for ${id}.`);
|
125
|
+
}
|
126
|
+
},
|
127
|
+
renderBody: function(out, { node }) {
|
128
|
+
const metadata = {
|
129
|
+
type: node.type,
|
130
|
+
title: get(node, "metadata.title"),
|
131
|
+
description: get(node, "metadata.description"),
|
132
|
+
canonicalPath: get(node, "siteContext.path"),
|
133
|
+
canonicalUrl: get(node, "siteContext.canonicalUrl"),
|
134
|
+
noIndex: get(node, "siteContext.noIndex"),
|
135
|
+
imageSrc: get(node, "metadata.image.src"),
|
136
|
+
};
|
137
|
+
|
138
|
+
const publishedDate = get(node, "metadata.publishedDate");
|
139
|
+
|
140
|
+
const updatedDate = get(node, "metadata.updatedDate");
|
141
|
+
|
142
|
+
const expiresDate = get(node, "metadata.expiresDate");
|
143
|
+
|
144
|
+
common_tag(metadata, out, __component, "1");
|
145
|
+
|
146
|
+
if (node.type === "video") {
|
147
|
+
out.w("<meta property=\"og:type\" content=\"video.other\">");
|
148
|
+
|
149
|
+
if (publishedDate) {
|
150
|
+
out.w("<meta property=\"video:release_date\"" +
|
151
|
+
marko_attr("content", publishedDate) +
|
152
|
+
">");
|
153
|
+
}
|
154
|
+
} else {
|
155
|
+
out.w("<meta property=\"og:type\" content=\"article\">");
|
156
|
+
|
157
|
+
if (publishedDate) {
|
158
|
+
out.w("<meta property=\"article:published_time\"" +
|
159
|
+
marko_attr("content", publishedDate) +
|
160
|
+
">");
|
161
|
+
}
|
162
|
+
|
163
|
+
if (updatedDate) {
|
164
|
+
out.w("<meta property=\"article:modified_time\"" +
|
165
|
+
marko_attr("content", updatedDate) +
|
166
|
+
">");
|
167
|
+
}
|
168
|
+
|
169
|
+
if (expiresDate) {
|
170
|
+
out.w("<meta property=\"article:expiration_time\"" +
|
171
|
+
marko_attr("content", expiresDate) +
|
172
|
+
">");
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
const structuredData = buildStructuredData(node);
|
177
|
+
|
178
|
+
if (structuredData) {
|
179
|
+
out.w("<script type=\"application/ld+json\">" +
|
180
|
+
marko_escapeScript(("\n " + structuredData) + "\n ") +
|
181
|
+
"</script>");
|
182
|
+
}
|
183
|
+
}
|
184
|
+
}, out, __component, "0");
|
185
|
+
} else {
|
186
|
+
warn('Unable to create content metadata: no content id was provided.');
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
marko_template._ = marko_renderer(render, {
|
191
|
+
___type: marko_componentType
|
192
|
+
}, marko_component);
|
193
|
+
|
194
|
+
marko_template.meta = {
|
195
|
+
id: "/@parameter1/base-cms-marko-web$3.11.0/components/page/metadata/content.marko",
|
196
|
+
component: "./content.marko",
|
197
|
+
tags: [
|
198
|
+
"./components/common.marko",
|
199
|
+
"@parameter1/base-cms-marko-core/components/queries/index.marko"
|
200
|
+
]
|
201
|
+
};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var marko_template = module.exports = require("marko/src/html").t(__filename),
|
5
|
+
marko_componentType = "/@parameter1/base-cms-marko-web$3.11.0/components/page/metadata/default.marko",
|
6
|
+
marko_renderer = require("marko/src/runtime/components/renderer"),
|
7
|
+
common_template = require("./components/common.marko"),
|
8
|
+
marko_loadTag = require("marko/src/runtime/helpers/load-tag"),
|
9
|
+
common_tag = marko_loadTag(common_template);
|
10
|
+
|
11
|
+
function render(input, out, __component, component, state) {
|
12
|
+
var data = input;
|
13
|
+
|
14
|
+
common_tag(input, out, __component, "0");
|
15
|
+
|
16
|
+
out.w("<meta property=\"og:type\" content=\"website\">");
|
17
|
+
}
|
18
|
+
|
19
|
+
marko_template._ = marko_renderer(render, {
|
20
|
+
___implicit: true,
|
21
|
+
___type: marko_componentType
|
22
|
+
});
|
23
|
+
|
24
|
+
marko_template.meta = {
|
25
|
+
id: "/@parameter1/base-cms-marko-web$3.11.0/components/page/metadata/default.marko",
|
26
|
+
tags: [
|
27
|
+
"./components/common.marko"
|
28
|
+
]
|
29
|
+
};
|
@@ -0,0 +1,79 @@
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var marko_template = module.exports = require("marko/src/html").t(__filename),
|
5
|
+
marko_componentType = "/@parameter1/base-cms-marko-web$3.11.0/components/page/metadata/website-section.marko",
|
6
|
+
marko_component = require("./website-section.marko"),
|
7
|
+
marko_renderer = require("marko/src/runtime/components/renderer"),
|
8
|
+
module_gql = require("graphql-tag"),
|
9
|
+
gql = module_gql.default || module_gql,
|
10
|
+
module_baseCmsObjectPath_module = require("@parameter1/base-cms-object-path"),
|
11
|
+
baseCmsObjectPath_module = module_baseCmsObjectPath_module.default || module_baseCmsObjectPath_module,
|
12
|
+
get = module_baseCmsObjectPath_module.get,
|
13
|
+
module_baseCmsUtils_module = require("@parameter1/base-cms-utils"),
|
14
|
+
baseCmsUtils_module = module_baseCmsUtils_module.default || module_baseCmsUtils_module,
|
15
|
+
warn = module_baseCmsUtils_module.warn,
|
16
|
+
common_template = require("./components/common.marko"),
|
17
|
+
marko_loadTag = require("marko/src/runtime/helpers/load-tag"),
|
18
|
+
common_tag = marko_loadTag(common_template),
|
19
|
+
marko_web_query_template = require("@parameter1/base-cms-marko-core/components/queries/index.marko"),
|
20
|
+
marko_web_query_tag = marko_loadTag(marko_web_query_template);
|
21
|
+
|
22
|
+
function render(input, out, __component, component, state) {
|
23
|
+
var data = input;
|
24
|
+
|
25
|
+
const { alias } = input;
|
26
|
+
|
27
|
+
const queryFragment = gql`
|
28
|
+
fragment WebsiteSectionPageMetadataFragment on WebsiteSection {
|
29
|
+
id
|
30
|
+
canonicalPath
|
31
|
+
metadata {
|
32
|
+
title
|
33
|
+
description
|
34
|
+
}
|
35
|
+
}
|
36
|
+
`;
|
37
|
+
|
38
|
+
if (alias) {
|
39
|
+
marko_web_query_tag({
|
40
|
+
collapsible: true,
|
41
|
+
name: "website-section",
|
42
|
+
params: {
|
43
|
+
alias: alias,
|
44
|
+
queryFragment: queryFragment
|
45
|
+
},
|
46
|
+
whenEmpty: {
|
47
|
+
renderBody: function(out) {
|
48
|
+
warn(`Unable to create website section metadata: no section found for ${alias}.`);
|
49
|
+
}
|
50
|
+
},
|
51
|
+
renderBody: function(out, { node }) {
|
52
|
+
const metadata = {
|
53
|
+
title: get(node, "metadata.title"),
|
54
|
+
description: get(node, "metadata.description"),
|
55
|
+
canonicalPath: node.canonicalPath,
|
56
|
+
};
|
57
|
+
|
58
|
+
common_tag(metadata, out, __component, "1");
|
59
|
+
|
60
|
+
out.w("<meta property=\"og:type\" content=\"website\">");
|
61
|
+
}
|
62
|
+
}, out, __component, "0");
|
63
|
+
} else {
|
64
|
+
warn('Unable to create website section metadata: no section alias was provided.');
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
marko_template._ = marko_renderer(render, {
|
69
|
+
___type: marko_componentType
|
70
|
+
}, marko_component);
|
71
|
+
|
72
|
+
marko_template.meta = {
|
73
|
+
id: "/@parameter1/base-cms-marko-web$3.11.0/components/page/metadata/website-section.marko",
|
74
|
+
component: "./website-section.marko",
|
75
|
+
tags: [
|
76
|
+
"./components/common.marko",
|
77
|
+
"@parameter1/base-cms-marko-core/components/queries/index.marko"
|
78
|
+
]
|
79
|
+
};
|
@@ -0,0 +1,42 @@
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var marko_template = module.exports = require("marko/src/html").t(__filename),
|
5
|
+
marko_componentType = "/@parameter1/base-cms-marko-web$3.11.0/components/page/rel-canonical.marko",
|
6
|
+
marko_renderer = require("marko/src/runtime/components/renderer"),
|
7
|
+
module_baseCmsUtils_module = require("@parameter1/base-cms-utils"),
|
8
|
+
baseCmsUtils_module = module_baseCmsUtils_module.default || module_baseCmsUtils_module,
|
9
|
+
cleanPath = module_baseCmsUtils_module.cleanPath,
|
10
|
+
marko_dynamicTag = require("marko/src/runtime/helpers/dynamic-tag"),
|
11
|
+
marko_attr = require("marko/src/runtime/html/helpers/attr");
|
12
|
+
|
13
|
+
function render(input, out, __component, component, state) {
|
14
|
+
var data = input;
|
15
|
+
|
16
|
+
const { req, requestOrigin } = out.global;
|
17
|
+
|
18
|
+
const path = input.path || req.path;
|
19
|
+
|
20
|
+
const href = input.url || `${out.global.requestOrigin}/${cleanPath(path)}`;
|
21
|
+
|
22
|
+
if (input.renderBody) {
|
23
|
+
marko_dynamicTag(out, input.renderBody, function() {
|
24
|
+
return {
|
25
|
+
href: href
|
26
|
+
};
|
27
|
+
}, null, null, null, __component, "0");
|
28
|
+
} else {
|
29
|
+
out.w("<link rel=\"canonical\"" +
|
30
|
+
marko_attr("href", href) +
|
31
|
+
">");
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
marko_template._ = marko_renderer(render, {
|
36
|
+
___implicit: true,
|
37
|
+
___type: marko_componentType
|
38
|
+
});
|
39
|
+
|
40
|
+
marko_template.meta = {
|
41
|
+
id: "/@parameter1/base-cms-marko-web$3.11.0/components/page/rel-canonical.marko"
|
42
|
+
};
|
@@ -0,0 +1,46 @@
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var marko_template = module.exports = require("marko/src/html").t(__filename),
|
5
|
+
marko_componentType = "/@parameter1/base-cms-marko-web$3.11.0/components/page/title.marko",
|
6
|
+
marko_renderer = require("marko/src/runtime/components/renderer"),
|
7
|
+
module_baseCmsUtils_module = require("@parameter1/base-cms-utils"),
|
8
|
+
baseCmsUtils_module = module_baseCmsUtils_module.default || module_baseCmsUtils_module,
|
9
|
+
cleanPath = module_baseCmsUtils_module.cleanPath,
|
10
|
+
marko_dynamicTag = require("marko/src/runtime/helpers/dynamic-tag"),
|
11
|
+
helpers_escape_xml = require("marko/src/runtime/html/helpers/escape-xml"),
|
12
|
+
marko_escapeXml = helpers_escape_xml.x;
|
13
|
+
|
14
|
+
function render(input, out, __component, component, state) {
|
15
|
+
var data = input;
|
16
|
+
|
17
|
+
const { config } = out.global;
|
18
|
+
|
19
|
+
const parts = [
|
20
|
+
input.value,
|
21
|
+
config.website("name"),
|
22
|
+
];
|
23
|
+
|
24
|
+
const concatWith = input.concatWith || "|";
|
25
|
+
|
26
|
+
const title = parts.filter(v => v && v !== 'Home').join(` ${concatWith} `);
|
27
|
+
|
28
|
+
out.w("<title>");
|
29
|
+
|
30
|
+
if (input.renderBody) {
|
31
|
+
marko_dynamicTag(out, input.renderBody, null, null, null, null, __component, "1");
|
32
|
+
} else {
|
33
|
+
out.w(marko_escapeXml(title));
|
34
|
+
}
|
35
|
+
|
36
|
+
out.w("</title>");
|
37
|
+
}
|
38
|
+
|
39
|
+
marko_template._ = marko_renderer(render, {
|
40
|
+
___implicit: true,
|
41
|
+
___type: marko_componentType
|
42
|
+
});
|
43
|
+
|
44
|
+
marko_template.meta = {
|
45
|
+
id: "/@parameter1/base-cms-marko-web$3.11.0/components/page/title.marko"
|
46
|
+
};
|
@@ -0,0 +1,63 @@
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var marko_template = module.exports = require("marko/src/html").t(__filename),
|
5
|
+
marko_componentType = "/@parameter1/base-cms-marko-web$3.11.0/components/page/wrapper.marko",
|
6
|
+
marko_renderer = require("marko/src/runtime/components/renderer"),
|
7
|
+
module_baseCmsObjectPath_module = require("@parameter1/base-cms-object-path"),
|
8
|
+
baseCmsObjectPath_module = module_baseCmsObjectPath_module.default || module_baseCmsObjectPath_module,
|
9
|
+
getAsArray = module_baseCmsObjectPath_module.getAsArray,
|
10
|
+
marko_forOf = require("marko/src/runtime/helpers/for-of"),
|
11
|
+
marko_assign = require("marko/src/runtime/helpers/assign"),
|
12
|
+
marko_web_element_template = require("../element"),
|
13
|
+
marko_loadTag = require("marko/src/runtime/helpers/load-tag"),
|
14
|
+
marko_web_element_tag = marko_loadTag(marko_web_element_template),
|
15
|
+
marko_dynamicTag = require("marko/src/runtime/helpers/dynamic-tag");
|
16
|
+
|
17
|
+
function render(input, out, __component, component, state) {
|
18
|
+
var data = input;
|
19
|
+
|
20
|
+
const blockName = input.blockName || "page-wrapper";
|
21
|
+
|
22
|
+
const tag = input.tag || "div";
|
23
|
+
|
24
|
+
const sections = getAsArray(input.sections);
|
25
|
+
|
26
|
+
const modifiers = [...getAsArray(input.modifiers)];
|
27
|
+
|
28
|
+
const classNames = [blockName, ...modifiers.map(mod => `${blockName}--${mod}`), input.class];
|
29
|
+
|
30
|
+
if (sections.length) {
|
31
|
+
marko_dynamicTag(out, tag, function() {
|
32
|
+
return marko_assign({}, input.attrs, {
|
33
|
+
class: classNames
|
34
|
+
});
|
35
|
+
}, function(out) {
|
36
|
+
var $for$0 = 0;
|
37
|
+
|
38
|
+
marko_forOf(sections, function(section) {
|
39
|
+
var $keyScope$0 = "[" + (($for$0++) + "]");
|
40
|
+
|
41
|
+
marko_web_element_tag(marko_assign({
|
42
|
+
name: "default",
|
43
|
+
tag: "div"
|
44
|
+
}, section, {
|
45
|
+
blockName: blockName,
|
46
|
+
name: "section"
|
47
|
+
}), out, __component, "1" + $keyScope$0);
|
48
|
+
});
|
49
|
+
}, null, null, __component, "0");
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
marko_template._ = marko_renderer(render, {
|
54
|
+
___implicit: true,
|
55
|
+
___type: marko_componentType
|
56
|
+
});
|
57
|
+
|
58
|
+
marko_template.meta = {
|
59
|
+
id: "/@parameter1/base-cms-marko-web$3.11.0/components/page/wrapper.marko",
|
60
|
+
tags: [
|
61
|
+
"../element"
|
62
|
+
]
|
63
|
+
};
|
@@ -0,0 +1,49 @@
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var marko_template = module.exports = require("marko/src/html").t(__filename),
|
5
|
+
marko_componentType = "/@parameter1/base-cms-marko-web$3.11.0/components/resolve/page.marko",
|
6
|
+
marko_component = require("./page.marko"),
|
7
|
+
marko_renderer = require("marko/src/runtime/components/renderer"),
|
8
|
+
module_baseCmsUtils_module = require("@parameter1/base-cms-utils"),
|
9
|
+
baseCmsUtils_module = module_baseCmsUtils_module.default || module_baseCmsUtils_module,
|
10
|
+
isFunction = module_baseCmsUtils_module.isFunction,
|
11
|
+
module_baseCmsObjectPath_module = require("@parameter1/base-cms-object-path"),
|
12
|
+
baseCmsObjectPath_module = module_baseCmsObjectPath_module.default || module_baseCmsObjectPath_module,
|
13
|
+
getAsObject = module_baseCmsObjectPath_module.getAsObject,
|
14
|
+
marko_dynamicTag = require("marko/src/runtime/helpers/dynamic-tag"),
|
15
|
+
marko_web_resolve_template = require("@parameter1/base-cms-marko-core/components/resolve.marko"),
|
16
|
+
marko_loadTag = require("marko/src/runtime/helpers/load-tag"),
|
17
|
+
marko_web_resolve_tag = marko_loadTag(marko_web_resolve_template);
|
18
|
+
|
19
|
+
function render(input, out, __component, component, state) {
|
20
|
+
var data = input;
|
21
|
+
|
22
|
+
const node = getAsObject(input, "node");
|
23
|
+
|
24
|
+
if (isFunction(node.load)) {
|
25
|
+
marko_web_resolve_tag({
|
26
|
+
promise: node.load(),
|
27
|
+
renderBody: function(out, { resolved }) {
|
28
|
+
marko_dynamicTag(out, input.renderBody, function() {
|
29
|
+
return {
|
30
|
+
resolved: resolved,
|
31
|
+
data: resolved.data
|
32
|
+
};
|
33
|
+
}, null, null, null, __component, "1");
|
34
|
+
}
|
35
|
+
}, out, __component, "0");
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
marko_template._ = marko_renderer(render, {
|
40
|
+
___type: marko_componentType
|
41
|
+
}, marko_component);
|
42
|
+
|
43
|
+
marko_template.meta = {
|
44
|
+
id: "/@parameter1/base-cms-marko-web$3.11.0/components/resolve/page.marko",
|
45
|
+
component: "./page.marko",
|
46
|
+
tags: [
|
47
|
+
"@parameter1/base-cms-marko-core/components/resolve.marko"
|
48
|
+
]
|
49
|
+
};
|
@@ -0,0 +1,46 @@
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
var marko_template = module.exports = require("marko/src/html").t(__filename),
|
5
|
+
marko_componentType = "/@parameter1/base-cms-marko-web$3.11.0/components/rss/website-section.marko",
|
6
|
+
marko_renderer = require("marko/src/runtime/components/renderer"),
|
7
|
+
module_url_module = require("url"),
|
8
|
+
url_module = module_url_module.default || module_url_module,
|
9
|
+
URLSearchParams = module_url_module.URLSearchParams,
|
10
|
+
marko_attr = require("marko/src/runtime/html/helpers/attr");
|
11
|
+
|
12
|
+
function render(input, out, __component, component, state) {
|
13
|
+
var data = input;
|
14
|
+
|
15
|
+
const { config } = out.global;
|
16
|
+
|
17
|
+
const { queryName, queryParams, channelParams } = input;
|
18
|
+
|
19
|
+
const defaultTitle = input.name ? `RSS Feed for ${input.name}` : "RSS Feed";
|
20
|
+
|
21
|
+
const title = input.title || defaultTitle;
|
22
|
+
|
23
|
+
const query = new URLSearchParams();
|
24
|
+
|
25
|
+
query.append("input", JSON.stringify(queryParams));
|
26
|
+
|
27
|
+
if (channelParams) query.append("channel", JSON.stringify(channelParams));
|
28
|
+
|
29
|
+
const href = `${config.rssMountPoint()}/${queryName}.xml?${query}`;
|
30
|
+
|
31
|
+
if (queryName) {
|
32
|
+
out.w("<link rel=\"alternate\" type=\"application/rss+xml\"" +
|
33
|
+
marko_attr("title", title) +
|
34
|
+
marko_attr("href", href) +
|
35
|
+
">");
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
marko_template._ = marko_renderer(render, {
|
40
|
+
___implicit: true,
|
41
|
+
___type: marko_componentType
|
42
|
+
});
|
43
|
+
|
44
|
+
marko_template.meta = {
|
45
|
+
id: "/@parameter1/base-cms-marko-web$3.11.0/components/rss/website-section.marko"
|
46
|
+
};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
const { isFunction: isFn } = require('@parameter1/base-cms-utils');
|
1
2
|
const { getAsObject } = require('@parameter1/base-cms-object-path');
|
2
3
|
const ResolvedNode = require('./resolved');
|
3
4
|
|
@@ -9,12 +10,14 @@ class PageNode {
|
|
9
10
|
queryFragment,
|
10
11
|
variables,
|
11
12
|
resultField,
|
13
|
+
sideloadDataFn,
|
12
14
|
}) {
|
13
15
|
this.apolloClient = apolloClient;
|
14
16
|
this.queryFactory = queryFactory;
|
15
17
|
this.queryFragment = queryFragment;
|
16
18
|
this.variables = variables;
|
17
19
|
this.resultField = resultField;
|
20
|
+
this.sideloadDataFn = sideloadDataFn;
|
18
21
|
}
|
19
22
|
|
20
23
|
async load() {
|
@@ -22,8 +25,18 @@ class PageNode {
|
|
22
25
|
const { queryFragment, variables, resultField } = this;
|
23
26
|
const path = `data.${resultField}`;
|
24
27
|
const query = this.queryFactory({ queryFragment, queryName: 'PageNode' });
|
25
|
-
|
26
|
-
.
|
28
|
+
const [r, sideloadedData] = await Promise.all([
|
29
|
+
this.apolloClient.query({ query, variables }),
|
30
|
+
(async () => {
|
31
|
+
if (isFn(this.sideloadDataFn)) {
|
32
|
+
this.sideloadDataFn.bind(this);
|
33
|
+
return this.sideloadDataFn();
|
34
|
+
}
|
35
|
+
return undefined;
|
36
|
+
})(),
|
37
|
+
]);
|
38
|
+
this.promise = createNode(getAsObject(r, path));
|
39
|
+
this.sideloadedData = sideloadedData;
|
27
40
|
}
|
28
41
|
return this.promise;
|
29
42
|
}
|
@@ -15,6 +15,7 @@ module.exports = ({
|
|
15
15
|
redirectToFn,
|
16
16
|
pathFn,
|
17
17
|
formatResponse,
|
18
|
+
sideloadDataFn,
|
18
19
|
} = {}) => asyncRoute(async (req, res) => {
|
19
20
|
const id = isFn(idResolver) ? await idResolver(req, res) : req.params.id;
|
20
21
|
const { apollo, query } = req;
|
@@ -36,6 +37,7 @@ module.exports = ({
|
|
36
37
|
queryFragment,
|
37
38
|
variables: { input: { id: Number(id), ...additionalInput } },
|
38
39
|
resultField: 'content',
|
40
|
+
sideloadDataFn,
|
39
41
|
});
|
40
42
|
if (isFn(formatResponse)) await formatResponse({ res, content, pageNode });
|
41
43
|
return res.marko(template, { ...content, pageNode });
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@parameter1/base-cms-marko-web",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.13.0",
|
4
4
|
"description": "Core Marko+Express components for BaseCMS websites",
|
5
5
|
"author": "Jacob Bare <jacob@parameter1.com>",
|
6
6
|
"main": "index.js",
|
@@ -16,10 +16,10 @@
|
|
16
16
|
"dependencies": {
|
17
17
|
"@godaddy/terminus": "^4.9.0",
|
18
18
|
"@parameter1/base-cms-apollo-ssr": "^3.0.0",
|
19
|
-
"@parameter1/base-cms-embedded-media": "^3.
|
19
|
+
"@parameter1/base-cms-embedded-media": "^3.13.0",
|
20
20
|
"@parameter1/base-cms-express-apollo": "^3.0.0",
|
21
21
|
"@parameter1/base-cms-graphql-fragment-types": "^3.0.0",
|
22
|
-
"@parameter1/base-cms-image": "^3.
|
22
|
+
"@parameter1/base-cms-image": "^3.13.0",
|
23
23
|
"@parameter1/base-cms-inflector": "^3.0.0",
|
24
24
|
"@parameter1/base-cms-marko-node-require": "^3.0.0",
|
25
25
|
"@parameter1/base-cms-object-path": "^3.0.0",
|
@@ -46,5 +46,5 @@
|
|
46
46
|
"publishConfig": {
|
47
47
|
"access": "public"
|
48
48
|
},
|
49
|
-
"gitHead": "
|
49
|
+
"gitHead": "2b9579aef02949a06b27119afdd4046ee891eb24"
|
50
50
|
}
|