@protobase/ui 0.19.1 → 0.19.3

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 (49) hide show
  1. package/dist/app/app.js +2 -0
  2. package/dist/app/favicon.svg +1 -0
  3. package/dist/app/gallery/detail-fields.js +12 -0
  4. package/dist/app/gallery/gallery-layout.js +3 -1
  5. package/dist/app/gallery/gallery-section.js +7 -4
  6. package/dist/app/gallery/lightbox.js +38 -44
  7. package/dist/app/gallery/photo-details.js +21 -28
  8. package/dist/app/pages/merge-ui.d.ts +1 -1
  9. package/dist/app/pages/merge-ui.js +5 -3
  10. package/dist/app/pages/project-ui.d.ts +6 -1
  11. package/dist/app/pages/record-actions.js +32 -6
  12. package/dist/app/project-logo.js +17 -0
  13. package/dist/app/record-mode/record-mode.js +12 -7
  14. package/dist/app/record-page.js +27 -38
  15. package/dist/app-shell/app-shell.d.ts +1 -1
  16. package/dist/app-shell/app-shell.js +3 -2
  17. package/dist/app-shell/index.d.ts +1 -0
  18. package/dist/app-shell/logo.d.ts +11 -0
  19. package/dist/app-shell/logo.js +30 -32
  20. package/dist/app-shell/sidebar.d.ts +2 -1
  21. package/dist/app-shell/sidebar.js +3 -3
  22. package/dist/app-shell/wordmark-path.js +4 -0
  23. package/dist/auth/auth-layout.d.ts +10 -0
  24. package/dist/auth/code-form.d.ts +29 -0
  25. package/dist/auth/resend-code-button.d.ts +11 -0
  26. package/dist/format/date.js +2 -15
  27. package/dist/index.d.ts +8 -1
  28. package/dist/index.js +8 -1
  29. package/dist/package.js +1 -1
  30. package/dist/primitives/button.d.ts +11 -0
  31. package/dist/primitives/input.d.ts +11 -0
  32. package/dist/primitives/spinner.d.ts +5 -0
  33. package/dist/record-view/action-rail.js +22 -11
  34. package/dist/record-view/record-header.js +5 -5
  35. package/dist/shell/assets/app-ChEqQ9ca.js +66 -0
  36. package/dist/shell/assets/{index-Bes91xE3.js → index-5frCs7fQ.js} +1 -1
  37. package/dist/shell/assets/index-D-4IHhqX.css +2 -0
  38. package/dist/shell/assets/maplibre-D8plsjP2.js +814 -0
  39. package/dist/shell/assets/{record-map-CY2LFq1z.js → record-map-BDJTOwZo.js} +1 -1
  40. package/dist/shell/assets/records-map-C-XKw6m1.js +1 -0
  41. package/dist/shell/assets/shared-protobase-ui-Ceamz_7l.js +1 -0
  42. package/dist/shell/index.html +5 -4
  43. package/dist/shell/protobase.shell.json +1 -1
  44. package/package.json +6 -5
  45. package/dist/shell/assets/app-DYl-j-Nf.js +0 -66
  46. package/dist/shell/assets/index-BLnOMDD8.css +0 -2
  47. package/dist/shell/assets/maplibre-BDe9GhVw.js +0 -814
  48. package/dist/shell/assets/records-map-B_DHVvmx.js +0 -1
  49. package/dist/shell/assets/shared-protobase-ui-Bb2W4Il8.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./react-Cvdyeg_0.js";import{d as n,q as r}from"./app-DYl-j-Nf.js";import{a as i,i as a,n as o,o as s,r as c,s as l,t as u}from"./maplibre-BDe9GhVw.js";import{t as d}from"./jsx-runtime-NZYk81nU.js";function f(e,t){if(!e)throw Error(t)}var p=e(t(),1),m=0;function h(e,t,n){if(e.style&&e.style._loaded){let r={...n};return delete r.id,delete r.children,e.addSource(t,r),e.getSource(t)}return null}function g(e,t,n){f(t.id===n.id,`source id changed`),f(t.type===n.type,`source type changed`);let r=``,i=0;for(let e in t)e!==`children`&&e!==`id`&&!s(n[e],t[e])&&(r=e,i++);if(!i)return;let a=t.type;if(a===`geojson`)e.setData(t.data);else if(a===`image`)e.updateImage({url:t.url,coordinates:t.coordinates});else switch(r){case`coordinates`:e.setCoordinates?.(t.coordinates);break;case`url`:e.setUrl?.(t.url);break;case`tiles`:e.setTiles?.(t.tiles);break;default:console.warn(`Unable to update <Source> prop: ${r}`)}}function _(e){let t=(0,p.useContext)(i).map.getMap(),n=(0,p.useRef)(e),[,r]=(0,p.useState)(0),a=(0,p.useMemo)(()=>e.id||`jsx-source-${m++}`,[]);(0,p.useEffect)(()=>{if(t){let e=()=>setTimeout(()=>r(e=>e+1),0);return t.on(`styledata`,e),e(),()=>{if(t.off(`styledata`,e),t.style&&t.style._loaded&&t.getSource(a)){let e=t.getStyle()?.layers;if(e)for(let n of e)n.source===a&&t.removeLayer(n.id);t.removeSource(a)}}}},[t]);let o=t&&t.style&&t.getSource(a);return o?g(o,e,n.current):o=h(t,a,e),n.current=e,o&&p.Children.map(e.children,e=>e&&(0,p.cloneElement)(e,{source:a}))||null}function v(e,t,n,r){if(f(n.id===r.id,`layer id changed`),f(n.type===r.type,`layer type changed`),n.type===`custom`||r.type===`custom`)return;let{layout:i={},paint:a={},filter:o,minzoom:c,maxzoom:l,beforeId:u}=n;if(u!==r.beforeId&&e.moveLayer(t,u),i!==r.layout){let n=r.layout||{};for(let r in i)s(i[r],n[r])||e.setLayoutProperty(t,r,i[r]);for(let r in n)i.hasOwnProperty(r)||e.setLayoutProperty(t,r,void 0)}if(a!==r.paint){let n=r.paint||{};for(let r in a)s(a[r],n[r])||e.setPaintProperty(t,r,a[r]);for(let r in n)a.hasOwnProperty(r)||e.setPaintProperty(t,r,void 0)}s(o,r.filter)||e.setFilter(t,o),(c!==r.minzoom||l!==r.maxzoom)&&e.setLayerZoomRange(t,c,l)}function y(e,t,n){if(e.style&&e.style._loaded&&(!(`source`in n)||e.getSource(n.source))){let r={...n,id:t};delete r.beforeId,e.addLayer(r,n.beforeId)}}var b=0;function x(e){let t=(0,p.useContext)(i).map.getMap(),n=(0,p.useRef)(e),[,r]=(0,p.useState)(0),a=(0,p.useMemo)(()=>e.id||`jsx-layer-${b++}`,[]);if((0,p.useEffect)(()=>{if(t){let e=()=>r(e=>e+1);return t.on(`styledata`,e),e(),()=>{t.off(`styledata`,e),t.style&&t.style._loaded&&t.getLayer(a)&&t.removeLayer(a)}}},[t]),t&&t.style&&t.getLayer(a))try{v(t,a,e,n.current)}catch(e){console.warn(e)}else y(t,a,e);return n.current=e,null}var S=512,C=85.051129,w=16,T=Array.from({length:23},(e,t)=>t),E=e=>e.type===`LineString`?e.coordinates:e.type===`MultiPolygon`?e.coordinates.flat(2):e.coordinates.flat(),D=e=>{let t=Math.max(-85.051129,Math.min(C,e))*Math.PI/180;return .5-Math.log(Math.tan(Math.PI/4+t/2))/(2*Math.PI)},O=e=>{let t=E(e),n=t.map(([e])=>e),r=t.map(([,e])=>D(e)),i=(Math.max(...n)-Math.min(...n))/360*S,a=(Math.max(...r)-Math.min(...r))*S;return Math.max(i,a)},k=(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:O(e.area),chosen:t?.includes(e.key)??!1}}]});return{type:`FeatureCollection`,features:[...n.filter(e=>!e.properties.chosen),...n.filter(e=>e.properties.chosen)]}},A=e=>[`interpolate`,[`linear`],[`zoom`],...T.flatMap(t=>[t,[`*`,e,[`min`,1,[`max`,0,[`/`,[`-`,[`*`,[`get`,`span`],2**t],w],32]]]]])],j=e(d(),1),M=[`==`,[`get`,`kind`],`polygon`],N=[`==`,[`get`,`kind`],`line`],P=(e,t)=>[`case`,[`get`,`chosen`],e,t],F=({points:e,selected:t,colors:n})=>{let r=k(e,t);if(r.features.length===0)return null;let i=[`case`,[`get`,`chosen`],n.chosen,n.area];return(0,j.jsxs)(_,{id:`position-areas`,type:`geojson`,data:r,children:[(0,j.jsx)(x,{id:`position-area-fills`,type:`fill`,filter:M,paint:{"fill-color":i,"fill-opacity":A(P(.15,.1))}}),(0,j.jsx)(x,{id:`position-area-outlines`,type:`line`,filter:M,paint:{"line-color":i,"line-width":1.5,"line-dasharray":[3,2],"line-opacity":A(.8)}}),(0,j.jsx)(x,{id:`position-area-lines`,type:`line`,filter:N,layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-color":i,"line-width":6,"line-opacity":A(P(.6,.35))}})]})},I=(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})`},L=28,R={padding:48,maxZoom:15,duration:0},z={padding:48,maxZoom:16,duration:300},B=32,V=new Intl.NumberFormat(`en-IE`,{notation:`compact`,maximumFractionDigits:1}),H=e=>[[e.west,e.south],[e.east,e.north]],U=({style:e,initial:t,points:i,buckets:s,fit:d,onFitted:f,onMove:m,selected:h,covered:g,onSelect:_,onClear:v,markerLabel:y,bucketLabel:b})=>{let x=(0,p.useRef)(null),[S,C]=(0,p.useState)([]),[w,T]=(0,p.useState)(),E=new globalThis.Map(i.map(e=>[e.key,e])),D=i.map(e=>e.key).join(`,`),O=d&&JSON.stringify(d),k=()=>{let e=x.current?.getMap();e&&C(n(i.map(t=>({key:t.key,...e.project([t.longitude,t.latitude])})),L))},A=()=>{let e=x.current?.getMap();if(!e)return;let t=e.getBounds(),n=e.getCenter();m({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()})},M=()=>{let e=x.current?.getMap();e&&d&&(e.fitBounds(H(d),R),f(),A())};(0,p.useEffect)(k,[D]),(0,p.useEffect)(M,[O]);let N=S.find(e=>h!==void 0&&e.keys.some(e=>h.includes(e)))?.at;return(0,p.useEffect)(()=>{let e=x.current?.getMap(),t=N===void 0?void 0:E.get(N);if(!e||!t||g===0)return;let{y:n}=e.project([t.longitude,t.latitude]),r=e.getContainer().clientHeight-g;n>B&&n<r||e.easeTo({center:[t.longitude,t.latitude],offset:[0,(B-g)/2],duration:300})},[N,g]),(0,j.jsxs)(a,{ref:x,mapLib:u,mapStyle:e,initialViewState:t??{latitude:0,longitude:0,zoom:1},style:{width:`100%`,height:`100%`},onLoad:()=>{let e=x.current.getMap().getContainer();T({area:I(e,`--primary`),chosen:I(e,`--foreground`)}),k(),d?M():A()},onZoomEnd:k,onMoveEnd:A,onClick:v,children:[(0,j.jsx)(o,{showCompass:!1}),w&&(0,j.jsx)(F,{points:i,selected:h,colors:w}),s.map(e=>(0,j.jsx)(c,{latitude:e.latitude,longitude:e.longitude,anchor:`center`,children:(0,j.jsx)(`button`,{type:`button`,"aria-label":b(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(),x.current?.getMap().fitBounds(H(e.bounds),z)},children:V.format(e.count)})},`${e.latitude},${e.longitude}`)),S.map(e=>{let t=E.get(e.at);if(!t)return null;let n=h!==void 0&&e.keys.some(e=>h.includes(e)),i=e.keys.every(e=>E.get(e)?.approximate);return(0,j.jsx)(c,{latitude:t.latitude,longitude:t.longitude,anchor:`bottom`,style:{zIndex:+!!n},children:(0,j.jsxs)(`button`,{type:`button`,"aria-label":y(e.keys),"aria-pressed":n,className:`relative block cursor-pointer`,onClick:t=>{t.stopPropagation(),_(e.keys)},children:[(0,j.jsx)(l,{"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,j.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{U as RecordsMap};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{A as t,B as n,C as r,D as i,E as a,F as o,G as s,I as c,K as l,L as u,M as d,N as f,O as p,P as m,R as h,S as g,T as _,U as v,V as y,W as b,_ as x,a as S,b as C,c as w,f as T,g as E,h as D,i as O,j as k,k as A,l as j,m as M,n as N,o as P,p as F,r as I,s as L,t as R,u as z,v as B,w as V,x as H,y as U,z as W}from"./app-DYl-j-Nf.js";import{t as G}from"./jsx-runtime-NZYk81nU.js";var K=e(G(),1),q=({row:e,resource:t,recordKey:n,...r})=>{let i=z(),a=S(),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,K.jsx)(M,{to:{kind:`record`,resource:o,key:e?e.key:n},...r})};export{t as ActionCard,v as ApiProvider,R as App,M as AppLink,U as AssistantDock,m as ChatMessage,f as ChatThread,p as CompactTable,d as Composer,_ as DiffView,A as FieldList,l as OtpInput,H as PartView,q as RecordLink,F as ResponsiveDialog,k as SidePanel,T as SignInPrompt,V as StepList,g as definePlugin,r as defineUi,a as diffStats,N as isConflict,n as mergeUi,i as parseDiff,u as pluginApi,h as protobaseVersion,y as uiFromModule,c as useApiToken,D as useAppAddress,B as useAssistant,x as useAssistantClient,C as useBackendData,b as useClient,P as useFacets,L as useHistogram,S as useLayoutRecord,O as useList,j as useListDisplay,E as useMeta,W as usePlugin,o as useRecord,s as useResourceClient,w as useSeries,I as useUpdateRecord};