@toclocoinc/lattice-grid 1.9.0 → 1.9.1

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Lattice Grid 1.9.0 — core + DOM renderer
2
+ * Lattice Grid 1.9.1 — core + DOM renderer
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
@@ -911,7 +911,14 @@ STDEV:(a)=>spread(numbers(a),true),
911
911
  STDEVP:(a)=>spread(numbers(a),false),
912
912
  VAR:(a)=>{const sd=spread(numbers(a),true);return sd*sd;},
913
913
  VARP:(a)=>{const sd=spread(numbers(a),false);return sd*sd;},
914
- COUNTDISTINCT:(a)=>new Set(a.filter((v)=>v!==null&&v!==undefined&&v!=='')).size,
914
+ COUNTDISTINCT:(a)=>{
915
+ const seen=new Set();
916
+ for(const arg of a){
917
+ const values=Array.isArray(arg)?arg:[arg];
918
+ for(const v of values)if(v!==null&&v!==undefined&&v!=='')seen.add(v);
919
+ }
920
+ return seen.size;
921
+ },
915
922
  IQR:(a)=>{
916
923
  const values=numbers(a);
917
924
  return percentileOf(values,0.75)-percentileOf(values,0.25);
@@ -6725,6 +6732,7 @@ const key=(ctx.row&&ctx.row.key)||api.keyOf(ctx.data);
6725
6732
  return key?api.running(source,spec.kind||'total',key):null;
6726
6733
  },
6727
6734
  };
6735
+ if(def.sort===undefined)m.sort={...(m.sort||{}),enabled:false};
6728
6736
  }
6729
6737
  const field=def.field??(isFunction(m.value&&m.value.compute)?null:(def.id??null));
6730
6738
  const computed=isFunction(m.value&&m.value.compute);
@@ -12945,14 +12953,22 @@ return this.#keyIndex.get(key);
12945
12953
  #changedColumns(previous,next){
12946
12954
  const changed=[];
12947
12955
  for(const colId of this.#queryColumns()){
12948
- const column=this.#column(colId);
12949
- if(!column)continue;
12950
- const before=isFunction(column.getValue)?column.getValue(previous):undefined;
12951
- const after=isFunction(column.getValue)?column.getValue(next):undefined;
12952
- if(!Object.is(before,after))changed.push(colId);
12956
+ if(this.#column(colId)&&this.#moved(colId,previous,next,new Set()))changed.push(colId);
12953
12957
  }
12954
12958
  return changed;
12955
12959
  }
12960
+ #moved(colId,previous,next,seen){
12961
+ if(seen.has(colId))return false;
12962
+ seen.add(colId);
12963
+ const column=this.#column(colId);
12964
+ if(!column)return false;
12965
+ const deps=column.value&&column.value.deps;
12966
+ if(Array.isArray(deps)&&deps.length){
12967
+ return deps.some((dep)=>this.#moved(String(dep),previous,next,seen));
12968
+ }
12969
+ if(!isFunction(column.getValue))return false;
12970
+ return!Object.is(column.getValue(previous),column.getValue(next));
12971
+ }
12956
12972
  #queryColumns(){
12957
12973
  const ids=new Set();
12958
12974
  for(const entry of this.#state('sort',[]))ids.add(entry.col);
@@ -13101,7 +13117,16 @@ handleFor(colId){
13101
13117
  return this.#handles.handle(colId);
13102
13118
  }
13103
13119
  #runSort(filtered){
13104
- const entries=this.#state('sort',[]);
13120
+ const entries=this.#state('sort',[]).filter((entry)=>{
13121
+ const column=this.#column(entry.col);
13122
+ if(!column||!column.running)return true;
13123
+ warnOnce(
13124
+ `source.sort.running.${entry.col}`,
13125
+ `sort ignores "${entry.col}": a running total is a function of the sort order, `
13126
+ +'so it cannot also decide it. Sort by the column it runs over instead.',
13127
+ );
13128
+ return false;
13129
+ });
13105
13130
  if(!entries.length)return filtered;
13106
13131
  const locale=(this.#ctx.config||{}).locale;
13107
13132
  if(entries.length===1){
@@ -28627,6 +28652,8 @@ Object.defineProperty(__exports,"RADIX_PRESETS",{enumerable:true,get:function(){
28627
28652
  Object.defineProperty(__exports,"parseRadix",{enumerable:true,get:function(){return parseRadix;}});
28628
28653
  Object.defineProperty(__exports,"formatRadix",{enumerable:true,get:function(){return formatRadix;}});
28629
28654
  Object.defineProperty(__exports,"createUnitType",{enumerable:true,get:function(){return createUnitType;}});
28655
+ Object.defineProperty(__exports,"registerUnitSystem",{enumerable:true,get:function(){return registerUnitSystem;}});
28656
+ Object.defineProperty(__exports,"defineUnit",{enumerable:true,get:function(){return defineUnit;}});
28630
28657
  Object.defineProperty(__exports,"UNIT_SYSTEMS",{enumerable:true,get:function(){return UNIT_SYSTEMS;}});
28631
28658
  Object.defineProperty(__exports,"parseUnit",{enumerable:true,get:function(){return parseUnit;}});
28632
28659
  Object.defineProperty(__exports,"formatUnit",{enumerable:true,get:function(){return formatUnit;}});
@@ -28637,6 +28664,8 @@ const RADIX_PRESETS=__m0["RADIX_PRESETS"];
28637
28664
  const parseRadix=__m0["parseRadix"];
28638
28665
  const formatRadix=__m0["formatRadix"];
28639
28666
  const createUnitType=__m0["createUnitType"];
28667
+ const registerUnitSystem=__m0["registerUnitSystem"];
28668
+ const defineUnit=__m0["defineUnit"];
28640
28669
  const UNIT_SYSTEMS=__m0["UNIT_SYSTEMS"];
28641
28670
  const parseUnit=__m0["parseUnit"];
28642
28671
  const formatUnit=__m0["formatUnit"];
@@ -38088,6 +38117,8 @@ Object.defineProperty(__exports,"RADIX_PRESETS",{enumerable:true,get:function(){
38088
38117
  Object.defineProperty(__exports,"parseRadix",{enumerable:true,get:function(){return __m5["parseRadix"];}});
38089
38118
  Object.defineProperty(__exports,"formatRadix",{enumerable:true,get:function(){return __m5["formatRadix"];}});
38090
38119
  Object.defineProperty(__exports,"createUnitType",{enumerable:true,get:function(){return __m5["createUnitType"];}});
38120
+ Object.defineProperty(__exports,"registerUnitSystem",{enumerable:true,get:function(){return __m5["registerUnitSystem"];}});
38121
+ Object.defineProperty(__exports,"defineUnit",{enumerable:true,get:function(){return __m5["defineUnit"];}});
38091
38122
  Object.defineProperty(__exports,"UNIT_SYSTEMS",{enumerable:true,get:function(){return __m5["UNIT_SYSTEMS"];}});
38092
38123
  Object.defineProperty(__exports,"parseUnit",{enumerable:true,get:function(){return __m5["parseUnit"];}});
38093
38124
  Object.defineProperty(__exports,"formatUnit",{enumerable:true,get:function(){return __m5["formatUnit"];}});
@@ -59661,6 +59692,12 @@ const __m3=__req("packages/dom/src/renderer/textentry.js");
59661
59692
  const isTextEntry=__m3["isTextEntry"];
59662
59693
  const IN_RANGE='lat-cell--range';
59663
59694
  const RANGE_EDGE='lat-cell--range-edge';
59695
+ const EDGE_SIDES=Object.freeze({
59696
+ top:'lat-cell--range-top',
59697
+ right:'lat-cell--range-right',
59698
+ bottom:'lat-cell--range-bottom',
59699
+ left:'lat-cell--range-left',
59700
+ });
59664
59701
  const DRAG_THRESHOLD=3;
59665
59702
  class RangeController{
59666
59703
  #grid;
@@ -59922,7 +59959,13 @@ if(!Number.isFinite(index)||index<0)continue;
59922
59959
  const inRange=hasRange&&selection.inRange(index,colId);
59923
59960
  const inPreview=!!preview&&this.#inFillPreview(index,colId,preview);
59924
59961
  cell.classList.toggle(IN_RANGE,inRange||inPreview);
59925
- cell.classList.toggle(RANGE_EDGE,(inRange||inPreview)&&this.#isEdge(index,colId,selection));
59962
+ const edges=(inRange||inPreview)
59963
+ ?this.#edgesOf(index,colId,selection)
59964
+ :null;
59965
+ cell.classList.toggle(RANGE_EDGE,!!edges&&edges.any);
59966
+ for(const[side,className]of Object.entries(EDGE_SIDES)){
59967
+ cell.classList.toggle(className,!!edges&&edges[side]);
59968
+ }
59926
59969
  }
59927
59970
  this.#placeHandle();
59928
59971
  }
@@ -59934,15 +59977,19 @@ if(!columns.has(colId))return false;
59934
59977
  const last=this.#indexOfKey([...new Set(cells.map((c)=>c.key))].pop());
59935
59978
  return index>last&&index<=preview.rowIndex;
59936
59979
  }
59937
- #isEdge(index,colId,selection){
59980
+ #edgesOf(index,colId,selection){
59938
59981
  const columns=this.#grid.columns.visible().map((c)=>c.id);
59939
59982
  const at=columns.indexOf(colId);
59940
- const left=at>0?columns[at-1]:null;
59941
- const right=at<columns.length-1?columns[at+1]:null;
59942
- return!selection.inRange(index-1,colId)
59943
- ||!selection.inRange(index+1,colId)
59944
- ||!left||!selection.inRange(index,left)
59945
- ||!right||!selection.inRange(index,right);
59983
+ const before=at>0?columns[at-1]:null;
59984
+ const after=at>=0&&at<columns.length-1?columns[at+1]:null;
59985
+ const edges={
59986
+ top:!selection.inRange(index-1,colId),
59987
+ bottom:!selection.inRange(index+1,colId),
59988
+ left:!before||!selection.inRange(index,before),
59989
+ right:!after||!selection.inRange(index,after),
59990
+ };
59991
+ edges.any=edges.top||edges.bottom||edges.left||edges.right;
59992
+ return edges;
59946
59993
  }
59947
59994
  #placeHandle(){
59948
59995
  const corner=this.#grid.selection.corner();
@@ -63045,6 +63092,8 @@ Object.defineProperty(__exports,"RADIX_PRESETS",{enumerable:true,get:function(){
63045
63092
  Object.defineProperty(__exports,"parseRadix",{enumerable:true,get:function(){return __m4["parseRadix"];}});
63046
63093
  Object.defineProperty(__exports,"formatRadix",{enumerable:true,get:function(){return __m4["formatRadix"];}});
63047
63094
  Object.defineProperty(__exports,"createUnitType",{enumerable:true,get:function(){return __m4["createUnitType"];}});
63095
+ Object.defineProperty(__exports,"registerUnitSystem",{enumerable:true,get:function(){return __m4["registerUnitSystem"];}});
63096
+ Object.defineProperty(__exports,"defineUnit",{enumerable:true,get:function(){return __m4["defineUnit"];}});
63048
63097
  Object.defineProperty(__exports,"UNIT_SYSTEMS",{enumerable:true,get:function(){return __m4["UNIT_SYSTEMS"];}});
63049
63098
  Object.defineProperty(__exports,"parseUnit",{enumerable:true,get:function(){return __m4["parseUnit"];}});
63050
63099
  Object.defineProperty(__exports,"formatUnit",{enumerable:true,get:function(){return __m4["formatUnit"];}});
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Lattice Grid 1.9.0 — charts module
2
+ * Lattice Grid 1.9.1 — charts module
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
@@ -2027,11 +2027,12 @@ function reduce(bucket,fn){
2027
2027
  const kernel=AGGREGATIONS[fn]||AGGREGATIONS[DEFAULT_AGGREGATION];
2028
2028
  return kernel(bucket.values,bucket.rows);
2029
2029
  }
2030
+ const NUMERIC_TYPES=Object.freeze(['number','currency','percent']);
2030
2031
  function scaleKindFor(column,values){
2031
2032
  const type=column&&typeof column.type==='string'?column.type:'';
2032
2033
  if(type==='date'||type==='datetime')return'time';
2033
2034
  if(values.length&&values.every((v)=>v instanceof Date))return'time';
2034
- if(type==='number'||type==='currency'||type==='percent'){
2035
+ if(NUMERIC_TYPES.includes(type)){
2035
2036
  const distinct=new Set(values.map(key));
2036
2037
  return distinct.size>12?'linear':'category';
2037
2038
  }
@@ -2040,7 +2041,9 @@ return'category';
2040
2041
  function bindSeries(grid,spec){
2041
2042
  const measure=measureOf(spec.y);
2042
2043
  const dimensionId=spec.x||null;
2043
- const seriesId=spec.series||null;
2044
+ const seriesId=spec.series
2045
+ ||(typeof spec.multiples==='string'?spec.multiples:null)
2046
+ ||null;
2044
2047
  const columns=grid.columns;
2045
2048
  const dimensionColumn=dimensionId?columns.get(dimensionId):undefined;
2046
2049
  const measureColumn=measure.col?columns.get(measure.col):undefined;
@@ -2091,9 +2094,16 @@ if(extra!==null)point.sizes=(point.sizes||0)+extra;
2091
2094
  }
2092
2095
  }
2093
2096
  const ordered=[...categories.values()].sort((a,b)=>a.order-b.order);
2094
- const limited=typeof spec.limit==='number'&&spec.limit>0
2097
+ const taken=typeof spec.limit==='number'&&spec.limit>0
2095
2098
  ?ordered.slice(0,spec.limit)
2096
2099
  :ordered;
2100
+ const kind=scaleKindFor(dimensionColumn,seenValues);
2101
+ const numeric=NUMERIC_TYPES.includes(
2102
+ dimensionColumn&&typeof dimensionColumn.type==='string'?dimensionColumn.type:'',
2103
+ );
2104
+ const limited=kind==='category'&&numeric
2105
+ ?[...taken].sort((a,b)=>(toNumber(a.value)??0)-(toNumber(b.value)??0))
2106
+ :taken;
2097
2107
  const out=[...series.entries()].map(([sKey,bucket],index)=>({
2098
2108
  key:sKey,
2099
2109
  label:bucket.label,
@@ -2116,7 +2126,7 @@ return{
2116
2126
  series:out,
2117
2127
  categories:limited.map((c)=>c.value),
2118
2128
  labels:limited.map((c)=>c.label),
2119
- kind:scaleKindFor(dimensionColumn,seenValues),
2129
+ kind,
2120
2130
  measure:{...measure,title:measureColumn?.title||measure.col||''},
2121
2131
  dimension:{col:dimensionId,title:dimensionColumn?.title||dimensionId||''},
2122
2132
  empty:out.length===0||limited.length===0,
@@ -4022,6 +4032,7 @@ __def("packages/modules/charts/geo.js",function(__exports,__req){
4022
4032
  'use strict';
4023
4033
  Object.defineProperty(__exports,"CONTINENTS",{enumerable:true,get:function(){return CONTINENTS;}});
4024
4034
  Object.defineProperty(__exports,"CONTINENT_NAMES",{enumerable:true,get:function(){return CONTINENT_NAMES;}});
4035
+ Object.defineProperty(__exports,"OUTLINES",{enumerable:true,get:function(){return OUTLINES;}});
4025
4036
  Object.defineProperty(__exports,"COUNTRY_CONTINENT",{enumerable:true,get:function(){return COUNTRY_CONTINENT;}});
4026
4037
  Object.defineProperty(__exports,"ALPHA3",{enumerable:true,get:function(){return ALPHA3;}});
4027
4038
  Object.defineProperty(__exports,"NUMERIC",{enumerable:true,get:function(){return NUMERIC;}});
@@ -4058,22 +4069,60 @@ OC:'Oceania',
4058
4069
  SA:'South America',
4059
4070
  });
4060
4071
  const OUTLINES=Object.freeze({
4061
- NA:[[-168,65],[-140,70],[-95,82],[-60,82],[-52,60],[-65,45],[-80,25],
4062
- [-97,16],[-105,20],[-115,30],[-125,40],[-140,60],[-168,65]],
4063
- SA:[[-81,12],[-60,12],[-50,0],[-35,-8],[-38,-22],[-48,-34],[-58,-40],
4064
- [-65,-55],[-75,-50],[-72,-30],[-70,-18],[-81,0],[-81,12]],
4065
- EU:[[-10,36],[-9,44],[-5,52],[2,58],[5,62],[15,70],[30,71],[40,66],
4066
- [55,60],[50,50],[40,45],[28,41],[20,40],[10,37],[-10,36]],
4067
- AF:[[-17,21],[-16,12],[-8,5],[8,4],[10,-2],[12,-12],[14,-22],[20,-34],
4068
- [32,-26],[40,-15],[51,-2],[43,11],[35,22],[25,32],[10,37],[-6,36],
4069
- [-17,21]],
4070
- AS:[[26,40],[45,40],[60,55],[80,72],[110,75],[140,72],[170,66],[160,55],
4071
- [140,45],[130,34],[122,22],[105,10],[95,5],[80,8],[72,20],[60,25],
4072
- [45,12],[35,30],[26,40]],
4073
- OC:[[113,-22],[130,-12],[142,-11],[153,-25],[150,-38],[140,-38],[130,-32],
4074
- [115,-34],[113,-22]],
4075
- AN:[[-180,-70],[-120,-74],[-60,-78],[0,-70],[60,-68],[120,-70],[180,-72],
4076
- [180,-85],[-180,-85],[-180,-70]],
4072
+ NA:[
4073
+ [[-168,66],[-156,71],[-130,70],[-115,69],[-100,69],[-85,70],[-75,73],
4074
+ [-64,66],[-78,62],[-79,55],[-65,60],[-56,52],[-60,45],[-67,45],
4075
+ [-70,42],[-74,40],[-76,37],[-81,32],[-80,27],[-81,25],[-84,30],
4076
+ [-90,29],[-94,29],[-97,26],[-97,21],[-91,19],[-88,21],[-87,16],
4077
+ [-83,9],[-79,9],[-85,13],[-92,16],[-96,16],[-105,20],[-110,24],
4078
+ [-114,28],[-117,32],[-122,37],[-124,42],[-124,48],[-130,55],
4079
+ [-140,60],[-150,59],[-160,55],[-165,60],[-168,66]],
4080
+ [[-43,60],[-32,64],[-22,70],[-20,74],[-25,78],[-33,83],[-45,83],
4081
+ [-58,82],[-62,76],[-56,70],[-55,66],[-52,61],[-43,60]],
4082
+ ],
4083
+ SA:[[[-81,12],[-72,12],[-62,11],[-52,5],[-50,0],[-44,-2],[-35,-6],
4084
+ [-38,-13],[-39,-18],[-48,-25],[-53,-34],[-57,-38],[-62,-40],[-65,-45],
4085
+ [-68,-52],[-75,-53],[-73,-45],[-73,-37],[-71,-30],[-70,-23],[-71,-18],
4086
+ [-76,-14],[-81,-6],[-80,-2],[-78,1],[-77,8],[-81,12]]],
4087
+ EU:[
4088
+ [[-10,36],[-9,44],[-2,43],[-4,48],[-1,49],[4,52],[7,53],[8,57],
4089
+ [10,58],[5,58],[5,62],[11,64],[15,69],[21,70],[28,71],[32,70],
4090
+ [40,67],[44,68],[50,69],[60,70],[60,60],[58,52],[50,46],[40,44],
4091
+ [36,45],[30,46],[28,41],[26,40],[23,38],[18,40],[13,38],[15,37],
4092
+ [12,44],[8,44],[3,42],[-2,37],[-10,36]],
4093
+ [[-5,50],[1,51],[2,53],[-1,55],[-3,58],[-5,58],[-6,55],[-5,50]],
4094
+ [[-10,52],[-6,52],[-6,55],[-10,55],[-10,52]],
4095
+ ],
4096
+ AF:[[[-17,21],[-16,15],[-17,12],[-13,8],[-8,5],[-3,5],[3,6],[8,4],
4097
+ [9,2],[10,-2],[12,-6],[12,-12],[14,-18],[15,-23],[18,-29],[23,-34],
4098
+ [27,-34],[32,-29],[33,-26],[35,-22],[40,-16],[41,-10],[40,-3],[43,0],
4099
+ [51,4],[51,11],[45,12],[43,12],[39,15],[37,21],[34,28],[32,31],
4100
+ [25,32],[20,31],[15,32],[10,37],[3,36],[-2,35],[-6,36],[-10,30],
4101
+ [-13,27],[-17,21]]],
4102
+ AS:[
4103
+ [[26,40],[35,36],[36,31],[43,30],[48,30],[50,27],[56,25],[57,22],
4104
+ [60,25],[62,25],[67,24],[70,21],[73,16],[77,8],[80,6],[80,13],
4105
+ [84,19],[87,21],[92,21],[95,16],[98,10],[104,1],[104,10],[107,11],
4106
+ [109,17],[117,23],[122,30],[122,37],[126,34],[129,35],[130,43],
4107
+ [135,45],[142,45],[143,53],[140,58],[155,59],[162,60],[170,66],
4108
+ [180,68],[170,71],[150,73],[130,74],[110,76],[90,76],[75,73],
4109
+ [70,70],[60,70],[60,60],[58,52],[50,46],[40,44],[36,45],[30,46],
4110
+ [28,41],[26,40]],
4111
+ [[130,31],[132,32],[135,33],[137,34],[140,35],[141,38],[141,41],
4112
+ [142,42],[145,43],[145,45],[141,45],[140,42],[139,40],[137,37],
4113
+ [135,35],[133,34],[131,33],[130,31]],
4114
+ ],
4115
+ OC:[
4116
+ [[113,-22],[114,-26],[115,-34],[119,-34],[126,-32],[132,-32],[137,-35],
4117
+ [141,-38],[147,-38],[150,-37],[153,-30],[153,-25],[146,-19],[142,-11],
4118
+ [136,-12],[130,-12],[126,-14],[122,-18],[113,-22]],
4119
+ [[145,-41],[148,-41],[148,-43],[145,-43],[145,-41]],
4120
+ [[173,-35],[178,-38],[174,-41],[172,-43],[167,-46],[170,-44],[173,-35]],
4121
+ ],
4122
+ AN:[[[-180,-78],[-150,-76],[-120,-74],[-100,-73],[-80,-72],[-60,-63],
4123
+ [-45,-60],[-58,-64],[-70,-70],[-60,-76],[-30,-77],[0,-70],[20,-70],
4124
+ [40,-68],[60,-67],[80,-66],[100,-66],[120,-66],[140,-66],[160,-78],
4125
+ [170,-84],[180,-85],[-180,-85],[-180,-78]]],
4077
4126
  });
4078
4127
  const COUNTRY_CONTINENT=Object.freeze({
4079
4128
  AD:'EU',AE:'AS',AF:'AS',AG:'NA',AI:'NA',AL:'EU',AM:'AS',AO:'AF',AQ:'AN',
@@ -4169,21 +4218,30 @@ if(CONTINENTS.includes(code)&&!(code in COUNTRY_CONTINENT))return code;
4169
4218
  if(CONTINENTS.includes(code))return code;
4170
4219
  return COUNTRY_CONTINENT[code]||null;
4171
4220
  }
4172
- function projection(plot){
4173
- const scale=Math.min(plot.width/360,plot.height/180);
4221
+ function projection(plot,opts={}){
4222
+ const south=opts.antarctic?-90:-58;
4223
+ const north=84;
4224
+ const span=north-south;
4225
+ const scale=Math.min(plot.width/360,plot.height/span);
4174
4226
  const width=360*scale;
4175
- const height=180*scale;
4227
+ const height=span*scale;
4176
4228
  const left=plot.left+(plot.width-width)/2;
4177
4229
  const top=plot.top+(plot.height-height)/2;
4178
- return(lon,lat)=>[left+(lon+180)*scale,top+(90-lat)*scale];
4230
+ return(lon,lat)=>[left+(lon+180)*scale,top+(north-lat)*scale];
4179
4231
  }
4180
4232
  function ringPath(ring,project){
4233
+ const rings=Array.isArray(ring)&&Array.isArray(ring[0])&&Array.isArray(ring[0][0])
4234
+ ?ring
4235
+ :[ring];
4181
4236
  const parts=[];
4182
- for(let i=0;i<ring.length;i++){
4183
- const[x,y]=project(ring[i][0],ring[i][1]);
4237
+ for(const one of rings){
4238
+ if(!Array.isArray(one)||!one.length)continue;
4239
+ for(let i=0;i<one.length;i++){
4240
+ const[x,y]=project(one[i][0],one[i][1]);
4184
4241
  parts.push(i?'L':'M',round(x),round(y));
4185
4242
  }
4186
- if(parts.length)parts.push('Z');
4243
+ parts.push('Z');
4244
+ }
4187
4245
  return path(parts);
4188
4246
  }
4189
4247
  function shapesToPaths(opts){
@@ -4226,7 +4284,6 @@ new Pool(ctx.groups.labels).finish();
4226
4284
  const supplied=shapesToPaths({
4227
4285
  shapes:ctx.shapes,plot,codeProperty:ctx.codeProperty,
4228
4286
  });
4229
- const project=projection(plot);
4230
4287
  const useCountries=supplied.size>0;
4231
4288
  const totals=new Map();
4232
4289
  const unmatched=[];
@@ -4247,13 +4304,17 @@ entry.labels.push(bound.labels[i]);
4247
4304
  totals.set(target,entry);
4248
4305
  }
4249
4306
  }
4307
+ const antarctic=totals.has('AN');
4308
+ const project=projection(plot,{antarctic});
4250
4309
  const domain=measureDomain([...totals.values()].map((e)=>e.value),{
4251
4310
  zero:!ctx.diverging,nice:false,
4252
4311
  });
4253
4312
  const ramp=colourRamp(domain,!!ctx.diverging,scheme);
4254
4313
  const pool=new Pool(ctx.groups.marks);
4255
4314
  const regions=[];
4256
- const codes=useCountries?[...supplied.keys()]:CONTINENTS;
4315
+ const codes=useCountries
4316
+ ?[...supplied.keys()]
4317
+ :CONTINENTS.filter((code)=>code!=='AN'||antarctic);
4257
4318
  for(const code of codes){
4258
4319
  const d=useCountries?supplied.get(code):ringPath(OUTLINES[code],project);
4259
4320
  const entry=totals.get(code);
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Lattice Grid 1.9.0 — devtools module
2
+ * Lattice Grid 1.9.1 — devtools module
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Lattice Grid 1.9.0 — dhtmlx-compat module
2
+ * Lattice Grid 1.9.1 — dhtmlx-compat module
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
@@ -909,7 +909,14 @@ STDEV:(a)=>spread(numbers(a),true),
909
909
  STDEVP:(a)=>spread(numbers(a),false),
910
910
  VAR:(a)=>{const sd=spread(numbers(a),true);return sd*sd;},
911
911
  VARP:(a)=>{const sd=spread(numbers(a),false);return sd*sd;},
912
- COUNTDISTINCT:(a)=>new Set(a.filter((v)=>v!==null&&v!==undefined&&v!=='')).size,
912
+ COUNTDISTINCT:(a)=>{
913
+ const seen=new Set();
914
+ for(const arg of a){
915
+ const values=Array.isArray(arg)?arg:[arg];
916
+ for(const v of values)if(v!==null&&v!==undefined&&v!=='')seen.add(v);
917
+ }
918
+ return seen.size;
919
+ },
913
920
  IQR:(a)=>{
914
921
  const values=numbers(a);
915
922
  return percentileOf(values,0.75)-percentileOf(values,0.25);
@@ -6723,6 +6730,7 @@ const key=(ctx.row&&ctx.row.key)||api.keyOf(ctx.data);
6723
6730
  return key?api.running(source,spec.kind||'total',key):null;
6724
6731
  },
6725
6732
  };
6733
+ if(def.sort===undefined)m.sort={...(m.sort||{}),enabled:false};
6726
6734
  }
6727
6735
  const field=def.field??(isFunction(m.value&&m.value.compute)?null:(def.id??null));
6728
6736
  const computed=isFunction(m.value&&m.value.compute);
@@ -12943,14 +12951,22 @@ return this.#keyIndex.get(key);
12943
12951
  #changedColumns(previous,next){
12944
12952
  const changed=[];
12945
12953
  for(const colId of this.#queryColumns()){
12946
- const column=this.#column(colId);
12947
- if(!column)continue;
12948
- const before=isFunction(column.getValue)?column.getValue(previous):undefined;
12949
- const after=isFunction(column.getValue)?column.getValue(next):undefined;
12950
- if(!Object.is(before,after))changed.push(colId);
12954
+ if(this.#column(colId)&&this.#moved(colId,previous,next,new Set()))changed.push(colId);
12951
12955
  }
12952
12956
  return changed;
12953
12957
  }
12958
+ #moved(colId,previous,next,seen){
12959
+ if(seen.has(colId))return false;
12960
+ seen.add(colId);
12961
+ const column=this.#column(colId);
12962
+ if(!column)return false;
12963
+ const deps=column.value&&column.value.deps;
12964
+ if(Array.isArray(deps)&&deps.length){
12965
+ return deps.some((dep)=>this.#moved(String(dep),previous,next,seen));
12966
+ }
12967
+ if(!isFunction(column.getValue))return false;
12968
+ return!Object.is(column.getValue(previous),column.getValue(next));
12969
+ }
12954
12970
  #queryColumns(){
12955
12971
  const ids=new Set();
12956
12972
  for(const entry of this.#state('sort',[]))ids.add(entry.col);
@@ -13099,7 +13115,16 @@ handleFor(colId){
13099
13115
  return this.#handles.handle(colId);
13100
13116
  }
13101
13117
  #runSort(filtered){
13102
- const entries=this.#state('sort',[]);
13118
+ const entries=this.#state('sort',[]).filter((entry)=>{
13119
+ const column=this.#column(entry.col);
13120
+ if(!column||!column.running)return true;
13121
+ warnOnce(
13122
+ `source.sort.running.${entry.col}`,
13123
+ `sort ignores "${entry.col}": a running total is a function of the sort order, `
13124
+ +'so it cannot also decide it. Sort by the column it runs over instead.',
13125
+ );
13126
+ return false;
13127
+ });
13103
13128
  if(!entries.length)return filtered;
13104
13129
  const locale=(this.#ctx.config||{}).locale;
13105
13130
  if(entries.length===1){
@@ -28625,6 +28650,8 @@ Object.defineProperty(__exports,"RADIX_PRESETS",{enumerable:true,get:function(){
28625
28650
  Object.defineProperty(__exports,"parseRadix",{enumerable:true,get:function(){return parseRadix;}});
28626
28651
  Object.defineProperty(__exports,"formatRadix",{enumerable:true,get:function(){return formatRadix;}});
28627
28652
  Object.defineProperty(__exports,"createUnitType",{enumerable:true,get:function(){return createUnitType;}});
28653
+ Object.defineProperty(__exports,"registerUnitSystem",{enumerable:true,get:function(){return registerUnitSystem;}});
28654
+ Object.defineProperty(__exports,"defineUnit",{enumerable:true,get:function(){return defineUnit;}});
28628
28655
  Object.defineProperty(__exports,"UNIT_SYSTEMS",{enumerable:true,get:function(){return UNIT_SYSTEMS;}});
28629
28656
  Object.defineProperty(__exports,"parseUnit",{enumerable:true,get:function(){return parseUnit;}});
28630
28657
  Object.defineProperty(__exports,"formatUnit",{enumerable:true,get:function(){return formatUnit;}});
@@ -28635,6 +28662,8 @@ const RADIX_PRESETS=__m0["RADIX_PRESETS"];
28635
28662
  const parseRadix=__m0["parseRadix"];
28636
28663
  const formatRadix=__m0["formatRadix"];
28637
28664
  const createUnitType=__m0["createUnitType"];
28665
+ const registerUnitSystem=__m0["registerUnitSystem"];
28666
+ const defineUnit=__m0["defineUnit"];
28638
28667
  const UNIT_SYSTEMS=__m0["UNIT_SYSTEMS"];
28639
28668
  const parseUnit=__m0["parseUnit"];
28640
28669
  const formatUnit=__m0["formatUnit"];
@@ -38086,6 +38115,8 @@ Object.defineProperty(__exports,"RADIX_PRESETS",{enumerable:true,get:function(){
38086
38115
  Object.defineProperty(__exports,"parseRadix",{enumerable:true,get:function(){return __m5["parseRadix"];}});
38087
38116
  Object.defineProperty(__exports,"formatRadix",{enumerable:true,get:function(){return __m5["formatRadix"];}});
38088
38117
  Object.defineProperty(__exports,"createUnitType",{enumerable:true,get:function(){return __m5["createUnitType"];}});
38118
+ Object.defineProperty(__exports,"registerUnitSystem",{enumerable:true,get:function(){return __m5["registerUnitSystem"];}});
38119
+ Object.defineProperty(__exports,"defineUnit",{enumerable:true,get:function(){return __m5["defineUnit"];}});
38089
38120
  Object.defineProperty(__exports,"UNIT_SYSTEMS",{enumerable:true,get:function(){return __m5["UNIT_SYSTEMS"];}});
38090
38121
  Object.defineProperty(__exports,"parseUnit",{enumerable:true,get:function(){return __m5["parseUnit"];}});
38091
38122
  Object.defineProperty(__exports,"formatUnit",{enumerable:true,get:function(){return __m5["formatUnit"];}});
@@ -59659,6 +59690,12 @@ const __m3=__req("packages/dom/src/renderer/textentry.js");
59659
59690
  const isTextEntry=__m3["isTextEntry"];
59660
59691
  const IN_RANGE='lat-cell--range';
59661
59692
  const RANGE_EDGE='lat-cell--range-edge';
59693
+ const EDGE_SIDES=Object.freeze({
59694
+ top:'lat-cell--range-top',
59695
+ right:'lat-cell--range-right',
59696
+ bottom:'lat-cell--range-bottom',
59697
+ left:'lat-cell--range-left',
59698
+ });
59662
59699
  const DRAG_THRESHOLD=3;
59663
59700
  class RangeController{
59664
59701
  #grid;
@@ -59920,7 +59957,13 @@ if(!Number.isFinite(index)||index<0)continue;
59920
59957
  const inRange=hasRange&&selection.inRange(index,colId);
59921
59958
  const inPreview=!!preview&&this.#inFillPreview(index,colId,preview);
59922
59959
  cell.classList.toggle(IN_RANGE,inRange||inPreview);
59923
- cell.classList.toggle(RANGE_EDGE,(inRange||inPreview)&&this.#isEdge(index,colId,selection));
59960
+ const edges=(inRange||inPreview)
59961
+ ?this.#edgesOf(index,colId,selection)
59962
+ :null;
59963
+ cell.classList.toggle(RANGE_EDGE,!!edges&&edges.any);
59964
+ for(const[side,className]of Object.entries(EDGE_SIDES)){
59965
+ cell.classList.toggle(className,!!edges&&edges[side]);
59966
+ }
59924
59967
  }
59925
59968
  this.#placeHandle();
59926
59969
  }
@@ -59932,15 +59975,19 @@ if(!columns.has(colId))return false;
59932
59975
  const last=this.#indexOfKey([...new Set(cells.map((c)=>c.key))].pop());
59933
59976
  return index>last&&index<=preview.rowIndex;
59934
59977
  }
59935
- #isEdge(index,colId,selection){
59978
+ #edgesOf(index,colId,selection){
59936
59979
  const columns=this.#grid.columns.visible().map((c)=>c.id);
59937
59980
  const at=columns.indexOf(colId);
59938
- const left=at>0?columns[at-1]:null;
59939
- const right=at<columns.length-1?columns[at+1]:null;
59940
- return!selection.inRange(index-1,colId)
59941
- ||!selection.inRange(index+1,colId)
59942
- ||!left||!selection.inRange(index,left)
59943
- ||!right||!selection.inRange(index,right);
59981
+ const before=at>0?columns[at-1]:null;
59982
+ const after=at>=0&&at<columns.length-1?columns[at+1]:null;
59983
+ const edges={
59984
+ top:!selection.inRange(index-1,colId),
59985
+ bottom:!selection.inRange(index+1,colId),
59986
+ left:!before||!selection.inRange(index,before),
59987
+ right:!after||!selection.inRange(index,after),
59988
+ };
59989
+ edges.any=edges.top||edges.bottom||edges.left||edges.right;
59990
+ return edges;
59944
59991
  }
59945
59992
  #placeHandle(){
59946
59993
  const corner=this.#grid.selection.corner();
@@ -63043,6 +63090,8 @@ Object.defineProperty(__exports,"RADIX_PRESETS",{enumerable:true,get:function(){
63043
63090
  Object.defineProperty(__exports,"parseRadix",{enumerable:true,get:function(){return __m4["parseRadix"];}});
63044
63091
  Object.defineProperty(__exports,"formatRadix",{enumerable:true,get:function(){return __m4["formatRadix"];}});
63045
63092
  Object.defineProperty(__exports,"createUnitType",{enumerable:true,get:function(){return __m4["createUnitType"];}});
63093
+ Object.defineProperty(__exports,"registerUnitSystem",{enumerable:true,get:function(){return __m4["registerUnitSystem"];}});
63094
+ Object.defineProperty(__exports,"defineUnit",{enumerable:true,get:function(){return __m4["defineUnit"];}});
63046
63095
  Object.defineProperty(__exports,"UNIT_SYSTEMS",{enumerable:true,get:function(){return __m4["UNIT_SYSTEMS"];}});
63047
63096
  Object.defineProperty(__exports,"parseUnit",{enumerable:true,get:function(){return __m4["parseUnit"];}});
63048
63097
  Object.defineProperty(__exports,"formatUnit",{enumerable:true,get:function(){return __m4["formatUnit"];}});