@protobase/ui 0.55.9 → 0.55.10
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/notifications/push/use-push-notifications.d.ts +1 -1
- package/dist/package.js +1 -1
- package/dist/shell/assets/{app-CGUPflzp.js → app-D8Qf1k6C.js} +4 -4
- package/dist/shell/assets/{index-CNVN3aoJ.js → index-DOPpQFX5.js} +2 -2
- package/dist/shell/assets/{records-map-CASdPEx-.js → records-map-Bfiqk3KU.js} +2 -2
- package/dist/shell/assets/{shared-protobase-ui-CSEfJMHq.js → shared-protobase-ui-DtoVw1Ll.js} +2 -2
- 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-CGUPflzp.js.map → app-D8Qf1k6C.js.map} +1 -1
- package/dist/shell-source-maps/assets/{index-CNVN3aoJ.js.map → index-DOPpQFX5.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-CASdPEx-.js.map → records-map-Bfiqk3KU.js.map} +1 -1
- package/dist/shell-source-maps/assets/{shared-protobase-ui-CSEfJMHq.js.map → shared-protobase-ui-DtoVw1Ll.js.map} +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-DOPpQFX5.js","names":["createRoot","StrictMode","projectUi","__exportAll","__toESM","require_react","require_client","require_jsx_runtime","uiFromModule","nativeBridgeOf","App","relList","link","processPreload","mutation","mutations","node","getFetchOpts","fetchOpts","import_react","import_client","_virtual_protobase_project_ui_exports","_virtual_protobase_project_ui_default","apiOriginMeta","showKeyboardAccessoryBar","bridge","nativeViewport","content","part","applyNativeViewport","meta","doc","apiOriginOf","contents","value","url","pageApiOrigin","import_jsx_runtime","root","nativeBridge","browserLocale"],"sources":["../../../../schema/src/api-origin-meta.ts","../../../src/app/native-keyboard.ts","../../../src/app/native-viewport.ts","../../../src/app/page-api-origin.ts","../../../src/app/main.tsx"],"sourcesContent":["/**\n * The `<meta name>` whose `content` names the origin of the API the shell calls, such as `https://shop.example.com`, for\n * a page served from elsewhere: `protobase mobile` writes it into the app's `index.html`. Without it, the shell calls\n * the API on its own origin.\n */\nexport const apiOriginMeta = 'protobase-api-origin'\n","import type { NativeBridge } from './native-auth-fetch'\n\n/**\n * Gives the iOS app's keyboard back the bar above it, with the arrows to the previous and next field and Done, which\n * Capacitor's keyboard plugin hides when it loads and has no setting for. A binary built before it had the plugin,\n * and Android, which has no such bar, are left as they are.\n */\nexport const showKeyboardAccessoryBar = async (bridge: NativeBridge) => {\n if (bridge.getPlatform() !== 'ios' || !bridge.isPluginAvailable('Keyboard')) return\n await bridge.nativePromise('Keyboard', 'setAccessoryBarVisible', { isVisible: true })\n}\n","/**\n * The viewport of the iOS and Android app: as the page's, at a scale of one. Safari on iOS zooms into an input whose\n * text is smaller than 16px when it is focused, and in the app the page then stays zoomed with its right side cut off;\n * an app does not zoom, so its viewport stays at that scale, under a pinch too. The page in a browser keeps its zoom.\n */\nexport const nativeViewport = (content: string) => {\n const kept = content.split(',').map((part) => part.trim()).filter((part) => part && !/^maximum-scale\\s*=/.test(part))\n return [...kept, 'maximum-scale=1'].join(', ')\n}\n\n/** Gives the document's viewport the app's scale; a document without a viewport tag needs none. */\nexport const applyNativeViewport = (doc: Document) => {\n const meta = doc.querySelector('meta[name=\"viewport\"]')\n if (!meta) return\n meta.setAttribute('content', nativeViewport(meta.getAttribute('content') ?? ''))\n}\n","import { apiOriginMeta } from '@protobase/schema/internal'\n\n/**\n * The API origin the page's `<meta name=\"protobase-api-origin\">` tags name: `undefined` without one. Anything but one\n * tag holding exactly an http or https origin, such as `https://shop.example.com`, is an error.\n */\nexport const apiOriginOf = (contents: string[]) => {\n if (contents.length === 0) return undefined\n if (contents.length > 1) throw new Error(`The page has ${contents.length} ${apiOriginMeta} meta tags; it may have one`)\n const value = contents[0]!\n const url = URL.canParse(value) ? new URL(value) : undefined\n if (!url || (url.protocol !== 'http:' && url.protocol !== 'https:') || url.origin !== value) {\n throw new Error(`The page's ${apiOriginMeta} meta tag holds \"${value}\", which is not an http or https origin such as https://shop.example.com`)\n }\n return value\n}\n\n/** The API origin this page names in its `<meta name=\"protobase-api-origin\">` (see `apiOriginOf`). */\nexport const pageApiOrigin = () =>\n apiOriginOf([...document.querySelectorAll<HTMLMetaElement>(`meta[name=\"${apiOriginMeta}\"]`)].map((meta) => meta.content))\n","import { StrictMode } from 'react'\nimport { createRoot } from 'react-dom/client'\nimport * as projectUi from 'virtual:protobase-project-ui'\nimport '../styles.css'\nimport { browserLocale } from '../locale/active-locale'\nimport { App } from './app'\nimport { nativeBridgeOf, type NativeBridge } from './native-auth-fetch'\nimport { showKeyboardAccessoryBar } from './native-keyboard'\nimport { applyNativeViewport } from './native-viewport'\nimport { pageApiOrigin } from './page-api-origin'\nimport { uiFromModule } from './pages/ui-from-module'\n\nconst root = document.getElementById('root')\nif (!root) throw new Error('index.html needs an element with id \"root\"')\n\nconst nativeBridge = nativeBridgeOf(window as { Capacitor?: NativeBridge })\nif (nativeBridge) {\n applyNativeViewport(document)\n void showKeyboardAccessoryBar(nativeBridge)\n}\n\ncreateRoot(root).render(\n <StrictMode>\n <App baseUrl={`${pageApiOrigin() ?? ''}/api/v1`} ui={uiFromModule(projectUi)} locale={browserLocale()} nativeBridge={nativeBridge} />\n </StrictMode>,\n)\n"],"mappings":"85BAKauB,EAAgB,uBCEhBC,EAA2B,KAAO,IAAyB,CAClEC,EAAO,YAAY,IAAM,OAAUA,EAAO,kBAAkB,UAAU,GAC1E,MAAMA,EAAO,cAAc,WAAY,yBAA0B,CAAE,UAAW,EAAK,CAAC,CACtF,ECLaC,EAAkB,GAEtB,CAAC,GADKC,EAAQ,MAAM,GAAG,CAAC,CAAC,IAAK,GAASC,EAAK,KAAK,CAAC,CAAC,CAAC,OAAQ,GAASA,GAAQ,CAAC,qBAAqB,KAAKA,CAAI,CACx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
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records-map-CASdPEx-.js","names":["useRef","useState","__toESM","require_react","require_jsx_runtime","groupPoints","cachedFormat","MapPin","Source","MapLayerSwitch","Marker","Layer","Map","mapLib","cn","import_react","worldPixels","mercatorLimit","fadeFrom","zooms","zoom","positionsOf","geometry","mercatorY","radians","latitude","zoomZeroSpan","positions","longitudes","longitude","ys","width","height","areaFeatures","features","points","point","kind","selected","feature","fadeIn","full","import_jsx_runtime","areaLayerId","polygons","lines","chosen","yes","no","PositionAreas","data","color","colors","themeColor","probe","token","element","resolved","canvas","context","red","green","blue","alpha","groupRadius","fitOptions","bucketOptions","markerHeight","compact","tag","corners","bounds","RecordsMap","ref","groups","setGroups","setColors","byKey","pointKeys","fitKey","fit","regroup","map","report","center","onMove","fitNow","onFitted","chosenAt","group","key","at","covered","open","y","style","initial","container","onClear","NavigationControl","buckets","bucket","bucketLabel","event","approximate","markerLabel","onSelect"],"sources":["../../../src/app/map/area-features.ts","../../../src/app/map/position-areas.tsx","../../../src/app/map/theme-color.ts","../../../src/app/map/records-map.tsx"],"sourcesContent":["import type { ExpressionSpecification } from 'maplibre-gl'\nimport type { MapPoint } from '../displays/map-groups'\nimport type { AreaGeometry } from './approximate-position'\n\n/** An area as the map's GeoJSON source holds it: whose it is, whether it is filled or a line, its size, and whether its record is chosen. */\nexport type AreaFeature = {\n type: 'Feature'\n geometry: AreaGeometry\n properties: { key: string; kind: 'polygon' | 'line'; span: number; chosen: boolean }\n}\n\n// MapLibre draws the whole world 512 pixels across at zoom 0, each zoom level twice as wide as the one before.\nconst worldPixels = 512\n// The furthest north and south Web Mercator draws.\nconst mercatorLimit = 85.051129\n// An area fades in as it grows from about half a marker to a marker and a half across, smaller it says nothing the marker does not.\nconst fadeFrom = 16\nconst fadeTo = 48\nconst zooms = Array.from({ length: 23 }, (_, zoom) => zoom)\n\nconst positionsOf = (geometry: AreaGeometry): [number, number][] => {\n if (geometry.type === 'LineString') return geometry.coordinates\n if (geometry.type === 'MultiPolygon') return geometry.coordinates.flat(2)\n return geometry.coordinates.flat()\n}\n\n// How far down the world a latitude is drawn, from 0 at the top to 1 at the bottom.\nconst mercatorY = (latitude: number) => {\n const radians = (Math.max(-mercatorLimit, Math.min(mercatorLimit, latitude)) * Math.PI) / 180\n return 0.5 - Math.log(Math.tan(Math.PI / 4 + radians / 2)) / (2 * Math.PI)\n}\n\n/** How many pixels across the area is drawn at zoom 0, the larger of its width and height; twice as many each zoom level in. */\nexport const zoomZeroSpan = (geometry: AreaGeometry) => {\n const positions = positionsOf(geometry)\n const longitudes = positions.map(([longitude]) => longitude)\n const ys = positions.map(([, latitude]) => mercatorY(latitude))\n const width = ((Math.max(...longitudes) - Math.min(...longitudes)) / 360) * worldPixels\n const height = (Math.max(...ys) - Math.min(...ys)) * worldPixels\n return Math.max(width, height)\n}\n\n/** The areas of the points that have one, those of the chosen records last so they are drawn on top. */\nexport const areaFeatures = (points: MapPoint[], selected: string[] | undefined): { type: 'FeatureCollection'; features: AreaFeature[] } => {\n const features = points.flatMap((point): AreaFeature[] => {\n if (!point.area) return []\n const kind = point.area.type === 'LineString' || point.area.type === 'MultiLineString' ? 'line' : 'polygon'\n return [{ type: 'Feature', geometry: point.area, properties: { key: point.key, kind, span: zoomZeroSpan(point.area), chosen: selected?.includes(point.key) ?? false } }]\n })\n return { type: 'FeatureCollection', features: [...features.filter((feature) => !feature.properties.chosen), ...features.filter((feature) => feature.properties.chosen)] }\n}\n\n/**\n * An opacity of `full` for an area drawn large enough to mean something at the zoom, fading in as it grows to that\n * size: at each whole zoom level its share of `full` follows from its span, and MapLibre blends between the levels.\n */\nexport const fadeIn = (full: number | ExpressionSpecification): ExpressionSpecification =>\n [\n 'interpolate',\n ['linear'],\n ['zoom'],\n ...zooms.flatMap((zoom) => [zoom, ['*', full, ['min', 1, ['max', 0, ['/', ['-', ['*', ['get', 'span'], 2 ** zoom], fadeFrom], fadeTo - fadeFrom]]]]]),\n ] as ExpressionSpecification\n","import type { ExpressionSpecification, FilterSpecification } from 'maplibre-gl'\nimport { Layer, Source } from 'react-map-gl/maplibre'\nimport type { MapPoint } from '../displays/map-groups'\nimport { areaFeatures, fadeIn } from './area-features'\n\n/** The colours of the areas, as MapLibre reads them: the markers' own, and the chosen marker's. */\nexport type AreaColors = { area: string; chosen: string }\n\n/** The areas' lowest layer, which a layer of tiles goes under. */\nexport const areaLayerId = 'position-area-fills'\n\nconst polygons: FilterSpecification = ['==', ['get', 'kind'], 'polygon']\nconst lines: FilterSpecification = ['==', ['get', 'kind'], 'line']\nconst chosen = (yes: number, no: number): ExpressionSpecification => ['case', ['get', 'chosen'], yes, no]\n\n/**\n * The areas around the approximate positions among `points`, drawn under the markers in the markers' colour: a polygon\n * filled faintly within a dashed outline, a line such as a street as a wide stroke. Each fades in as the map zooms close\n * enough for it to be larger than a marker, and the chosen records' areas are drawn darker. Nothing without areas.\n */\nexport const PositionAreas = ({ points, selected, colors }: { points: MapPoint[]; selected: string[] | undefined; colors: AreaColors }) => {\n const data = areaFeatures(points, selected)\n if (data.features.length === 0) return null\n const color: ExpressionSpecification = ['case', ['get', 'chosen'], colors.chosen, colors.area]\n return (\n <Source id=\"position-areas\" type=\"geojson\" data={data}>\n <Layer id={areaLayerId} type=\"fill\" filter={polygons} paint={{ 'fill-color': color, 'fill-opacity': fadeIn(chosen(0.15, 0.1)) }} />\n <Layer id=\"position-area-outlines\" type=\"line\" filter={polygons} paint={{ 'line-color': color, 'line-width': 1.5, 'line-dasharray': [3, 2], 'line-opacity': fadeIn(0.8) }} />\n <Layer id=\"position-area-lines\" type=\"line\" filter={lines} layout={{ 'line-cap': 'round', 'line-join': 'round' }} paint={{ 'line-color': color, 'line-width': 6, 'line-opacity': fadeIn(chosen(0.6, 0.35)) }} />\n </Source>\n )\n}\n","/**\n * The colour a theme token such as `--primary` holds where `element` is, as `rgba()`, which MapLibre's paint reads\n * whatever the theme writes it in: the browser resolves the token, and a pixel painted with it gives its channels.\n */\nexport const themeColor = (element: HTMLElement, token: string) => {\n const probe = document.createElement('span')\n probe.style.color = `var(${token})`\n element.append(probe)\n const resolved = getComputedStyle(probe).color\n probe.remove()\n const canvas = document.createElement('canvas')\n canvas.width = 1\n canvas.height = 1\n const context = canvas.getContext('2d', { willReadFrequently: true })\n if (!context) return resolved\n context.fillStyle = resolved\n context.fillRect(0, 0, 1, 1)\n const [red, green, blue, alpha] = context.getImageData(0, 0, 1, 1).data\n return `rgba(${red}, ${green}, ${blue}, ${alpha! / 255})`\n}\n","import { useEffect, useRef, useState } from 'react'\nimport { MapPin } from 'lucide-react'\nimport { Map, Marker, NavigationControl, type MapRef } from 'react-map-gl/maplibre'\nimport type { MapBounds, MapBucket, MapLayerModel } from '@protobase/client'\nimport type { MapView } from '@protobase/schema'\nimport { cn } from '../../lib/cn'\nimport { groupPoints, type MapGroup, type MapPoint } from '../displays/map-groups'\nimport type { MapArea } from './map-area'\nimport { MapLayerSwitch } from './map-layer-switch'\nimport { mapLib } from './maplibre'\nimport { areaLayerId, PositionAreas, type AreaColors } from './position-areas'\nimport { themeColor } from './theme-color'\nimport { cachedFormat } from '../../format/intl-cache'\n\n// How close, in pixels, records are drawn under one marker, about a marker's width.\nconst groupRadius = 28\nconst fitOptions = { padding: 48, maxZoom: 15, duration: 0 }\n// A bucket opens far enough in for the server to send its records: it does from zoom 16 on.\nconst bucketOptions = { padding: 48, maxZoom: 16, duration: 300 }\nconst markerHeight = 32\nconst compact = () => cachedFormat('compact', (tag) => new Intl.NumberFormat(tag, { notation: 'compact', maximumFractionDigits: 1 }))\n\nconst corners = (bounds: MapBounds): [[number, number], [number, number]] => [\n [bounds.west, bounds.south],\n [bounds.east, bounds.north],\n]\n\ntype RecordsMapProps = {\n style: string\n /** The layers the map may switch to in place of the style's. */\n layers?: MapLayerModel[]\n /** Where the map looks when it opens; the whole world without it. */\n initial: MapView | undefined\n points: MapPoint[]\n /** Counts of records in parts of the map, drawn as circles in place of their records. */\n buckets: MapBucket[]\n /** Bounds to move the map to, each time they change; `onFitted` says it moved there. */\n fit: MapBounds | undefined\n onFitted: () => void\n /** The map's area and view, each time it comes to rest. */\n onMove: (area: MapArea, view: MapView) => void\n /** The records whose marker is chosen, if any. */\n selected: string[] | undefined\n /** How many pixels at the map's bottom something covers, such as the chosen record's card. */\n covered: number\n onSelect: (keys: string[]) => void\n onClear: () => void\n /** What a marker for these records says to a screen reader. */\n markerLabel: (keys: string[]) => string\n /** What a bucket of this many records says to a screen reader. */\n bucketLabel: (count: number) => string\n}\n\n/**\n * A map of `style` with a marker for each group of records that lie close together at the zoom, showing how many it\n * stands for, and a circle with the count of each bucket, which zooms in on its records when chosen. A marker whose\n * records' positions are all approximate is drawn hollow with a dashed edge, over the areas around them. Choosing a\n * marker selects its records; choosing the map elsewhere clears the selection. A chosen marker the covered bottom would\n * hide moves up into the open part of the map.\n */\nexport const RecordsMap = ({ style, layers, initial, points, buckets, fit, onFitted, onMove, selected, covered, onSelect, onClear, markerLabel, bucketLabel }: RecordsMapProps) => {\n const ref = useRef<MapRef>(null)\n const [groups, setGroups] = useState<MapGroup[]>([])\n const [colors, setColors] = useState<AreaColors>()\n const byKey = new globalThis.Map(points.map((point) => [point.key, point]))\n const pointKeys = points.map((point) => point.key).join(',')\n const fitKey = fit && JSON.stringify(fit)\n\n // The groups as the map is drawn now: only the zoom changes which records lie close together\n const regroup = () => {\n const map = ref.current?.getMap()\n if (!map) return\n setGroups(\n groupPoints(\n points.map((point) => ({ key: point.key, ...map.project([point.longitude, point.latitude]) })),\n groupRadius,\n ),\n )\n }\n\n const report = () => {\n const map = ref.current?.getMap()\n if (!map) return\n const bounds = map.getBounds()\n const center = map.getCenter()\n onMove({ bounds: { south: bounds.getSouth(), west: bounds.getWest(), north: bounds.getNorth(), east: bounds.getEast() }, zoom: map.getZoom() }, { latitude: center.lat, longitude: center.lng, zoom: map.getZoom() })\n }\n\n const fitNow = () => {\n const map = ref.current?.getMap()\n if (!map || !fit) return\n map.fitBounds(corners(fit), fitOptions)\n onFitted()\n report()\n }\n\n // Other records are grouped at the zoom the map is at\n useEffect(regroup, [pointKeys])\n useEffect(fitNow, [fitKey])\n\n // The chosen marker in view above what covers the map's bottom\n const chosenAt = groups.find((group) => selected !== undefined && group.keys.some((key) => selected.includes(key)))?.at\n useEffect(() => {\n const map = ref.current?.getMap()\n const at = chosenAt === undefined ? undefined : byKey.get(chosenAt)\n if (!map || !at || covered === 0) return\n const { y } = map.project([at.longitude, at.latitude])\n const open = map.getContainer().clientHeight - covered\n if (y > markerHeight && y < open) return\n map.easeTo({ center: [at.longitude, at.latitude], offset: [0, (markerHeight - covered) / 2], duration: 300 })\n // A new choice or a new cover moves the map, not every new group\n }, [chosenAt, covered])\n\n return (\n <Map\n ref={ref}\n mapLib={mapLib}\n mapStyle={style}\n initialViewState={initial ?? { latitude: 0, longitude: 0, zoom: 1 }}\n style={{ width: '100%', height: '100%' }}\n onLoad={() => {\n const container = ref.current!.getMap().getContainer()\n setColors({ area: themeColor(container, '--primary'), chosen: themeColor(container, '--foreground') })\n regroup()\n if (fit) fitNow()\n else report()\n }}\n onZoomEnd={regroup}\n onMoveEnd={report}\n onClick={onClear}\n >\n <NavigationControl showCompass={false} />\n <MapLayerSwitch layers={layers} below={areaLayerId} />\n {colors && <PositionAreas points={points} selected={selected} colors={colors} />}\n {buckets.map((bucket) => (\n <Marker key={`${bucket.latitude},${bucket.longitude}`} latitude={bucket.latitude} longitude={bucket.longitude} anchor=\"center\">\n <button\n type=\"button\"\n aria-label={bucketLabel(bucket.count)}\n 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\"\n onClick={(event) => {\n event.stopPropagation()\n ref.current?.getMap().fitBounds(corners(bucket.bounds), bucketOptions)\n }}\n >\n {compact().format(bucket.count)}\n </button>\n </Marker>\n ))}\n {groups.map((group) => {\n const at = byKey.get(group.at)\n if (!at) return null\n const chosen = selected !== undefined && group.keys.some((key) => selected.includes(key))\n const approximate = group.keys.every((key) => byKey.get(key)?.approximate)\n return (\n <Marker key={group.at} latitude={at.latitude} longitude={at.longitude} anchor=\"bottom\" style={{ zIndex: chosen ? 1 : 0 }}>\n <button\n type=\"button\"\n aria-label={markerLabel(group.keys)}\n aria-pressed={chosen}\n className=\"relative block cursor-pointer\"\n onClick={(event) => {\n event.stopPropagation()\n onSelect(group.keys)\n }}\n >\n <MapPin\n aria-hidden\n data-approximate={approximate || undefined}\n className={cn('size-8 drop-shadow', approximate ? (chosen ? 'fill-background text-foreground' : 'fill-background text-primary') : chosen ? 'fill-foreground text-background' : 'fill-primary text-primary-foreground')}\n strokeWidth={approximate ? 2 : 1.5}\n strokeDasharray={approximate ? '3 2' : undefined}\n />\n {group.keys.length > 1 && (\n <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\">\n {group.keys.length}\n </span>\n )}\n </button>\n </Marker>\n )\n })}\n </Map>\n )\n}\n"],"mappings":"2RAYMgB,EAAc,IAEdC,EAAgB,UAEhBC,EAAW,GAEXC,EAAQ,MAAM,KAAK,CAAE,OAAQ,EAAG,GAAI,EAAG,IAASC,CAAI,EAEpDC,EAAe,GACfC,EAAS,OAAS,aAAqBA,EAAS,YAChDA,EAAS,OAAS,eAAuBA,EAAS,YAAY,KAAK,CAAC,EACjEA,EAAS,YAAY,KAAK,EAI7BC,EAAa,GAAqB,CACtC,IAAMC,EAAW,KAAK,IAAI,WAAgB,KAAK,IAAIP,EAAeQ,CAAQ,CAAC,EAAI,KAAK,GAAM,IAC1F,MAAO,IAAM,KAAK,IAAI,KAAK,IAAI,KAAK,GAAK,EAAID,EAAU,CAAC,CAAC,GAAK,EAAI,KAAK,GACzE,EAGaE,EAAgB,GAA2B,CACtD,IAAMC,EAAYN,EAAYC,CAAQ,EAChCM,EAAaD,EAAU,KAAK,CAACE,KAAeA,CAAS,EACrDC,EAAKH,EAAU,KAAK,EAAGF,KA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"version":3,"file":"records-map-Bfiqk3KU.js","names":["useRef","useState","__toESM","require_react","require_jsx_runtime","groupPoints","cachedFormat","MapPin","Source","MapLayerSwitch","Marker","Layer","Map","mapLib","cn","import_react","worldPixels","mercatorLimit","fadeFrom","zooms","zoom","positionsOf","geometry","mercatorY","radians","latitude","zoomZeroSpan","positions","longitudes","longitude","ys","width","height","areaFeatures","features","points","point","kind","selected","feature","fadeIn","full","import_jsx_runtime","areaLayerId","polygons","lines","chosen","yes","no","PositionAreas","data","color","colors","themeColor","probe","token","element","resolved","canvas","context","red","green","blue","alpha","groupRadius","fitOptions","bucketOptions","markerHeight","compact","tag","corners","bounds","RecordsMap","ref","groups","setGroups","setColors","byKey","pointKeys","fitKey","fit","regroup","map","report","center","onMove","fitNow","onFitted","chosenAt","group","key","at","covered","open","y","style","initial","container","onClear","NavigationControl","buckets","bucket","bucketLabel","event","approximate","markerLabel","onSelect"],"sources":["../../../src/app/map/area-features.ts","../../../src/app/map/position-areas.tsx","../../../src/app/map/theme-color.ts","../../../src/app/map/records-map.tsx"],"sourcesContent":["import type { ExpressionSpecification } from 'maplibre-gl'\nimport type { MapPoint } from '../displays/map-groups'\nimport type { AreaGeometry } from './approximate-position'\n\n/** An area as the map's GeoJSON source holds it: whose it is, whether it is filled or a line, its size, and whether its record is chosen. */\nexport type AreaFeature = {\n type: 'Feature'\n geometry: AreaGeometry\n properties: { key: string; kind: 'polygon' | 'line'; span: number; chosen: boolean }\n}\n\n// MapLibre draws the whole world 512 pixels across at zoom 0, each zoom level twice as wide as the one before.\nconst worldPixels = 512\n// The furthest north and south Web Mercator draws.\nconst mercatorLimit = 85.051129\n// An area fades in as it grows from about half a marker to a marker and a half across, smaller it says nothing the marker does not.\nconst fadeFrom = 16\nconst fadeTo = 48\nconst zooms = Array.from({ length: 23 }, (_, zoom) => zoom)\n\nconst positionsOf = (geometry: AreaGeometry): [number, number][] => {\n if (geometry.type === 'LineString') return geometry.coordinates\n if (geometry.type === 'MultiPolygon') return geometry.coordinates.flat(2)\n return geometry.coordinates.flat()\n}\n\n// How far down the world a latitude is drawn, from 0 at the top to 1 at the bottom.\nconst mercatorY = (latitude: number) => {\n const radians = (Math.max(-mercatorLimit, Math.min(mercatorLimit, latitude)) * Math.PI) / 180\n return 0.5 - Math.log(Math.tan(Math.PI / 4 + radians / 2)) / (2 * Math.PI)\n}\n\n/** How many pixels across the area is drawn at zoom 0, the larger of its width and height; twice as many each zoom level in. */\nexport const zoomZeroSpan = (geometry: AreaGeometry) => {\n const positions = positionsOf(geometry)\n const longitudes = positions.map(([longitude]) => longitude)\n const ys = positions.map(([, latitude]) => mercatorY(latitude))\n const width = ((Math.max(...longitudes) - Math.min(...longitudes)) / 360) * worldPixels\n const height = (Math.max(...ys) - Math.min(...ys)) * worldPixels\n return Math.max(width, height)\n}\n\n/** The areas of the points that have one, those of the chosen records last so they are drawn on top. */\nexport const areaFeatures = (points: MapPoint[], selected: string[] | undefined): { type: 'FeatureCollection'; features: AreaFeature[] } => {\n const features = points.flatMap((point): AreaFeature[] => {\n if (!point.area) return []\n const kind = point.area.type === 'LineString' || point.area.type === 'MultiLineString' ? 'line' : 'polygon'\n return [{ type: 'Feature', geometry: point.area, properties: { key: point.key, kind, span: zoomZeroSpan(point.area), chosen: selected?.includes(point.key) ?? false } }]\n })\n return { type: 'FeatureCollection', features: [...features.filter((feature) => !feature.properties.chosen), ...features.filter((feature) => feature.properties.chosen)] }\n}\n\n/**\n * An opacity of `full` for an area drawn large enough to mean something at the zoom, fading in as it grows to that\n * size: at each whole zoom level its share of `full` follows from its span, and MapLibre blends between the levels.\n */\nexport const fadeIn = (full: number | ExpressionSpecification): ExpressionSpecification =>\n [\n 'interpolate',\n ['linear'],\n ['zoom'],\n ...zooms.flatMap((zoom) => [zoom, ['*', full, ['min', 1, ['max', 0, ['/', ['-', ['*', ['get', 'span'], 2 ** zoom], fadeFrom], fadeTo - fadeFrom]]]]]),\n ] as ExpressionSpecification\n","import type { ExpressionSpecification, FilterSpecification } from 'maplibre-gl'\nimport { Layer, Source } from 'react-map-gl/maplibre'\nimport type { MapPoint } from '../displays/map-groups'\nimport { areaFeatures, fadeIn } from './area-features'\n\n/** The colours of the areas, as MapLibre reads them: the markers' own, and the chosen marker's. */\nexport type AreaColors = { area: string; chosen: string }\n\n/** The areas' lowest layer, which a layer of tiles goes under. */\nexport const areaLayerId = 'position-area-fills'\n\nconst polygons: FilterSpecification = ['==', ['get', 'kind'], 'polygon']\nconst lines: FilterSpecification = ['==', ['get', 'kind'], 'line']\nconst chosen = (yes: number, no: number): ExpressionSpecification => ['case', ['get', 'chosen'], yes, no]\n\n/**\n * The areas around the approximate positions among `points`, drawn under the markers in the markers' colour: a polygon\n * filled faintly within a dashed outline, a line such as a street as a wide stroke. Each fades in as the map zooms close\n * enough for it to be larger than a marker, and the chosen records' areas are drawn darker. Nothing without areas.\n */\nexport const PositionAreas = ({ points, selected, colors }: { points: MapPoint[]; selected: string[] | undefined; colors: AreaColors }) => {\n const data = areaFeatures(points, selected)\n if (data.features.length === 0) return null\n const color: ExpressionSpecification = ['case', ['get', 'chosen'], colors.chosen, colors.area]\n return (\n <Source id=\"position-areas\" type=\"geojson\" data={data}>\n <Layer id={areaLayerId} type=\"fill\" filter={polygons} paint={{ 'fill-color': color, 'fill-opacity': fadeIn(chosen(0.15, 0.1)) }} />\n <Layer id=\"position-area-outlines\" type=\"line\" filter={polygons} paint={{ 'line-color': color, 'line-width': 1.5, 'line-dasharray': [3, 2], 'line-opacity': fadeIn(0.8) }} />\n <Layer id=\"position-area-lines\" type=\"line\" filter={lines} layout={{ 'line-cap': 'round', 'line-join': 'round' }} paint={{ 'line-color': color, 'line-width': 6, 'line-opacity': fadeIn(chosen(0.6, 0.35)) }} />\n </Source>\n )\n}\n","/**\n * The colour a theme token such as `--primary` holds where `element` is, as `rgba()`, which MapLibre's paint reads\n * whatever the theme writes it in: the browser resolves the token, and a pixel painted with it gives its channels.\n */\nexport const themeColor = (element: HTMLElement, token: string) => {\n const probe = document.createElement('span')\n probe.style.color = `var(${token})`\n element.append(probe)\n const resolved = getComputedStyle(probe).color\n probe.remove()\n const canvas = document.createElement('canvas')\n canvas.width = 1\n canvas.height = 1\n const context = canvas.getContext('2d', { willReadFrequently: true })\n if (!context) return resolved\n context.fillStyle = resolved\n context.fillRect(0, 0, 1, 1)\n const [red, green, blue, alpha] = context.getImageData(0, 0, 1, 1).data\n return `rgba(${red}, ${green}, ${blue}, ${alpha! / 255})`\n}\n","import { useEffect, useRef, useState } from 'react'\nimport { MapPin } from 'lucide-react'\nimport { Map, Marker, NavigationControl, type MapRef } from 'react-map-gl/maplibre'\nimport type { MapBounds, MapBucket, MapLayerModel } from '@protobase/client'\nimport type { MapView } from '@protobase/schema'\nimport { cn } from '../../lib/cn'\nimport { groupPoints, type MapGroup, type MapPoint } from '../displays/map-groups'\nimport type { MapArea } from './map-area'\nimport { MapLayerSwitch } from './map-layer-switch'\nimport { mapLib } from './maplibre'\nimport { areaLayerId, PositionAreas, type AreaColors } from './position-areas'\nimport { themeColor } from './theme-color'\nimport { cachedFormat } from '../../format/intl-cache'\n\n// How close, in pixels, records are drawn under one marker, about a marker's width.\nconst groupRadius = 28\nconst fitOptions = { padding: 48, maxZoom: 15, duration: 0 }\n// A bucket opens far enough in for the server to send its records: it does from zoom 16 on.\nconst bucketOptions = { padding: 48, maxZoom: 16, duration: 300 }\nconst markerHeight = 32\nconst compact = () => cachedFormat('compact', (tag) => new Intl.NumberFormat(tag, { notation: 'compact', maximumFractionDigits: 1 }))\n\nconst corners = (bounds: MapBounds): [[number, number], [number, number]] => [\n [bounds.west, bounds.south],\n [bounds.east, bounds.north],\n]\n\ntype RecordsMapProps = {\n style: string\n /** The layers the map may switch to in place of the style's. */\n layers?: MapLayerModel[]\n /** Where the map looks when it opens; the whole world without it. */\n initial: MapView | undefined\n points: MapPoint[]\n /** Counts of records in parts of the map, drawn as circles in place of their records. */\n buckets: MapBucket[]\n /** Bounds to move the map to, each time they change; `onFitted` says it moved there. */\n fit: MapBounds | undefined\n onFitted: () => void\n /** The map's area and view, each time it comes to rest. */\n onMove: (area: MapArea, view: MapView) => void\n /** The records whose marker is chosen, if any. */\n selected: string[] | undefined\n /** How many pixels at the map's bottom something covers, such as the chosen record's card. */\n covered: number\n onSelect: (keys: string[]) => void\n onClear: () => void\n /** What a marker for these records says to a screen reader. */\n markerLabel: (keys: string[]) => string\n /** What a bucket of this many records says to a screen reader. */\n bucketLabel: (count: number) => string\n}\n\n/**\n * A map of `style` with a marker for each group of records that lie close together at the zoom, showing how many it\n * stands for, and a circle with the count of each bucket, which zooms in on its records when chosen. A marker whose\n * records' positions are all approximate is drawn hollow with a dashed edge, over the areas around them. Choosing a\n * marker selects its records; choosing the map elsewhere clears the selection. A chosen marker the covered bottom would\n * hide moves up into the open part of the map.\n */\nexport const RecordsMap = ({ style, layers, initial, points, buckets, fit, onFitted, onMove, selected, covered, onSelect, onClear, markerLabel, bucketLabel }: RecordsMapProps) => {\n const ref = useRef<MapRef>(null)\n const [groups, setGroups] = useState<MapGroup[]>([])\n const [colors, setColors] = useState<AreaColors>()\n const byKey = new globalThis.Map(points.map((point) => [point.key, point]))\n const pointKeys = points.map((point) => point.key).join(',')\n const fitKey = fit && JSON.stringify(fit)\n\n // The groups as the map is drawn now: only the zoom changes which records lie close together\n const regroup = () => {\n const map = ref.current?.getMap()\n if (!map) return\n setGroups(\n groupPoints(\n points.map((point) => ({ key: point.key, ...map.project([point.longitude, point.latitude]) })),\n groupRadius,\n ),\n )\n }\n\n const report = () => {\n const map = ref.current?.getMap()\n if (!map) return\n const bounds = map.getBounds()\n const center = map.getCenter()\n onMove({ bounds: { south: bounds.getSouth(), west: bounds.getWest(), north: bounds.getNorth(), east: bounds.getEast() }, zoom: map.getZoom() }, { latitude: center.lat, longitude: center.lng, zoom: map.getZoom() })\n }\n\n const fitNow = () => {\n const map = ref.current?.getMap()\n if (!map || !fit) return\n map.fitBounds(corners(fit), fitOptions)\n onFitted()\n report()\n }\n\n // Other records are grouped at the zoom the map is at\n useEffect(regroup, [pointKeys])\n useEffect(fitNow, [fitKey])\n\n // The chosen marker in view above what covers the map's bottom\n const chosenAt = groups.find((group) => selected !== undefined && group.keys.some((key) => selected.includes(key)))?.at\n useEffect(() => {\n const map = ref.current?.getMap()\n const at = chosenAt === undefined ? undefined : byKey.get(chosenAt)\n if (!map || !at || covered === 0) return\n const { y } = map.project([at.longitude, at.latitude])\n const open = map.getContainer().clientHeight - covered\n if (y > markerHeight && y < open) return\n map.easeTo({ center: [at.longitude, at.latitude], offset: [0, (markerHeight - covered) / 2], duration: 300 })\n // A new choice or a new cover moves the map, not every new group\n }, [chosenAt, covered])\n\n return (\n <Map\n ref={ref}\n mapLib={mapLib}\n mapStyle={style}\n initialViewState={initial ?? { latitude: 0, longitude: 0, zoom: 1 }}\n style={{ width: '100%', height: '100%' }}\n onLoad={() => {\n const container = ref.current!.getMap().getContainer()\n setColors({ area: themeColor(container, '--primary'), chosen: themeColor(container, '--foreground') })\n regroup()\n if (fit) fitNow()\n else report()\n }}\n onZoomEnd={regroup}\n onMoveEnd={report}\n onClick={onClear}\n >\n <NavigationControl showCompass={false} />\n <MapLayerSwitch layers={layers} below={areaLayerId} />\n {colors && <PositionAreas points={points} selected={selected} colors={colors} />}\n {buckets.map((bucket) => (\n <Marker key={`${bucket.latitude},${bucket.longitude}`} latitude={bucket.latitude} longitude={bucket.longitude} anchor=\"center\">\n <button\n type=\"button\"\n aria-label={bucketLabel(bucket.count)}\n 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\"\n onClick={(event) => {\n event.stopPropagation()\n ref.current?.getMap().fitBounds(corners(bucket.bounds), bucketOptions)\n }}\n >\n {compact().format(bucket.count)}\n </button>\n </Marker>\n ))}\n {groups.map((group) => {\n const at = byKey.get(group.at)\n if (!at) return null\n const chosen = selected !== undefined && group.keys.some((key) => selected.includes(key))\n const approximate = group.keys.every((key) => byKey.get(key)?.approximate)\n return (\n <Marker key={group.at} latitude={at.latitude} longitude={at.longitude} anchor=\"bottom\" style={{ zIndex: chosen ? 1 : 0 }}>\n <button\n type=\"button\"\n aria-label={markerLabel(group.keys)}\n aria-pressed={chosen}\n className=\"relative block cursor-pointer\"\n onClick={(event) => {\n event.stopPropagation()\n onSelect(group.keys)\n }}\n >\n <MapPin\n aria-hidden\n data-approximate={approximate || undefined}\n className={cn('size-8 drop-shadow', approximate ? (chosen ? 'fill-background text-foreground' : 'fill-background text-primary') : chosen ? 'fill-foreground text-background' : 'fill-primary text-primary-foreground')}\n strokeWidth={approximate ? 2 : 1.5}\n strokeDasharray={approximate ? '3 2' : undefined}\n />\n {group.keys.length > 1 && (\n <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\">\n {group.keys.length}\n </span>\n )}\n </button>\n </Marker>\n )\n })}\n </Map>\n )\n}\n"],"mappings":"2RAYMgB,EAAc,IAEdC,EAAgB,UAEhBC,EAAW,GAEXC,EAAQ,MAAM,KAAK,CAAE,OAAQ,EAAG,GAAI,EAAG,IAASC,CAAI,EAEpDC,EAAe,GACfC,EAAS,OAAS,aAAqBA,EAAS,YAChDA,EAAS,OAAS,eAAuBA,EAAS,YAAY,KAAK,CAAC,EACjEA,EAAS,YAAY,KAAK,EAI7BC,EAAa,GAAqB,CACtC,IAAMC,EAAW,KAAK,IAAI,WAAgB,KAAK,IAAIP,EAAeQ,CAAQ,CAAC,EAAI,KAAK,GAAM,IAC1F,MAAO,IAAM,KAAK,IAAI,KAAK,IAAI,KAAK,GAAK,EAAID,EAAU,CAAC,CAAC,GAAK,EAAI,KAAK,GACzE,EAGaE,EAAgB,GAA2B,CACtD,IAAMC,EAAYN,EAAYC,CAAQ,EAChCM,EAAaD,EAAU,KAAK,CAACE,KAAeA,CAAS,EACrDC,EAAKH,EAAU,KAAK,EAAGF,KAAcF,EAAUE,CAAQ,CAAC,EACxDM,GAAU,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ui-CSEfJMHq.js","names":["useMemo","useState","__toESM","require_react","require_jsx_runtime","keepPreviousData","useQuery","useQueryClient","fetchLabels","useRecord","useAdminMeta","isFramed","MentionedText","dayIn","ChatThread","Dialog","mentionedIds","ResponsiveDialog","mergeUi","useResourceClient","useGuardedPress","uiFromModule","keys","useCarousel","useListDisplay","CodeForm","useOptionalAuth","pluginApi","useMeta","protobaseVersion","ApiProvider","ChatMessage","Button","usePlugin","useClient","LogoMark","ResendCodeButton","Composer","formatWeekdayDate","emptyDraft","AuthLayout","useArmedAfterFocus","MenuSelect","CarouselControls","CarouselTrack","SignInPrompt","parseDiff","shownImage","useMarkNotificationsRead","Markdown","ActionCard","Input","Form","OtpInput","AssistantDock","defineUi","useFacets","useBackendData","useMembers","diffStats","useAppAddress","DiffView","AppLink","useInbox","ActionInputError","useApiToken","Spinner","text","buttonClass","useAssistantClient","RelationPicker","StepList","Textarea","isConflict","useSeries","useUnreadNotifications","Token","PartView","useList","useOptionalListDisplay","useUpdateRecord","useLayoutRecord","usePushNotifications","FileImage","App","useHistogram","useAssistant","definePlugin","CompactTable","Section","MentionBox","viewerZone","SidePanel","useFieldControl","FieldList","Field","allowDelayMs","Segmented","cn","dayBefore","day","sameChatDay","a","zone","b","chatDayLabel","time","today","now","import_jsx_runtime","ChatDivider","shown","label","line","tone","RecordLink","rest","display","around","name","resource","row","recordKey","import_react","signedInUserOf","state","useSignedInUser","box","carouselSlides","images","image","Carousel","slides","carousel","className","fit","Choices","options","option","value","onChange","usePickedLabels","client","queryClient","sorted","ids","target","view","RecordPicker","resources","props","views","known","setKnown","fetched","labelOf","key","remember","current","chosen"],"sources":["../../../src/chat/chat-day.ts","../../../src/chat/chat-divider.tsx","../../../src/app/displays/record-link.tsx","../../../src/auth/use-signed-in-user.ts","../../../src/carousel/carousel-images.ts","../../../src/carousel/carousel.tsx","../../../src/primitives/choices.tsx","../../../src/app/use-picked-labels.ts","../../../src/app/record-picker.tsx"],"sourcesContent":["import { formatWeekdayDate } from '../format/date'\nimport { dayIn, viewerZone } from '../format/zone'\nimport { text } from './messages'\n\nconst dayBefore = (day: string) => new Date(Date.parse(`${day}T00:00:00Z`) - 86_400_000).toISOString().slice(0, 10)\n\n/** Whether two ISO timestamps fall on the same day in `zone`, the viewer's unless given: a day divider goes between two messages that do not. */\nexport const sameChatDay = (a: string, b: string, zone = viewerZone()) => dayIn(Date.parse(a), zone) === dayIn(Date.parse(b), zone)\n\n/** The label of the divider above a day's first message, sent at `time`: \"Today\", \"Yesterday\" or \"Mon, 26 Oct 2026\", as the viewer's calendar in `zone` has it. */\nexport const chatDayLabel = (time: string, now = Date.now(), zone = viewerZone()) => {\n const day = dayIn(Date.parse(time), zone)\n const today = dayIn(now, zone)\n if (day === today) return text('today')\n if (day === dayBefore(today)) return text('yesterday')\n return formatWeekdayDate(Date.parse(`${day}T00:00:00Z`))\n}\n","import { cn } from '../lib/cn'\nimport { text } from './messages'\n\nexport type ChatDividerProps =\n /** A muted line between the messages of two days, labelled with the later one, such as by `chatDayLabel`. */\n | { tone?: 'day'; label: string }\n /** A line above the first message the reader has not seen, \"New messages\" unless labelled otherwise. */\n | { tone: 'new'; label?: string }\n\n/**\n * A line across a chat with a label in its middle, between the messages of two days or above the new ones. Marked\n * `data-chat-divider`, so a thread keeps the reader's place on the message below it, not on the divider.\n */\nexport const ChatDivider = ({ tone = 'day', label }: ChatDividerProps) => {\n const shown = label ?? text('newMessages')\n const line = cn('h-px flex-1', tone === 'new' ? 'bg-danger' : 'bg-border')\n return (\n <div role=\"separator\" aria-label={shown} data-tone={tone} data-chat-divider=\"\" className=\"flex items-center gap-3 text-xs font-medium\">\n <span className={line} />\n <span className={tone === 'new' ? 'text-danger' : 'text-muted-foreground'}>{shown}</span>\n <span className={line} />\n </div>\n )\n}\n","import type { AnchorHTMLAttributes } from 'react'\nimport type { KeyValue } from '@protobase/schema'\nimport { useLayoutRecord } from '../pages/record-scope'\nimport { AppLink } from '../use-app-address'\nimport { useOptionalListDisplay } from './display-context'\nimport type { ListDisplayRow } from './list-displays'\n\ntype Target = { row: ListDisplayRow; resource?: never; recordKey?: never } | { row?: never; resource?: string; recordKey: KeyValue | readonly KeyValue[] }\n\n/**\n * A link to a record's page, through the app's addresses: a list display's `row`, or a `recordKey` of `resource`. The\n * resource defaults to the list display's or the record's around it, so a custom component never writes a path.\n */\nexport const RecordLink = ({ row, resource, recordKey, ...rest }: AnchorHTMLAttributes<HTMLAnchorElement> & Target) => {\n const display = useOptionalListDisplay()\n const around = useLayoutRecord()\n const name = resource ?? display?.resource ?? around?.model.name\n if (name === undefined) throw new Error('RecordLink needs a resource outside a list display or a record')\n return <AppLink to={{ kind: 'record', resource: name, key: row ? row.key : recordKey }} {...rest} />\n}\n","import { useMemo } from 'react'\nimport { useOptionalAuth, type AuthState } from './auth-provider'\n\n/** Who is signed in: their user id, the id `.author()` stores and mentions hold, and their name. */\nexport type SignedInUser = { id: string; name?: string }\n\n/** The signed-in person of an auth state; none while it loads, for a visitor, and before the sign-in finished. */\nexport const signedInUserOf = (state: AuthState | undefined): SignedInUser | undefined => {\n if (state?.kind !== 'signed-in') return\n const { id, name } = state.user\n return { id, ...(name && { name }) }\n}\n\n/**\n * The signed-in person, from the session the app already holds, such as for a filter on their own user id;\n * `undefined` while the session loads, for a visitor and when nobody is signed in.\n */\nexport const useSignedInUser = (): SignedInUser | undefined => {\n const state = useOptionalAuth()?.state\n return useMemo(() => signedInUserOf(state), [state])\n}\n","import type { StoredFile } from '@protobase/client'\nimport { shownImage } from '../live/file-values'\n\n/** An image a carousel shows: a link with what it shows, or a file field's value, as records carry it. */\nexport type CarouselImage = { src: string; alt: string } | (StoredFile & { alt?: string })\n\n// A frame up to about half a page wide: of a file's variants, the smallest that covers it is drawn, the file itself when none does\nconst box = { width: 640, height: 480 }\n\n/** What each slide draws, in order: a file that is missing or is no raster image is left out. */\nexport const carouselSlides = (images: readonly CarouselImage[]) =>\n images.flatMap((image) => {\n if ('src' in image) return [{ image: { url: image.src }, alt: image.alt }]\n const shown = shownImage(image, box)\n return shown ? [{ image: shown, alt: image.alt ?? '' }] : []\n })\n","import { cn } from '../lib/cn'\nimport { FileImage } from '../live/file-image'\nimport { CarouselControls } from './carousel-controls'\nimport { carouselSlides, type CarouselImage } from './carousel-images'\nimport { CarouselTrack } from './carousel-track'\nimport { useCarousel } from './use-carousel'\n\nexport type CarouselProps = {\n /** The images in order: links with what each shows, or file field values. */\n images: readonly CarouselImage[]\n /** What the images are, read out with the carousel. */\n label?: string\n /** `cover` fills the frame and crops what overflows it, the default; `contain` shows each image whole. */\n fit?: 'cover' | 'contain'\n /** Whether a swipe steps through the images; off, it scrolls what the carousel sits in, such as a row that scrolls sideways. */\n swipe?: boolean\n /** The frame's classes, such as its aspect ratio, border and rounding. */\n className?: string\n}\n\n/**\n * Images side by side in a frame that snaps image by image, swiped on a touch screen or moved by arrows on hover, with\n * dots marking the one in view; the record cards' photos step the same way. A single image shows without arrows or dots.\n */\nexport const Carousel = ({ images, label, fit = 'cover', swipe = true, className }: CarouselProps) => {\n const slides = carouselSlides(images)\n const carousel = useCarousel(slides.length)\n return (\n <div role=\"group\" aria-roledescription=\"carousel\" aria-label={label} className={cn('group/carousel relative overflow-hidden', className)}>\n <CarouselTrack\n data-carousel-track\n carousel={carousel}\n swipe={swipe}\n slides={slides.map(({ image, alt }) => (\n <FileImage image={image} alt={alt} loading=\"lazy\" className={cn('size-full', fit === 'cover' ? 'object-cover' : 'object-contain')} />\n ))}\n />\n <CarouselControls carousel={carousel} count={slides.length} swipe={swipe} reveal=\"group-hover/carousel:opacity-100\" className=\"inset-0\" />\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport { cn } from '../lib/cn'\n\nexport type ChoiceOption<T extends string> = { value: T; label: string; description?: ReactNode; disabled?: boolean }\n\n/**\n * `name` groups the radio buttons, so that the arrow keys move between them; `label` names the group for screen\n * readers. A disabled option shows and cannot be chosen.\n */\nexport type ChoicesProps<T extends string> = { name: string; label?: string; options: Array<ChoiceOption<T>>; value: T | undefined; onChange: (value: T) => void }\n\n/** One of a few options, each a card of its own row with a line that says what it means; the chosen one is outlined. */\nexport const Choices = <T extends string>({ name, label, options, value, onChange }: ChoicesProps<T>) => (\n <div role=\"radiogroup\" aria-label={label} className=\"flex flex-col gap-2\">\n {options.map((option) => (\n <label\n key={option.value}\n className={cn(\n 'block rounded-lg border p-3 transition-colors has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-primary',\n option.disabled ? 'cursor-default bg-background opacity-60' : option.value === value ? 'cursor-pointer border-primary bg-primary-soft' : 'cursor-pointer bg-background hover:bg-surface',\n )}\n >\n <input type=\"radio\" name={name} value={option.value} checked={option.value === value} disabled={option.disabled} onChange={() => onChange(option.value)} className=\"sr-only\" />\n <span className={cn('block font-medium', option.value === value && 'text-primary-text')}>{option.label}</span>\n {option.description && <span className=\"mt-0.5 block text-xs leading-snug text-muted-foreground\">{option.description}</span>}\n </label>\n ))}\n </div>\n)\n","import { keepPreviousData, useQuery, useQueryClient } from '@tanstack/react-query'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { useClient } from '../data/api-provider'\nimport { keys } from '../data/query-keys'\nimport { fetchLabels, type Labels } from '../live/relation-labels'\n\n/** The names of the chosen records, fetched in one list call; the previous names stay while the next ones load. */\nexport const usePickedLabels = (target: ResourceModel, view: ViewModel | undefined, ids: string[]): Labels => {\n const client = useClient()\n const queryClient = useQueryClient()\n const sorted = [...new Set(ids)].sort()\n const labels = useQuery({\n queryKey: keys.pickedLabels(target.name, sorted.join(',')),\n enabled: sorted.length > 0,\n placeholderData: keepPreviousData,\n queryFn: () => fetchLabels(queryClient, client, target, sorted, view),\n })\n return labels.data ?? new Map()\n}\n","import { useState } from 'react'\nimport { Token } from '../primitives/token'\nimport { useAdminMeta } from './meta-gate'\nimport { RelationPicker } from './relation-picker'\nimport { usePickedLabels } from './use-picked-labels'\n\ntype One = {\n multiple?: false\n /** The chosen record's key, as text; `undefined` for none. */\n value: string | undefined\n onChange: (key: string) => void\n}\n\ntype Several = {\n multiple: true\n /** The chosen records' keys, as text. */\n value: string[]\n onChange: (keys: string[]) => void\n}\n\nexport type RecordPickerProps = (One | Several) & {\n /** The name of the resource whose records it picks. */\n resource: string\n invalid?: boolean\n}\n\n/**\n * Picks records of a resource of the app with the create form's relation picker: type to narrow them by their search\n * fields or title, scroll for more, choose with the mouse or the keyboard. With `multiple`, each choice is added as a\n * token that can be taken off again, and choosing a chosen record takes it off.\n */\nexport const RecordPicker = (props: RecordPickerProps) => {\n const { resources, views } = useAdminMeta()\n const target = resources[props.resource]\n if (!target) throw new Error(`RecordPicker: the app has no resource named \"${props.resource}\"`)\n if (target.primaryKey.length !== 1) throw new Error(`RecordPicker: \"${props.resource}\" has a composite key, which a picker cannot name`)\n const view = views[props.resource]\n const keys = props.multiple ? props.value : props.value === undefined ? [] : [props.value]\n // The names of records chosen here, so a choice shows its name before the names are fetched.\n const [known, setKnown] = useState<Record<string, string>>({})\n const fetched = usePickedLabels(target, view, keys)\n const labelOf = (key: string) => known[key] ?? fetched.get(key) ?? key\n const remember = (key: string, label: string) => setKnown((current) => ({ ...current, [key]: label }))\n\n if (!props.multiple) {\n const { value, onChange } = props\n return (\n <RelationPicker\n target={target}\n view={view}\n value={value ?? ''}\n label={value === undefined ? undefined : labelOf(value)}\n invalid={props.invalid}\n onChange={(key, label) => {\n remember(key, label)\n onChange(key)\n }}\n />\n )\n }\n\n const { value, onChange } = props\n return (\n <div className=\"flex flex-col gap-2\">\n <RelationPicker\n target={target}\n view={view}\n value=\"\"\n chosen={value}\n several\n invalid={props.invalid}\n onChange={(key, label) => {\n remember(key, label)\n onChange(value.includes(key) ? value.filter((chosen) => chosen !== key) : [...value, key])\n }}\n />\n {value.length > 0 && (\n <div className=\"flex flex-wrap gap-1\">\n {value.map((key) => (\n <Token key={key} label={labelOf(key)} onRemove={() => onChange(value.filter((chosen) => chosen !== key))} />\n ))}\n </div>\n )}\n </div>\n )\n}\n"],"m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D,CACU,SACF,OACN,MAAM,GACN,OAAQqE,EACR,QAAA,GACA,QAASW,EAAM,QACf,UAAW,EAAK,IAAU,CACxBO,EAASD,EAAK5C,CAAK,EACnB4B,EAASD,EAAM,SAASiB,CAAG,EAAIjB,EAAM,OAAQ,GAAWoB,IAAWH,CAAG,EAAI,CAAC,GAAGjB,EAAOiB,CAAG,CAAC,CAC3F,CACD,CAAA,EACAjB,EAAM,OAAS,IACd,EAAA9B,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,uBACZ,SAAA8B,EAAM,IAAK,IACV,EAAA9B,EAAA,IAAA,CAACjC,GAAD,CAAiB,MAAO+E,EAAQC,CAAG,EAAG,aAAgBhB,EAASD,EAAM,OAAQ,GAAWoB,IAAWH,CAAG,CAAC,CAAI,EAA/FA,CAA+F,CAC5G,CACE,CAAA,CAEJ,GAET","debugId":"9211f24c-1ea6-48fc-8b00-d595e377b919"}
|
|
1
|
+
{"version":3,"file":"shared-protobase-ui-DtoVw1Ll.js","names":["useMemo","useState","__toESM","require_react","require_jsx_runtime","keepPreviousData","useQuery","useQueryClient","fetchLabels","useRecord","useAdminMeta","isFramed","MentionedText","dayIn","ChatThread","Dialog","mentionedIds","ResponsiveDialog","mergeUi","useResourceClient","useGuardedPress","uiFromModule","keys","useCarousel","useListDisplay","CodeForm","useOptionalAuth","pluginApi","useMeta","protobaseVersion","ApiProvider","ChatMessage","Button","usePlugin","useClient","LogoMark","ResendCodeButton","Composer","formatWeekdayDate","emptyDraft","AuthLayout","useArmedAfterFocus","MenuSelect","CarouselControls","CarouselTrack","SignInPrompt","parseDiff","shownImage","useMarkNotificationsRead","Markdown","ActionCard","Input","Form","OtpInput","AssistantDock","defineUi","useFacets","useBackendData","useMembers","diffStats","useAppAddress","DiffView","AppLink","useInbox","ActionInputError","useApiToken","Spinner","text","buttonClass","useAssistantClient","RelationPicker","StepList","Textarea","isConflict","useSeries","useUnreadNotifications","Token","PartView","useList","useOptionalListDisplay","useUpdateRecord","useLayoutRecord","usePushNotifications","FileImage","App","useHistogram","useAssistant","definePlugin","CompactTable","Section","MentionBox","viewerZone","SidePanel","useFieldControl","FieldList","Field","allowDelayMs","Segmented","cn","dayBefore","day","sameChatDay","a","zone","b","chatDayLabel","time","today","now","import_jsx_runtime","ChatDivider","shown","label","line","tone","RecordLink","rest","display","around","name","resource","row","recordKey","import_react","signedInUserOf","state","useSignedInUser","box","carouselSlides","images","image","Carousel","slides","carousel","className","fit","Choices","options","option","value","onChange","usePickedLabels","client","queryClient","sorted","ids","target","view","RecordPicker","resources","props","views","known","setKnown","fetched","labelOf","key","remember","current","chosen"],"sources":["../../../src/chat/chat-day.ts","../../../src/chat/chat-divider.tsx","../../../src/app/displays/record-link.tsx","../../../src/auth/use-signed-in-user.ts","../../../src/carousel/carousel-images.ts","../../../src/carousel/carousel.tsx","../../../src/primitives/choices.tsx","../../../src/app/use-picked-labels.ts","../../../src/app/record-picker.tsx"],"sourcesContent":["import { formatWeekdayDate } from '../format/date'\nimport { dayIn, viewerZone } from '../format/zone'\nimport { text } from './messages'\n\nconst dayBefore = (day: string) => new Date(Date.parse(`${day}T00:00:00Z`) - 86_400_000).toISOString().slice(0, 10)\n\n/** Whether two ISO timestamps fall on the same day in `zone`, the viewer's unless given: a day divider goes between two messages that do not. */\nexport const sameChatDay = (a: string, b: string, zone = viewerZone()) => dayIn(Date.parse(a), zone) === dayIn(Date.parse(b), zone)\n\n/** The label of the divider above a day's first message, sent at `time`: \"Today\", \"Yesterday\" or \"Mon, 26 Oct 2026\", as the viewer's calendar in `zone` has it. */\nexport const chatDayLabel = (time: string, now = Date.now(), zone = viewerZone()) => {\n const day = dayIn(Date.parse(time), zone)\n const today = dayIn(now, zone)\n if (day === today) return text('today')\n if (day === dayBefore(today)) return text('yesterday')\n return formatWeekdayDate(Date.parse(`${day}T00:00:00Z`))\n}\n","import { cn } from '../lib/cn'\nimport { text } from './messages'\n\nexport type ChatDividerProps =\n /** A muted line between the messages of two days, labelled with the later one, such as by `chatDayLabel`. */\n | { tone?: 'day'; label: string }\n /** A line above the first message the reader has not seen, \"New messages\" unless labelled otherwise. */\n | { tone: 'new'; label?: string }\n\n/**\n * A line across a chat with a label in its middle, between the messages of two days or above the new ones. Marked\n * `data-chat-divider`, so a thread keeps the reader's place on the message below it, not on the divider.\n */\nexport const ChatDivider = ({ tone = 'day', label }: ChatDividerProps) => {\n const shown = label ?? text('newMessages')\n const line = cn('h-px flex-1', tone === 'new' ? 'bg-danger' : 'bg-border')\n return (\n <div role=\"separator\" aria-label={shown} data-tone={tone} data-chat-divider=\"\" className=\"flex items-center gap-3 text-xs font-medium\">\n <span className={line} />\n <span className={tone === 'new' ? 'text-danger' : 'text-muted-foreground'}>{shown}</span>\n <span className={line} />\n </div>\n )\n}\n","import type { AnchorHTMLAttributes } from 'react'\nimport type { KeyValue } from '@protobase/schema'\nimport { useLayoutRecord } from '../pages/record-scope'\nimport { AppLink } from '../use-app-address'\nimport { useOptionalListDisplay } from './display-context'\nimport type { ListDisplayRow } from './list-displays'\n\ntype Target = { row: ListDisplayRow; resource?: never; recordKey?: never } | { row?: never; resource?: string; recordKey: KeyValue | readonly KeyValue[] }\n\n/**\n * A link to a record's page, through the app's addresses: a list display's `row`, or a `recordKey` of `resource`. The\n * resource defaults to the list display's or the record's around it, so a custom component never writes a path.\n */\nexport const RecordLink = ({ row, resource, recordKey, ...rest }: AnchorHTMLAttributes<HTMLAnchorElement> & Target) => {\n const display = useOptionalListDisplay()\n const around = useLayoutRecord()\n const name = resource ?? display?.resource ?? around?.model.name\n if (name === undefined) throw new Error('RecordLink needs a resource outside a list display or a record')\n return <AppLink to={{ kind: 'record', resource: name, key: row ? row.key : recordKey }} {...rest} />\n}\n","import { useMemo } from 'react'\nimport { useOptionalAuth, type AuthState } from './auth-provider'\n\n/** Who is signed in: their user id, the id `.author()` stores and mentions hold, and their name. */\nexport type SignedInUser = { id: string; name?: string }\n\n/** The signed-in person of an auth state; none while it loads, for a visitor, and before the sign-in finished. */\nexport const signedInUserOf = (state: AuthState | undefined): SignedInUser | undefined => {\n if (state?.kind !== 'signed-in') return\n const { id, name } = state.user\n return { id, ...(name && { name }) }\n}\n\n/**\n * The signed-in person, from the session the app already holds, such as for a filter on their own user id;\n * `undefined` while the session loads, for a visitor and when nobody is signed in.\n */\nexport const useSignedInUser = (): SignedInUser | undefined => {\n const state = useOptionalAuth()?.state\n return useMemo(() => signedInUserOf(state), [state])\n}\n","import type { StoredFile } from '@protobase/client'\nimport { shownImage } from '../live/file-values'\n\n/** An image a carousel shows: a link with what it shows, or a file field's value, as records carry it. */\nexport type CarouselImage = { src: string; alt: string } | (StoredFile & { alt?: string })\n\n// A frame up to about half a page wide: of a file's variants, the smallest that covers it is drawn, the file itself when none does\nconst box = { width: 640, height: 480 }\n\n/** What each slide draws, in order: a file that is missing or is no raster image is left out. */\nexport const carouselSlides = (images: readonly CarouselImage[]) =>\n images.flatMap((image) => {\n if ('src' in image) return [{ image: { url: image.src }, alt: image.alt }]\n const shown = shownImage(image, box)\n return shown ? [{ image: shown, alt: image.alt ?? '' }] : []\n })\n","import { cn } from '../lib/cn'\nimport { FileImage } from '../live/file-image'\nimport { CarouselControls } from './carousel-controls'\nimport { carouselSlides, type CarouselImage } from './carousel-images'\nimport { CarouselTrack } from './carousel-track'\nimport { useCarousel } from './use-carousel'\n\nexport type CarouselProps = {\n /** The images in order: links with what each shows, or file field values. */\n images: readonly CarouselImage[]\n /** What the images are, read out with the carousel. */\n label?: string\n /** `cover` fills the frame and crops what overflows it, the default; `contain` shows each image whole. */\n fit?: 'cover' | 'contain'\n /** Whether a swipe steps through the images; off, it scrolls what the carousel sits in, such as a row that scrolls sideways. */\n swipe?: boolean\n /** The frame's classes, such as its aspect ratio, border and rounding. */\n className?: string\n}\n\n/**\n * Images side by side in a frame that snaps image by image, swiped on a touch screen or moved by arrows on hover, with\n * dots marking the one in view; the record cards' photos step the same way. A single image shows without arrows or dots.\n */\nexport const Carousel = ({ images, label, fit = 'cover', swipe = true, className }: CarouselProps) => {\n const slides = carouselSlides(images)\n const carousel = useCarousel(slides.length)\n return (\n <div role=\"group\" aria-roledescription=\"carousel\" aria-label={label} className={cn('group/carousel relative overflow-hidden', className)}>\n <CarouselTrack\n data-carousel-track\n carousel={carousel}\n swipe={swipe}\n slides={slides.map(({ image, alt }) => (\n <FileImage image={image} alt={alt} loading=\"lazy\" className={cn('size-full', fit === 'cover' ? 'object-cover' : 'object-contain')} />\n ))}\n />\n <CarouselControls carousel={carousel} count={slides.length} swipe={swipe} reveal=\"group-hover/carousel:opacity-100\" className=\"inset-0\" />\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport { cn } from '../lib/cn'\n\nexport type ChoiceOption<T extends string> = { value: T; label: string; description?: ReactNode; disabled?: boolean }\n\n/**\n * `name` groups the radio buttons, so that the arrow keys move between them; `label` names the group for screen\n * readers. A disabled option shows and cannot be chosen.\n */\nexport type ChoicesProps<T extends string> = { name: string; label?: string; options: Array<ChoiceOption<T>>; value: T | undefined; onChange: (value: T) => void }\n\n/** One of a few options, each a card of its own row with a line that says what it means; the chosen one is outlined. */\nexport const Choices = <T extends string>({ name, label, options, value, onChange }: ChoicesProps<T>) => (\n <div role=\"radiogroup\" aria-label={label} className=\"flex flex-col gap-2\">\n {options.map((option) => (\n <label\n key={option.value}\n className={cn(\n 'block rounded-lg border p-3 transition-colors has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-primary',\n option.disabled ? 'cursor-default bg-background opacity-60' : option.value === value ? 'cursor-pointer border-primary bg-primary-soft' : 'cursor-pointer bg-background hover:bg-surface',\n )}\n >\n <input type=\"radio\" name={name} value={option.value} checked={option.value === value} disabled={option.disabled} onChange={() => onChange(option.value)} className=\"sr-only\" />\n <span className={cn('block font-medium', option.value === value && 'text-primary-text')}>{option.label}</span>\n {option.description && <span className=\"mt-0.5 block text-xs leading-snug text-muted-foreground\">{option.description}</span>}\n </label>\n ))}\n </div>\n)\n","import { keepPreviousData, useQuery, useQueryClient } from '@tanstack/react-query'\nimport type { ResourceModel, ViewModel } from '@protobase/schema'\nimport { useClient } from '../data/api-provider'\nimport { keys } from '../data/query-keys'\nimport { fetchLabels, type Labels } from '../live/relation-labels'\n\n/** The names of the chosen records, fetched in one list call; the previous names stay while the next ones load. */\nexport const usePickedLabels = (target: ResourceModel, view: ViewModel | undefined, ids: string[]): Labels => {\n const client = useClient()\n const queryClient = useQueryClient()\n const sorted = [...new Set(ids)].sort()\n const labels = useQuery({\n queryKey: keys.pickedLabels(target.name, sorted.join(',')),\n enabled: sorted.length > 0,\n placeholderData: keepPreviousData,\n queryFn: () => fetchLabels(queryClient, client, target, sorted, view),\n })\n return labels.data ?? new Map()\n}\n","import { useState } from 'react'\nimport { Token } from '../primitives/token'\nimport { useAdminMeta } from './meta-gate'\nimport { RelationPicker } from './relation-picker'\nimport { usePickedLabels } from './use-picked-labels'\n\ntype One = {\n multiple?: false\n /** The chosen record's key, as text; `undefined` for none. */\n value: string | undefined\n onChange: (key: string) => void\n}\n\ntype Several = {\n multiple: true\n /** The chosen records' keys, as text. */\n value: string[]\n onChange: (keys: string[]) => void\n}\n\nexport type RecordPickerProps = (One | Several) & {\n /** The name of the resource whose records it picks. */\n resource: string\n invalid?: boolean\n}\n\n/**\n * Picks records of a resource of the app with the create form's relation picker: type to narrow them by their search\n * fields or title, scroll for more, choose with the mouse or the keyboard. With `multiple`, each choice is added as a\n * token that can be taken off again, and choosing a chosen record takes it off.\n */\nexport const RecordPicker = (props: RecordPickerProps) => {\n const { resources, views } = useAdminMeta()\n const target = resources[props.resource]\n if (!target) throw new Error(`RecordPicker: the app has no resource named \"${props.resource}\"`)\n if (target.primaryKey.length !== 1) throw new Error(`RecordPicker: \"${props.resource}\" has a composite key, which a picker cannot name`)\n const view = views[props.resource]\n const keys = props.multiple ? props.value : props.value === undefined ? [] : [props.value]\n // The names of records chosen here, so a choice shows its name before the names are fetched.\n const [known, setKnown] = useState<Record<string, string>>({})\n const fetched = usePickedLabels(target, view, keys)\n const labelOf = (key: string) => known[key] ?? fetched.get(key) ?? key\n const remember = (key: string, label: string) => setKnown((current) => ({ ...current, [key]: label }))\n\n if (!props.multiple) {\n const { value, onChange } = props\n return (\n <RelationPicker\n target={target}\n view={view}\n value={value ?? ''}\n label={value === undefined ? undefined : labelOf(value)}\n invalid={props.invalid}\n onChange={(key, label) => {\n remember(key, label)\n onChange(key)\n }}\n />\n )\n }\n\n const { value, onChange } = props\n return (\n <div className=\"flex flex-col gap-2\">\n <RelationPicker\n target={target}\n view={view}\n value=\"\"\n chosen={value}\n several\n invalid={props.invalid}\n onChange={(key, label) => {\n remember(key, label)\n onChange(value.includes(key) ? value.filter((chosen) => chosen !== key) : [...value, key])\n }}\n />\n {value.length > 0 && (\n <div className=\"flex flex-wrap gap-1\">\n {value.map((key) => (\n <Token key={key} label={labelOf(key)} onRemove={() => onChange(value.filter((chosen) => chosen !== key))} />\n ))}\n </div>\n )}\n </div>\n )\n}\n"],"mappings":"g9BAIA,IAAMmG,GAAa,GAAgB,IAAI,KAAK,KAAK,MAAM,GAAGC,EAAI,WAAW,EAAI,KAAU,CAAA,CAAE,YAAY,CAAC,CAAC,MAAM,EAAG,EAAE,EAGrGC,IAAe,EAAW,EAAW,EAAOV,EAAW,IAAM9E,EAAM,KAAK,MAAMyF,CAAC,EAAGC,CAAI,IAAM1F,EAAM,KAAK,MAAM2F,CAAC,EAAGD,CAAI,EAGrHE,IAAgB,EAAc,EAAM,KAAK,IAAI,EAAG,EAAOd,EAAW,IAAM,CACnF,IAAMS,EAAMvF,EAAM,KAAK,MAAM6F,CAAI,EAAGH,CAAI,EAClCI,EAAQ9F,EAAM+F,EAAKL,CAAI,EAG7B,OAFIH,IAAQO,EAAcxC,EAAK,OAAO,EAClCiC,IAAQD,GAAUQ,CAAK,EAAUxC,EAAK,WAAW,EAC9C7B,EAAkB,KAAK,MAAM,GAAG8D,EAAI,WAAW,CAAC,CACzD,aCHaU,IAAe,CAAE,OAAO,MAAO,WAA8B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|
2
2
|
"name": "@protobase/ui",
|
|
3
|
-
"version": "0.55.
|
|
3
|
+
"version": "0.55.10",
|
|
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.55.
|
|
43
|
-
"@protobase/layout": "0.55.
|
|
44
|
-
"@protobase/schema": "0.55.
|
|
42
|
+
"@protobase/client": "0.55.10",
|
|
43
|
+
"@protobase/layout": "0.55.10",
|
|
44
|
+
"@protobase/schema": "0.55.10",
|
|
45
45
|
"@sentry/browser": "^11.7.0",
|
|
46
46
|
"@tanstack/react-query": "^5.104.1",
|
|
47
47
|
"@tanstack/react-table": "^9.2.6",
|