@tileflow/core 0.1.0-alpha.4 → 0.1.0-alpha.41
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 +201 -0
- package/README.md +318 -26
- package/THIRD_PARTY_NOTICES.md +444 -0
- package/dist/3d-CzLTD0RK.d.ts +1092 -0
- package/dist/3d.d.ts +1 -0
- package/dist/3d.js +12660 -0
- package/dist/browser.d.ts +2278 -0
- package/dist/browser.js +21826 -0
- package/dist/build.d.ts +595 -0
- package/dist/build.js +29737 -0
- package/dist/capture-shot-ChPQvPyi.d.ts +291 -0
- package/dist/capture.d.ts +9 -0
- package/dist/capture.js +510 -0
- package/dist/config-reference.json +40527 -0
- package/dist/icon-composition-HUh_Lj8Z.d.ts +2516 -0
- package/dist/index.d.ts +1805 -162
- package/dist/index.js +26400 -3488
- package/dist/manifest-types-DnhSJjCM.d.ts +902 -0
- package/dist/manifest.d.ts +9 -0
- package/dist/manifest.js +449 -0
- package/dist/native-profile.d.ts +206 -0
- package/dist/native-profile.js +9339 -0
- package/dist/native.d.ts +365 -0
- package/dist/native.js +5970 -0
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +1445 -0
- package/dist/worker/camera-tile-worker.global.js +20 -0
- package/docs/application-tile-reading.md +86 -0
- package/docs/authoring-model.md +269 -0
- package/docs/boundary-areas-and-choropleths.md +217 -0
- package/docs/buildings-3d.md +608 -0
- package/docs/camera-moves-and-tile-cache.md +112 -0
- package/docs/capture-scenes.md +40 -0
- package/docs/capture-shots.md +173 -0
- package/docs/cartographic-defaults.md +210 -0
- package/docs/compiled-style-performance.md +286 -0
- package/docs/data-is-separate-from-design.md +610 -0
- package/docs/depth-markers.md +65 -0
- package/docs/dynamic-style-images.md +100 -0
- package/docs/globe-atmosphere.md +113 -0
- package/docs/hosted-session-authorization.md +106 -0
- package/docs/map-and-terrain-examples.md +156 -0
- package/docs/map-emphasis.md +89 -0
- package/docs/native-artifact-profile.md +152 -0
- package/docs/native-resource-urls.md +369 -0
- package/docs/nautical-marks.md +308 -0
- package/docs/public-api-and-browser-subpath.md +101 -0
- package/docs/route-drawing.md +191 -0
- package/docs/shared-visual-primitives.md +101 -0
- package/docs/street-lights.md +127 -0
- package/docs/street-sky.md +156 -0
- package/docs/style-states.md +73 -0
- package/docs/sun-and-light.md +167 -0
- package/docs/theme-transitions-and-blends.md +317 -0
- package/docs/themes-and-module-styles.md +156 -0
- package/docs/trees-3d.md +295 -0
- package/package.json +67 -8
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,34 +1,326 @@
|
|
|
1
1
|
# @tileflow/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Define, validate, and compile Tileflow maps into MapLibre Style JSON. Core owns the map language;
|
|
4
|
+
it does not start a server, prepare files on disk, render a browser map, or deploy a hosted map.
|
|
5
|
+
|
|
6
|
+
> Related packages and guides: [documentation index](https://raw.githubusercontent.com/tileflow/tileflow-sdk/main/llms.txt).
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @tileflow/core@alpha @tileflow/maps@alpha
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`@tileflow/maps` is needed for the official map used below, not for every Core application. Use
|
|
15
|
+
ES module imports. For config loading and asset preparation, use the Node.js 22+ CLI or a build
|
|
16
|
+
integration. Browser applications should use a framework adapter with prepared assets.
|
|
17
|
+
|
|
18
|
+
## Define a map
|
|
19
|
+
|
|
20
|
+
Create `tileflow.config.ts`. Every public config exports one map:
|
|
21
|
+
|
|
22
|
+
<!-- docs:check -->
|
|
4
23
|
|
|
5
24
|
```ts
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
maps: {
|
|
21
|
-
madrid: {
|
|
22
|
-
basemap: osm(),
|
|
23
|
-
theme: 'light',
|
|
24
|
-
modules: [roads({preset: 'modern', density: 'balanced'})],
|
|
25
|
-
view: {
|
|
26
|
-
center: [-3.7038, 40.4168],
|
|
27
|
-
zoom: 12,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
25
|
+
import {defineMap, labels, roads} from '@tileflow/core';
|
|
26
|
+
import {streets} from '@tileflow/maps';
|
|
27
|
+
|
|
28
|
+
export default defineMap({
|
|
29
|
+
id: 'madrid',
|
|
30
|
+
name: 'Madrid',
|
|
31
|
+
version: 1,
|
|
32
|
+
extends: streets,
|
|
33
|
+
modules: {
|
|
34
|
+
roads: roads({detail: 'streets', hierarchy: 'clear'}),
|
|
35
|
+
labels: labels({roads: 'major'}),
|
|
30
36
|
},
|
|
37
|
+
view: {center: [-3.7038, 40.4168], zoom: 12},
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Coordinates use `[longitude, latitude]`. This map inherits Streets' themes and assets.
|
|
42
|
+
A standalone map uses `defineMap()` without `extends`.
|
|
43
|
+
|
|
44
|
+
Validate and preview the file with the project-local CLI:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
npm install --save-dev --save-exact tileflow@alpha
|
|
48
|
+
npx tileflow validate --json
|
|
49
|
+
npx tileflow preview
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Loading a config executes its imports. Treat it as trusted code, not as sandboxed JSON.
|
|
53
|
+
|
|
54
|
+
## Understand inheritance
|
|
55
|
+
|
|
56
|
+
Omitted fields inherit, but declaring a field does not imply a recursive merge:
|
|
57
|
+
|
|
58
|
+
- `view` deep-merges; nested arrays replace.
|
|
59
|
+
- `modules` merges by domain. Declaring `roads(...)` replaces that domain's inherited request and
|
|
60
|
+
render contributions. Use `refine(...)` to patch it, `disable()` to remove it, and `reset()` for
|
|
61
|
+
an explicit reset inside a supported patch.
|
|
62
|
+
- `themes` replaces the complete collection and clears inherited `systemThemes` and `timeOfDay` mappings.
|
|
63
|
+
`defaultTheme` can select an inherited concrete theme; `systemThemes` replaces its complete mapping.
|
|
64
|
+
- `icons` replaces the ordered contributor list. Omission inherits it; `[]` disables it. Local and
|
|
65
|
+
package directories can be combined with explicit locked `iconSet('@team/set')` descriptors.
|
|
66
|
+
Spread the parent's list explicitly when composing contributors. Later contributors win for an
|
|
67
|
+
exact icon ID.
|
|
68
|
+
- `fonts` and `glyphs` are mutually exclusive text providers. Declaring either replaces the inherited
|
|
69
|
+
provider. `atmosphere`, `data`, `projection`, `sky`, `terrain`, and `marine` are also atomic.
|
|
70
|
+
|
|
71
|
+
Identity (`id`, `name`, `version`) and tooling `scenes` and `shots` belong to the leaf map and do not inherit.
|
|
72
|
+
Module object order does not determine rendering order. See the
|
|
73
|
+
[map inheritance contract](https://github.com/tileflow/tileflow-sdk/blob/main/docs/contracts/map-inheritance.md)
|
|
74
|
+
for the complete merge rules.
|
|
75
|
+
|
|
76
|
+
## Team Icon Sets foundations
|
|
77
|
+
|
|
78
|
+
`iconSet('@team/set')` is an explicit icon contributor alongside local and package-owned directories.
|
|
79
|
+
It performs no I/O. A resolved map accepts at most 32 contributors, and the same set reference may
|
|
80
|
+
appear only once. Shared sets use the same explicit array order and later-wins semantics as ordinary
|
|
81
|
+
icon directories.
|
|
82
|
+
|
|
83
|
+
An exact `tileflow.icons.lock.json` identifies immutable set revisions and generated artifacts. The
|
|
84
|
+
lock parser rejects duplicate JSON keys, stale reference sets, mixed Teams, invalid IDs, floating
|
|
85
|
+
versions, unsafe URLs, and manifest/hash mismatches. Serialization is canonical. Hashes are internal
|
|
86
|
+
integrity machinery, not identifiers that application authors manage.
|
|
87
|
+
|
|
88
|
+
Shared-set content identifies the effective published artifact. Git owns original artwork history;
|
|
89
|
+
source-only SVG edits producing the same artifact are not shared content changes. No original-source
|
|
90
|
+
hash, source format, or filesystem path is added to a shared package. Local/package originals retain
|
|
91
|
+
their existing source identity. Shared winners use explicit `rendered-icon` identity, while an
|
|
92
|
+
ordered versioned icon-composition receipt records consumed revisions separately, including
|
|
93
|
+
fully shadowed sets and dependency changes that preserve rendered pixels.
|
|
94
|
+
|
|
95
|
+
Map revision hashing preserves the existing v1 result for maps without shared sets. Maps with sets
|
|
96
|
+
require a complete receipt and use the domain-separated v2 revision contract. Build-manifest map
|
|
97
|
+
entries identify that contract with `mapRevisionSchemaVersion: 2`; omission means legacy v1. The
|
|
98
|
+
Metadata-free RGBA icon packages retain `tileflow-icon-package-v1` identity. SDF appearance or text-fitting metadata uses
|
|
99
|
+
`tileflow-icon-package-v2` and v2 composition receipts; defaults and layout participate in identity.
|
|
100
|
+
|
|
101
|
+
These are portable contracts. `@tileflow/dev` composes declared contributors on its normal
|
|
102
|
+
preparation path, and the `tileflow` CLI owns catalog management and exact lock maintenance.
|
|
103
|
+
Importing `iconSet` adds a declaration; it resolves no revision and does not by itself make a
|
|
104
|
+
Team catalog available to your deployment.
|
|
105
|
+
|
|
106
|
+
## Style with themes and semantic modules
|
|
107
|
+
|
|
108
|
+
Themes are complete appearance documents, not loose color overrides. Every theme must supply the
|
|
109
|
+
same token schema. Use `token.color(...)`, `token.number(...)`, `token.image(...)`, and typed font
|
|
110
|
+
roles for theme-dependent values. Use `fixed(value, {reason})` for an intentionally invariant visual
|
|
111
|
+
value. Structural controls, such as visibility and zoom gates, remain ordinary literals.
|
|
112
|
+
|
|
113
|
+
Extend a theme without changing the inherited map structure:
|
|
114
|
+
|
|
115
|
+
<!-- docs:check -->
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
import {defineMap, defineTheme} from '@tileflow/core';
|
|
119
|
+
import {streets, streetsThemes} from '@tileflow/maps';
|
|
120
|
+
|
|
121
|
+
const dark = defineTheme(streetsThemes.dark, {
|
|
122
|
+
id: 'madrid-dark',
|
|
123
|
+
version: 1,
|
|
124
|
+
colorScheme: 'dark',
|
|
125
|
+
tokens: {color: {'surface.land': '#0d1320', 'surface.water': '#081e2e'}},
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export default defineMap({
|
|
129
|
+
id: 'madrid',
|
|
130
|
+
version: 1,
|
|
131
|
+
extends: streets,
|
|
132
|
+
themes: {light: streetsThemes.light, dark},
|
|
133
|
+
defaultTheme: 'light',
|
|
134
|
+
systemThemes: {light: 'light', dark: 'dark'},
|
|
31
135
|
});
|
|
32
136
|
```
|
|
33
137
|
|
|
34
|
-
|
|
138
|
+
`system` is a runtime selection policy, not a stored theme. Builds, captures, static scenes, and
|
|
139
|
+
receipts must use a concrete theme such as `light` or `dark`.
|
|
140
|
+
|
|
141
|
+
Theme and `timeOfDay` changes animate over 450 ms by default, respecting reduced motion. See
|
|
142
|
+
[theme transitions, time-of-day presets and blends](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/theme-transitions-and-blends.md).
|
|
143
|
+
The same controller can make chosen modules recede and the map's labels fade so an application's
|
|
144
|
+
own content reads first; see [map emphasis](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/map-emphasis.md).
|
|
145
|
+
It also sets the style-wide states that themes read with `expr.globalState`, easing numbers so the
|
|
146
|
+
values a theme interpolates on them move smoothly; see
|
|
147
|
+
[style states](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/style-states.md).
|
|
148
|
+
For application-drawn RGBA symbols, it also manages fixed-size
|
|
149
|
+
[dynamic style images](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/dynamic-style-images.md),
|
|
150
|
+
including state refresh, theme changes and restoration without changing layer placement.
|
|
151
|
+
Applications draw their own routes in the theme's inks, read with `getRouteInks()`, and draw them
|
|
152
|
+
on with `createTileflowLineProgress`. `createTileflowGroundLayers` keeps them under 3D buildings,
|
|
153
|
+
which hide them where they stand in front, and can show the hidden stretches faintly; see
|
|
154
|
+
[route drawing](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/route-drawing.md).
|
|
155
|
+
A theme can describe its sun and sky light (`lighting.sun`, `lighting.ambient`); the controller
|
|
156
|
+
returns the sun the map shows with `getSun()`, mixed during a blend, for an application's own 3D
|
|
157
|
+
layers, and `setSun()` places it by direction or by the real sun of a date and place; see
|
|
158
|
+
[sun and light](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/sun-and-light.md).
|
|
159
|
+
`createTileflowBuildings3D` enables worker-meshed buildings rising in at zoom 15–15.3, with scene
|
|
160
|
+
sun, cast/contact shadows and 0.8 m rounded corners. Each effect is independently overridable. See
|
|
161
|
+
[3D buildings](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/buildings-3d.md).
|
|
162
|
+
Street lights default to off, including in Streets. Set `roads.streetLights.enabled: true` and mount
|
|
163
|
+
`createTileflowStreetLights` to enable them; see
|
|
164
|
+
[street lights](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/street-lights.md).
|
|
165
|
+
`createTileflowVegetation` controls all trees using the map's `3d`, `flat` or `auto` policy; see
|
|
166
|
+
[vegetation controls and 3D trees](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/trees-3d.md).
|
|
167
|
+
|
|
168
|
+
Labels use native placement. POI icons and names place together by default;
|
|
169
|
+
`placement.coupleIconAndLabel: false` separates them.
|
|
170
|
+
|
|
171
|
+
The semantic domains are `land`, `water`, `nautical`, `roads`, `buildings`, `boundaries`, `labels`,
|
|
172
|
+
`poi`, `aeroways`, `transit`, `vegetation`, `addresses`, and `landforms`. Style stable geographic
|
|
173
|
+
targets rather than compiler-generated MapLibre layer IDs. Shared primitives cover fills, lines,
|
|
174
|
+
text, icons, circles, and extrusions. `zoom.*` supplies zoom curves; `expr.*` and `field(...)` supply
|
|
175
|
+
the closed data-expression language. `renderPass`, `refineRenderTarget`, and `withRenderStack` add
|
|
176
|
+
owner-local rendering behavior without bypassing the compiler. A pass, or a target its module moves,
|
|
177
|
+
is placed at a band edge such as `'above-relief'` or `'below-labels'`, or `{above}` / `{below}` one
|
|
178
|
+
semantic target.
|
|
179
|
+
|
|
180
|
+
## Compile and inspect
|
|
181
|
+
|
|
182
|
+
`validateTileflowMap(input)` returns `{valid, messages}`. `parseTileflowMap(map)` resolves and
|
|
183
|
+
validates the authoring input and throws on failure. `createStyle(map, options)` returns a style or
|
|
184
|
+
throws; `createStyleResult(map, options)` returns structured diagnostics and a compilation report.
|
|
185
|
+
Only a successful result contains `style`.
|
|
186
|
+
|
|
187
|
+
Maps with package/local icon or font directories need the CLI, a build plugin, or
|
|
188
|
+
[`@tileflow/dev/artifacts`](https://github.com/tileflow/tileflow-sdk/blob/main/packages/dev/README.md)
|
|
189
|
+
to prepare assets. Browser components consume the resulting manifest.
|
|
190
|
+
|
|
191
|
+
Discover the language and inspect a prepared map:
|
|
192
|
+
|
|
193
|
+
```sh
|
|
194
|
+
npx tileflow describe themes --json
|
|
195
|
+
npx tileflow language manifest --json
|
|
196
|
+
npx tileflow language schema --json
|
|
197
|
+
npx tileflow inspect --json
|
|
198
|
+
npx tileflow explain --theme dark --json
|
|
199
|
+
npx tileflow semantic-diff --from-config before/tileflow.config.ts --to-config after/tileflow.config.ts --json
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The language manifest is also exported as `tileflowAuthoringManifest`, with
|
|
203
|
+
`tileflowAuthoringManifestSchemaVersion`. The generated schema distinguishes authoring input from
|
|
204
|
+
resolved compiler input. `diffTileflowMaps(before, after)` returns deterministic semantic changes
|
|
205
|
+
at JSON Pointer paths. Physical inspection IDs and indexes are diagnostic observations, not stable
|
|
206
|
+
application targets.
|
|
207
|
+
|
|
208
|
+
## Select a prepared map
|
|
209
|
+
|
|
210
|
+
React, Vue and Svelte accept a required `source` object, `{map, manifestUrl?}`. `map` is the portable
|
|
211
|
+
name in the manifest, not a Hosted `map_...` identifier. An omitted web `manifestUrl` means exactly
|
|
212
|
+
`/tileflow/manifest.json`; custom paths and external hosts must be explicit. The native Core and
|
|
213
|
+
React Native type contracts use `{map, manifestUrl}` with an explicit absolute URL. They do not
|
|
214
|
+
infer an application origin, Metro host or manifest location.
|
|
215
|
+
|
|
216
|
+
<!-- docs:check -->
|
|
217
|
+
|
|
218
|
+
```ts
|
|
219
|
+
import type {TileflowNativeSource} from '@tileflow/core/native';
|
|
220
|
+
import type {TileflowRuntimeSource} from '@tileflow/core/runtime';
|
|
221
|
+
|
|
222
|
+
const webSource = {map: 'madrid'} satisfies TileflowRuntimeSource;
|
|
223
|
+
const nativeSource = {
|
|
224
|
+
map: 'madrid',
|
|
225
|
+
manifestUrl: 'https://maps.example.com/tileflow/native/manifest.json',
|
|
226
|
+
} satisfies TileflowNativeSource;
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
These objects select existing prepared maps; they do not compile or render one. Every Tileflow
|
|
230
|
+
framework Map is manifest-backed, without a renderer discriminator or direct-style mode. The
|
|
231
|
+
obsolete source fields `kind` and `style` are rejected. Completely unmanaged maps use upstream
|
|
232
|
+
MapLibre directly. Omitted themes use the manifest default, concrete themes select exact names,
|
|
233
|
+
and `system` requires the manifest's explicit light/dark mapping and a supplied runtime color scheme.
|
|
234
|
+
See the [native source guide](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/native-resource-urls.md)
|
|
235
|
+
for source coordination, bounded acquisition and safe diagnostics. The pre-release React Native
|
|
236
|
+
package uses this contract for its mounted Map; it is not yet published.
|
|
237
|
+
|
|
238
|
+
## Data, terrain, and browser resources
|
|
239
|
+
|
|
240
|
+
Tileflow World is the hosted primary source. `vectorTiles()` with `openMapTiles()` supports
|
|
241
|
+
external local/self-hosted data; hosted eligibility is separate. `hostedTileset()`, `boundaryAreas`
|
|
242
|
+
and semantic overlays add named sources. Local PMTiles inputs are tooling-only.
|
|
243
|
+
|
|
244
|
+
`bathymetry({vectorLayers: {...}})` declares contour/name layers. `marine: 'nautical'` adds
|
|
245
|
+
navigation marks, flashing lights, and a "Not for navigation" notice.
|
|
246
|
+
|
|
247
|
+
World attribution links to Tileflow's source notice, OpenMapTiles, and OpenStreetMap. External
|
|
248
|
+
vector data retains the attribution supplied by its owner.
|
|
249
|
+
|
|
250
|
+
`projection` accepts `mercator` or `globe`. Terrain supports `none`, `hillshade`, `3d`, and an object
|
|
251
|
+
form for explicit hillshade and contour configuration. Browser-derived contours require a DEM tile
|
|
252
|
+
template, zoom limits, thresholds, and the Tileflow contour protocol. Framework adapters and local
|
|
253
|
+
tooling prepare browser resources; direct MapLibre integrations must register required protocols
|
|
254
|
+
before loading a style. See the
|
|
255
|
+
[browser runtime contract](https://github.com/tileflow/tileflow-sdk/blob/main/docs/contracts/framework-browser-runtime.md).
|
|
256
|
+
|
|
257
|
+
With `projection: 'globe'`, `atmosphere: true` adds a halo and stars; an object configures colors, star count and size.
|
|
258
|
+
`sky` follows the sun at street level. Frameworks and capture attach both; direct
|
|
259
|
+
MapLibre consumers call `attachTileflowAtmosphere(map)` from `@tileflow/core/browser`.
|
|
260
|
+
See
|
|
261
|
+
[globe atmosphere](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/globe-atmosphere.md)
|
|
262
|
+
and [street sky](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/street-sky.md).
|
|
263
|
+
|
|
264
|
+
Applications that need the map's data themselves, such as streets to route over or the place
|
|
265
|
+
under the camera, read chosen layers of a vector source for an area at a fixed zoom with
|
|
266
|
+
`createTileflowTileReader` from `@tileflow/core/browser`, which also runs in a module worker. See
|
|
267
|
+
[application tile reading](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/application-tile-reading.md).
|
|
268
|
+
|
|
269
|
+
In a 3D scene, `createTileflowDepthMarkers` from `@tileflow/core/browser` draws application markers
|
|
270
|
+
that nearer buildings hide, facing the viewer or lying on the ground. See
|
|
271
|
+
[depth markers](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/depth-markers.md).
|
|
272
|
+
|
|
273
|
+
Text requires exactly one provider. Soundings and Blueprint use URL glyphs; Streets packages DINish
|
|
274
|
+
and Noto Sans; Baedeker, 1777 and Siegfried package Cormorant; Cívica packages its lettering. Hosted
|
|
275
|
+
rejects packaged/local fonts: self-host or replace them with compatible public glyphs. Tile and font
|
|
276
|
+
URLs do not grant redistribution rights.
|
|
277
|
+
|
|
278
|
+
## Reference
|
|
279
|
+
|
|
280
|
+
Use the [generated language schema](https://github.com/tileflow/tileflow-sdk/blob/main/docs/modules-api-reference.json),
|
|
281
|
+
[cartographic authoring contract](https://github.com/tileflow/tileflow-sdk/blob/main/docs/contracts/cartographic-authoring.md),
|
|
282
|
+
and [public exports](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/src/index.ts)
|
|
283
|
+
for exact options. Prefer the installed CLI's generated contracts when using a published release;
|
|
284
|
+
`main` can contain unreleased changes. Report defects in the
|
|
285
|
+
[issue tracker](https://github.com/tileflow/tileflow-sdk/issues).
|
|
286
|
+
|
|
287
|
+
## Detailed guides
|
|
288
|
+
|
|
289
|
+
These guides also ship in the installed package under `docs/` and describe this source revision;
|
|
290
|
+
prefer the installed copy for an older release.
|
|
291
|
+
|
|
292
|
+
- [Globe atmosphere](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/globe-atmosphere.md)
|
|
293
|
+
- [Map and terrain examples](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/map-and-terrain-examples.md)
|
|
294
|
+
- [Authoring model](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/authoring-model.md)
|
|
295
|
+
- [Shared visual primitives](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/shared-visual-primitives.md)
|
|
296
|
+
- [Compiled-style performance](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/compiled-style-performance.md)
|
|
297
|
+
- [Camera moves and the tile cache](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/camera-moves-and-tile-cache.md)
|
|
298
|
+
- [Cartographic defaults and overrides](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/cartographic-defaults.md)
|
|
299
|
+
- [Themes and module styles](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/themes-and-module-styles.md)
|
|
300
|
+
- [Theme transitions and blends](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/theme-transitions-and-blends.md)
|
|
301
|
+
- [Map emphasis](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/map-emphasis.md)
|
|
302
|
+
- [Style states](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/style-states.md)
|
|
303
|
+
- [Route drawing](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/route-drawing.md)
|
|
304
|
+
- [Sun and light](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/sun-and-light.md)
|
|
305
|
+
- [3D buildings](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/buildings-3d.md)
|
|
306
|
+
- [Street lights](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/street-lights.md)
|
|
307
|
+
- [3D trees](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/trees-3d.md)
|
|
308
|
+
- [Boundary areas and choropleths](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/boundary-areas-and-choropleths.md)
|
|
309
|
+
- [Nautical marks](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/nautical-marks.md)
|
|
310
|
+
- [Data is separate from design](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/data-is-separate-from-design.md)
|
|
311
|
+
- [Capture scenes](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/capture-scenes.md)
|
|
312
|
+
- [Capture shots](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/capture-shots.md)
|
|
313
|
+
- [Public API and browser subpath](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/public-api-and-browser-subpath.md)
|
|
314
|
+
- [Application tile reading](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/application-tile-reading.md)
|
|
315
|
+
- [Depth markers](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/depth-markers.md)
|
|
316
|
+
- [Hosted session authorization](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/hosted-session-authorization.md)
|
|
317
|
+
- [Native resource URLs](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/native-resource-urls.md)
|
|
318
|
+
- [Native artifact profile](https://github.com/tileflow/tileflow-sdk/blob/main/packages/core/docs/native-artifact-profile.md)
|
|
319
|
+
|
|
320
|
+
## Native icon capabilities
|
|
321
|
+
|
|
322
|
+
Prepared icon metadata identifies SDF assets and their default fill and halo. Core rejects any
|
|
323
|
+
symbol layer that can select both SDF and RGBA, including fallbacks and effective local overrides,
|
|
324
|
+
with `TF_ICON_REPRESENTATION_MIXED`. It preserves layers, collisions and interaction IDs. Omitted
|
|
325
|
+
SDF paint follows the resolved image selection; supplied map paint stays independent from asset
|
|
326
|
+
defaults. See [Author recolorable and adaptable icons](https://github.com/tileflow/tileflow-sdk/blob/main/packages/dev/docs/native-icons.md).
|