@tileflow/core 0.1.0-alpha.13 → 0.1.0-alpha.16

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/README.md CHANGED
@@ -42,18 +42,31 @@ export default defineTileflow({
42
42
  },
43
43
  typography: {
44
44
  font: 'Inter',
45
+ roads: {weight: 'bold'},
45
46
  },
46
47
  },
47
48
  },
48
49
  maps: {
49
50
  madrid: {
50
- basemap: osm(),
51
+ basemap: osm({version: '2026-06-07'}),
51
52
  icons: 'brand',
52
53
  theme: 'light',
53
54
  modules: [
54
- labels({roads: 'major'}),
55
- poi({categories: ['food', 'coffee', 'culture', 'transit'], icons: 'essential'}),
56
- roads({detail: 'streets', hierarchy: 'clear', outline: 'subtle', weight: 'regular'}),
55
+ labels({roads: 'major', roadClasses: ['motorway', 'trunk', 'primary']}),
56
+ poi({
57
+ categories: ['food', 'coffee', 'culture', 'transit'],
58
+ color: 'category',
59
+ density: 'balanced',
60
+ icons: 'essential',
61
+ }),
62
+ roads({
63
+ detail: 'streets',
64
+ hierarchy: 'clear',
65
+ oneWayMarkers: true,
66
+ outline: 'subtle',
67
+ weight: 'regular',
68
+ widthScale: {motorway: 1.15, minor: 0.9},
69
+ }),
57
70
  ],
58
71
  layers: {
59
72
  'highway-primary': {
@@ -71,6 +84,43 @@ export default defineTileflow({
71
84
  });
72
85
  ```
73
86
 
87
+ ## Capture scenes
88
+
89
+ Commit named visual scenes beside the maps they exercise. Scenes are strict, bounded test inputs;
90
+ they do not change style or manifest identity.
91
+
92
+ ```ts
93
+ export default defineTileflow({
94
+ maps: {
95
+ madrid: {basemap: osm(), theme: 'light'},
96
+ },
97
+ scenes: {
98
+ 'madrid-desktop': {
99
+ map: 'madrid',
100
+ camera: {type: 'center', center: [-3.7038, 40.4168], zoom: 12},
101
+ viewport: {width: 1280, height: 800, dpr: 1},
102
+ },
103
+ 'madrid-product': {
104
+ map: 'madrid',
105
+ camera: {type: 'center', center: [-3.7038, 40.4168], zoom: 12},
106
+ viewport: {width: 390, height: 844, dpr: 2},
107
+ target: {
108
+ kind: 'application',
109
+ path: '/maps/madrid',
110
+ captureId: 'product-map',
111
+ },
112
+ },
113
+ },
114
+ });
115
+ ```
116
+
117
+ The default target renders autonomously with no server. An application target uses the app's
118
+ normal loopback development server and selects exactly one wrapper by `captureId`, explicit
119
+ selector, or map name. Cameras accept `center` or `bounds`; viewports are 64–4096 CSS pixels at DPR
120
+ 1 or 2 within the public physical-pixel budget. Standalone capture applies the camera; an
121
+ application route must render it itself because capture does not mutate application component
122
+ state. Use `tileflow capture <scene>` or the `@tileflow/capture` Node package to render them.
123
+
74
124
  ## Style contract
75
125
 
76
126
  Tileflow keeps these levels separate:
@@ -80,6 +130,8 @@ Tileflow keeps these levels separate:
80
130
  - `theme.modules.<name>` contains advanced, module-specific tokens. These are granular: setting `theme.modules.roads.rail` does not recolor primary roads.
81
131
  - `maps.<name>.icons` can point at a reusable root icon set, a hosted MapLibre sprite URL, or a local icon folder for Vite/build output.
82
132
  - `maps.<name>.modules` enables semantic behavior such as `labels()`, `poi()`, and `roads()`. Road colors remain in `theme.modules.roads`; `roads()` controls detail, hierarchy, weight, outline, and optional transport extras.
133
+ - `typography` sets a global font/weight and optional `places`, `roads`, `water`, and `poi` overrides. The hosted Noto Sans endpoint guarantees `regular` and `bold`; custom glyph endpoints may provide the other typed weights.
134
+ - `buildingStyle` controls generated building fill opacity, outline opacity/width, and a height threshold that selects the theme's low/high-rise colors. Generated landuse and landcover layers consume their corresponding module colors.
83
135
  - `maps.<name>.renderer` can be `auto`, `osm-bright`, or `generated`. `auto` preserves the default template when compatible; `generated` always uses Tileflow's generated layers; `osm-bright` throws if the map config cannot be rendered with the template.
84
136
  - `layers` is the raw MapLibre escape hatch for exact layer patches.
85
137
 
@@ -95,6 +147,8 @@ roads({
95
147
  hierarchy: 'strong',
96
148
  weight: 'regular',
97
149
  outline: 'strong',
150
+ oneWayMarkers: true,
151
+ widthScale: {motorway: 1.15, primary: 1.05, minor: 0.9},
98
152
  extras: {
99
153
  paths: false,
100
154
  rail: false,
@@ -108,6 +162,8 @@ roads({
108
162
  adds service roads and tracks. `hierarchy` accepts `subtle`, `clear`, or `strong`; `weight`
109
163
  accepts `thin`, `regular`, or `bold`; and `outline` accepts `none`, `subtle`, or `strong`.
110
164
  `extras.paths`, `extras.rail`, and `extras.ferry` are independent and default to `false`.
165
+ `widthScale` accepts bounded multipliers for selected road classes, and `oneWayMarkers` adds
166
+ direction markers to eligible one-way roads.
111
167
 
112
168
  Without options, `roads()` uses `detail: 'streets'`, `hierarchy: 'clear'`,
113
169
  `weight: 'regular'`, `outline: 'subtle'`, and all extras disabled. Named visual recipes belong
@@ -124,18 +180,59 @@ labels({
124
180
  language: 'auto',
125
181
  places: 'major',
126
182
  roads: 'major',
183
+ roadClasses: ['motorway', 'trunk', 'primary', 'secondary'],
127
184
  water: 'major',
128
185
  });
129
186
  ```
130
187
 
131
- `places`, `roads`, and `water` accept `none`, `major`, or `all`. Each value is progressive:
132
- `major` keeps the important labels for orientation and `all` adds local or secondary labels at
133
- their natural zoom. Road labels are automatically limited to road classes currently visible through
134
- `roads({detail})`. `language` accepts `auto`, `local`, or a language code such as `en` or `es`.
188
+ `places` and `water` accept `none`, `major`, or `all`. Road labels follow the road hierarchy and
189
+ accept `none`, `highways`, `major`, `streets`, or `all`: `highways` includes motorway and trunk
190
+ labels, `major` adds primary through tertiary, `streets` adds minor streets, and `all` adds service
191
+ roads and tracks. Path labels are eligible at `all` only when path geometry is visible; when
192
+ `roads()` is present, enable it with `roads({extras: {paths: true}})`.
193
+
194
+ Detail values select which feature classes may be labeled; they do not force every name onto the
195
+ map. Labels keep the template's natural zoom ranges and MapLibre collision handling. Road labels
196
+ are also clamped to the classes currently visible through `roads({detail})`, so the effective result
197
+ is the intersection of both modules. `language` accepts `auto`, `local`, or a language code such as
198
+ `en` or `es`.
199
+
200
+ `roadClasses` is an optional explicit eligibility list. It is intersected with both the label
201
+ detail and visible `roads()` classes, so it cannot label a road family that the map has hidden.
135
202
 
136
203
  Without options, `labels()` uses `language: 'auto'` and `major` for all three label families.
137
204
  Label colors remain in `theme.modules.labels`; font family and weight remain in `typography`.
138
205
 
206
+ ## POI module
207
+
208
+ POI category policy is resolved once for filtering, icon selection, label color, and collision
209
+ priority:
210
+
211
+ ```ts
212
+ poi({
213
+ categories: ['food', 'culture', 'lodging'],
214
+ classMapping: {culture: ['planetarium']},
215
+ color: 'category',
216
+ density: 'balanced',
217
+ icons: 'full',
218
+ labels: 'full',
219
+ placement: {coupleIconAndLabel: true, iconPadding: 4, textPadding: 8},
220
+ });
221
+ ```
222
+
223
+ Built-in mappings inspect both `class` and `subclass`; `classMapping` adds source-specific values
224
+ without removing the defaults. `color: 'category'` uses `theme.modules.poi` colors end to end.
225
+ Named density is opt-in and adds bounded category-aware rank gates plus stable sort priority;
226
+ omitting it preserves legacy layer behavior. Raw source rank expressions remain available through
227
+ `styleOverride` when a particular dataset needs a bespoke rule.
228
+
229
+ ## Tile-source revision
230
+
231
+ Set `version` on `osm({...})`, `maps.<name>.tiles`, or a named project tileset to pin an immutable
232
+ archive identifier. Map-level `tiles.version` wins over basemap and named-tileset defaults. Tileflow
233
+ adds it as `archiveVersion` to the TileJSON URL and records it as
234
+ `metadata['tileflow:tilesetVersion']`; it never infers stability from an unversioned response.
235
+
139
236
  ## Public API
140
237
 
141
238
  Use the package root only:
@@ -153,6 +250,10 @@ import {
153
250
  } from '@tileflow/core';
154
251
  ```
155
252
 
253
+ Capture scene schemas, types, normalization, limits, and schema version are also exported from the
254
+ package root. See the [local visual capture contract](https://tileflow.dev/docs/agent-workflow) for
255
+ the CLI workflow and readiness boundary.
256
+
156
257
  Subpaths under `src/`, `themes/`, `templates/`, and `modules/` are internal implementation details and can change during alpha releases.
157
258
 
158
259
  Docs: https://tileflow.dev/docs