@protobase/ui 0.19.4 → 0.19.5

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.
Files changed (55) hide show
  1. package/dist/account/backup-codes.js +2 -9
  2. package/dist/app/displays/list-displays.js +2 -1
  3. package/dist/app/filled-fields.js +5 -0
  4. package/dist/app/gallery/details-open-storage.js +10 -0
  5. package/dist/app/gallery/gallery-layout.js +3 -1
  6. package/dist/app/gallery/lightbox.js +107 -61
  7. package/dist/app/import/convert.js +151 -0
  8. package/dist/app/import/csv-parser.js +119 -0
  9. package/dist/app/import/failed-rows.js +21 -0
  10. package/dist/app/import/import-button.js +31 -0
  11. package/dist/app/import/import-check-step.js +123 -0
  12. package/dist/app/import/import-counts.js +19 -0
  13. package/dist/app/import/import-dialog.js +152 -0
  14. package/dist/app/import/import-file-step.js +65 -0
  15. package/dist/app/import/import-mapping-step.js +195 -0
  16. package/dist/app/import/import-result-step.js +86 -0
  17. package/dist/app/import/import-select.js +35 -0
  18. package/dist/app/import/locale-formats.js +15 -0
  19. package/dist/app/import/lookups.js +48 -0
  20. package/dist/app/import/mapping.js +78 -0
  21. package/dist/app/import/parse-worker.d.ts +1 -0
  22. package/dist/app/import/parse-worker.js +39 -0
  23. package/dist/app/import/prepare-rows.js +129 -0
  24. package/dist/app/import/run-import.js +130 -0
  25. package/dist/app/import/sheet-cell.js +17 -0
  26. package/dist/app/import/sheet-file.js +58 -0
  27. package/dist/app/import/sheet-source.js +72 -0
  28. package/dist/app/import/use-import-flow.js +225 -0
  29. package/dist/app/import/xlsx-reader.js +43 -0
  30. package/dist/app/import/xlsx-xml.js +169 -0
  31. package/dist/app/import/zip-reader.js +72 -0
  32. package/dist/app/list-page.js +8 -1
  33. package/dist/app/named-icon.js +9 -1
  34. package/dist/app/record-page.js +11 -2
  35. package/dist/auth/sign-in-prompt.js +1 -1
  36. package/dist/data/api-provider.js +8 -2
  37. package/dist/lib/save-file.js +12 -0
  38. package/dist/lib/use-focus-trap.js +7 -1
  39. package/dist/package.js +1 -1
  40. package/dist/primitives/sheet-swipe.js +5 -0
  41. package/dist/primitives/sheet.js +40 -12
  42. package/dist/record-view/key-facts.js +29 -0
  43. package/dist/shell/assets/app-CZ4drn7G.js +67 -0
  44. package/dist/shell/assets/index-BoeKjvo8.css +2 -0
  45. package/dist/shell/assets/{index-CEvfMgFJ.js → index-BzCCIfII.js} +1 -1
  46. package/dist/shell/assets/{maplibre-D6zfLfTV.js → maplibre-BOsAtlAo.js} +1 -1
  47. package/dist/shell/assets/parse-worker-BtcY0dQw.js +5 -0
  48. package/dist/shell/assets/{record-map-B6_rbCcG.js → record-map-BK_02Lmk.js} +1 -1
  49. package/dist/shell/assets/{records-map-bQbuIc13.js → records-map-Dn72A_l-.js} +1 -1
  50. package/dist/shell/assets/{shared-protobase-ui-8pJgwjfc.js → shared-protobase-ui-B6lrj7eA.js} +1 -1
  51. package/dist/shell/index.html +4 -4
  52. package/dist/shell/protobase.shell.json +1 -1
  53. package/package.json +4 -4
  54. package/dist/shell/assets/app-BYFiTXK6.js +0 -66
  55. package/dist/shell/assets/index-CiGP6kle.css +0 -2
@@ -0,0 +1,5 @@
1
+ (function(){let e=[`,`,`;`,` `],t=t=>{let n=new Map(e.map(e=>[e,0])),r=!1;for(let e of t)e===`"`?r=!r:!r&&n.has(e)&&n.set(e,n.get(e)+1);return[...n].reduce((e,t)=>t[1]>e[1]?t:e,[`,`,0])[0]},n=e=>{let t=!1;for(let n=0;n<e.length;n++){let r=e[n];if(r===`"`)t=!t;else if(!t&&(r===`
2
+ `||r===`\r`))return e.slice(0,n)}},r=e=>{let r=e,i=``,a=!1,o=``,s=[],c=!1,l=!1,u=!1,d=!1,f=()=>{s.push(o),o=``},p=e=>{f(),e.push(s),s=[],d=!1},m=e=>{let t=[];for(let n of e)if(!(u&&(u=!1,n===`
3
+ `))){if(c){if(l){if(l=!1,n===`"`){o+=`"`;continue}c=!1}else if(n===`"`){l=!0;continue}else{o+=n;continue}}n===`"`&&o===``?(c=!0,d=!0):n===r?(f(),d=!0):n===`
4
+ `||n===`\r`?(u=n===`\r`,p(t)):(o+=n,d=!0)}return t},h=e=>{if(a)return m(e);i+=e,i.charCodeAt(0)===65279&&(i=i.slice(1));let o=n(i);if(o===void 0)return[];a=!0,r??=t(o);let s=i;return i=``,m(s)};return{push:h,end:()=>{let e=a?[]:h(`
5
+ `);return l&&(l=!1,c=!1),(d||o!==``)&&p(e),e},delimiter:()=>r}},i={amp:`&`,lt:`<`,gt:`>`,quot:`"`,apos:`'`},a=e=>e.replace(/&(#x[0-9a-f]+|#\d+|amp|lt|gt|quot|apos);/gi,(e,t)=>t[0]===`#`?String.fromCodePoint(t[1]===`x`||t[1]===`X`?parseInt(t.slice(2),16):Number(t.slice(1))):i[t.toLowerCase()]??e),o=e=>{let t={};for(let n of e.matchAll(/([\w:.-]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g)){let e=n[1].slice(n[1].indexOf(`:`)+1);t[e]=a(n[2]??n[3]??``)}return t},s=e=>e.replace(/<rPh\b[\s\S]*?<\/rPh>/g,``).match(/<t\b[^>]*>[\s\S]*?<\/t>/g)?.map(e=>a(e.replace(/^<t\b[^>]*>|<\/t>$/g,``))).join(``)??``,c=e=>[...e.matchAll(/<si\b[^>]*?(?:\/>|>([\s\S]*?)<\/si>)/g)].map(e=>s(e[1]??``)),l=(e,t)=>{let n=new Map([...t.matchAll(/<Relationship\b([^>]*)>/g)].map(e=>{let{Id:t,Target:n}=o(e[1]);return[t,n.startsWith(`/`)?n.slice(1):`xl/${n}`]})),r=[...e.matchAll(/<sheet\b([^>]*)>/g)].map(e=>{let{name:t,id:r}=o(e[1]),i=n.get(r);if(!t||!i)throw Error(`The workbook names a sheet it does not hold`);return{name:t,path:i}}),i=/<workbookPr\b([^>]*)>/.exec(e);return{sheets:r,date1904:i?[`1`,`true`].includes(o(i[1]).date1904??``):!1}},u=/* @__PURE__ */ new Set([14,15,16,17,18,19,20,21,22,27,28,29,30,31,32,33,34,35,36,45,46,47,50,51,52,53,54,55,56,57,58]),d=e=>/[dmyhs]/i.test(e.replace(/"[^"]*"|\[[^\]]*\]|\\.|_.|\*./g,``)),f=e=>{let t=new Map([...e.matchAll(/<numFmt\b([^>]*)>/g)].map(e=>{let{numFmtId:t,formatCode:n}=o(e[1]);return[Number(t),n??``]})),n=/<cellXfs\b[^>]*>([\s\S]*?)<\/cellXfs>/.exec(e)?.[1]??``,r=/* @__PURE__ */ new Set;return[...n.matchAll(/<xf\b([^>]*)>/g)].forEach((e,n)=>{let i=Number(o(e[1]).numFmtId??0);(u.has(i)||t.has(i)&&d(t.get(i)))&&r.add(n)}),r},p=e=>String(e).padStart(2,`0`),m=(e,t=!1)=>{let n=t?e+1462:e<60?e+1:e,r=new Date(Date.UTC(1899,11,30)+Math.round(n*86400)*1e3),i=`${r.getUTCFullYear()}-${p(r.getUTCMonth()+1)}-${p(r.getUTCDate())}`;return r.getUTCHours()*3600+r.getUTCMinutes()*60+r.getUTCSeconds()===0?i:`${i}T${p(r.getUTCHours())}:${p(r.getUTCMinutes())}:${p(r.getUTCSeconds())}`},h=e=>{let t=0;for(let n of e.toUpperCase()){let e=n.charCodeAt(0);if(e<65||e>90)break;t=t*26+(e-64)}return t-1},g=(e,t,n)=>{let r=e.t??`n`;if(r===`inlineStr`)return s(t);let i=/<v\b[^>]*>([\s\S]*?)<\/v>/.exec(t)?.[1];if(i===void 0)return null;let o=a(i);if(r===`s`)return n.strings[Number(o)]??null;if(r===`b`)return o===`1`;if(r===`str`||r===`e`)return o;if(r===`d`)return{date:o.replace(/Z$/,``)};let c=Number(o);return n.dates.has(Number(e.s??0))?{date:m(c,n.date1904)}:c},_=(e,t,n)=>{let r=/^<row\b([^>]*)>/.exec(e),i=Number(o(r?.[1]??``).r??n+1),a=[];for(let n of e.matchAll(/<c\b([^>]*?)(?:\/>|>([\s\S]*?)<\/c>)/g)){let e=o(n[1]),r=e.r?h(e.r):a.length;for(;a.length<r;)a.push(null);a[r]=g(e,n[2]??``,t)}return{line:i,cells:a}},v=()=>{let e=``;return t=>{e+=t;let n=[],r=0;for(let t of e.matchAll(/<row\b[^>]*?(?:\/>|>[\s\S]*?<\/row>)/g))n.push(t[0]),r=t.index+t[0].length;return e=e.slice(r),n}},y=async(e,t,n)=>new DataView(await e.slice(t,n).arrayBuffer()),b=()=>/* @__PURE__ */ Error(`The file is not an Excel workbook (.xlsx): it is no ZIP archive`),x=e=>{for(let t=e.byteLength-22;t>=0;t--)if(e.getUint32(t,!0)===101010256)return t;return-1},S=async e=>{let t=Math.max(0,e.size-65557),n=await y(e,t,e.size),r=x(n);if(r<0)throw b();let i=n.getUint16(r+10,!0),a=n.getUint32(r+12,!0),o=n.getUint32(r+16,!0);if(i===65535||a===4294967295||o===4294967295)throw Error(`The workbook is too large to read: it is a ZIP64 archive`);let s=await y(e,o,o+a),c=new TextDecoder,l=/* @__PURE__ */ new Map,u=0;for(let e=0;e<i;e++){if(s.getUint32(u,!0)!==33639248)throw b();let e=s.getUint16(u+28,!0),t=s.getUint16(u+30,!0),n=s.getUint16(u+32,!0),r=c.decode(new Uint8Array(s.buffer,s.byteOffset+u+46,e));l.set(r,{name:r,method:s.getUint16(u+10,!0),size:s.getUint32(u+20,!0),offset:s.getUint32(u+42,!0)}),u+=46+e+t+n}return l},C=async(e,t)=>{let n=await y(e,t.offset,t.offset+30);if(n.getUint32(0,!0)!==67324752)throw b();let r=t.offset+30+n.getUint16(26,!0)+n.getUint16(28,!0),i=e.slice(r,r+t.size).stream();if(t.method===0)return i;if(t.method===8)return i.pipeThrough(new DecompressionStream(`deflate-raw`));throw Error(`The workbook's part ${t.name} is compressed in a way that cannot be read (method ${t.method})`)};async function*w(e,t){let n=(await C(e,t)).pipeThrough(new TextDecoderStream).getReader();try{for(;;){let{done:e,value:t}=await n.read();if(e)return;yield t}}finally{await n.cancel()}}let T=async(e,t)=>{let n=[];for await(let r of w(e,t))n.push(r);return n.join(``)},E=(e,t)=>{let n=e.get(t);if(!n)throw Error(`The file is not an Excel workbook (.xlsx): it has no ${t}`);return n},D=async e=>{let t=await S(e),{sheets:n,date1904:r}=l(await T(e,E(t,`xl/workbook.xml`)),await T(e,E(t,`xl/_rels/workbook.xml.rels`))),i,a=async()=>(i={strings:t.has(`xl/sharedStrings.xml`)?c(await T(e,t.get(`xl/sharedStrings.xml`))):[],dates:t.has(`xl/styles.xml`)?f(await T(e,t.get(`xl/styles.xml`))):/* @__PURE__ */ new Set,date1904:r},i);async function*o(r){let o=n.find(e=>e.name===r);if(!o)throw Error(`The workbook has no sheet called ${r}`);let s=i??await a(),c=v(),l=0;for await(let n of w(e,E(t,o.path)))for(let e of c(n)){let t=_(e,s,l);l=t.line,yield t}}return{sheets:n.map(e=>e.name),rows:o}},O=async e=>{let t=new Uint8Array(await e.slice(0,2).arrayBuffer());return t[0]===80&&t[1]===75},k=async e=>{let t=/\.([^.]+)$/.exec(e.name)?.[1]?.toLowerCase();return t===`xlsx`?`xlsx`:t===`csv`||t===`tsv`||t===`txt`?`csv`:await O(e)?`xlsx`:`csv`},A=async e=>await k(e)===`xlsx`?(await D(e)).sheets:[],j=()=>/* @__PURE__ */ Error(`The file is not UTF-8 text. Save it as "CSV UTF-8" and choose it again.`);async function*M(e){let t=r(),n=new TextDecoder(`utf-8`,{fatal:!0}),i=e=>{try{return e?n.decode(e,{stream:!0}):n.decode()}catch(e){throw e instanceof TypeError?j():e}},a=e.stream().getReader(),o=0,s=e=>e.map(e=>({line:++o,cells:e}));try{for(;;){let{done:e,value:n}=await a.read();if(e)break;yield*s(t.push(i(n)))}yield*s([...t.push(i()),...t.end()])}finally{await a.cancel()}}async function*N(e,t){if(await k(e)===`csv`)return yield*M(e);let n=await D(e),r=t??n.sheets[0];if(r===void 0)throw Error(`The workbook has no sheets`);yield*n.rows(r)}let P=self,F=e=>P.postMessage(e),I,L=async e=>{let t=[];for await(let n of N(e.file,e.sheet)){if(t.push(n),t.length<e.chunk)continue;let r=new Promise(e=>I=e);F({type:`rows`,rows:t}),t=[],await r}F({type:`rows`,rows:t}),F({type:`end`})},R=async e=>{if(e.type===`next`)return I?.();if(e.type===`sheets`)return F({type:`sheets`,sheets:await A(e.file)});await L(e)};P.onmessage=e=>{R(e.data).catch(e=>F({type:`error`,message:e instanceof Error?e.message:String(e)}))}})();
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t,c as n,n as r,o as i,s as a,t as o}from"./maplibre-D6zfLfTV.js";import{t as s}from"./jsx-runtime-NZYk81nU.js";var c=e(s(),1),l=({style:e,layers:s,position:l,zoom:u})=>(0,c.jsxs)(a,{mapLib:o,mapStyle:e,initialViewState:{...l,zoom:u},cooperativeGestures:!0,style:{width:`100%`,height:`100%`},children:[(0,c.jsx)(t,{showCompass:!1}),(0,c.jsx)(r,{layers:s}),(0,c.jsx)(i,{latitude:l.latitude,longitude:l.longitude,anchor:`bottom`,children:(0,c.jsx)(n,{"aria-hidden":!0,className:`size-8 fill-primary text-primary-foreground drop-shadow`,strokeWidth:1.5})})]});export{l as RecordMap};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t,c as n,n as r,o as i,s as a,t as o}from"./maplibre-BOsAtlAo.js";import{t as s}from"./jsx-runtime-NZYk81nU.js";var c=e(s(),1),l=({style:e,layers:s,position:l,zoom:u})=>(0,c.jsxs)(a,{mapLib:o,mapStyle:e,initialViewState:{...l,zoom:u},cooperativeGestures:!0,style:{width:`100%`,height:`100%`},children:[(0,c.jsx)(t,{showCompass:!1}),(0,c.jsx)(r,{layers:s}),(0,c.jsx)(i,{latitude:l.latitude,longitude:l.longitude,anchor:`bottom`,children:(0,c.jsx)(n,{"aria-hidden":!0,className:`size-8 fill-primary text-primary-foreground drop-shadow`,strokeWidth:1.5})})]});export{l as RecordMap};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./react-Cvdyeg_0.js";import{d as n,rt as r}from"./app-BYFiTXK6.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./maplibre-D6zfLfTV.js";import{t as f}from"./jsx-runtime-NZYk81nU.js";var p=e(t(),1),m=512,h=85.051129,g=16,_=Array.from({length:23},(e,t)=>t),v=e=>e.type===`LineString`?e.coordinates:e.type===`MultiPolygon`?e.coordinates.flat(2):e.coordinates.flat(),y=e=>{let t=Math.max(-85.051129,Math.min(h,e))*Math.PI/180;return .5-Math.log(Math.tan(Math.PI/4+t/2))/(2*Math.PI)},b=e=>{let t=v(e),n=t.map(([e])=>e),r=t.map(([,e])=>y(e)),i=(Math.max(...n)-Math.min(...n))/360*m,a=(Math.max(...r)-Math.min(...r))*m;return Math.max(i,a)},x=(e,t)=>{let n=e.flatMap(e=>{if(!e.area)return[];let n=e.area.type===`LineString`||e.area.type===`MultiLineString`?`line`:`polygon`;return[{type:`Feature`,geometry:e.area,properties:{key:e.key,kind:n,span:b(e.area),chosen:t?.includes(e.key)??!1}}]});return{type:`FeatureCollection`,features:[...n.filter(e=>!e.properties.chosen),...n.filter(e=>e.properties.chosen)]}},S=e=>[`interpolate`,[`linear`],[`zoom`],..._.flatMap(t=>[t,[`*`,e,[`min`,1,[`max`,0,[`/`,[`-`,[`*`,[`get`,`span`],2**t],g],32]]]]])],C=e(f(),1),w=`position-area-fills`,T=[`==`,[`get`,`kind`],`polygon`],E=[`==`,[`get`,`kind`],`line`],D=(e,t)=>[`case`,[`get`,`chosen`],e,t],O=({points:e,selected:t,colors:n})=>{let r=x(e,t);if(r.features.length===0)return null;let i=[`case`,[`get`,`chosen`],n.chosen,n.area];return(0,C.jsxs)(o,{id:`position-areas`,type:`geojson`,data:r,children:[(0,C.jsx)(l,{id:w,type:`fill`,filter:T,paint:{"fill-color":i,"fill-opacity":S(D(.15,.1))}}),(0,C.jsx)(l,{id:`position-area-outlines`,type:`line`,filter:T,paint:{"line-color":i,"line-width":1.5,"line-dasharray":[3,2],"line-opacity":S(.8)}}),(0,C.jsx)(l,{id:`position-area-lines`,type:`line`,filter:E,layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-color":i,"line-width":6,"line-opacity":S(D(.6,.35))}})]})},k=(e,t)=>{let n=document.createElement(`span`);n.style.color=`var(${t})`,e.append(n);let r=getComputedStyle(n).color;n.remove();let i=document.createElement(`canvas`);i.width=1,i.height=1;let a=i.getContext(`2d`,{willReadFrequently:!0});if(!a)return r;a.fillStyle=r,a.fillRect(0,0,1,1);let[o,s,c,l]=a.getImageData(0,0,1,1).data;return`rgba(${o}, ${s}, ${c}, ${l/255})`},A=28,j={padding:48,maxZoom:15,duration:0},M={padding:48,maxZoom:16,duration:300},N=32,P=new Intl.NumberFormat(`en-IE`,{notation:`compact`,maximumFractionDigits:1}),F=e=>[[e.west,e.south],[e.east,e.north]],I=({style:e,layers:t,initial:o,points:l,buckets:f,fit:m,onFitted:h,onMove:g,selected:_,covered:v,onSelect:y,onClear:b,markerLabel:x,bucketLabel:S})=>{let T=(0,p.useRef)(null),[E,D]=(0,p.useState)([]),[I,L]=(0,p.useState)(),R=new globalThis.Map(l.map(e=>[e.key,e])),z=l.map(e=>e.key).join(`,`),B=m&&JSON.stringify(m),V=()=>{let e=T.current?.getMap();e&&D(n(l.map(t=>({key:t.key,...e.project([t.longitude,t.latitude])})),A))},H=()=>{let e=T.current?.getMap();if(!e)return;let t=e.getBounds(),n=e.getCenter();g({bounds:{south:t.getSouth(),west:t.getWest(),north:t.getNorth(),east:t.getEast()},zoom:e.getZoom()},{latitude:n.lat,longitude:n.lng,zoom:e.getZoom()})},U=()=>{let e=T.current?.getMap();e&&m&&(e.fitBounds(F(m),j),h(),H())};(0,p.useEffect)(V,[z]),(0,p.useEffect)(U,[B]);let W=E.find(e=>_!==void 0&&e.keys.some(e=>_.includes(e)))?.at;return(0,p.useEffect)(()=>{let e=T.current?.getMap(),t=W===void 0?void 0:R.get(W);if(!e||!t||v===0)return;let{y:n}=e.project([t.longitude,t.latitude]),r=e.getContainer().clientHeight-v;n>N&&n<r||e.easeTo({center:[t.longitude,t.latitude],offset:[0,(N-v)/2],duration:300})},[W,v]),(0,C.jsxs)(u,{ref:T,mapLib:d,mapStyle:e,initialViewState:o??{latitude:0,longitude:0,zoom:1},style:{width:`100%`,height:`100%`},onLoad:()=>{let e=T.current.getMap().getContainer();L({area:k(e,`--primary`),chosen:k(e,`--foreground`)}),V(),m?U():H()},onZoomEnd:V,onMoveEnd:H,onClick:b,children:[(0,C.jsx)(i,{showCompass:!1}),(0,C.jsx)(s,{layers:t,below:w}),I&&(0,C.jsx)(O,{points:l,selected:_,colors:I}),f.map(e=>(0,C.jsx)(c,{latitude:e.latitude,longitude:e.longitude,anchor:`center`,children:(0,C.jsx)(`button`,{type:`button`,"aria-label":S(e.count),className:`flex size-10 cursor-pointer items-center justify-center rounded-full border-2 border-background bg-primary text-xs font-semibold text-primary-foreground tabular-nums shadow`,onClick:t=>{t.stopPropagation(),T.current?.getMap().fitBounds(F(e.bounds),M)},children:P.format(e.count)})},`${e.latitude},${e.longitude}`)),E.map(e=>{let t=R.get(e.at);if(!t)return null;let n=_!==void 0&&e.keys.some(e=>_.includes(e)),i=e.keys.every(e=>R.get(e)?.approximate);return(0,C.jsx)(c,{latitude:t.latitude,longitude:t.longitude,anchor:`bottom`,style:{zIndex:+!!n},children:(0,C.jsxs)(`button`,{type:`button`,"aria-label":x(e.keys),"aria-pressed":n,className:`relative block cursor-pointer`,onClick:t=>{t.stopPropagation(),y(e.keys)},children:[(0,C.jsx)(a,{"aria-hidden":!0,"data-approximate":i||void 0,className:r(`size-8 drop-shadow`,i?n?`fill-background text-foreground`:`fill-background text-primary`:n?`fill-foreground text-background`:`fill-primary text-primary-foreground`),strokeWidth:i?2:1.5,strokeDasharray:i?`3 2`:void 0}),e.keys.length>1&&(0,C.jsx)(`span`,{className:`absolute -right-2 -top-1 min-w-5 rounded-full border border-background bg-foreground px-1 text-center text-[11px] font-medium leading-4 text-background tabular-nums`,children:e.keys.length})]})},e.at)})]})};export{I as RecordsMap};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./react-Cvdyeg_0.js";import{d as n,rt as r}from"./app-CZ4drn7G.js";import{a as i,c as a,i as o,n as s,o as c,r as l,s as u,t as d}from"./maplibre-BOsAtlAo.js";import{t as f}from"./jsx-runtime-NZYk81nU.js";var p=e(t(),1),m=512,h=85.051129,g=16,_=Array.from({length:23},(e,t)=>t),v=e=>e.type===`LineString`?e.coordinates:e.type===`MultiPolygon`?e.coordinates.flat(2):e.coordinates.flat(),y=e=>{let t=Math.max(-85.051129,Math.min(h,e))*Math.PI/180;return .5-Math.log(Math.tan(Math.PI/4+t/2))/(2*Math.PI)},b=e=>{let t=v(e),n=t.map(([e])=>e),r=t.map(([,e])=>y(e)),i=(Math.max(...n)-Math.min(...n))/360*m,a=(Math.max(...r)-Math.min(...r))*m;return Math.max(i,a)},x=(e,t)=>{let n=e.flatMap(e=>{if(!e.area)return[];let n=e.area.type===`LineString`||e.area.type===`MultiLineString`?`line`:`polygon`;return[{type:`Feature`,geometry:e.area,properties:{key:e.key,kind:n,span:b(e.area),chosen:t?.includes(e.key)??!1}}]});return{type:`FeatureCollection`,features:[...n.filter(e=>!e.properties.chosen),...n.filter(e=>e.properties.chosen)]}},S=e=>[`interpolate`,[`linear`],[`zoom`],..._.flatMap(t=>[t,[`*`,e,[`min`,1,[`max`,0,[`/`,[`-`,[`*`,[`get`,`span`],2**t],g],32]]]]])],C=e(f(),1),w=`position-area-fills`,T=[`==`,[`get`,`kind`],`polygon`],E=[`==`,[`get`,`kind`],`line`],D=(e,t)=>[`case`,[`get`,`chosen`],e,t],O=({points:e,selected:t,colors:n})=>{let r=x(e,t);if(r.features.length===0)return null;let i=[`case`,[`get`,`chosen`],n.chosen,n.area];return(0,C.jsxs)(o,{id:`position-areas`,type:`geojson`,data:r,children:[(0,C.jsx)(l,{id:w,type:`fill`,filter:T,paint:{"fill-color":i,"fill-opacity":S(D(.15,.1))}}),(0,C.jsx)(l,{id:`position-area-outlines`,type:`line`,filter:T,paint:{"line-color":i,"line-width":1.5,"line-dasharray":[3,2],"line-opacity":S(.8)}}),(0,C.jsx)(l,{id:`position-area-lines`,type:`line`,filter:E,layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-color":i,"line-width":6,"line-opacity":S(D(.6,.35))}})]})},k=(e,t)=>{let n=document.createElement(`span`);n.style.color=`var(${t})`,e.append(n);let r=getComputedStyle(n).color;n.remove();let i=document.createElement(`canvas`);i.width=1,i.height=1;let a=i.getContext(`2d`,{willReadFrequently:!0});if(!a)return r;a.fillStyle=r,a.fillRect(0,0,1,1);let[o,s,c,l]=a.getImageData(0,0,1,1).data;return`rgba(${o}, ${s}, ${c}, ${l/255})`},A=28,j={padding:48,maxZoom:15,duration:0},M={padding:48,maxZoom:16,duration:300},N=32,P=new Intl.NumberFormat(`en-IE`,{notation:`compact`,maximumFractionDigits:1}),F=e=>[[e.west,e.south],[e.east,e.north]],I=({style:e,layers:t,initial:o,points:l,buckets:f,fit:m,onFitted:h,onMove:g,selected:_,covered:v,onSelect:y,onClear:b,markerLabel:x,bucketLabel:S})=>{let T=(0,p.useRef)(null),[E,D]=(0,p.useState)([]),[I,L]=(0,p.useState)(),R=new globalThis.Map(l.map(e=>[e.key,e])),z=l.map(e=>e.key).join(`,`),B=m&&JSON.stringify(m),V=()=>{let e=T.current?.getMap();e&&D(n(l.map(t=>({key:t.key,...e.project([t.longitude,t.latitude])})),A))},H=()=>{let e=T.current?.getMap();if(!e)return;let t=e.getBounds(),n=e.getCenter();g({bounds:{south:t.getSouth(),west:t.getWest(),north:t.getNorth(),east:t.getEast()},zoom:e.getZoom()},{latitude:n.lat,longitude:n.lng,zoom:e.getZoom()})},U=()=>{let e=T.current?.getMap();e&&m&&(e.fitBounds(F(m),j),h(),H())};(0,p.useEffect)(V,[z]),(0,p.useEffect)(U,[B]);let W=E.find(e=>_!==void 0&&e.keys.some(e=>_.includes(e)))?.at;return(0,p.useEffect)(()=>{let e=T.current?.getMap(),t=W===void 0?void 0:R.get(W);if(!e||!t||v===0)return;let{y:n}=e.project([t.longitude,t.latitude]),r=e.getContainer().clientHeight-v;n>N&&n<r||e.easeTo({center:[t.longitude,t.latitude],offset:[0,(N-v)/2],duration:300})},[W,v]),(0,C.jsxs)(u,{ref:T,mapLib:d,mapStyle:e,initialViewState:o??{latitude:0,longitude:0,zoom:1},style:{width:`100%`,height:`100%`},onLoad:()=>{let e=T.current.getMap().getContainer();L({area:k(e,`--primary`),chosen:k(e,`--foreground`)}),V(),m?U():H()},onZoomEnd:V,onMoveEnd:H,onClick:b,children:[(0,C.jsx)(i,{showCompass:!1}),(0,C.jsx)(s,{layers:t,below:w}),I&&(0,C.jsx)(O,{points:l,selected:_,colors:I}),f.map(e=>(0,C.jsx)(c,{latitude:e.latitude,longitude:e.longitude,anchor:`center`,children:(0,C.jsx)(`button`,{type:`button`,"aria-label":S(e.count),className:`flex size-10 cursor-pointer items-center justify-center rounded-full border-2 border-background bg-primary text-xs font-semibold text-primary-foreground tabular-nums shadow`,onClick:t=>{t.stopPropagation(),T.current?.getMap().fitBounds(F(e.bounds),M)},children:P.format(e.count)})},`${e.latitude},${e.longitude}`)),E.map(e=>{let t=R.get(e.at);if(!t)return null;let n=_!==void 0&&e.keys.some(e=>_.includes(e)),i=e.keys.every(e=>R.get(e)?.approximate);return(0,C.jsx)(c,{latitude:t.latitude,longitude:t.longitude,anchor:`bottom`,style:{zIndex:+!!n},children:(0,C.jsxs)(`button`,{type:`button`,"aria-label":x(e.keys),"aria-pressed":n,className:`relative block cursor-pointer`,onClick:t=>{t.stopPropagation(),y(e.keys)},children:[(0,C.jsx)(a,{"aria-hidden":!0,"data-approximate":i||void 0,className:r(`size-8 drop-shadow`,i?n?`fill-background text-foreground`:`fill-background text-primary`:n?`fill-foreground text-background`:`fill-primary text-primary-foreground`),strokeWidth:i?2:1.5,strokeDasharray:i?`3 2`:void 0}),e.keys.length>1&&(0,C.jsx)(`span`,{className:`absolute -right-2 -top-1 min-w-5 rounded-full border border-background bg-foreground px-1 text-center text-[11px] font-medium leading-4 text-background tabular-nums`,children:e.keys.length})]})},e.at)})]})};export{I as RecordsMap};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,A as n,B as r,C as i,D as a,E as o,F as s,G as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as T,Z as E,_ as D,a as O,b as k,c as ee,f as A,g as j,h as M,i as N,j as P,k as F,l as I,m as L,n as R,nt as z,o as B,p as V,q as H,r as U,s as W,t as G,u as K,v as q,w as J,x as Y,y as X,z as Z}from"./app-BYFiTXK6.js";import{t as Q}from"./jsx-runtime-NZYk81nU.js";var $=e(Q(),1),te=({row:e,resource:t,recordKey:n,...r})=>{let i=K(),a=O(),o=t??i?.resource??a?.model.name;if(o===void 0)throw Error(`RecordLink needs a resource outside a list display or a record`);return(0,$.jsx)(L,{to:{kind:`record`,resource:o,key:e?e.key:n},...r})};export{n as ActionCard,d as ApiProvider,G as App,L as AppLink,X as AssistantDock,c as AuthLayout,w as Button,g as ChatMessage,m as ChatThread,x as CodeForm,h as CompactTable,p as Composer,b as DiffView,F as FieldList,t as Input,z as LogoMark,T as OtpInput,Y as PartView,te as RecordLink,C as ResendCodeButton,V as ResponsiveDialog,P as SidePanel,A as SignInPrompt,_ as Spinner,J as StepList,E as buttonClass,y as definePlugin,i as defineUi,o as diffStats,R as isConflict,r as mergeUi,a as parseDiff,f as pluginApi,v as protobaseVersion,S as uiFromModule,l as useApiToken,M as useAppAddress,q as useAssistant,D as useAssistantClient,k as useBackendData,H as useClient,B as useFacets,W as useHistogram,O as useLayoutRecord,N as useList,I as useListDisplay,j as useMeta,Z as usePlugin,s as useRecord,u as useResourceClient,ee as useSeries,U as useUpdateRecord};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$ as t,A as n,B as r,C as i,D as a,E as o,F as s,G as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as T,Z as E,_ as D,a as O,b as k,c as ee,f as A,g as j,h as M,i as N,j as P,k as F,l as I,m as L,n as R,nt as z,o as B,p as V,q as H,r as U,s as W,t as G,u as K,v as q,w as J,x as Y,y as X,z as Z}from"./app-CZ4drn7G.js";import{t as Q}from"./jsx-runtime-NZYk81nU.js";var $=e(Q(),1),te=({row:e,resource:t,recordKey:n,...r})=>{let i=K(),a=O(),o=t??i?.resource??a?.model.name;if(o===void 0)throw Error(`RecordLink needs a resource outside a list display or a record`);return(0,$.jsx)(L,{to:{kind:`record`,resource:o,key:e?e.key:n},...r})};export{n as ActionCard,d as ApiProvider,G as App,L as AppLink,X as AssistantDock,c as AuthLayout,w as Button,g as ChatMessage,m as ChatThread,x as CodeForm,h as CompactTable,p as Composer,b as DiffView,F as FieldList,t as Input,z as LogoMark,T as OtpInput,Y as PartView,te as RecordLink,C as ResendCodeButton,V as ResponsiveDialog,P as SidePanel,A as SignInPrompt,_ as Spinner,J as StepList,E as buttonClass,y as definePlugin,i as defineUi,o as diffStats,R as isConflict,r as mergeUi,a as parseDiff,f as pluginApi,v as protobaseVersion,S as uiFromModule,l as useApiToken,M as useAppAddress,q as useAssistant,D as useAssistantClient,k as useBackendData,H as useClient,B as useFacets,W as useHistogram,O as useLayoutRecord,N as useList,I as useListDisplay,j as useMeta,Z as usePlugin,s as useRecord,u as useResourceClient,ee as useSeries,U as useUpdateRecord};
@@ -16,15 +16,15 @@
16
16
  }
17
17
  document.documentElement.dataset.theme = stored === 'light' || stored === 'dark' ? stored : matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
18
18
  </script>
19
- <script type="importmap">{"imports":{"react":"/assets/shared-react-DhkZ2M4l.js","react/jsx-runtime":"/assets/shared-react-jsx-runtime-xPQrWk0g.js","react-dom":"/assets/shared-react-dom-D508a1cq.js","@protobase/ui":"/assets/shared-protobase-ui-8pJgwjfc.js"}}</script>
20
- <script type="module" crossorigin src="/assets/index-CEvfMgFJ.js"></script>
19
+ <script type="importmap">{"imports":{"react":"/assets/shared-react-DhkZ2M4l.js","react/jsx-runtime":"/assets/shared-react-jsx-runtime-xPQrWk0g.js","react-dom":"/assets/shared-react-dom-D508a1cq.js","@protobase/ui":"/assets/shared-protobase-ui-B6lrj7eA.js"}}</script>
20
+ <script type="module" crossorigin src="/assets/index-BzCCIfII.js"></script>
21
21
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
22
22
  <link rel="modulepreload" crossorigin href="/assets/react-Cvdyeg_0.js">
23
23
  <link rel="modulepreload" crossorigin href="/assets/react-dom-B-VxWsjA.js">
24
24
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-NZYk81nU.js">
25
- <link rel="modulepreload" crossorigin href="/assets/app-BYFiTXK6.js">
25
+ <link rel="modulepreload" crossorigin href="/assets/app-CZ4drn7G.js">
26
26
  <link rel="stylesheet" crossorigin href="/assets/app-GUjJKojE.css">
27
- <link rel="stylesheet" crossorigin href="/assets/index-CiGP6kle.css">
27
+ <link rel="stylesheet" crossorigin href="/assets/index-BoeKjvo8.css">
28
28
  <link rel="stylesheet" href="/protobase.theme.css">
29
29
  <link rel="icon" type="image/svg+xml" href="/protobase.favicon.svg">
30
30
  </head>
@@ -1,5 +1,5 @@
1
1
  {
2
- "protobase": "0.19.4",
2
+ "protobase": "0.19.5",
3
3
  "pluginApi": 1,
4
4
  "paths": [
5
5
  "/index.html",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/ui",
3
- "version": "0.19.4",
3
+ "version": "0.19.5",
4
4
  "description": "The Protobase admin app and the React hooks and components for custom UI.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -39,9 +39,9 @@
39
39
  "dependencies": {
40
40
  "@dnd-kit/core": "^6.3.1",
41
41
  "@dnd-kit/sortable": "^10.0.0",
42
- "@protobase/client": "0.19.4",
43
- "@protobase/layout": "0.19.4",
44
- "@protobase/schema": "0.19.4",
42
+ "@protobase/client": "0.19.5",
43
+ "@protobase/layout": "0.19.5",
44
+ "@protobase/schema": "0.19.5",
45
45
  "@sentry/browser": "^11.7.0",
46
46
  "@tanstack/react-query": "^5.104.1",
47
47
  "@tanstack/react-table": "^9.2.6",