diff --git a/examples/playground/README.md b/examples/playground/README.md index 3ff3cf3..398dece 100644 --- a/examples/playground/README.md +++ b/examples/playground/README.md @@ -5,21 +5,21 @@ the marker API. ## Get Started -1. Install dependencies: +1. Install dependencies: - npm install + npm install -2. create the `.env` file. The API Key to use - [can be found here][gcloud_console_maps_credentials]. +2. create the `.env` file. The API Key to use + [can be found here][gcloud_console_maps_credentials]. - GOOGLE_MAPS_API_KEY="" - PRODUCTION_BASEURL="/marker-api-playground/" + GOOGLE_MAPS_API_KEY="" + PRODUCTION_BASEURL="/marker-api-playground/" -3. start the 'playground' environment: +3. start the 'playground' environment: - npm start + npm start -4. open http://localhost:5173 in your browser +4. open http://localhost:5173 in your browser [gcloud_console_maps_credentials]: https://console.cloud.google.com/apis/credentials/key/cace4819-4b19-489c-bd49-d91300d72dab?project=ubilabs-dev @@ -41,13 +41,13 @@ modules can only be imported using async imports from urls. - `/`: contains `index.html`, `examples.html` and configuration-files - `/scripts`: this is the place for utility scripts, mostly written in [zx][] - `/src`: the typescript source-root. The application entrypoint is in `main.ts` -- `/src/code-samples`: contains the source-files for all examples. The +- `/src/code-samples`: contains the source-files for all examples. The typescript files here should all follow the conventions for examples below. - For the examples index-page, these files are packaged into examples.json + For the examples index-page, these files are packaged into examples.json by the `build:examples` npm task (see `/scripts/update-examples.mjs`) -- `/src/code-samples/lib`: contains the typescript declaration-files - generated from the library that are required by the editor and referenced +- `/src/code-samples/lib`: contains the typescript declaration-files + generated from the library that are required by the editor and referenced by the examples. Those files are generated by `npm run build:dts` from the library files. - `/types` is for additional typescript declarations @@ -64,16 +64,15 @@ modules can only be imported using async imports from urls. - the first line of the example has to contain a comment in the form: `// title: This describes what it does` - this comment will be the text shown in the example-index -- the example must import the marker-library via the `*.d.ts` files - available in `./src/code-samples/lib/` - (e.g. `import {Marker} from './lib/marker';`). +- the example must import components from the marker-library using regular + imports (e.g. `import {Marker} from '@ubilabs/google-maps-marker';`). - there has to be a default export, which will be called with the map-instance as parameter when the script is run - When any changes are done in the browser environment (event-listeners, timeouts, intervals, ...), the exported function has to return a cleanup - function removing all those. This doesn't apply for created markers, those - are automatically removed from the map when a new version of the script is - executed. + function removing all those. This doesn't apply for created markers and + marker-collections, those are automatically removed from the map when a + new version of the script is executed. ## scripts, npm-tasks and deployment @@ -88,8 +87,6 @@ The following supporting scripts and tasks are available: - `npm start`: starts the vite dev-server (this will also run the `build:dts` and `build:examples` tasks) -- `npm run build:dts`: compiles all typescript-files in `./src/lib` - into corresponding declaration files in `./examples/lib` - `npm run build:examples`: runs the `script/update-examples.mjs` script to update the examples index in `./examples/examples.json`. The index is loaded in `examples.html` to render the list of examples diff --git a/examples/playground/examples.html b/examples/playground/examples.html index 0060fdb..ecdd5fc 100644 --- a/examples/playground/examples.html +++ b/examples/playground/examples.html @@ -19,6 +19,7 @@ background: #1e1e1e; color: #d4d4d4; } + main { max-width: 640px; width: 100%; @@ -35,11 +36,21 @@

List of examples