svgmapviewer-astro-floors 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.
- package/LICENSE +15 -0
- package/package.json +47 -0
- package/src/addresses.schema.json +30 -0
- package/src/components/SvgMapViewer/SvgMapViewer.tsx +17 -0
- package/src/components/SvgMapViewer/main.ts +10 -0
- package/src/content.config.ts +42 -0
- package/src/floorsConfig.schema.json +98 -0
- package/src/index.ts +10 -0
- package/src/names.schema.json +13 -0
- package/src/schema.ts +182 -0
- package/src/svgMapViewerConfigUser.schema.json +260 -0
- package/src/utils/tag.ts +25 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Daiji Maps
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "svgmapviewer-astro-floors",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"files": [
|
|
5
|
+
"./src"
|
|
6
|
+
],
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./src/index.ts"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@astrojs/react": "^5.0.6",
|
|
13
|
+
"@xstate/store": "^3.17.5",
|
|
14
|
+
"astro": "^6.4.2",
|
|
15
|
+
"effect": "4.0.0-beta.74",
|
|
16
|
+
"react": "^19.2.6",
|
|
17
|
+
"react-dom": "^19.2.6",
|
|
18
|
+
"zod": "^4.4.3",
|
|
19
|
+
"svgmapviewer": "0.4.0",
|
|
20
|
+
"svgmapviewer-tools-floors": "0.1.0",
|
|
21
|
+
"svgmapviewer-app-floors": "0.1.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/react": "^19.2.15",
|
|
25
|
+
"@types/react-dom": "^19.2.3",
|
|
26
|
+
"@typescript/native-preview": "7.0.0-dev.20260527.2",
|
|
27
|
+
"tsx": "^4.22.3"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"astro": "^6",
|
|
31
|
+
"svgmapviewer": "0.4.0"
|
|
32
|
+
},
|
|
33
|
+
"lint-staged": {
|
|
34
|
+
"*.{ts,tsx}": "eslint --fix",
|
|
35
|
+
"*": "oxfmt --write"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=22.12.0"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"dev": "astro dev",
|
|
42
|
+
"build": "astro build",
|
|
43
|
+
"regen": "tsx scripts/regen-schema.ts",
|
|
44
|
+
"preview": "astro preview",
|
|
45
|
+
"astro": "astro"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"propertyNames": {
|
|
5
|
+
"type": "string"
|
|
6
|
+
},
|
|
7
|
+
"additionalProperties": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"coord": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"x": {
|
|
14
|
+
"type": "number"
|
|
15
|
+
},
|
|
16
|
+
"y": {
|
|
17
|
+
"type": "number"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"required": ["x", "y"],
|
|
21
|
+
"additionalProperties": false
|
|
22
|
+
},
|
|
23
|
+
"fidx": {
|
|
24
|
+
"type": "number"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"required": ["coord", "fidx"],
|
|
28
|
+
"additionalProperties": false
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* eslint-disable functional/no-return-void */
|
|
2
|
+
/* eslint-disable functional/no-expression-statements */
|
|
3
|
+
import { useEffect } from 'react'
|
|
4
|
+
import type { SvgMapViewerConfigUser } from 'svgmapviewer'
|
|
5
|
+
|
|
6
|
+
export function SvgMapViewer(props: Readonly<SvgMapViewerConfigUser>) {
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
import('./main').then((appMain) => appMain.main(props))
|
|
9
|
+
}, [props])
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
<div id="root"></div>
|
|
14
|
+
<div id="style-root"></div>
|
|
15
|
+
</>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint-disable functional/no-return-void */
|
|
2
|
+
/* eslint-disable functional/no-expression-statements */
|
|
3
|
+
import type { SvgMapViewerConfigUser } from 'svgmapviewer'
|
|
4
|
+
import { svgmapviewer } from 'svgmapviewer-app-floors'
|
|
5
|
+
|
|
6
|
+
export function main(props: Readonly<SvgMapViewerConfigUser>) {
|
|
7
|
+
svgmapviewer({
|
|
8
|
+
...props,
|
|
9
|
+
})
|
|
10
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { file, glob } from 'astro/loaders'
|
|
2
|
+
import { defineCollection } from 'astro:content'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
addressSchema,
|
|
6
|
+
addrsSchema,
|
|
7
|
+
floorsConfigSchema,
|
|
8
|
+
svgMapViewerConfigUserSchema,
|
|
9
|
+
} from './schema'
|
|
10
|
+
|
|
11
|
+
const floors = defineCollection({
|
|
12
|
+
loader: glob({
|
|
13
|
+
base: './src/content/floors',
|
|
14
|
+
pattern: '**/*.{json,yaml}',
|
|
15
|
+
}),
|
|
16
|
+
schema: floorsConfigSchema,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const addresses = defineCollection({
|
|
20
|
+
loader: file('./src/content/addresses.yaml'),
|
|
21
|
+
schema: addressSchema,
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const names = defineCollection({
|
|
25
|
+
loader: file('./src/content/names.yaml'),
|
|
26
|
+
schema: addrsSchema,
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const svgMapViewerConfig = defineCollection({
|
|
30
|
+
loader: glob({
|
|
31
|
+
base: './src/content/svgMapViewerConfig',
|
|
32
|
+
pattern: '**/*.{json,yaml}',
|
|
33
|
+
}),
|
|
34
|
+
schema: svgMapViewerConfigUserSchema,
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
export const collections = {
|
|
38
|
+
floors,
|
|
39
|
+
addresses,
|
|
40
|
+
names,
|
|
41
|
+
svgMapViewerConfig,
|
|
42
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"initialFidx": {
|
|
6
|
+
"type": "number"
|
|
7
|
+
},
|
|
8
|
+
"floors": {
|
|
9
|
+
"type": "array",
|
|
10
|
+
"items": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"name": {
|
|
14
|
+
"type": "string"
|
|
15
|
+
},
|
|
16
|
+
"href": {
|
|
17
|
+
"type": "string"
|
|
18
|
+
},
|
|
19
|
+
"file": {
|
|
20
|
+
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
"labels": {
|
|
23
|
+
"type": "array",
|
|
24
|
+
"items": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"attrs": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"propertyNames": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"additionalProperties": {
|
|
33
|
+
"anyOf": [
|
|
34
|
+
{
|
|
35
|
+
"type": "null"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"type": "number"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"type": "string"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"children": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"items": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"properties": {
|
|
51
|
+
"attrs": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"propertyNames": {
|
|
54
|
+
"type": "string"
|
|
55
|
+
},
|
|
56
|
+
"additionalProperties": {
|
|
57
|
+
"anyOf": [
|
|
58
|
+
{
|
|
59
|
+
"type": "null"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"type": "number"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"type": "string"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"text": {
|
|
71
|
+
"anyOf": [
|
|
72
|
+
{
|
|
73
|
+
"type": "null"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"type": "string"
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"required": ["attrs", "text"],
|
|
82
|
+
"additionalProperties": false
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"required": ["attrs", "children"],
|
|
87
|
+
"additionalProperties": false
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"required": ["name", "href"],
|
|
92
|
+
"additionalProperties": false
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"required": ["initialFidx", "floors"],
|
|
97
|
+
"additionalProperties": {}
|
|
98
|
+
}
|
package/src/index.ts
ADDED
package/src/schema.ts
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
export const posSchema = z.object({
|
|
4
|
+
x: z.number(),
|
|
5
|
+
y: z.number(),
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
const addrSchema = z.string()
|
|
9
|
+
export const addrsSchema = z.array(addrSchema)
|
|
10
|
+
//const nameEntrySchema = z.tuple([z.string(), addrsSchema])
|
|
11
|
+
const floorPosSchema = z.object({
|
|
12
|
+
coord: posSchema,
|
|
13
|
+
fidx: z.number(),
|
|
14
|
+
})
|
|
15
|
+
//const addressSchema = z.tuple([z.string(), floorPosSchema])
|
|
16
|
+
|
|
17
|
+
export const boxSchema = z.object({
|
|
18
|
+
x: z.number(),
|
|
19
|
+
y: z.number(),
|
|
20
|
+
width: z.number(),
|
|
21
|
+
height: z.number(),
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
export const nameSchema = z.string() // z.union([z.string(), z.array(z.string())])
|
|
25
|
+
|
|
26
|
+
export const namesSchema = z.record(z.string(), nameSchema)
|
|
27
|
+
|
|
28
|
+
export const addressSchema = z.object({
|
|
29
|
+
coord: posSchema,
|
|
30
|
+
fidx: z.number(),
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
export const addressesSchema = addressSchema // z.record(z.string(), addressSchema)
|
|
34
|
+
|
|
35
|
+
// poiKindSchema
|
|
36
|
+
// poixSchema
|
|
37
|
+
// poiSchema
|
|
38
|
+
|
|
39
|
+
export const poiTagSchema = z.union([
|
|
40
|
+
z.literal('shop.cafe'),
|
|
41
|
+
z.literal('shop.misc'),
|
|
42
|
+
z.literal('shop.restaurant'),
|
|
43
|
+
z.literal('facility.elevator'),
|
|
44
|
+
z.literal('facility.escalator'),
|
|
45
|
+
z.literal('facility.toilet'),
|
|
46
|
+
])
|
|
47
|
+
|
|
48
|
+
export const poixSchema = z.object({
|
|
49
|
+
tag: poiTagSchema,
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
export const poiSchema = z.object({
|
|
53
|
+
id: z.string().optional(),
|
|
54
|
+
name: nameSchema.optional(),
|
|
55
|
+
coord: posSchema.optional(),
|
|
56
|
+
fidx: z.number().optional(),
|
|
57
|
+
size: z.number(),
|
|
58
|
+
x: poixSchema,
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
// searchAddressesSchema
|
|
62
|
+
// searchNamesSchema
|
|
63
|
+
|
|
64
|
+
export const baseInfoSchema = z.object({
|
|
65
|
+
title: z.string(),
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
const searchAddressSchema = z.object({
|
|
69
|
+
address: z.string(),
|
|
70
|
+
floorPos: floorPosSchema,
|
|
71
|
+
})
|
|
72
|
+
const searchNameSchema = z.object({
|
|
73
|
+
name: z.string(),
|
|
74
|
+
addresses: z.array(z.string()),
|
|
75
|
+
})
|
|
76
|
+
const searchInfoSchema = z.object({
|
|
77
|
+
name: z.string(),
|
|
78
|
+
info: baseInfoSchema,
|
|
79
|
+
})
|
|
80
|
+
export const searchAddressesSchema = z.array(searchAddressSchema)
|
|
81
|
+
export const searchNamesSchema = z.array(searchNameSchema)
|
|
82
|
+
export const searchInfosSchema = z.array(searchInfoSchema)
|
|
83
|
+
|
|
84
|
+
// osmMapDataSchema
|
|
85
|
+
// osmMapMapSchema
|
|
86
|
+
// mapCoordSchema
|
|
87
|
+
// uiConfigSchema
|
|
88
|
+
|
|
89
|
+
const osmMapDataSchema = z.object({})
|
|
90
|
+
|
|
91
|
+
const osmMapMapSchema = z.object({})
|
|
92
|
+
|
|
93
|
+
const mapCoordSchema = z.object({})
|
|
94
|
+
|
|
95
|
+
export const uiConfigSchema = z.object({
|
|
96
|
+
showGuides: z.boolean(),
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
// osmDataConfigSchema
|
|
100
|
+
// osmRenderConfigSchema
|
|
101
|
+
// osmSearchConfigSchema
|
|
102
|
+
|
|
103
|
+
export const osmDataConfigSchema = z.object({
|
|
104
|
+
origViewBox: boxSchema,
|
|
105
|
+
mapData: osmMapDataSchema,
|
|
106
|
+
mapMap: osmMapMapSchema,
|
|
107
|
+
mapCoord: mapCoordSchema,
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
export const osmRenderConfigSchema = z.object({
|
|
111
|
+
//renderMap
|
|
112
|
+
//readonly isMapRendered: () => boolean
|
|
113
|
+
//readonly getMapNames: OsmGetMapNames
|
|
114
|
+
//readonly getMapPaths: () => readonly Readonly<OsmMapPathOps>[]
|
|
115
|
+
//readonly getMapObjects: () => readonly Readonly<OsmMapObjects>[]
|
|
116
|
+
//readonly getMapSymbols: () => readonly Readonly<OsmMapSymbols>[]
|
|
117
|
+
//readonly getMapMarkers: () => readonly Readonly<OsmMapMarkers>[]
|
|
118
|
+
//readonly mapSvgStyle: string
|
|
119
|
+
//readonly cartoConfig?: OsmCartoConfig
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
export const osmSearchConfigSchema = z.object({
|
|
123
|
+
//readonly osmSearchEntries: readonly Readonly<OsmSearchEntry>[] // XXX
|
|
124
|
+
//readonly getSearchEntries: OsmGetSearchEntries
|
|
125
|
+
//readonly getSearchInfo: OsmGetSearchInfo
|
|
126
|
+
//readonly renderInfo: RenderInfo
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
// floorTspanSchema
|
|
130
|
+
// labelTextSchema
|
|
131
|
+
// floorSchema
|
|
132
|
+
// floorsConfigSchema
|
|
133
|
+
|
|
134
|
+
const labelTspanSchema = z.object({
|
|
135
|
+
attrs: z.record(z.string(), z.union([z.null(), z.number(), z.string()])),
|
|
136
|
+
text: z.union([z.null(), z.string()]),
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
const labelTextSchema = z.object({
|
|
140
|
+
attrs: z.record(z.string(), z.union([z.null(), z.number(), z.string()])),
|
|
141
|
+
children: z.array(labelTspanSchema),
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
export const floorSchema = z.object({
|
|
145
|
+
name: z.string(),
|
|
146
|
+
href: z.string(),
|
|
147
|
+
file: z.string().optional(),
|
|
148
|
+
labels: z.array(labelTextSchema).optional(),
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
export const floorsSchema = z.array(floorSchema)
|
|
152
|
+
|
|
153
|
+
export const floorsConfigSchema = z.object({
|
|
154
|
+
initialFidx: z.number(),
|
|
155
|
+
floors: z.array(floorSchema),
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
// svgMapViewerConfigSchema
|
|
159
|
+
|
|
160
|
+
export const svgMapViewerConfigSchema = z.object({
|
|
161
|
+
root: z.string(),
|
|
162
|
+
href: z.string(),
|
|
163
|
+
width: z.number(),
|
|
164
|
+
height: z.number(),
|
|
165
|
+
origViewBox: boxSchema, // XXX
|
|
166
|
+
origBoundingBox: boxSchema.optional(), // XXX
|
|
167
|
+
fontSize: z.number(),
|
|
168
|
+
backgroundColor: z.string().optional(),
|
|
169
|
+
title: z.string(),
|
|
170
|
+
subtitle: z.string(),
|
|
171
|
+
copyright: z.string(),
|
|
172
|
+
zoomFactor: z.number(),
|
|
173
|
+
searchAddresses: searchAddressesSchema.optional(),
|
|
174
|
+
searchNames: searchNamesSchema.optional(),
|
|
175
|
+
searchInfos: searchInfosSchema.optional(),
|
|
176
|
+
floorsConfig: floorsConfigSchema.optional(),
|
|
177
|
+
uiConfig: uiConfigSchema.optional(),
|
|
178
|
+
//isContainerRendered: () => boolean
|
|
179
|
+
//isUiRendered: () => boolean
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
export const svgMapViewerConfigUserSchema = svgMapViewerConfigSchema.partial()
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"root": {
|
|
6
|
+
"type": "string"
|
|
7
|
+
},
|
|
8
|
+
"href": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"width": {
|
|
12
|
+
"type": "number"
|
|
13
|
+
},
|
|
14
|
+
"height": {
|
|
15
|
+
"type": "number"
|
|
16
|
+
},
|
|
17
|
+
"origViewBox": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"properties": {
|
|
20
|
+
"x": {
|
|
21
|
+
"type": "number"
|
|
22
|
+
},
|
|
23
|
+
"y": {
|
|
24
|
+
"type": "number"
|
|
25
|
+
},
|
|
26
|
+
"width": {
|
|
27
|
+
"type": "number"
|
|
28
|
+
},
|
|
29
|
+
"height": {
|
|
30
|
+
"type": "number"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"required": ["x", "y", "width", "height"],
|
|
34
|
+
"additionalProperties": false
|
|
35
|
+
},
|
|
36
|
+
"origBoundingBox": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"properties": {
|
|
39
|
+
"x": {
|
|
40
|
+
"type": "number"
|
|
41
|
+
},
|
|
42
|
+
"y": {
|
|
43
|
+
"type": "number"
|
|
44
|
+
},
|
|
45
|
+
"width": {
|
|
46
|
+
"type": "number"
|
|
47
|
+
},
|
|
48
|
+
"height": {
|
|
49
|
+
"type": "number"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"required": ["x", "y", "width", "height"],
|
|
53
|
+
"additionalProperties": false
|
|
54
|
+
},
|
|
55
|
+
"fontSize": {
|
|
56
|
+
"type": "number"
|
|
57
|
+
},
|
|
58
|
+
"backgroundColor": {
|
|
59
|
+
"type": "string"
|
|
60
|
+
},
|
|
61
|
+
"title": {
|
|
62
|
+
"type": "string"
|
|
63
|
+
},
|
|
64
|
+
"subtitle": {
|
|
65
|
+
"type": "string"
|
|
66
|
+
},
|
|
67
|
+
"copyright": {
|
|
68
|
+
"type": "string"
|
|
69
|
+
},
|
|
70
|
+
"zoomFactor": {
|
|
71
|
+
"type": "number"
|
|
72
|
+
},
|
|
73
|
+
"searchAddresses": {
|
|
74
|
+
"type": "array",
|
|
75
|
+
"items": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"properties": {
|
|
78
|
+
"address": {
|
|
79
|
+
"type": "string"
|
|
80
|
+
},
|
|
81
|
+
"floorPos": {
|
|
82
|
+
"type": "object",
|
|
83
|
+
"properties": {
|
|
84
|
+
"coord": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"properties": {
|
|
87
|
+
"x": {
|
|
88
|
+
"type": "number"
|
|
89
|
+
},
|
|
90
|
+
"y": {
|
|
91
|
+
"type": "number"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"required": ["x", "y"],
|
|
95
|
+
"additionalProperties": false
|
|
96
|
+
},
|
|
97
|
+
"fidx": {
|
|
98
|
+
"type": "number"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"required": ["coord", "fidx"],
|
|
102
|
+
"additionalProperties": false
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"required": ["address", "floorPos"],
|
|
106
|
+
"additionalProperties": false
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"searchNames": {
|
|
110
|
+
"type": "array",
|
|
111
|
+
"items": {
|
|
112
|
+
"type": "object",
|
|
113
|
+
"properties": {
|
|
114
|
+
"name": {
|
|
115
|
+
"type": "string"
|
|
116
|
+
},
|
|
117
|
+
"addresses": {
|
|
118
|
+
"type": "array",
|
|
119
|
+
"items": {
|
|
120
|
+
"type": "string"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"required": ["name", "addresses"],
|
|
125
|
+
"additionalProperties": false
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"searchInfos": {
|
|
129
|
+
"type": "array",
|
|
130
|
+
"items": {
|
|
131
|
+
"type": "object",
|
|
132
|
+
"properties": {
|
|
133
|
+
"name": {
|
|
134
|
+
"type": "string"
|
|
135
|
+
},
|
|
136
|
+
"info": {
|
|
137
|
+
"type": "object",
|
|
138
|
+
"properties": {
|
|
139
|
+
"title": {
|
|
140
|
+
"type": "string"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"required": ["title"],
|
|
144
|
+
"additionalProperties": false
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"required": ["name", "info"],
|
|
148
|
+
"additionalProperties": false
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"floorsConfig": {
|
|
152
|
+
"type": "object",
|
|
153
|
+
"properties": {
|
|
154
|
+
"initialFidx": {
|
|
155
|
+
"type": "number"
|
|
156
|
+
},
|
|
157
|
+
"floors": {
|
|
158
|
+
"type": "array",
|
|
159
|
+
"items": {
|
|
160
|
+
"type": "object",
|
|
161
|
+
"properties": {
|
|
162
|
+
"name": {
|
|
163
|
+
"type": "string"
|
|
164
|
+
},
|
|
165
|
+
"href": {
|
|
166
|
+
"type": "string"
|
|
167
|
+
},
|
|
168
|
+
"file": {
|
|
169
|
+
"type": "string"
|
|
170
|
+
},
|
|
171
|
+
"labels": {
|
|
172
|
+
"type": "array",
|
|
173
|
+
"items": {
|
|
174
|
+
"type": "object",
|
|
175
|
+
"properties": {
|
|
176
|
+
"attrs": {
|
|
177
|
+
"type": "object",
|
|
178
|
+
"propertyNames": {
|
|
179
|
+
"type": "string"
|
|
180
|
+
},
|
|
181
|
+
"additionalProperties": {
|
|
182
|
+
"anyOf": [
|
|
183
|
+
{
|
|
184
|
+
"type": "null"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"type": "number"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"type": "string"
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"children": {
|
|
196
|
+
"type": "array",
|
|
197
|
+
"items": {
|
|
198
|
+
"type": "object",
|
|
199
|
+
"properties": {
|
|
200
|
+
"attrs": {
|
|
201
|
+
"type": "object",
|
|
202
|
+
"propertyNames": {
|
|
203
|
+
"type": "string"
|
|
204
|
+
},
|
|
205
|
+
"additionalProperties": {
|
|
206
|
+
"anyOf": [
|
|
207
|
+
{
|
|
208
|
+
"type": "null"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"type": "number"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"type": "string"
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
"text": {
|
|
220
|
+
"anyOf": [
|
|
221
|
+
{
|
|
222
|
+
"type": "null"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"type": "string"
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"required": ["attrs", "text"],
|
|
231
|
+
"additionalProperties": false
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
"required": ["attrs", "children"],
|
|
236
|
+
"additionalProperties": false
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
"required": ["name", "href"],
|
|
241
|
+
"additionalProperties": false
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"required": ["initialFidx", "floors"],
|
|
246
|
+
"additionalProperties": false
|
|
247
|
+
},
|
|
248
|
+
"uiConfig": {
|
|
249
|
+
"type": "object",
|
|
250
|
+
"properties": {
|
|
251
|
+
"showGuides": {
|
|
252
|
+
"type": "boolean"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
"required": ["showGuides"],
|
|
256
|
+
"additionalProperties": false
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
"additionalProperties": {}
|
|
260
|
+
}
|
package/src/utils/tag.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type TaggedTag<TInfo, Key extends keyof TInfo> = Extract<
|
|
2
|
+
TInfo[Key],
|
|
3
|
+
{ tag: string | number | symbol }
|
|
4
|
+
>['tag']
|
|
5
|
+
|
|
6
|
+
export type TaggedProps<
|
|
7
|
+
TInfo,
|
|
8
|
+
Key extends keyof TInfo,
|
|
9
|
+
K extends TaggedTag<TInfo, Key>,
|
|
10
|
+
> = Readonly<
|
|
11
|
+
Omit<TInfo, Key> & {
|
|
12
|
+
readonly [P in Key]: Extract<TInfo[Key], { tag: K }>
|
|
13
|
+
}
|
|
14
|
+
>
|
|
15
|
+
|
|
16
|
+
export type TaggedRenderer<
|
|
17
|
+
TInfo,
|
|
18
|
+
Key extends keyof TInfo,
|
|
19
|
+
K extends TaggedTag<TInfo, Key>,
|
|
20
|
+
TNode,
|
|
21
|
+
> = (props: TaggedProps<TInfo, Key, K>) => TNode
|
|
22
|
+
|
|
23
|
+
export type TaggedRendererMap<TInfo, Key extends keyof TInfo, TNode> = {
|
|
24
|
+
readonly [K in TaggedTag<TInfo, Key>]: TaggedRenderer<TInfo, Key, K, TNode>
|
|
25
|
+
}
|