mapshaper 0.7.17 → 0.7.18

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/www/mapshaper.js CHANGED
@@ -18650,14 +18650,14 @@
18650
18650
  var labelPositionFields = ['label-pos', 'dx', 'dy', 'text-anchor'];
18651
18651
 
18652
18652
  var labelPositionStyles = {
18653
- n: {dx: 0, dy: '-0.45em', 'text-anchor': 'middle'},
18654
- s: {dx: 0, dy: '1.05em', 'text-anchor': 'middle'},
18655
- e: {dx: '0.4em', dy: '0.25em', 'text-anchor': 'start'},
18656
- w: {dx: '-0.4em', dy: '0.25em', 'text-anchor': 'end'},
18657
- ne: {dx: '0.35em', dy: '-0.15em', 'text-anchor': 'start'},
18658
- se: {dx: '0.35em', dy: '0.7em', 'text-anchor': 'start'},
18659
- nw: {dx: '-0.35em', dy: '-0.15em', 'text-anchor': 'end'},
18660
- sw: {dx: '-0.35em', dy: '0.7em', 'text-anchor': 'end'},
18653
+ n: {dx: 0, dy: '-0.5em', 'text-anchor': 'middle'},
18654
+ s: {dx: 0, dy: '1.1em', 'text-anchor': 'middle'},
18655
+ e: {dx: '0.45em', dy: '0.23em', 'text-anchor': 'start'},
18656
+ w: {dx: '-0.45em', dy: '0.23em', 'text-anchor': 'end'},
18657
+ ne: {dx: '0.4em', dy: '-0.15em', 'text-anchor': 'start'},
18658
+ se: {dx: '0.4em', dy: '0.7em', 'text-anchor': 'start'},
18659
+ nw: {dx: '-0.4em', dy: '-0.15em', 'text-anchor': 'end'},
18660
+ sw: {dx: '-0.4em', dy: '0.7em', 'text-anchor': 'end'},
18661
18661
  c: {dx: 0, dy: '0.25em', 'text-anchor': 'middle'}
18662
18662
  };
18663
18663
 
@@ -31667,6 +31667,10 @@ ${svg}
31667
31667
  type: 'flag'
31668
31668
  })
31669
31669
  .option('where', whereOpt)
31670
+ .option('ids', {
31671
+ describe: 'comma-sep. list of feature ids to style',
31672
+ type: 'numbers'
31673
+ })
31670
31674
  .option('class', {
31671
31675
  describe: 'name of CSS class or classes (space-separated)'
31672
31676
  })
@@ -44077,7 +44081,17 @@ ${svg}
44077
44081
  return utils.pickOne(schemes) || 'Tableau20';
44078
44082
  }
44079
44083
 
44080
- function getCategoricalColorScheme(name, n) {
44084
+ function randomRotateArr(arr) {
44085
+ var n = Math.floor(Math.random() * arr.length);
44086
+ return arr.slice(-n).concat(arr.slice(0, -n));
44087
+ }
44088
+
44089
+ function getRandomizedCategoricalColorScheme(n) {
44090
+ var name = pickRandomCategoricalScheme(n);
44091
+ return getCategoricalColorScheme(name, n, true);
44092
+ }
44093
+
44094
+ function getCategoricalColorScheme(name, n, randomized) {
44081
44095
  var colors;
44082
44096
  initSchemes();
44083
44097
  name = standardName(name);
@@ -44092,7 +44106,11 @@ ${svg}
44092
44106
  // stop(name, 'does not contain', n, 'colors');
44093
44107
  message('Color scheme has', colors.length, 'colors. Using duplication to match', n, 'categories.');
44094
44108
  colors = wrapColors(colors, n);
44095
- } else {
44109
+ }
44110
+ if (randomized) {
44111
+ colors = randomRotateArr(colors);
44112
+ }
44113
+ if (n < colors.length) {
44096
44114
  colors = colors.slice(0, n);
44097
44115
  }
44098
44116
  return colors;
@@ -44183,7 +44201,7 @@ ${svg}
44183
44201
 
44184
44202
  if (colorArg == 'random') {
44185
44203
  if (categorical) {
44186
- colorScheme = pickRandomCategoricalScheme(n);
44204
+ return getRandomizedCategoricalColorScheme(n);
44187
44205
  } else {
44188
44206
  colorScheme = pickRandomColorScheme('sequential');
44189
44207
  }
@@ -56697,6 +56715,9 @@ ${svg}
56697
56715
  if (opts.where) {
56698
56716
  filterFn = compileFeatureExpression(opts.where, lyr, dataset.arcs);
56699
56717
  }
56718
+ if (opts.ids) {
56719
+ filterFn = combineFilters(filterFn, getIdFilter(opts.ids));
56720
+ }
56700
56721
  if (opts.clear) {
56701
56722
  lyr.data.getFields().filter(isSupportedSvgStyleProperty).forEach(lyr.data.deleteField, lyr.data);
56702
56723
  }
@@ -58248,7 +58269,7 @@ ${svg}
58248
58269
  });
58249
58270
  }
58250
58271
 
58251
- var version = "0.7.17";
58272
+ var version = "0.7.18";
58252
58273
 
58253
58274
  // Parse command line args into commands and run them
58254
58275
  // Function takes an optional Node-style callback. A Promise is returned if no callback is given.
package/www/page.css CHANGED
@@ -2025,6 +2025,11 @@ body.pan.panning .map-layers:not(.drawing) {
2025
2025
  font-size: 12.5px;
2026
2026
  }
2027
2027
 
2028
+ .label-style-panel button.label-style-close {
2029
+ font-size: 16px; /* close button icon */
2030
+ }
2031
+
2032
+
2028
2033
  .label-style-panel select {
2029
2034
  padding: 1px 0;
2030
2035
  }
@@ -2053,7 +2058,7 @@ body.pan.panning .map-layers:not(.drawing) {
2053
2058
  .label-style-row span,
2054
2059
  .label-style-row-label {
2055
2060
  display: block;
2056
- margin-bottom: 3px;
2061
+ /* margin-bottom: 3px; */
2057
2062
  color: #555;
2058
2063
  }
2059
2064
 
@@ -2121,7 +2126,8 @@ body.pan.panning .map-layers:not(.drawing) {
2121
2126
  border-top: 1px solid #ccc;
2122
2127
  }
2123
2128
 
2124
- .label-saved-style-row button {
2129
+ .label-saved-style-row button,
2130
+ .label-style-row button {
2125
2131
  margin-right: 5px;
2126
2132
  }
2127
2133
 
@@ -2201,6 +2207,185 @@ body.pan.panning .map-layers:not(.drawing) {
2201
2207
  box-sizing: border-box;
2202
2208
  }
2203
2209
 
2210
+ .layer-style-panel .layer-color-row {
2211
+ position: relative;
2212
+ }
2213
+
2214
+ .point-style-section + .point-style-section {
2215
+ margin-top: 10px;
2216
+ padding-top: 8px;
2217
+ border-top: 1px solid #ccc;
2218
+ }
2219
+
2220
+ .point-style-section.point-style-first-visible {
2221
+ margin-top: 7px;
2222
+ padding-top: 0;
2223
+ border-top: 0;
2224
+ }
2225
+
2226
+ .point-style-note {
2227
+ color: #555;
2228
+ line-height: 1.25;
2229
+ }
2230
+
2231
+ .point-create-labels-row {
2232
+ display: flex;
2233
+ align-items: center;
2234
+ gap: 10px;
2235
+ }
2236
+
2237
+ .point-create-circles-row {
2238
+ display: flex;
2239
+ align-items: baseline;
2240
+ gap: 2px;
2241
+ color: #555;
2242
+ }
2243
+
2244
+ .point-create-circles-row span {
2245
+ display: inline;
2246
+ margin: 0;
2247
+ color: #555;
2248
+ }
2249
+
2250
+ .point-create-copy-label {
2251
+ display: inline-flex;
2252
+ align-items: center;
2253
+ gap: 4px;
2254
+ margin: 0;
2255
+ color: #555;
2256
+ }
2257
+
2258
+ .point-create-copy-label span {
2259
+ display: inline;
2260
+ margin: 0;
2261
+ color: #555;
2262
+ }
2263
+
2264
+ .point-symbol-row {
2265
+ display: flex;
2266
+ align-items: flex-start;
2267
+ gap: 12px;
2268
+ }
2269
+
2270
+ .point-symbol-size-row {
2271
+ display: flex;
2272
+ align-items: flex-start;
2273
+ gap: 12px;
2274
+ }
2275
+
2276
+ .point-symbol-stepper-control {
2277
+ display: flex;
2278
+ flex-direction: column;
2279
+ gap: 2px;
2280
+ }
2281
+
2282
+ .point-symbol-stepper-control:last-child {
2283
+ margin-left: auto;
2284
+ align-items: flex-end;
2285
+ }
2286
+
2287
+ .point-symbol-color-cell {
2288
+ position: relative;
2289
+ white-space: nowrap;
2290
+ flex: 1;
2291
+ }
2292
+
2293
+ .point-symbol-row .layer-number-control input[type="text"],
2294
+ .point-symbol-width-row input[type="text"] {
2295
+ width: 45px;
2296
+ height: 19px;
2297
+ padding-top: 0;
2298
+ padding-bottom: 0;
2299
+ box-sizing: border-box;
2300
+ }
2301
+
2302
+ .point-symbol-width-row input[type="text"] {
2303
+ width: 55px;
2304
+ }
2305
+
2306
+ .layer-style-control-line {
2307
+ display: flex;
2308
+ align-items: flex-start;
2309
+ gap: 12px;
2310
+ }
2311
+
2312
+ .layer-color-cell {
2313
+ position: relative;
2314
+ white-space: nowrap;
2315
+ }
2316
+
2317
+ .layer-style-panel .layer-color-row input[type="text"] {
2318
+ width: 79px;
2319
+ height: 19px;
2320
+ padding-top: 0;
2321
+ padding-bottom: 0;
2322
+ box-sizing: border-box;
2323
+ vertical-align: top;
2324
+ }
2325
+
2326
+ .layer-row-controls {
2327
+ display: flex;
2328
+ gap: 6px;
2329
+ align-items: flex-start;
2330
+ justify-content: flex-start;
2331
+ }
2332
+
2333
+ .layer-number-control {
2334
+ display: block;
2335
+ margin: 0;
2336
+ }
2337
+
2338
+ .layer-number-control > span,
2339
+ .label-color-row > span,
2340
+ .layer-color-cell > span {
2341
+ display: block;
2342
+ margin-bottom: 3px;
2343
+ color: #555;
2344
+ }
2345
+
2346
+ .layer-style-panel .layer-number-control input[type="text"] {
2347
+ width: 45px;
2348
+ height: 19px;
2349
+ padding-top: 0;
2350
+ padding-bottom: 0;
2351
+ box-sizing: border-box;
2352
+ }
2353
+
2354
+ .layer-stepper-control {
2355
+ display: flex;
2356
+ align-items: center;
2357
+ gap: 2px;
2358
+ }
2359
+
2360
+ .layer-stepper-control .label-panel-btn {
2361
+ text-align: center;
2362
+ line-height: 18px;
2363
+ }
2364
+
2365
+ .layer-stroke-width-value {
2366
+ display: inline-block;
2367
+ width: 30px;
2368
+ min-height: 17px;
2369
+ line-height: 17px;
2370
+ text-align: center;
2371
+ border: 1px solid #999;
2372
+ background: white;
2373
+ cursor: pointer;
2374
+ box-sizing: border-box;
2375
+ }
2376
+
2377
+ .layer-stroke-width-value.editing {
2378
+ cursor: text;
2379
+ }
2380
+
2381
+ .layer-stroke-width-row .layer-number-control {
2382
+ display: block;
2383
+ }
2384
+
2385
+ .layer-style-panel .layer-color-row .label-color-picker input[type="text"] {
2386
+ width: 45px;
2387
+ }
2388
+
2204
2389
  .label-color-picker {
2205
2390
  position: absolute;
2206
2391
  z-index: 25;
@@ -2220,6 +2405,34 @@ body.pan.panning .map-layers:not(.drawing) {
2220
2405
  cursor: crosshair;
2221
2406
  }
2222
2407
 
2408
+ .label-color-presets {
2409
+ margin: 0 0 6px 0;
2410
+ }
2411
+
2412
+ .label-color-preset-row {
2413
+ display: flex;
2414
+ gap: 2px;
2415
+ margin-bottom: 2px;
2416
+ }
2417
+
2418
+ .label-color-preset {
2419
+ box-sizing: border-box;
2420
+ width: 14px;
2421
+ height: 14px;
2422
+ border: 1px solid rgba(0, 0, 0, 0.25);
2423
+ cursor: pointer;
2424
+ }
2425
+
2426
+ .label-color-preset:hover,
2427
+ .label-color-preset:focus {
2428
+ outline: 1px solid #d3aa00;
2429
+ outline-offset: 1px;
2430
+ }
2431
+
2432
+ .label-color-preset-group-start {
2433
+ margin-left: 2px;
2434
+ }
2435
+
2223
2436
  .label-color-picker.dragging-color canvas {
2224
2437
  cursor: none;
2225
2438
  }
@@ -2280,6 +2493,30 @@ body.dragging-color-picker * {
2280
2493
  margin-right: 5px;
2281
2494
  }
2282
2495
 
2496
+ .label-style-selection-row .label-editing-status,
2497
+ .label-style-selection-row .label-editing-clear {
2498
+ display: inline;
2499
+ }
2500
+
2501
+ .label-style-selection-row .label-editing-clear.hidden {
2502
+ display: none;
2503
+ }
2504
+
2505
+ .label-editing-status {
2506
+ color: #555;
2507
+ }
2508
+
2509
+ .label-style-selection-row .label-editing-clear {
2510
+ margin-left: 8px;
2511
+ color: var(--colored-text);
2512
+ cursor: pointer;
2513
+ }
2514
+
2515
+ .label-style-selection-row .label-editing-clear:hover {
2516
+ color: black;
2517
+ text-decoration: underline;
2518
+ }
2519
+
2283
2520
  .label-position-grid {
2284
2521
  display: grid;
2285
2522
  grid-template-columns: repeat(3, 10px);