@documental-xyz/core 0.1.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 (114) hide show
  1. package/README.md +424 -0
  2. package/integration.ts +113 -0
  3. package/package.json +83 -0
  4. package/src/admin/admin.astro +29 -0
  5. package/src/assets/scripts/App.js +70 -0
  6. package/src/assets/scripts/EnteringAnimations.js +34 -0
  7. package/src/assets/scripts/MapBoxHandler.js +680 -0
  8. package/src/assets/scripts/ScrollProgressionBar.js +24 -0
  9. package/src/assets/scripts/utils/ScrollObserver.js +166 -0
  10. package/src/assets/styles/config/_breakpoints.scss +37 -0
  11. package/src/assets/styles/config/_colors.scss +8 -0
  12. package/src/assets/styles/config/_config.scss +5 -0
  13. package/src/assets/styles/config/_functions.scss +90 -0
  14. package/src/assets/styles/config/_grrr.configs.scss +7 -0
  15. package/src/assets/styles/config/_mixins.scss +207 -0
  16. package/src/assets/styles/config/_type.scss +175 -0
  17. package/src/assets/styles/config/_vars.scss +16 -0
  18. package/src/assets/styles/globals/_content.scss +47 -0
  19. package/src/assets/styles/globals/_grrr.scss +18 -0
  20. package/src/assets/styles/globals/_html.scss +25 -0
  21. package/src/assets/styles/globals/_lists.scss +19 -0
  22. package/src/assets/styles/globals/_map-anchors.scss +32 -0
  23. package/src/assets/styles/globals/_reset.scss +240 -0
  24. package/src/assets/styles/globals/_reveal-animations.scss +104 -0
  25. package/src/assets/styles/globals/_root.scss +6 -0
  26. package/src/assets/styles/globals/_scroll-progression-bar.scss +8 -0
  27. package/src/assets/styles/main.scss +17 -0
  28. package/src/assets/styles/utils/.gitkeep +0 -0
  29. package/src/assets/styles/utils/grrr/_grrr.scss +433 -0
  30. package/src/assets/styles/utils/list-styles/_list-styles.scss +190 -0
  31. package/src/components/AnimationToggle.astro +19 -0
  32. package/src/components/BigNumbers.astro +83 -0
  33. package/src/components/Button.astro +49 -0
  34. package/src/components/Caption.astro +15 -0
  35. package/src/components/Card.astro +68 -0
  36. package/src/components/Cards.astro +66 -0
  37. package/src/components/CardsCall.astro +125 -0
  38. package/src/components/ChartBar.astro +217 -0
  39. package/src/components/ChartPercentage.astro +137 -0
  40. package/src/components/Column.astro +54 -0
  41. package/src/components/ColumnSticky.astro +129 -0
  42. package/src/components/Columns.astro +139 -0
  43. package/src/components/Compare.astro +266 -0
  44. package/src/components/Cta.astro +242 -0
  45. package/src/components/Gallery.astro +594 -0
  46. package/src/components/Group.astro +140 -0
  47. package/src/components/HtmlEmbed.astro +98 -0
  48. package/src/components/ImageBlock.astro +134 -0
  49. package/src/components/InnerColumns.astro +54 -0
  50. package/src/components/LogosGroup.astro +102 -0
  51. package/src/components/Map.astro +321 -0
  52. package/src/components/MapBox.astro +96 -0
  53. package/src/components/MapView.astro +30 -0
  54. package/src/components/Menu.astro +278 -0
  55. package/src/components/Pullquote.astro +46 -0
  56. package/src/components/Slider.astro +223 -0
  57. package/src/components/Spacer.astro +25 -0
  58. package/src/components/Text.astro +173 -0
  59. package/src/components/TextPlaceholder.astro +98 -0
  60. package/src/components/Timeline.astro +73 -0
  61. package/src/components/TimelineBullet.astro +67 -0
  62. package/src/components/VideoEmbed.astro +99 -0
  63. package/src/content/loader.ts +29 -0
  64. package/src/content/pages/alter-ameacada.md +80 -0
  65. package/src/content/pages/expulsions.md +1447 -0
  66. package/src/content/pages/home.md +346 -0
  67. package/src/content/pages/nhanderekoa-studio-autonoma.md +3113 -0
  68. package/src/content/pages/nhanderekoa-terra-ind/303/255gena-jaragu/303/241.md +3806 -0
  69. package/src/content/pages/nova-landing-page.md +546 -0
  70. package/src/content/pages/territ/303/263rios-de-exce/303/247/303/243o.md +2199 -0
  71. package/src/content/pages/teste-alter-do-chao.md +955 -0
  72. package/src/content/pages/teste-layout.md +1484 -0
  73. package/src/content/pages/thiago.md +93 -0
  74. package/src/content/schema/blog.ts +11 -0
  75. package/src/content/schema/geostorys.ts +13 -0
  76. package/src/content/schema/index.ts +3 -0
  77. package/src/content/schema/pages.ts +494 -0
  78. package/src/content.config.ts +49 -0
  79. package/src/env.d.ts +1 -0
  80. package/src/integration/override-aliases.ts +67 -0
  81. package/src/layouts/components/ButtonLayout.astro +8 -0
  82. package/src/layouts/components/CardLayout.astro +8 -0
  83. package/src/layouts/components/CardsCallLayout.astro +26 -0
  84. package/src/layouts/components/CardsLayout.astro +14 -0
  85. package/src/layouts/components/ChartBarLayout.astro +21 -0
  86. package/src/layouts/components/ChartPercentageLayout.astro +17 -0
  87. package/src/layouts/components/ColumnLayout.astro +11 -0
  88. package/src/layouts/components/ColumnStickyLayout.astro +10 -0
  89. package/src/layouts/components/ColumnsLayout.astro +13 -0
  90. package/src/layouts/components/CompareLayout.astro +22 -0
  91. package/src/layouts/components/CtaLayout.astro +91 -0
  92. package/src/layouts/components/GalleryLayout.astro +24 -0
  93. package/src/layouts/components/GroupLayout.astro +53 -0
  94. package/src/layouts/components/HtmlEmbedLayout.astro +18 -0
  95. package/src/layouts/components/ImageBlockLayout.astro +20 -0
  96. package/src/layouts/components/InnerColumnsLayout.astro +14 -0
  97. package/src/layouts/components/LogosGroupLayout.astro +22 -0
  98. package/src/layouts/components/MapLayout.astro +41 -0
  99. package/src/layouts/components/MapViewLayout.astro +8 -0
  100. package/src/layouts/components/MapboxLayout.astro +248 -0
  101. package/src/layouts/components/PullquoteLayout.astro +13 -0
  102. package/src/layouts/components/SliderLayout.astro +18 -0
  103. package/src/layouts/components/SpacerLayout.astro +8 -0
  104. package/src/layouts/components/TextLayout.astro +17 -0
  105. package/src/layouts/components/TextPlaceholderLayout.astro +7 -0
  106. package/src/layouts/components/TimelineBulletLayout.astro +14 -0
  107. package/src/layouts/components/TimelineLayout.astro +10 -0
  108. package/src/layouts/components/VideoEmbedLayout.astro +28 -0
  109. package/src/layouts/pages/Layout.astro +90 -0
  110. package/src/layouts/pages/PageLayout.astro +200 -0
  111. package/src/lib/collections.ts +1 -0
  112. package/src/routes/[slug].astro +17 -0
  113. package/src/routes/index.astro +5 -0
  114. package/src/vite/yaml-merge-plugin.ts +234 -0
@@ -0,0 +1,248 @@
1
+ ---
2
+ const { Component, props } = Astro.props;
3
+ const { style, center, zoom, bearing, pitch, layers, token, views, mapboxData } = props;
4
+
5
+ function parseFilterString(filterStr) {
6
+ if (!filterStr) return null;
7
+
8
+ const operators = ['==', '!=', '<=', '>=', '<', '>', 'in', '!in', 'has', '!has'];
9
+
10
+ for (const op of operators) {
11
+ if (filterStr.includes(op)) {
12
+ const parts = filterStr.split(op);
13
+ if (parts.length === 2) {
14
+ const key = parts[0].trim();
15
+ let value = parts[1].trim();
16
+
17
+ if (op === 'has' || op === '!has') {
18
+ return [op, key];
19
+ }
20
+
21
+ if (op === 'in' || op === '!in') {
22
+ const values = value.split(',').map(v => {
23
+ v = v.trim();
24
+ return !isNaN(v) && v !== '' ? parseFloat(v) : v;
25
+ });
26
+ return [op, ['get', key], values];
27
+ }
28
+
29
+ if (!isNaN(value) && value !== '') {
30
+ value = parseFloat(value);
31
+ }
32
+
33
+ return [op, ['get', key], value];
34
+ }
35
+ }
36
+ }
37
+
38
+ return null;
39
+ }
40
+
41
+ function processLayerString(layerInput) {
42
+ if (typeof layerInput === 'string') {
43
+ if (layerInput.includes('[') && layerInput.includes(']')) {
44
+ const bracketStart = layerInput.indexOf('[');
45
+ const bracketEnd = layerInput.indexOf(']');
46
+
47
+ const name = layerInput.substring(0, bracketStart);
48
+ const filterStr = layerInput.substring(bracketStart + 1, bracketEnd);
49
+ const filter = parseFilterString(filterStr);
50
+
51
+ return { name, filter };
52
+ }
53
+
54
+ return { name: layerInput, filter: null };
55
+ }
56
+
57
+ if (typeof layerInput === 'object' && layerInput.name) {
58
+ const processedLayer = {
59
+ name: layerInput.name,
60
+ filter: null
61
+ };
62
+
63
+ if (layerInput.filterKey && layerInput.comparison && layerInput.filterValue !== undefined && layerInput.filterValue !== '') {
64
+ let filterValue = layerInput.filterValue;
65
+
66
+ if (!isNaN(filterValue) && filterValue !== '') {
67
+ filterValue = parseFloat(filterValue);
68
+ }
69
+
70
+ if (layerInput.comparison === 'has' || layerInput.comparison === '!has') {
71
+ processedLayer.filter = [layerInput.comparison, layerInput.filterKey];
72
+ } else if (layerInput.comparison === 'in' || layerInput.comparison === '!in') {
73
+ const values = Array.isArray(filterValue) ? filterValue : [filterValue];
74
+ processedLayer.filter = [layerInput.comparison, ['get', layerInput.filterKey], values];
75
+ } else {
76
+ processedLayer.filter = [layerInput.comparison, ['get', layerInput.filterKey], filterValue];
77
+ }
78
+ }
79
+
80
+ return processedLayer;
81
+ }
82
+
83
+ return { name: layerInput, filter: null };
84
+ }
85
+
86
+ function processLayers(layers) {
87
+ if (!layers) return [];
88
+
89
+ if (typeof layers === 'string') {
90
+ const layerLines = layers.split('\n').map(line => line.trim()).filter(line => line.length > 0);
91
+ return layerLines.map(processLayerString).filter(layer => layer.name);
92
+ }
93
+
94
+ if (Array.isArray(layers)) {
95
+ return layers.map(processLayerString).filter(layer => layer.name);
96
+ }
97
+
98
+ return [];
99
+ }
100
+
101
+ let finalMapConfig = null;
102
+ let finalMapViews = {};
103
+
104
+ const hasComponentData = style && token;
105
+ const hasPageData = mapboxData && mapboxData.style && mapboxData.token;
106
+
107
+ if (hasComponentData) {
108
+ finalMapConfig = {
109
+ style,
110
+ center: center ? [center.lng, center.lat] : [0, 0],
111
+ zoom: zoom || 2,
112
+ bearing: bearing || 0,
113
+ pitch: pitch || 0,
114
+ layers: processLayers(layers),
115
+ };
116
+
117
+ if (views) {
118
+ finalMapViews = views.reduce((acc, view) => {
119
+ if (view.id) {
120
+ acc[view.id] = {
121
+ center: view.center ? [view.center.lng, view.center.lat] : [0, 0],
122
+ duration: view.duration || 4000,
123
+ zoom: view.zoom || 2,
124
+ bearing: view.bearing || 0,
125
+ pitch: view.pitch || 0,
126
+ layers: processLayers(view.layers),
127
+ mobile: view.mobile || {},
128
+ captions: view.captions || {},
129
+ };
130
+ }
131
+ return acc;
132
+ }, {});
133
+ }
134
+ }
135
+
136
+ if (hasPageData) {
137
+ const centerLng = mapboxData.centerLng || mapboxData.center?.lng || 0;
138
+ const centerLat = mapboxData.centerLat || mapboxData.center?.lat || 0;
139
+
140
+ const pageMapConfig = {
141
+ style: mapboxData.style,
142
+ center: [parseFloat(String(centerLng)), parseFloat(String(centerLat))],
143
+ zoom: parseFloat(String(mapboxData.zoom || 2)),
144
+ bearing: parseFloat(String(mapboxData.bearing || 0)),
145
+ pitch: parseFloat(String(mapboxData.pitch || 0)),
146
+ layers: processLayers(mapboxData.layers),
147
+ };
148
+
149
+ let pageMapViews = {};
150
+ if (mapboxData.views && Array.isArray(mapboxData.views)) {
151
+ mapboxData.views.forEach(view => {
152
+ if (view.id) {
153
+ const viewCenterLng = view.centerLng || view.center?.lng || 0;
154
+ const viewCenterLat = view.centerLat || view.center?.lat || 0;
155
+
156
+ let processedCaptions = {};
157
+ if (view.title || view.notes || view.items) {
158
+ processedCaptions = {
159
+ title: view.title,
160
+ notes: view.notes,
161
+ items: view.items ? view.items.map(item => {
162
+ if (item.icon && item.colorIcon && item.typeIcon) {
163
+ const fillValue = item.iconFill ? 1 : 0;
164
+ const iconHtml = `<span class="material-symbols-${item.typeIcon}" style="color: ${item.colorIcon}; font-variation-settings: 'FILL' ${fillValue}">${item.icon}</span>`;
165
+ return {
166
+ ...item,
167
+ icon: iconHtml
168
+ };
169
+ }
170
+ return item;
171
+ }) : []
172
+ };
173
+ }
174
+
175
+ const mobileConfig = view.mobileZoom ? { zoom: parseFloat(String(view.mobileZoom)) } : {};
176
+
177
+ pageMapViews[view.id] = {
178
+ center: [parseFloat(String(viewCenterLng)), parseFloat(String(viewCenterLat))],
179
+ duration: parseFloat(String(view.duration || 4000)),
180
+ zoom: parseFloat(String(view.zoom || 2)),
181
+ bearing: parseFloat(String(view.bearing || 0)),
182
+ pitch: parseFloat(String(view.pitch || 0)),
183
+ layers: processLayers(view.layers),
184
+ mobile: mobileConfig,
185
+ captions: processedCaptions,
186
+ };
187
+ }
188
+ });
189
+ }
190
+
191
+ if (hasComponentData) {
192
+ const existingLayers = finalMapConfig.layers || [];
193
+ const newLayers = pageMapConfig.layers || [];
194
+
195
+ const mergedLayers = [...existingLayers];
196
+ newLayers.forEach(newLayer => {
197
+ if (!existingLayers.find(existing => existing.name === newLayer.name)) {
198
+ mergedLayers.push(newLayer);
199
+ }
200
+ });
201
+
202
+ finalMapConfig = {
203
+ ...finalMapConfig,
204
+ ...pageMapConfig,
205
+ layers: mergedLayers
206
+ };
207
+
208
+ finalMapViews = { ...finalMapViews, ...pageMapViews };
209
+ } else {
210
+ finalMapConfig = pageMapConfig;
211
+ finalMapViews = pageMapViews;
212
+ }
213
+ }
214
+ ---
215
+
216
+ <Component {...props}>
217
+ <slot />
218
+ </Component>
219
+
220
+ {(hasComponentData || hasPageData) && (
221
+ <script is:inline define:vars={{ finalMapConfig, finalMapViews, token: (token || mapboxData?.token) }}>
222
+ if (window.mapConfig) {
223
+ const existingLayers = window.mapConfig.layers || [];
224
+ const newLayers = finalMapConfig.layers || [];
225
+
226
+ const mergedLayers = [...existingLayers];
227
+ newLayers.forEach(newLayer => {
228
+ if (!existingLayers.find(existing => existing.name === newLayer.name)) {
229
+ mergedLayers.push(newLayer);
230
+ }
231
+ });
232
+
233
+ window.mapConfig = {
234
+ ...finalMapConfig,
235
+ ...window.mapConfig,
236
+ layers: mergedLayers
237
+ };
238
+ } else {
239
+ window.mapConfig = finalMapConfig;
240
+ }
241
+
242
+ window.mapBoxToken = window.mapBoxToken || token;
243
+
244
+ if (finalMapViews && Object.keys(finalMapViews).length > 0) {
245
+ window.mapViews = { ...finalMapViews, ...(window.mapViews || {}) };
246
+ }
247
+ </script>
248
+ )}
@@ -0,0 +1,13 @@
1
+ ---
2
+ import AnimationToggle from "../../components/AnimationToggle.astro";
3
+
4
+ const { Component, props } = Astro.props;
5
+ const { content, byline, ...otherProps } = props;
6
+ ---
7
+ <AnimationToggle>
8
+ <Component {...otherProps}>
9
+ {content}
10
+ {byline && <Fragment slot="byline">{byline}</Fragment>}
11
+ <slot />
12
+ </Component>
13
+ </AnimationToggle>
@@ -0,0 +1,18 @@
1
+ ---
2
+ import AnimationToggle from "../../components/AnimationToggle.astro";
3
+
4
+ const { Component, props } = Astro.props;
5
+ const { slides = [] } = props;
6
+
7
+ // Atualiza o array de slides substituindo a imagem original por `thumb` localizada em public/uploads
8
+ const updatedSlides = slides.map(slide => {
9
+ let updatedSlide = { ...slide };
10
+ if (updatedSlide.image) {
11
+ updatedSlide.image = /^https?:\/\//i.test(slide.image) ? slide.image : new URL(slide.image.replace(/^\/+/, ''), new URL(import.meta.env.BASE_URL, 'http://local')).pathname;
12
+ }
13
+ return updatedSlide;
14
+ });
15
+ ---
16
+ <AnimationToggle>
17
+ <Component slides={updatedSlides} />
18
+ </AnimationToggle>
@@ -0,0 +1,8 @@
1
+ ---
2
+ const { Component, props } = Astro.props;
3
+ const { desktop, tablet, mobile, ...otherProps } = props;
4
+ ---
5
+
6
+ <Component desktop={desktop} tablet={tablet} mobile={mobile} {...otherProps}>
7
+ <slot />
8
+ </Component>
@@ -0,0 +1,17 @@
1
+ ---
2
+ const { Component, props } = Astro.props;
3
+ const { txtColor, bgColor, content, ...otherProps } = props;
4
+
5
+ // Adicionando um processador de Markdown (se necessário)
6
+ import { marked } from 'marked';
7
+ import AnimationToggle from '../../components/AnimationToggle.astro';
8
+
9
+ const htmlContent = content ? marked(content) : null;
10
+ ---
11
+
12
+ <AnimationToggle>
13
+ <Component txtColor={txtColor} bgColor={bgColor} {...otherProps}>
14
+ {htmlContent && <Fragment set:html={htmlContent} />}
15
+ <slot />
16
+ </Component>
17
+ </AnimationToggle>
@@ -0,0 +1,7 @@
1
+ ---
2
+ const { Component, props } = Astro.props;
3
+ ---
4
+
5
+ <Component {...props}>
6
+ <slot />
7
+ </Component>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import { marked } from 'marked'; // ①
3
+
4
+ const { Component, props } = Astro.props;
5
+ const { text, content } = props;
6
+
7
+ const htmlContent = content ? marked(content) : null;
8
+ //console.log("Conteúdo TimelineBullet: ", htmlContent)
9
+
10
+ ---
11
+ <div>
12
+ <Component text={text} />
13
+ <Fragment set:html={htmlContent} />
14
+ </div>
@@ -0,0 +1,10 @@
1
+ ---
2
+ import AnimationToggle from "../../components/AnimationToggle.astro";
3
+
4
+ const { Component, props } = Astro.props;
5
+ ---
6
+ <AnimationToggle>
7
+ <Component>
8
+ <slot />
9
+ </Component>
10
+ </AnimationToggle>
@@ -0,0 +1,28 @@
1
+ ---
2
+ import AnimationToggle from "../../components/AnimationToggle.astro";
3
+
4
+ const { Component, props } = Astro.props;
5
+ const { videoUrl, videoCaption, wideVideo } = props;
6
+
7
+ const componentData = {
8
+ wide: wideVideo || false
9
+ };
10
+ ---
11
+ <AnimationToggle>
12
+ <Component {...componentData}>
13
+ <iframe
14
+ width="560"
15
+ height="315"
16
+ src={videoUrl}
17
+ title="YouTube video player"
18
+ frameborder="0"
19
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
20
+ referrerpolicy="strict-origin-when-cross-origin"
21
+ wide={wideVideo}
22
+ allowfullscreen
23
+ ></iframe>
24
+ <Fragment slot="caption">
25
+ {videoCaption}
26
+ </Fragment>
27
+ </Component>
28
+ </AnimationToggle>
@@ -0,0 +1,90 @@
1
+ ---
2
+ // src/layouts/Layout.astro
3
+ import '../../assets/styles/main.scss';
4
+
5
+ interface Props {
6
+ title: string;
7
+ pageTheme?: any;
8
+ }
9
+
10
+ const { title, pageTheme = {} } = Astro.props;
11
+
12
+ const primaryColor = pageTheme?.primaryColor || '#000';
13
+ const secondaryColor = pageTheme?.secondaryColor || '';
14
+ const highlightColor = pageTheme?.highlightColor || '';
15
+ const auxiliaryColor = pageTheme?.auxiliaryColor || '';
16
+ const displayFont = pageTheme?.displayFont || '';
17
+ const textFont = pageTheme?.textFont || '';
18
+ const spacingPatterns = pageTheme?.spacingPatterns || [];
19
+
20
+ const getFontName = (url) => {
21
+ if (!url) return '';
22
+ const fontName = url.match(/family=([^&:]+)/)?.[1];
23
+ return fontName ? fontName.replace(/\+/g, ' ') : '';
24
+ };
25
+
26
+ const displayFontName = getFontName(displayFont);
27
+ const textFontName = getFontName(textFont);
28
+
29
+ const styleString = spacingPatterns.map(pattern => `
30
+ --mt-${pattern.name}-mobile: ${pattern.mobile};
31
+ --mt-${pattern.name}-tablet: ${pattern.tablet};
32
+ --mt-${pattern.name}-desktop: ${pattern.desktop};
33
+ `).join('\n');
34
+ ---
35
+
36
+ <!doctype html>
37
+ <html lang="en" style={`
38
+ --clr-txt: ${primaryColor};
39
+ --clr-bg: ${secondaryColor};
40
+ --clr-bg-hl: ${highlightColor};
41
+ --clr-hl: ${auxiliaryColor};
42
+
43
+ ${displayFont ? `--ff-display: ${displayFontName};` : ''}
44
+ ${textFont ? `--ff-text: ${textFontName};` : ''}
45
+
46
+ ${styleString}
47
+
48
+ `}>
49
+ <head>
50
+ <meta charset="UTF-8" />
51
+ <meta name="description" content="Astro description" />
52
+ <meta name="viewport" content="width=device-width" />
53
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
54
+ <link rel="stylesheet" href={displayFont} />
55
+ <link rel="stylesheet" href={textFont} />
56
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,300,0,0" />
57
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
58
+ <script is:inline src="https://api.mapbox.com/mapbox-gl-js/v1.8.0/mapbox-gl.js"></script>
59
+ <link href="https://api.mapbox.com/mapbox-gl-js/v1.8.0/mapbox-gl.css" rel="stylesheet">
60
+ <script>import '../../assets/scripts/App.js';</script>
61
+ <meta name="generator" content={Astro.generator} />
62
+ <title>{title}</title>
63
+ </head>
64
+ <body style={`${!secondaryColor ? 'background-color: transparent !important;' : ''}`}>
65
+ <slot />
66
+ </body>
67
+ </html>
68
+
69
+ <script>
70
+ const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
71
+ isSafari && document.body.classList.add('is-safari');
72
+ </script>
73
+
74
+ <style lang="scss">
75
+ @use "../../assets/styles/config/config" as *;
76
+
77
+ :global(:root) {
78
+ --map-height-mobile: 52vh;
79
+
80
+ --mt-s: var(--mt-default-mobile, 40px);
81
+ --mt-m: var(--mt-default-tablet, 80px);
82
+ --mt-l: var(--mt-default-desktop, 120px);
83
+
84
+ @include media-break-down(xl) {
85
+ --mt-s: var(--mt-default-mobile, 30px);
86
+ --mt-m: var(--mt-default-tablet, 60px);
87
+ --mt-l: var(--mt-default-desktop, 90px);
88
+ }
89
+ }
90
+ </style>
@@ -0,0 +1,200 @@
1
+ ---
2
+ import { getEntry } from 'astro:content';
3
+ import { PAGES_COLLECTION } from '../../lib/collections';
4
+
5
+ import Layout from "./Layout.astro";
6
+ import MapBox from '../../components/MapBox.astro';
7
+ import Button from '../../components/Button.astro';
8
+ import Group from '../../components/Group.astro';
9
+ import ColumnSticky from '../../components/ColumnSticky.astro';
10
+ import Text from '../../components/Text.astro';
11
+ import Cta from '../../components/Cta.astro';
12
+ import CardsCall from '../../components/CardsCall.astro';
13
+ import Cards from '../../components/Cards.astro';
14
+ import ChartBar from '../../components/ChartBar.astro';
15
+ import ChartPercentage from '../../components/ChartPercentage.astro';
16
+ import Column from '../../components/Column.astro';
17
+ import Columns from '../../components/Columns.astro';
18
+ import ImageBlock from '../../components/ImageBlock.astro';
19
+ import InnerColumns from '../../components/InnerColumns.astro';
20
+ import LogosGroup from '../../components/LogosGroup.astro';
21
+ import VideoEmbed from '../../components/VideoEmbed.astro';
22
+ import HtmlEmbed from '../../components/HtmlEmbed.astro';
23
+ import Map from '../../components/Map.astro';
24
+ import MapView from '../../components/MapView.astro';
25
+ import Spacer from '../../components/Spacer.astro';
26
+ import Timeline from '../../components/Timeline.astro';
27
+ import TimelineBullet from '../../components/TimelineBullet.astro';
28
+ import BigNumbers from '../../components/BigNumbers.astro';
29
+ import Compare from '../../components/Compare.astro';
30
+ import Pullquote from '../../components/Pullquote.astro';
31
+ import Gallery from '../../components/Gallery.astro';
32
+ import Slider from '../../components/Slider.astro';
33
+ import Menu from "../../components/Menu.astro";
34
+
35
+ const { slug } = Astro.props;
36
+
37
+ const entry = await getEntry(PAGES_COLLECTION, slug);
38
+ if (!entry) {
39
+ throw new Error(`Nenhuma entrada encontrada para "${slug}".`);
40
+ }
41
+
42
+ const { title, components, mapbox, pageSettings } = entry.data;
43
+
44
+ const hasMapboxData = mapbox && mapbox.style && mapbox.token;
45
+
46
+ const componentMap = {
47
+ Group,
48
+ ColumnSticky,
49
+ Text,
50
+ Cta,
51
+ Cards,
52
+ CardsCall,
53
+ ChartBar,
54
+ ChartPercentage,
55
+ Column,
56
+ Columns,
57
+ ImageBlock,
58
+ InnerColumns,
59
+ LogosGroup,
60
+ VideoEmbed,
61
+ HtmlEmbed,
62
+ Map,
63
+ MapView,
64
+ Spacer,
65
+ Timeline,
66
+ TimelineBullet,
67
+ BigNumbers,
68
+ Compare,
69
+ Pullquote,
70
+ Gallery,
71
+ Slider,
72
+ Button
73
+ };
74
+
75
+ const languages = [
76
+ {
77
+ slug: "PT",
78
+ url: pageSettings?.link_pt_br || "#",
79
+ },
80
+ {
81
+ slug: "EN",
82
+ url: pageSettings?.link_en || "#",
83
+ },
84
+ {
85
+ slug: "ES",
86
+ url: pageSettings?.link_es || "#",
87
+ },
88
+ ];
89
+
90
+ const mainMenu = components
91
+ ? components
92
+ .filter(component => component.id && component.showInMenu === true)
93
+ .map(component => ({
94
+ text: component.longTitle || component.shortTitle,
95
+ url: `#${component.id}`,
96
+ }))
97
+ : [];
98
+ ---
99
+
100
+ <Layout title={title} pageTheme={entry.data?.pageTheme}>
101
+ <main>
102
+ <Menu
103
+ languages={languages}
104
+ menu={mainMenu}
105
+ sideLink={{ url: "/" }}
106
+ />
107
+ {hasMapboxData && <MapBox mapboxData={mapbox} />}
108
+ {
109
+ (async function() {
110
+ async function renderComponents(componentList) {
111
+ if (!componentList) return [];
112
+
113
+ const results = await Promise.all(componentList.map(async ({ type, components: childComponents, txtColor, bgColor, ...restProps }) => {
114
+ const Component = componentMap[type];
115
+ if (!Component) return null;
116
+
117
+ const themeColors = entry.data?.pageTheme || {};
118
+
119
+ const replaceColor = (color) => {
120
+ if (color === 'Primary') return themeColors?.primaryColor;
121
+ if (color === 'Secondary') return themeColors?.secondaryColor;
122
+ if (color === 'Highlight') return themeColors?.highlightColor;
123
+ if (color === '') return 'transparent';
124
+ return color;
125
+ };
126
+
127
+ const props = {
128
+ ...restProps,
129
+ txtColor: txtColor === 'Custom' ? restProps.customTxtColor : replaceColor(txtColor),
130
+ bgColor: bgColor === 'Custom' ? restProps.customBgColor : replaceColor(bgColor),
131
+ };
132
+
133
+ if (type === 'InnerColumns') {
134
+ const column1 = restProps.column1;
135
+ const column2 = restProps.column2;
136
+
137
+ return (
138
+ <InnerColumns>
139
+ <Fragment slot="column-1">
140
+ { renderComponents(column1.components)}
141
+ </Fragment>
142
+ <Fragment slot="column-2">
143
+ {renderComponents(column2.components)}
144
+ </Fragment>
145
+ </InnerColumns>
146
+ );
147
+ }
148
+
149
+ if (type === 'Columns') {
150
+ const column1 = restProps.column1;
151
+ const column2 = restProps.column2;
152
+ const paddingTop = restProps.paddingTop;
153
+ const paddingBottom = restProps.paddingBottom;
154
+ const invertOnMobile = restProps.invertOnMobile;
155
+ const alignment = restProps.columnsAlign;
156
+
157
+ return (
158
+ <Columns paddingTop={paddingTop} paddingBottom={paddingBottom} invertOnMobile={invertOnMobile} alignment={alignment}>
159
+ <Fragment slot="column-1">
160
+ { renderComponents(column1.components)}
161
+ </Fragment>
162
+ <Fragment slot="column-2">
163
+ {renderComponents(column2.components)}
164
+ </Fragment>
165
+ </Columns>
166
+ );
167
+ }
168
+
169
+ let Layout = null;
170
+ try {
171
+ const layoutModule = await import(`../components/${type}Layout.astro`);
172
+ Layout = layoutModule.default;
173
+ } catch (e) {
174
+ }
175
+
176
+ const children = childComponents ? await renderComponents(childComponents) : [];
177
+
178
+ if (Layout) {
179
+ return (
180
+ <Layout Component={Component} props={props} pageSettings={pageSettings}>
181
+ {children}
182
+ </Layout>
183
+ );
184
+ } else {
185
+ return (
186
+ <Component {...props}>
187
+ {children}
188
+ </Component>
189
+ );
190
+ }
191
+ }));
192
+
193
+ return results;
194
+ }
195
+
196
+ return await renderComponents(components);
197
+ })()
198
+ }
199
+ </main>
200
+ </Layout>
@@ -0,0 +1 @@
1
+ export const PAGES_COLLECTION = 'pages' as const;
@@ -0,0 +1,17 @@
1
+ ---
2
+ import PageLayout from '../layouts/pages/PageLayout.astro';
3
+ import { PAGES_COLLECTION } from '../lib/collections';
4
+
5
+ const { slug } = Astro.params;
6
+
7
+ export async function getStaticPaths() {
8
+ const { getCollection } = await import('astro:content');
9
+ const pages = await getCollection(PAGES_COLLECTION);
10
+
11
+ return pages.map((page) => ({
12
+ params: { slug: page.id },
13
+ }));
14
+ }
15
+ ---
16
+
17
+ <PageLayout slug={slug} />
@@ -0,0 +1,5 @@
1
+ ---
2
+ import PageLayout from '../layouts/pages/PageLayout.astro';
3
+ ---
4
+
5
+ <PageLayout slug="home" />