@protobase/ui 0.39.2 → 0.40.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.
- package/dist/connect/interaction-guard.d.ts +19 -0
- package/dist/connect/interaction-guard.js +3 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/package.js +1 -1
- package/dist/shell/assets/{app-BpnXvowC.js → app-N-0Q_AWp.js} +7 -7
- package/dist/shell/assets/{index-CT-GRDNo.js → index-BZYl8P78.js} +2 -2
- package/dist/shell/assets/{records-map-B-gRc65u.js → records-map-B7o1bLCm.js} +2 -2
- package/dist/shell/assets/shared-protobase-ui-BDsvC1q_.js +2 -0
- package/dist/shell/index.html +3 -3
- package/dist/shell/protobase.shell.json +1 -1
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/app-N-0Q_AWp.js.map +1 -0
- package/dist/shell-source-maps/assets/{index-CT-GRDNo.js.map → index-BZYl8P78.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-B-gRc65u.js.map → records-map-B7o1bLCm.js.map} +1 -1
- package/dist/shell-source-maps/assets/shared-protobase-ui-BDsvC1q_.js.map +1 -0
- package/package.json +4 -4
- package/dist/shell/assets/shared-protobase-ui-DqkWGoXi.js +0 -2
- package/dist/shell-source-maps/assets/app-BpnXvowC.js.map +0 -1
- package/dist/shell-source-maps/assets/shared-protobase-ui-DqkWGoXi.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{i as n,n as r,t as i}from"./react-CR5VJ85Q.js";import{J as a,t as o}from"./app-
|
|
2
|
-
//# debugId=
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{i as n,n as r,t as i}from"./react-CR5VJ85Q.js";import{J as a,t as o}from"./app-N-0Q_AWp.js";import{c as s}from"./preload-helper-C24C2MCK.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var c=t(n(),1),l=r(),u=e({default:()=>d}),d={},f=`protobase-api-origin`,p=e=>{if(e.length===0)return;if(e.length>1)throw Error(`The page has ${e.length} ${f} meta tags; it may have one`);let t=e[0],n=URL.canParse(t)?new URL(t):void 0;if(!n||n.protocol!==`http:`&&n.protocol!==`https:`||n.origin!==t)throw Error(`The page's ${f} meta tag holds "${t}", which is not an http or https origin such as https://shop.example.com`);return t},m=()=>p([...document.querySelectorAll(`meta[name="${f}"]`)].map(e=>e.content)),h=t(i(),1),g=document.getElementById(`root`);if(!g)throw Error(`index.html needs an element with id "root"`);(0,l.createRoot)(g).render((0,h.jsx)(c.StrictMode,{children:(0,h.jsx)(o,{baseUrl:`${m()??``}/api/v1`,ui:a(u),locale:s()})}));
|
|
2
|
+
//# debugId=59625f0f-efca-40a4-a462-7d0e65fbf318
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-CR5VJ85Q.js";import{
|
|
2
|
-
//# debugId=
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-CR5VJ85Q.js";import{mt as r,o as i}from"./app-N-0Q_AWp.js";import{a,c as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./maplibre-BlwO7zTh.js";import{t as p}from"./cn-Bi0ZEjD9.js";var m=e(t(),1),h=512,g=85.051129,_=16,v=Array.from({length:23},(e,t)=>t),y=e=>e.type===`LineString`?e.coordinates:e.type===`MultiPolygon`?e.coordinates.flat(2):e.coordinates.flat(),b=e=>{let t=Math.max(-85.051129,Math.min(g,e))*Math.PI/180;return .5-Math.log(Math.tan(Math.PI/4+t/2))/(2*Math.PI)},x=e=>{let t=y(e),n=t.map(([e])=>e),r=t.map(([,e])=>b(e)),i=(Math.max(...n)-Math.min(...n))/360*h,a=(Math.max(...r)-Math.min(...r))*h;return Math.max(i,a)},S=(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:x(e.area),chosen:t?.includes(e.key)??!1}}]});return{type:`FeatureCollection`,features:[...n.filter(e=>!e.properties.chosen),...n.filter(e=>e.properties.chosen)]}},C=e=>[`interpolate`,[`linear`],[`zoom`],...v.flatMap(t=>[t,[`*`,e,[`min`,1,[`max`,0,[`/`,[`-`,[`*`,[`get`,`span`],2**t],_],32]]]]])],w=e(n(),1),T=`position-area-fills`,E=[`==`,[`get`,`kind`],`polygon`],D=[`==`,[`get`,`kind`],`line`],O=(e,t)=>[`case`,[`get`,`chosen`],e,t],k=({points:e,selected:t,colors:n})=>{let r=S(e,t);if(r.features.length===0)return null;let i=[`case`,[`get`,`chosen`],n.chosen,n.area];return(0,w.jsxs)(s,{id:`position-areas`,type:`geojson`,data:r,children:[(0,w.jsx)(u,{id:T,type:`fill`,filter:E,paint:{"fill-color":i,"fill-opacity":C(O(.15,.1))}}),(0,w.jsx)(u,{id:`position-area-outlines`,type:`line`,filter:E,paint:{"line-color":i,"line-width":1.5,"line-dasharray":[3,2],"line-opacity":C(.8)}}),(0,w.jsx)(u,{id:`position-area-lines`,type:`line`,filter:D,layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-color":i,"line-width":6,"line-opacity":C(O(.6,.35))}})]})},A=(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})`},j=28,M={padding:48,maxZoom:15,duration:0},N={padding:48,maxZoom:16,duration:300},P=32,F=()=>r(`compact`,e=>new Intl.NumberFormat(e,{notation:`compact`,maximumFractionDigits:1})),I=e=>[[e.west,e.south],[e.east,e.north]],L=({style:e,layers:t,initial:n,points:r,buckets:s,fit:u,onFitted:h,onMove:g,selected:_,covered:v,onSelect:y,onClear:b,markerLabel:x,bucketLabel:S})=>{let C=(0,m.useRef)(null),[E,D]=(0,m.useState)([]),[O,L]=(0,m.useState)(),R=new globalThis.Map(r.map(e=>[e.key,e])),z=r.map(e=>e.key).join(`,`),B=u&&JSON.stringify(u),V=()=>{let e=C.current?.getMap();e&&D(i(r.map(t=>({key:t.key,...e.project([t.longitude,t.latitude])})),j))},H=()=>{let e=C.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=C.current?.getMap();e&&u&&(e.fitBounds(I(u),M),h(),H())};(0,m.useEffect)(V,[z]),(0,m.useEffect)(U,[B]);let W=E.find(e=>_!==void 0&&e.keys.some(e=>_.includes(e)))?.at;return(0,m.useEffect)(()=>{let e=C.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>P&&n<r||e.easeTo({center:[t.longitude,t.latitude],offset:[0,(P-v)/2],duration:300})},[W,v]),(0,w.jsxs)(d,{ref:C,mapLib:f,mapStyle:e,initialViewState:n??{latitude:0,longitude:0,zoom:1},style:{width:`100%`,height:`100%`},onLoad:()=>{let e=C.current.getMap().getContainer();L({area:A(e,`--primary`),chosen:A(e,`--foreground`)}),V(),u?U():H()},onZoomEnd:V,onMoveEnd:H,onClick:b,children:[(0,w.jsx)(a,{showCompass:!1}),(0,w.jsx)(c,{layers:t,below:T}),O&&(0,w.jsx)(k,{points:r,selected:_,colors:O}),s.map(e=>(0,w.jsx)(l,{latitude:e.latitude,longitude:e.longitude,anchor:`center`,children:(0,w.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(),C.current?.getMap().fitBounds(I(e.bounds),N)},children:F().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)),r=e.keys.every(e=>R.get(e)?.approximate);return(0,w.jsx)(l,{latitude:t.latitude,longitude:t.longitude,anchor:`bottom`,style:{zIndex:+!!n},children:(0,w.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,w.jsx)(o,{"aria-hidden":!0,"data-approximate":r||void 0,className:p(`size-8 drop-shadow`,r?n?`fill-background text-foreground`:`fill-background text-primary`:n?`fill-foreground text-background`:`fill-primary text-primary-foreground`),strokeWidth:r?2:1.5,strokeDasharray:r?`3 2`:void 0}),e.keys.length>1&&(0,w.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{L as RecordsMap};
|
|
2
|
+
//# debugId=7ba356cb-0a6e-424b-b219-caba48d808b0
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-CR5VJ85Q.js";import{B as r,K as i,W as a}from"./vendor-C4-Hop1T.js";import{$ as o,A as s,B as c,C as l,D as u,E as d,F as f,G as p,H as m,I as h,J as ee,K as te,L as ne,M as re,N as ie,O as g,P as _,Q as v,R as y,S as b,T as x,U as S,V as C,W as w,X as T,Y as E,Z as D,_ as O,_t as k,a as A,at as j,b as M,c as N,ct as P,d as F,dt as I,et as L,f as R,ft as z,g as B,gt as V,h as H,ht as U,i as W,it as G,j as K,k as q,l as J,lt as Y,m as X,n as ae,nt as oe,ot as se,p as ce,pt as le,q as ue,r as de,rt as fe,s as pe,st as me,t as he,tt as ge,u as _e,ut as ve,v as ye,vt as be,w as xe,x as Se,y as Z,z as Ce}from"./app-N-0Q_AWp.js";import{r as we}from"./preload-helper-C24C2MCK.js";import{t as Q}from"./cn-Bi0ZEjD9.js";var $=e(n(),1),Te=({row:e,resource:t,recordKey:n,...r})=>{let i=N(),a=X(),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)(y,{to:{kind:`record`,resource:o,key:e?e.key:n},...r})},Ee=({name:e,label:t,options:n,value:r,onChange:i})=>(0,$.jsx)(`div`,{role:`radiogroup`,"aria-label":t,className:`flex flex-col gap-2`,children:n.map(t=>(0,$.jsxs)(`label`,{className:Q(`block rounded-lg border p-3 transition-colors has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-primary`,t.disabled?`cursor-default bg-background opacity-60`:t.value===r?`cursor-pointer border-primary bg-primary-soft`:`cursor-pointer bg-background hover:bg-surface`),children:[(0,$.jsx)(`input`,{type:`radio`,name:e,value:t.value,checked:t.value===r,disabled:t.disabled,onChange:()=>i(t.value),className:`sr-only`}),(0,$.jsx)(`span`,{className:Q(`block font-medium`,t.value===r&&`text-primary-text`),children:t.label}),t.description&&(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs leading-snug text-muted-foreground`,children:t.description})]},t.value))}),De=(e,t,n)=>{let o=j(),s=i(),c=[...new Set(n)].sort();return r({queryKey:me.pickedLabels(e.name,c.join(`,`)),enabled:c.length>0,placeholderData:a,queryFn:()=>_e(s,o,e,c,t)}).data??new Map},Oe=e(t(),1),ke=e=>{let{resources:t,views:n}=oe(),r=t[e.resource];if(!r)throw Error(`RecordPicker: the app has no resource named "${e.resource}"`);if(r.primaryKey.length!==1)throw Error(`RecordPicker: "${e.resource}" has a composite key, which a picker cannot name`);let i=n[e.resource],a=e.multiple?e.value:e.value===void 0?[]:[e.value],[o,s]=(0,Oe.useState)({}),c=De(r,i,a),l=e=>o[e]??c.get(e)??e,u=(e,t)=>s(n=>({...n,[e]:t}));if(!e.multiple){let{value:t,onChange:n}=e;return(0,$.jsx)(f,{target:r,view:i,value:t??``,label:t===void 0?void 0:l(t),invalid:e.invalid,onChange:(e,t)=>{u(e,t),n(e)}})}let{value:d,onChange:p}=e;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(f,{target:r,view:i,value:``,chosen:d,several:!0,invalid:e.invalid,onChange:(e,t)=>{u(e,t),p(d.includes(e)?d.filter(t=>t!==e):[...d,e])}}),d.length>0&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:d.map(e=>(0,$.jsx)(J,{label:l(e),onRemove:()=>p(d.filter(t=>t!==e))},e))})]})};export{u as ActionCard,H as ActionInputError,G as ApiProvider,he as App,y as AppLink,ye as AssistantDock,D as AuthLayout,z as Button,K as ChatMessage,s as ChatThread,Ee as Choices,E as CodeForm,x as CompactTable,q as Composer,I as Dialog,b as DiffView,C as Field,d as FieldList,W as Form,V as Input,be as LogoMark,re as Markdown,A as MenuSelect,ve as OtpInput,M as PartView,Te as RecordLink,ke as RecordPicker,T as ResendCodeButton,Y as ResponsiveDialog,c as Section,we as Segmented,g as SidePanel,P as SignInPrompt,U as Spinner,Se as StepList,ne as Textarea,v as allowDelayMs,le as buttonClass,ie as definePlugin,_ as defineUi,l as diffStats,ae as isConflict,o as isFramed,ue as mergeUi,xe as parseDiff,w as pluginApi,p as protobaseVersion,ee as uiFromModule,S as useApiToken,Ce as useAppAddress,L as useArmedAfterFocus,O as useAssistant,B as useAssistantClient,Z as useBackendData,j as useClient,F as useFacets,k as useFieldControl,ge as useGuardedPress,R as useHistogram,X as useLayoutRecord,h as useList,pe as useListDisplay,fe as useMeta,te as usePlugin,m as useRecord,se as useResourceClient,ce as useSeries,de as useUpdateRecord};
|
|
2
|
+
//# debugId=43b2f0b5-abff-4b9f-9561-b7baa806f20a
|
package/dist/shell/index.html
CHANGED
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
}
|
|
19
19
|
document.documentElement.dataset.theme = stored === 'light' || stored === 'dark' ? stored : matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
|
|
20
20
|
</script>
|
|
21
|
-
<script type="importmap">{"imports":{"react":"/assets/shared-react-CuZpzdyh.js","react/jsx-runtime":"/assets/shared-react-jsx-runtime-Csr2Kx2w.js","react-dom":"/assets/shared-react-dom-BNlY7-7i.js","@protobase/ui":"/assets/shared-protobase-ui-
|
|
22
|
-
<script type="module" crossorigin src="/assets/index-
|
|
21
|
+
<script type="importmap">{"imports":{"react":"/assets/shared-react-CuZpzdyh.js","react/jsx-runtime":"/assets/shared-react-jsx-runtime-Csr2Kx2w.js","react-dom":"/assets/shared-react-dom-BNlY7-7i.js","@protobase/ui":"/assets/shared-protobase-ui-BDsvC1q_.js"}}</script>
|
|
22
|
+
<script type="module" crossorigin src="/assets/index-BZYl8P78.js"></script>
|
|
23
23
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
24
24
|
<link rel="modulepreload" crossorigin href="/assets/react-CR5VJ85Q.js">
|
|
25
25
|
<link rel="modulepreload" crossorigin href="/assets/vendor-C4-Hop1T.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/cn-Bi0ZEjD9.js">
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-C24C2MCK.js">
|
|
28
|
-
<link rel="modulepreload" crossorigin href="/assets/app-
|
|
28
|
+
<link rel="modulepreload" crossorigin href="/assets/app-N-0Q_AWp.js">
|
|
29
29
|
<link rel="stylesheet" crossorigin href="/assets/app-GUjJKojE.css">
|
|
30
30
|
<link rel="stylesheet" crossorigin href="/assets/index-BX850JXd.css">
|
|
31
31
|
<link rel="stylesheet" href="/protobase.theme.css">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const cacheName = "protobase-shell-
|
|
2
|
-
const precache = ["/index.html","/assets/shared-react-CuZpzdyh.js","/assets/shared-react-jsx-runtime-Csr2Kx2w.js","/assets/shared-react-dom-BNlY7-7i.js","/assets/shared-protobase-ui-
|
|
1
|
+
const cacheName = "protobase-shell-c2735a406174509e"
|
|
2
|
+
const precache = ["/index.html","/assets/shared-react-CuZpzdyh.js","/assets/shared-react-jsx-runtime-Csr2Kx2w.js","/assets/shared-react-dom-BNlY7-7i.js","/assets/shared-protobase-ui-BDsvC1q_.js","/assets/index-BZYl8P78.js","/assets/rolldown-runtime-hePW80VL.js","/assets/react-CR5VJ85Q.js","/assets/vendor-C4-Hop1T.js","/assets/cn-Bi0ZEjD9.js","/assets/preload-helper-C24C2MCK.js","/assets/app-N-0Q_AWp.js","/assets/app-GUjJKojE.css","/assets/index-BX850JXd.css","/protobase.theme.css","/protobase.favicon.svg"]
|
|
3
3
|
const revalidated = ["/protobase.theme.css","/protobase.favicon.svg"]
|
|
4
4
|
|
|
5
5
|
const fromCache = (request) =>
|