@mindful-web/marko-core 1.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 (78) hide show
  1. package/.eslintignore +1 -0
  2. package/LICENSE +21 -0
  3. package/components/elements/array.marko +20 -0
  4. package/components/elements/array.marko.js +69 -0
  5. package/components/elements/components/text.marko +11 -0
  6. package/components/elements/components/text.marko.js +37 -0
  7. package/components/elements/date.marko +22 -0
  8. package/components/elements/date.marko.js +53 -0
  9. package/components/elements/img.marko +27 -0
  10. package/components/elements/img.marko.js +60 -0
  11. package/components/elements/link.marko +25 -0
  12. package/components/elements/link.marko.js +58 -0
  13. package/components/elements/marko.json +128 -0
  14. package/components/elements/obj-array.marko +13 -0
  15. package/components/elements/obj-array.marko.js +52 -0
  16. package/components/elements/obj-date.marko +17 -0
  17. package/components/elements/obj-date.marko.js +48 -0
  18. package/components/elements/obj-nodes.marko +16 -0
  19. package/components/elements/obj-nodes.marko.js +58 -0
  20. package/components/elements/obj-text.marko +16 -0
  21. package/components/elements/obj-text.marko.js +47 -0
  22. package/components/elements/obj-value.marko +14 -0
  23. package/components/elements/obj-value.marko.js +50 -0
  24. package/components/elements/text.marko +37 -0
  25. package/components/elements/text.marko.js +78 -0
  26. package/components/marko.json +10 -0
  27. package/components/queries/all-author-content.marko +3 -0
  28. package/components/queries/all-author-content.marko.js +33 -0
  29. package/components/queries/all-company-content.marko +3 -0
  30. package/components/queries/all-company-content.marko.js +33 -0
  31. package/components/queries/all-published-content.marko +3 -0
  32. package/components/queries/all-published-content.marko.js +33 -0
  33. package/components/queries/components/loader.marko +6 -0
  34. package/components/queries/components/loader.marko.js +40 -0
  35. package/components/queries/content.marko +3 -0
  36. package/components/queries/content.marko.js +33 -0
  37. package/components/queries/dynamic-page.marko +3 -0
  38. package/components/queries/dynamic-page.marko.js +33 -0
  39. package/components/queries/index.marko +65 -0
  40. package/components/queries/index.marko.js +110 -0
  41. package/components/queries/magazine-active-issues.marko +3 -0
  42. package/components/queries/magazine-active-issues.marko.js +33 -0
  43. package/components/queries/magazine-issue.marko +3 -0
  44. package/components/queries/magazine-issue.marko.js +33 -0
  45. package/components/queries/magazine-latest-issue.marko +3 -0
  46. package/components/queries/magazine-latest-issue.marko.js +33 -0
  47. package/components/queries/magazine-publication.marko +3 -0
  48. package/components/queries/magazine-publication.marko.js +33 -0
  49. package/components/queries/magazine-publications.marko +3 -0
  50. package/components/queries/magazine-publications.marko.js +33 -0
  51. package/components/queries/magazine-scheduled-content.marko +3 -0
  52. package/components/queries/magazine-scheduled-content.marko.js +33 -0
  53. package/components/queries/marko.json +66 -0
  54. package/components/queries/most-popular-content.marko +3 -0
  55. package/components/queries/most-popular-content.marko.js +33 -0
  56. package/components/queries/newsletter-scheduled-content.marko +3 -0
  57. package/components/queries/newsletter-scheduled-content.marko.js +33 -0
  58. package/components/queries/related-published-content.marko +3 -0
  59. package/components/queries/related-published-content.marko.js +33 -0
  60. package/components/queries/website-optioned-content.marko +3 -0
  61. package/components/queries/website-optioned-content.marko.js +33 -0
  62. package/components/queries/website-scheduled-content.marko +3 -0
  63. package/components/queries/website-scheduled-content.marko.js +33 -0
  64. package/components/queries/website-section.marko +3 -0
  65. package/components/queries/website-section.marko.js +33 -0
  66. package/components/queries/website-sections.marko +3 -0
  67. package/components/queries/website-sections.marko.js +33 -0
  68. package/components/resolve.marko +32 -0
  69. package/components/resolve.marko.js +85 -0
  70. package/marko.json +6 -0
  71. package/middleware/clean-marko-response.js +1 -0
  72. package/package.json +35 -0
  73. package/utils/build-marko-global.js +1 -0
  74. package/utils/clean-marko-chunk.js +1 -0
  75. package/utils/default-value.js +6 -0
  76. package/utils/extract-render-body.js +1 -0
  77. package/utils/is-dev.js +1 -0
  78. package/utils/should-collapse.js +5 -0
@@ -0,0 +1,33 @@
1
+ // Compiled using marko@4.20.2 - DO NOT EDIT
2
+ "use strict";
3
+
4
+ var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
+ marko_componentType = "/@mindful-web/marko-core$1.0.0/components/queries/website-sections.marko",
6
+ marko_renderer = require("marko/dist/runtime/components/renderer"),
7
+ module_blockLoaders_module = require("@mindful-web/web-common/block-loaders"),
8
+ blockLoaders_module = module_blockLoaders_module.default || module_blockLoaders_module,
9
+ loader = module_blockLoaders_module.websiteSections,
10
+ marko_assign = require("marko/dist/runtime/helpers/assign"),
11
+ loader_template = require("./components/loader.marko"),
12
+ marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
13
+ loader_tag = marko_loadTag(loader_template);
14
+
15
+ function render(input, out, __component, component, state) {
16
+ var data = input;
17
+
18
+ loader_tag(marko_assign({
19
+ loader: loader
20
+ }, input), out, __component, "0");
21
+ }
22
+
23
+ marko_template._ = marko_renderer(render, {
24
+ d_: true,
25
+ e_: marko_componentType
26
+ });
27
+
28
+ marko_template.meta = {
29
+ id: "/@mindful-web/marko-core$1.0.0/components/queries/website-sections.marko",
30
+ tags: [
31
+ "./components/loader.marko"
32
+ ]
33
+ };
@@ -0,0 +1,32 @@
1
+ import isDev from "../utils/is-dev";
2
+
3
+ $ const { onAsyncBlockError } = out.global;
4
+ $ const { isArray } = Array;
5
+
6
+ <await(input.promise)>
7
+ <@then|resolved|>
8
+ <${input.renderBody} resolved=resolved />
9
+ </@then>
10
+ <@catch|err|>
11
+ $ if (typeof onAsyncBlockError === "function") onAsyncBlockError(err);
12
+ <if(input.onError)>
13
+ <${input.onError} err=err />
14
+ </if>
15
+ <else>
16
+ <pre data-marko-error=err.message>
17
+ An unexpected error occurred: ${err.message}
18
+ </pre>
19
+ <if(isDev)>
20
+ <pre>${err.stack}</pre>
21
+ </if>
22
+ <if(err.networkError && err.networkError.result)>
23
+ $ const { errors } = err.networkError.result;
24
+ <if(isArray(errors))>
25
+ <pre data-marko-error=JSON.stringify(errors)>
26
+ ${JSON.stringify(errors, null, 2)}
27
+ </pre>
28
+ </if>
29
+ </if>
30
+ </else>
31
+ </@catch>
32
+ </await>
@@ -0,0 +1,85 @@
1
+ // Compiled using marko@4.20.2 - DO NOT EDIT
2
+ "use strict";
3
+
4
+ var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
+ marko_componentType = "/@mindful-web/marko-core$1.0.0/components/resolve.marko",
6
+ marko_renderer = require("marko/dist/runtime/components/renderer"),
7
+ module_isDev = require("../utils/is-dev"),
8
+ isDev = module_isDev.default || module_isDev,
9
+ marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag"),
10
+ helpers_escape_xml = require("marko/dist/runtime/html/helpers/escape-xml"),
11
+ marko_escapeXml = helpers_escape_xml.x,
12
+ marko_attr = require("marko/dist/runtime/html/helpers/attr"),
13
+ marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
14
+ await_tag = marko_loadTag(require("marko/dist/core-tags/core/await/renderer"));
15
+
16
+ function render(input, out, __component, component, state) {
17
+ var data = input;
18
+
19
+ const { onAsyncBlockError } = out.global;
20
+
21
+ const { isArray } = Array;
22
+
23
+ await_tag({
24
+ _provider: input.promise,
25
+ _name: "input.promise",
26
+ then: {
27
+ renderBody: function(out, resolved) {
28
+ marko_dynamicTag(out, input.renderBody, function() {
29
+ return {
30
+ resolved: resolved
31
+ };
32
+ }, null, null, null, __component, "2");
33
+ }
34
+ },
35
+ catch: {
36
+ renderBody: function(out, err) {
37
+ if (typeof onAsyncBlockError === "function") onAsyncBlockError(err);
38
+
39
+ if (input.onError) {
40
+ marko_dynamicTag(out, input.onError, function() {
41
+ return {
42
+ err: err
43
+ };
44
+ }, null, null, null, __component, "4");
45
+ } else {
46
+ out.w("<pre" +
47
+ marko_attr("data-marko-error", err.message) +
48
+ ">\n An unexpected error occurred: " +
49
+ marko_escapeXml(err.message) +
50
+ "\n </pre>");
51
+
52
+ if (isDev) {
53
+ out.w("<pre>" +
54
+ marko_escapeXml(err.stack) +
55
+ "</pre>");
56
+ }
57
+
58
+ if (err.networkError && err.networkError.result) {
59
+ const { errors } = err.networkError.result;
60
+
61
+ if (isArray(errors)) {
62
+ out.w("<pre" +
63
+ marko_attr("data-marko-error", JSON.stringify(errors)) +
64
+ ">\n " +
65
+ marko_escapeXml(JSON.stringify(errors, null, 2)) +
66
+ "\n </pre>");
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }, out, __component, "0");
73
+ }
74
+
75
+ marko_template._ = marko_renderer(render, {
76
+ d_: true,
77
+ e_: marko_componentType
78
+ });
79
+
80
+ marko_template.meta = {
81
+ id: "/@mindful-web/marko-core$1.0.0/components/resolve.marko",
82
+ tags: [
83
+ "marko/dist/core-tags/core/await/renderer"
84
+ ]
85
+ };
package/marko.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "taglib-id": "@mindful-web/marko-core",
3
+ "taglib-imports": [
4
+ "./components/marko.json"
5
+ ]
6
+ }
@@ -0,0 +1 @@
1
+ module.exports = require('@mindful-web/marko-express/middleware/clean-response');
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@mindful-web/marko-core",
3
+ "version": "1.0.0",
4
+ "description": "Core Mindful Web Marko components.",
5
+ "author": "Jacob Bare <jacob@parameter1.com>",
6
+ "main": "index.js",
7
+ "license": "MIT",
8
+ "repository": "https://github.com/parameter1/mindful-web/tree/main/packages/marko-core",
9
+ "engines": {
10
+ "node": ">=14.15"
11
+ },
12
+ "os": [
13
+ "darwin",
14
+ "linux",
15
+ "win32"
16
+ ],
17
+ "scripts": {
18
+ "lint:fix": "yarn lint --fix",
19
+ "lint": "eslint --ext .js --max-warnings 5 ./",
20
+ "compile": "mindful-web-marko-compile compile",
21
+ "prepublish": "yarn compile --silent",
22
+ "test": "yarn compile --no-clean && yarn lint"
23
+ },
24
+ "dependencies": {
25
+ "@mindful-web/dayjs": "^1.0.0",
26
+ "@mindful-web/marko-express": "^1.0.0",
27
+ "@mindful-web/object-path": "^1.0.0",
28
+ "@mindful-web/utils": "^1.0.0",
29
+ "@mindful-web/web-common": "^1.0.0"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "gitHead": "0b77cab713eb5841202bb86c7119949866bc68b5"
35
+ }
@@ -0,0 +1 @@
1
+ module.exports = require('@mindful-web/marko-express/utils/build-global');
@@ -0,0 +1 @@
1
+ module.exports = require('@mindful-web/marko-express/utils/clean-chunk');
@@ -0,0 +1,6 @@
1
+ const { isFunction } = require('@mindful-web/utils');
2
+
3
+ module.exports = (value, def, formatter) => {
4
+ const fn = isFunction(formatter) ? formatter : (v) => v;
5
+ return value != null ? fn(value) : def;
6
+ };
@@ -0,0 +1 @@
1
+ module.exports = (input) => ({ renderBody: input.renderBody });
@@ -0,0 +1 @@
1
+ module.exports = ['development', 'dev', 'develop'].includes(process.env.NODE_ENV);
@@ -0,0 +1,5 @@
1
+ module.exports = (collapse) => {
2
+ if (collapse === 'false') return false;
3
+ if (collapse == null) return true;
4
+ return Boolean(collapse);
5
+ };