@mapvx/website-component 0.5.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.
package/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+ PRIVATE AND CONFIDENTIAL
2
+
3
+ Copyright (c) 2025
4
+
5
+ All rights reserved.
6
+
7
+ This software and its documentation are private and confidential.
8
+ No part of this software may be reproduced, distributed, or transmitted in any form or by any means,
9
+ including photocopying, recording, or other electronic or mechanical methods, without the prior written
10
+ permission of the copyright holder.
11
+
12
+ The receipt or possession of the source code and/or related information does not convey or imply any right
13
+ to use, reproduce, disclose or distribute its contents, or to manufacture, use, or sell anything that it
14
+ may describe.
15
+
16
+ Any unauthorized use, reproduction, or distribution of this software or its contents is strictly prohibited
17
+ and may result in severe civil and criminal penalties.
package/README.md ADDED
@@ -0,0 +1,438 @@
1
+ # MapVX Website Component
2
+
3
+ A modern, framework-agnostic web component built with Angular 20 that provides an interactive map and location discovery interface.
4
+
5
+ ## 🚀 Features
6
+
7
+ - ✅ Compatible with any framework (React, Vue, Vanilla JS, etc.)
8
+ - ✅ Self-contained and isolated (Shadow DOM)
9
+ - ✅ Optimized bundle without hashing for production
10
+ - ✅ Angular 20 with modern architecture (standalone components)
11
+ - 🔑 **Requires API Key**: The component needs a valid API key to function
12
+
13
+ ## 📦 Installation
14
+
15
+ ### Via NPM
16
+
17
+ ```bash
18
+ npm install @mapvx/website-component
19
+ ```
20
+
21
+ After installation, you can reference the files in your application:
22
+
23
+ **JavaScript/TypeScript:**
24
+
25
+ ```javascript
26
+ // Import the main component file
27
+ import '@mapvx/website-component/dist/browser/main.js'
28
+ // Import the styles
29
+ import '@mapvx/website-component/dist/browser/styles.css'
30
+ ```
31
+
32
+ **HTML:**
33
+
34
+ ```html
35
+ <!-- Include the component files -->
36
+ <script src="node_modules/@mapvx/website-component/dist/browser/main.js"></script>
37
+ <link rel="stylesheet" href="node_modules/@mapvx/website-component/dist/browser/styles.css" />
38
+ ```
39
+
40
+ **Webpack/Vite/Bundler:**
41
+
42
+ ```javascript
43
+ // In your main entry file
44
+ import '@mapvx/website-component/dist/browser/main.js'
45
+ import '@mapvx/website-component/dist/browser/styles.css'
46
+ ```
47
+
48
+ **Framework-specific examples:**
49
+
50
+ **React:**
51
+
52
+ ```jsx
53
+ // In your main App.jsx or index.jsx
54
+ import '@mapvx/website-component/dist/browser/main.js'
55
+ import '@mapvx/website-component/dist/browser/styles.css'
56
+
57
+ function App() {
58
+ return <mapvx-website api-key="your-api-key-here" />
59
+ }
60
+ ```
61
+
62
+ **Vue:**
63
+
64
+ ```javascript
65
+ // In your main.js
66
+ import '@mapvx/website-component/dist/browser/main.js'
67
+ import '@mapvx/website-component/dist/browser/styles.css'
68
+ ```
69
+
70
+ **Angular:**
71
+
72
+ ```typescript
73
+ // In your angular.json or import in main.ts
74
+ import '@mapvx/website-component/dist/browser/main.js'
75
+ import '@mapvx/website-component/dist/browser/styles.css'
76
+ ```
77
+
78
+ ### Helper Package (SSR Support)
79
+
80
+ For Server-Side Rendering (SSR) applications that need to preload initial data on the server:
81
+
82
+ ```bash
83
+ npm install @mapvx/website-component-helpers
84
+ ```
85
+
86
+ ### Via CDN (unpkg)
87
+
88
+ ```html
89
+ <!-- Include the component files -->
90
+ <script src="https://unpkg.com/@mapvx/website-component@latest/dist/browser/main.js"></script>
91
+ <link
92
+ rel="stylesheet"
93
+ href="https://unpkg.com/@mapvx/website-component@latest/dist/browser/styles.css"
94
+ />
95
+ ```
96
+
97
+ ## 🎯 Usage
98
+
99
+ ### Basic Usage
100
+
101
+ ```html
102
+ <!-- Basic implementation with required API key -->
103
+ <mapvx-website api-key="your-api-key-here"></mapvx-website>
104
+ ```
105
+
106
+ ### Advanced Usage with Configuration
107
+
108
+ ```html
109
+ <!-- With all available options -->
110
+ <mapvx-website
111
+ api-key="your-api-key-here"
112
+ institution-id="optional-institution-id"
113
+ initial-data='{"custom": "data"}'
114
+ default-to-map="true"
115
+ show-category-filters="false"
116
+ show-city-filter="true"
117
+ inherit-font-family="false"
118
+ >
119
+ </mapvx-website>
120
+ ```
121
+
122
+ ### Framework Integration
123
+
124
+ #### React
125
+
126
+ ```jsx
127
+ function App() {
128
+ return (
129
+ <mapvx-website
130
+ api-key="your-api-key-here"
131
+ default-to-map="true"
132
+ show-category-filters="false"
133
+ />
134
+ )
135
+ }
136
+ ```
137
+
138
+ #### Vue
139
+
140
+ ```vue
141
+ <template>
142
+ <mapvx-website
143
+ api-key="your-api-key-here"
144
+ :default-to-map="true"
145
+ :show-category-filters="false"
146
+ />
147
+ </template>
148
+ ```
149
+
150
+ #### Angular
151
+
152
+ ```typescript
153
+ // In your component
154
+ @Component({
155
+ template: `
156
+ <mapvx-website
157
+ [attr.api-key]="apiKey"
158
+ [attr.default-to-map]="defaultToMap"
159
+ [attr.show-category-filters]="showFilters"
160
+ />
161
+ `,
162
+ })
163
+ export class MyComponent {
164
+ apiKey = 'your-api-key-here'
165
+ defaultToMap = true
166
+ showFilters = false
167
+ }
168
+ ```
169
+
170
+ ## 📋 Input Properties
171
+
172
+ The web component accepts the following input properties to customize its behavior:
173
+
174
+ | Property | Type | Required | Default | Description |
175
+ | ----------------------- | --------- | ---------- | ------- | ------------------------------------------------------------------------------------------------ |
176
+ | `api-key` | `string` | ✅ **Yes** | - | Valid API key to initialize the SDK |
177
+ | `institution-id` | `string` | ✅ **Yes** | - | Institution ID for specific data filtering and search |
178
+ | `initial-data` | `string` | ❌ No | - | JSON string with initial data (use `prepareInitialData` from `@mapvx/website-component-helpers`) |
179
+ | `default-to-map` | `boolean` | ❌ No | `false` | If `true`, shows map view by default |
180
+ | `show-category-filters` | `boolean` | ❌ No | `true` | If `true`, shows category filters |
181
+ | `show-city-filter` | `boolean` | ❌ No | `true` | If `true`, shows city filter |
182
+ | `inherit-font-family` | `boolean` | ❌ No | `false` | If `true`, inherits font family from parent |
183
+
184
+ ### Input Usage Examples
185
+
186
+ #### Required Properties Only
187
+
188
+ ```html
189
+ <mapvx-website api-key="your-api-key-here"></mapvx-website>
190
+ ```
191
+
192
+ #### With Optional Configuration
193
+
194
+ ```html
195
+ <mapvx-website
196
+ api-key="your-api-key-here"
197
+ institution-id="institution-123"
198
+ default-to-map="true"
199
+ show-category-filters="false"
200
+ show-city-filter="true"
201
+ >
202
+ </mapvx-website>
203
+ ```
204
+
205
+ ## 🔧 Server-Side Rendering (SSR) Support
206
+
207
+ For applications using Server-Side Rendering (SSR) where you need to preload initial data on the server before sending it to the browser:
208
+
209
+ ### Installation
210
+
211
+ ```bash
212
+ npm install @mapvx/website-component-helpers
213
+ ```
214
+
215
+ ### Server-Side Usage
216
+
217
+ #### Next.js (App Router)
218
+
219
+ ```typescript
220
+ // app/page.tsx
221
+ import { prepareInitialData } from '@mapvx/website-component-helpers';
222
+
223
+ export default async function HomePage() {
224
+ // Execute on the server
225
+ const initialData = await prepareInitialData(process.env.MAPVX_API_KEY!);
226
+
227
+ return (
228
+ <div>
229
+ <h1>My App</h1>
230
+ <mapvx-website
231
+ api-key={process.env.MAPVX_API_KEY}
232
+ initial-data={initialData}
233
+ default-to-map="true"
234
+ />
235
+ </div>
236
+ );
237
+ }
238
+ ```
239
+
240
+ #### Next.js (Pages Router)
241
+
242
+ ```typescript
243
+ // pages/index.tsx
244
+ import { GetServerSideProps } from 'next';
245
+ import { prepareInitialData } from '@mapvx/website-component-helpers';
246
+
247
+ export const getServerSideProps: GetServerSideProps = async () => {
248
+ // Execute on the server
249
+ const initialData = await prepareInitialData(process.env.MAPVX_API_KEY!);
250
+
251
+ return {
252
+ props: {
253
+ initialData,
254
+ },
255
+ };
256
+ };
257
+
258
+ export default function HomePage({ initialData }: { initialData: string }) {
259
+ return (
260
+ <div>
261
+ <h1>My App</h1>
262
+ <mapvx-website
263
+ api-key={process.env.MAPVX_API_KEY}
264
+ initial-data={initialData}
265
+ default-to-map="true"
266
+ />
267
+ </div>
268
+ );
269
+ }
270
+ ```
271
+
272
+ #### Nuxt.js
273
+
274
+ ```vue
275
+ <!-- pages/index.vue -->
276
+ <template>
277
+ <div>
278
+ <h1>My App</h1>
279
+ <mapvx-website :api-key="apiKey" :initial-data="initialData" default-to-map="true" />
280
+ </div>
281
+ </template>
282
+
283
+ <script setup>
284
+ import { prepareInitialData } from '@mapvx/website-component-helpers'
285
+
286
+ // Server-side data fetching
287
+ const { data: initialData } = await useAsyncData('mapvx-data', async () => {
288
+ return await prepareInitialData(process.env.MAPVX_API_KEY)
289
+ })
290
+
291
+ const apiKey = process.env.MAPVX_API_KEY
292
+ </script>
293
+ ```
294
+
295
+ #### SvelteKit
296
+
297
+ ```typescript
298
+ // src/routes/+page.server.ts
299
+ import { prepareInitialData } from '@mapvx/website-component-helpers'
300
+ import type { PageServerLoad } from './$types'
301
+
302
+ export const load: PageServerLoad = async () => {
303
+ // Execute on the server
304
+ const initialData = await prepareInitialData(process.env.MAPVX_API_KEY!)
305
+
306
+ return {
307
+ initialData,
308
+ }
309
+ }
310
+ ```
311
+
312
+ ```svelte
313
+ <!-- src/routes/+page.svelte -->
314
+ <script lang="ts">
315
+ import type { PageData } from './$types';
316
+
317
+ export let data: PageData;
318
+ </script>
319
+
320
+ <div>
321
+ <h1>My App</h1>
322
+ <mapvx-website
323
+ api-key={process.env.MAPVX_API_KEY}
324
+ initial-data={data.initialData}
325
+ default-to-map="true"
326
+ />
327
+ </div>
328
+ ```
329
+
330
+ ### What `prepareInitialData` does
331
+
332
+ The `prepareInitialData` function is specifically designed for SSR applications:
333
+
334
+ - **Server-side execution**: Must be called on the server, not in the browser
335
+ - **Data fetching**: Fetches available places and institutions from the API
336
+ - **Performance optimization**: Preloads data on the server to avoid client-side API calls
337
+ - **SEO benefits**: Ensures data is available during server-side rendering
338
+ - **Returns**: JSON string with combined places and institutions data
339
+
340
+ ### Important Notes
341
+
342
+ ⚠️ **SSR Only**: This function should only be used in server-side rendering contexts. For client-side applications, the web component will fetch data automatically when needed.
343
+
344
+ ## 🎨 Customization
345
+
346
+ ### Custom Colors
347
+
348
+ The web component supports custom color theming through CSS custom properties. You can override the default colors by defining CSS variables in your application's root:
349
+
350
+ ```css
351
+ :root {
352
+ --mapvx-secondary-orange: #b41500;
353
+ --mapvx-secondary-blue: #053a96;
354
+ }
355
+ ```
356
+
357
+ #### Example Implementation
358
+
359
+ **HTML with inline styles:**
360
+
361
+ ```html
362
+ <style>
363
+ :root {
364
+ --mapvx-secondary-orange: #ff6b35;
365
+ --mapvx-secondary-blue: #1e3a8a;
366
+ }
367
+ </style>
368
+
369
+ <mapvx-website api-key="your-api-key-here"></mapvx-website>
370
+ ```
371
+
372
+ **CSS file:**
373
+
374
+ ```css
375
+ /* styles.css */
376
+ :root {
377
+ --mapvx-secondary-orange: #e74c3c;
378
+ --mapvx-secondary-blue: #3498db;
379
+ }
380
+ ```
381
+
382
+ **Framework-specific examples:**
383
+
384
+ **React:**
385
+
386
+ ```jsx
387
+ // In your CSS file or styled-components
388
+ :root {
389
+ --mapvx-secondary-orange: #ff6b35;
390
+ --mapvx-secondary-blue: #1e3a8a;
391
+ }
392
+
393
+ function App() {
394
+ return <mapvx-website api-key="your-api-key-here" />;
395
+ }
396
+ ```
397
+
398
+ **Vue:**
399
+
400
+ ```vue
401
+ <template>
402
+ <mapvx-website api-key="your-api-key-here" />
403
+ </template>
404
+
405
+ <style>
406
+ :root {
407
+ --mapvx-secondary-orange: #ff6b35;
408
+ --mapvx-secondary-blue: #1e3a8a;
409
+ }
410
+ </style>
411
+ ```
412
+
413
+ **Angular:**
414
+
415
+ ```scss
416
+ // styles.scss
417
+ :root {
418
+ --mapvx-secondary-orange: #ff6b35;
419
+ --mapvx-secondary-blue: #1e3a8a;
420
+ }
421
+ ```
422
+
423
+ ### Available Color Variables
424
+
425
+ | Variable | Default Value | Description |
426
+ | -------------------------- | ------------- | ------------------------------------------ |
427
+ | `--mapvx-secondary-orange` | `#EE5845` | Secondary orange color used in UI elements |
428
+ | `--mapvx-secondary-blue` | `#2C57A0` | Secondary blue color used in UI elements |
429
+
430
+ ### Notes
431
+
432
+ - Colors are applied globally when defined in `:root`
433
+ - The web component will automatically pick up these custom colors
434
+ - Use valid CSS color values (hex, rgb, hsl, etc.)
435
+
436
+ ## 🏠 Homepage
437
+
438
+ Visit [MapVX](https://mapvx.com) for more information.