-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New template for examples #8
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
eb1cd9d
update @mappable-world/mappable-types version
matthew44-mappable 89a604d
remove old examples
matthew44-mappable 3215e92
fix snapshots
matthew44-mappable 0cbf7e6
ts examples + vue
matthew44-mappable c50fb1d
fix package import type
matthew44-mappable File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>React example %PACKAGE_NAME%</title> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" /> | ||
<script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script> | ||
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script> | ||
<script crossorigin src="https://unpkg.com/@babel/standalone@7/babel.min.js"></script> | ||
<script src="https://js.api.mappable.world/3.0/?apikey=%APIKEY%&lang=en_US"></script> | ||
|
||
<script | ||
data-plugins="transform-modules-umd" | ||
data-presets="react, typescript" | ||
type="text/babel" | ||
src="../common.ts" | ||
></script> | ||
<script | ||
data-plugins="transform-modules-umd" | ||
data-presets="react, typescript" | ||
type="text/babel" | ||
src="./index.tsx" | ||
></script> | ||
|
||
<link rel="stylesheet" href="../common.css" /> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import {LOCATION} from '../common'; | ||
|
||
window.map = null; | ||
|
||
main(); | ||
async function main() { | ||
const [mappableReact] = await Promise.all([mappable.import('@mappable-world/mappable-reactify'), mappable.ready]); | ||
const reactify = mappableReact.reactify.bindTo(React, ReactDOM); | ||
|
||
const {MMap, MMapDefaultSchemeLayer, MMapDefaultFeaturesLayer, MMapControls} = reactify.module(mappable); | ||
|
||
const {useState, useCallback} = React; | ||
|
||
const {MMapZoomControl} = reactify.module(await mappable.import('@mappable-world/mappable-controls@0.0.1')); | ||
|
||
const {MMapButtonExample} = reactify.module(await mappable.import('%PACKAGE_NAME%')); | ||
|
||
ReactDOM.render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode>, | ||
document.getElementById('app') | ||
); | ||
|
||
function App() { | ||
const [location, setLocation] = useState(LOCATION); | ||
const onClick = useCallback(() => alert('Click!'), []); | ||
|
||
return ( | ||
<MMap location={location} ref={(x) => (map = x)}> | ||
<MMapDefaultSchemeLayer /> | ||
<MMapDefaultFeaturesLayer /> | ||
<MMapControls position="right"> | ||
<MMapZoomControl /> | ||
<MMapButtonExample text={'My button'} onClick={onClick} /> | ||
</MMapControls> | ||
</MMap> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"strict": false, | ||
"rootDirs": ["./", "../"], | ||
"types": ["./types.d.ts"] | ||
}, | ||
"include": ["./**/*.ts", "./**/*.tsx"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {MMap} from '@mappable-world/mappable-types'; | ||
|
||
declare global { | ||
const React: typeof import('react'); | ||
const ReactDOM: typeof import('react-dom'); | ||
const Vue: typeof import('@vue/runtime-dom'); | ||
let map: MMap; | ||
|
||
interface Window { | ||
map: MMap; | ||
} | ||
} | ||
|
||
declare module '@mappable-world/mappable-types/import' { | ||
interface Import { | ||
(pkg: '%PACKAGE_NAME%'): Promise<typeof import('../src/index')>; | ||
} | ||
} | ||
|
||
export {}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Vanilla example %PACKAGE_NAME%</title> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" /> | ||
<script crossorigin src="https://unpkg.com/@babel/standalone@7/babel.min.js"></script> | ||
<script src="https://js.api.mappable.world/3.0/?apikey=%APIKEY%&lang=en_US"></script> | ||
|
||
<script | ||
data-plugins="transform-modules-umd" | ||
data-presets="typescript" | ||
type="text/babel" | ||
src="../common.ts" | ||
></script> | ||
<script | ||
data-plugins="transform-modules-umd" | ||
data-presets="typescript" | ||
type="text/babel" | ||
src="./index.ts" | ||
></script> | ||
|
||
<link rel="stylesheet" href="../common.css" /> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import {LOCATION} from '../common'; | ||
window.map = null; | ||
|
||
main(); | ||
async function main() { | ||
await mappable.ready; | ||
const {MMap, MMapDefaultSchemeLayer, MMapDefaultFeaturesLayer, MMapControls} = mappable; | ||
|
||
const {MMapZoomControl} = await mappable.import('@mappable-world/mappable-controls@0.0.1'); | ||
const {MMapButtonExample} = await mappable.import('%PACKAGE_NAME%'); | ||
|
||
map = new MMap(document.getElementById('app'), {location: LOCATION}); | ||
|
||
map.addChild(new MMapDefaultSchemeLayer({})); | ||
map.addChild(new MMapDefaultFeaturesLayer({})); | ||
|
||
map.addChild( | ||
new MMapControls({position: 'right'}) | ||
.addChild(new MMapZoomControl({})) | ||
.addChild(new MMapButtonExample({text: 'My button', onClick: () => alert('Click!')})) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Vue example %PACKAGE_NAME%</title> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" /> | ||
<script crossorigin src="https://unpkg.com/vue@3/dist/vue.global.js"></script> | ||
<script crossorigin src="https://unpkg.com/@babel/standalone@7/babel.min.js"></script> | ||
<script src="https://js.api.mappable.world/3.0/?apikey=%APIKEY%&lang=en_US"></script> | ||
|
||
<script | ||
data-plugins="transform-modules-umd" | ||
data-presets="typescript" | ||
type="text/babel" | ||
src="../common.ts" | ||
></script> | ||
<script | ||
data-plugins="transform-modules-umd" | ||
data-presets="typescript" | ||
type="text/babel" | ||
src="./index.ts" | ||
></script> | ||
|
||
<link rel="stylesheet" href="../common.css" /> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {LOCATION} from '../common'; | ||
|
||
window.map = null; | ||
|
||
main(); | ||
async function main() { | ||
const [mappableVue] = await Promise.all([mappable.import('@mappable-world/mappable-vuefy'), mappable.ready]); | ||
const vuefy = mappableVue.vuefy.bindTo(Vue); | ||
|
||
const {MMap, MMapDefaultSchemeLayer, MMapDefaultFeaturesLayer, MMapControls} = vuefy.module(mappable); | ||
|
||
const {MMapZoomControl} = vuefy.module(await mappable.import('@mappable-world/mappable-controls@0.0.1')); | ||
|
||
const {MMapButtonExample} = vuefy.module(await mappable.import('%PACKAGE_NAME%')); | ||
|
||
const app = Vue.createApp({ | ||
components: { | ||
MMap, | ||
MMapDefaultSchemeLayer, | ||
MMapDefaultFeaturesLayer, | ||
MMapControls, | ||
MMapZoomControl, | ||
MMapButtonExample | ||
}, | ||
setup() { | ||
const refMap = (ref) => { | ||
window.map = ref?.entity; | ||
}; | ||
const onClick = () => alert('Click!'); | ||
return {LOCATION, refMap, onClick}; | ||
}, | ||
template: ` | ||
<MMap :location="LOCATION" :ref="refMap"> | ||
<MMapDefaultSchemeLayer /> | ||
<MMapDefaultFeaturesLayer /> | ||
<MMapControls position="right"> | ||
<MMapZoomControl /> | ||
<MMapButtonExample text="My button" :onClick="onClick" /> | ||
</MMapControls> | ||
</MMap>` | ||
}); | ||
app.mount('#app'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be a part of generated package, not for example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hello! I have created a new pull request for the proposed changes