Mercurial > repos > fubar > jbrowse2
view x/static/js/3199.a36b17a7.chunk.js.map @ 127:fbabf7498471 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 116b1a4bbd62251ad552306df2dc8aa8f46c6721
author | fubar |
---|---|
date | Mon, 07 Oct 2024 02:11:55 +0000 |
parents | 49f3d3878413 |
children |
line wrap: on
line source
{"version":3,"file":"static/js/3199.a36b17a7.chunk.js","mappings":"kRAiBA,MAAMA,GAA0BC,EAAAA,EAAAA,OAC9B,IAAM,kCAGFC,GAAYC,EAAAA,EAAAA,KAAAA,EAAa,KAAM,CACnCC,KAAM,CACJC,WAAY,SACZC,SAAU,SACVC,aAAc,gBAoIlB,GAhIqBC,EAAAA,EAAAA,WAAS,UAAU,MACtCC,IAIA,MAAM,QAAEC,GAAYR,KACd,UACJS,EAAS,6BACTC,EAA4B,mBAC5BC,EAAkB,kBAClBC,GACEL,EAEEM,GAAUC,EAAAA,EAAAA,YAAWP,GACrBQ,EAAc,IAAIC,IAAIL,GACtBM,EAAOR,EACVS,QAAOC,GAAKJ,EAAYK,IAAID,EAAEE,gBAC9BC,KAAI,CAACC,EAAQC,KACZ,MAAM,aAAEH,KAAiBI,GAASF,EAClC,MAAO,IACFA,EACHG,GAAIF,EACJH,eACAM,WAAWC,EAAAA,EAAAA,mBAAkBH,GAC7BI,iBAAkBN,EACnB,IAGCO,EAAS,CACb,GACAC,KAAKC,KACHC,EAAAA,EAAAA,aAAY,gBAAiB,IAAM,IACnCC,EAAAA,EAAAA,kBAAiBjB,EAAKK,KAAIa,GAAOA,EAAIR,cAEvCI,KAAKC,KACHC,EAAAA,EAAAA,aAAY,QAAS,IAAM,IAC3BC,EAAAA,EAAAA,kBAAiBjB,EAAKK,KAAIa,GAAOA,EAAIC,UAEvCL,KAAKC,KACHC,EAAAA,EAAAA,aAAY,WAAY,IAAM,IAC9BC,EAAAA,EAAAA,kBAAiBjB,EAAKK,KAAIa,GAAOA,EAAId,iBAEvC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C,MAAMC,GAAQ,IAAIC,aAAcC,OAAOH,IACjC,QAAEI,SAAkB,sCACpB,cAAEC,SAAwB,6CAE1BC,EAAUD,EADCD,EAAQH,IAEnBM,EAAMD,EAAQE,QAAQ,KAC5B,OAAOD,EAAM,EACTD,EAAQG,MAAM,EAAGF,GAAKd,WAAW,IAAK,KAAKA,WAAW,IAAK,KAC3Da,EAAQb,WAAW,IAAK,KAAKA,WAAW,IAAK,IACnD,C","sources":["../../../plugins/grid-bookmark/src/GridBookmarkWidget/components/BookmarkGrid.tsx","../../../plugins/grid-bookmark/src/GridBookmarkWidget/components/AssemblySelector.tsx","../../../plugins/grid-bookmark/src/GridBookmarkWidget/components/GridBookmarkWidget.tsx","../../../plugins/grid-bookmark/src/GridBookmarkWidget/utils.ts"],"sourcesContent":["import React, { lazy } from 'react'\nimport { observer } from 'mobx-react'\nimport { Link } from '@mui/material'\nimport { makeStyles } from 'tss-react/mui'\nimport { DataGrid, GRID_CHECKBOX_SELECTION_COL_DEF } from '@mui/x-data-grid'\nimport {\n getSession,\n assembleLocString,\n measureGridWidth,\n measureText,\n} from '@jbrowse/core/util'\nimport ColorPicker from '@jbrowse/core/ui/ColorPicker'\n\n// locals\nimport { navToBookmark } from '../utils'\nimport { GridBookmarkModel } from '../model'\n\nconst EditBookmarkLabelDialog = lazy(\n () => import('./dialogs/EditBookmarkLabelDialog'),\n)\n\nconst useStyles = makeStyles()(() => ({\n cell: {\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n}))\n\nconst BookmarkGrid = observer(function ({\n model,\n}: {\n model: GridBookmarkModel\n}) {\n const { classes } = useStyles()\n const {\n bookmarks,\n bookmarksWithValidAssemblies,\n selectedAssemblies,\n selectedBookmarks,\n } = model\n\n const session = getSession(model)\n const selectedSet = new Set(selectedAssemblies)\n const rows = bookmarks\n .filter(r => selectedSet.has(r.assemblyName))\n .map((region, index) => {\n const { assemblyName, ...rest } = region\n return {\n ...region,\n id: index,\n assemblyName,\n locString: assembleLocString(rest),\n correspondingObj: region,\n }\n })\n\n const widths = [\n 50,\n Math.max(\n measureText('Bookmark link', 12) + 30,\n measureGridWidth(rows.map(row => row.locString)),\n ),\n Math.max(\n measureText('Label', 12) + 30,\n measureGridWidth(rows.map(row => row.label)),\n ),\n Math.max(\n measureText('Assembly', 12) + 30,\n measureGridWidth(rows.map(row => row.assemblyName)),\n ),\n 100,\n ]\n\n return (\n <DataGrid\n autoHeight\n density=\"compact\"\n rows={rows}\n columns={[\n {\n ...GRID_CHECKBOX_SELECTION_COL_DEF,\n width: widths[0],\n },\n {\n field: 'locString',\n headerName: 'Bookmark link',\n width: widths[1],\n renderCell: ({ value, row }) => (\n <Link\n className={classes.cell}\n href=\"#\"\n onClick={async event => {\n event.preventDefault()\n const { views } = session\n await navToBookmark(value, row.assemblyName, views, model)\n }}\n >\n {value}\n </Link>\n ),\n },\n {\n field: 'label',\n headerName: 'Label',\n width: widths[2],\n editable: true,\n },\n {\n field: 'assemblyName',\n headerName: 'Assembly',\n width: widths[3],\n },\n {\n field: 'highlight',\n headerName: 'Highlight',\n width: widths[4],\n renderCell: ({ value, row }) => (\n <ColorPicker\n color={value || 'black'}\n onChange={event => {\n model.updateBookmarkHighlight(row, event)\n }}\n />\n ),\n },\n ]}\n onCellDoubleClick={({ row }) => {\n getSession(model).queueDialog(onClose => [\n EditBookmarkLabelDialog,\n { onClose, model, dialogRow: row },\n ])\n }}\n processRowUpdate={row => {\n const target = rows[row.id]!\n model.updateBookmarkLabel(target, row.label)\n return row\n }}\n onProcessRowUpdateError={e => {\n session.notifyError(`${e}`, e)\n }}\n checkboxSelection\n onRowSelectionModelChange={newRowSelectionModel => {\n if (bookmarksWithValidAssemblies.length > 0) {\n model.setSelectedBookmarks(\n newRowSelectionModel.map(value => ({\n ...rows[value as number]!,\n })),\n )\n }\n }}\n rowSelectionModel={selectedBookmarks.map(r => r.id)}\n disableRowSelectionOnClick\n />\n )\n})\n\nexport default BookmarkGrid\n","import React from 'react'\nimport { observer } from 'mobx-react'\n\nimport {\n Checkbox,\n FormControl,\n InputLabel,\n ListItemText,\n MenuItem,\n OutlinedInput,\n Select,\n} from '@mui/material'\n\n// locals\nimport { GridBookmarkModel } from '../model'\n\nconst AssemblySelector = observer(function ({\n model,\n}: {\n model: GridBookmarkModel\n}) {\n const { validAssemblies, selectedAssemblies } = model\n const noAssemblies = validAssemblies.size === 0\n const label = 'Select assemblies'\n const id = 'select-assemblies-label'\n const selectedSet = new Set(selectedAssemblies)\n const isAllSelected = [...validAssemblies].every(e => selectedSet.has(e))\n\n return (\n <FormControl disabled={noAssemblies} fullWidth>\n <InputLabel id={id}>{label}</InputLabel>\n <Select\n labelId={id}\n multiple\n value={selectedAssemblies}\n onChange={event => {\n model.setSelectedAssemblies([...event.target.value])\n }}\n input={<OutlinedInput label={label} />}\n renderValue={selected => selected.join(', ')}\n >\n <MenuItem\n onClickCapture={event => {\n // onClickCapture allows us to avoid the parent Select onChange from triggering\n if (isAllSelected) {\n model.setSelectedAssemblies([])\n } else {\n model.setSelectedAssemblies(undefined)\n }\n event.preventDefault()\n }}\n >\n <Checkbox\n checked={isAllSelected}\n indeterminate={!isAllSelected && selectedAssemblies.length > 0}\n />\n <ListItemText primary=\"Select all\" />\n </MenuItem>\n {[...validAssemblies].map(name => (\n <MenuItem key={name} value={name}>\n <Checkbox checked={selectedAssemblies.includes(name)} />\n <ListItemText primary={name} />\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n )\n})\n\nexport default AssemblySelector\n","import React, { lazy } from 'react'\nimport { observer } from 'mobx-react'\nimport { makeStyles } from 'tss-react/mui'\nimport { getSession } from '@jbrowse/core/util'\nimport { Alert } from '@mui/material'\nimport CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton'\n\n// locals\nimport BookmarkGrid from './BookmarkGrid'\nimport AssemblySelector from './AssemblySelector'\nimport { GridBookmarkModel } from '../model'\n\n// icons\nimport Menu from '@mui/icons-material/Menu'\nimport GetApp from '@mui/icons-material/GetApp'\nimport Publish from '@mui/icons-material/Publish'\nimport Settings from '@mui/icons-material/Settings'\nimport Palette from '@mui/icons-material/Palette'\nimport Share from '@mui/icons-material/Share'\nimport Delete from '@mui/icons-material/Delete'\n\n// lazies\nconst ExportBookmarksDialog = lazy(\n () => import('./dialogs/ExportBookmarksDialog'),\n)\nconst ImportBookmarksDialog = lazy(\n () => import('./dialogs/ImportBookmarksDialog'),\n)\nconst ShareBookmarksDialog = lazy(\n () => import('./dialogs/ShareBookmarksDialog'),\n)\nconst HighlightSettingsDialog = lazy(\n () => import('./dialogs/HighlightSettingsDialog'),\n)\nconst EditHighlightColorDialog = lazy(\n () => import('./dialogs/EditHighlightColorDialog'),\n)\nconst DeleteBookmarksDialog = lazy(\n () => import('./dialogs/DeleteBookmarksDialog'),\n)\n\nconst useStyles = makeStyles()({\n flex: {\n display: 'flex',\n },\n})\n\nconst GridBookmarkWidget = observer(function GridBookmarkWidget({\n model,\n}: {\n model: GridBookmarkModel\n}) {\n const { classes } = useStyles()\n return (\n <div>\n <Alert severity=\"info\">\n Click and type within the <strong>label</strong> field to annotate your\n bookmark. Double click the <strong>label</strong> field to do so within\n a dialog.\n </Alert>\n <div className={classes.flex}>\n <CascadingMenuButton\n data-testid=\"grid_bookmark_menu\"\n menuItems={[\n {\n label: 'Export',\n icon: GetApp,\n onClick: () => {\n getSession(model).queueDialog(onClose => [\n ExportBookmarksDialog,\n { onClose, model },\n ])\n },\n },\n {\n label: 'Import',\n icon: Publish,\n onClick: () => {\n getSession(model).queueDialog(onClose => [\n ImportBookmarksDialog,\n { model, onClose },\n ])\n },\n },\n {\n label: 'Delete',\n icon: Delete,\n onClick: () => {\n getSession(model).queueDialog(onClose => [\n DeleteBookmarksDialog,\n { model, onClose },\n ])\n },\n },\n {\n label: 'Share',\n icon: Share,\n onClick: () => {\n getSession(model).queueDialog(onClose => [\n ShareBookmarksDialog,\n { model, onClose },\n ])\n },\n },\n {\n label: 'Edit colors',\n icon: Palette,\n onClick: () => {\n getSession(model).queueDialog(onClose => [\n EditHighlightColorDialog,\n { model, onClose },\n ])\n },\n },\n {\n label: 'Settings',\n icon: Settings,\n onClick: () => {\n getSession(model).queueDialog(onClose => [\n HighlightSettingsDialog,\n { model, onClose },\n ])\n },\n },\n ]}\n >\n <Menu />\n </CascadingMenuButton>\n\n <AssemblySelector model={model} />\n </div>\n <BookmarkGrid model={model} />\n </div>\n )\n})\n\nexport default GridBookmarkWidget\n","import { saveAs } from 'file-saver'\nimport { getSession, assembleLocString } from '@jbrowse/core/util'\nimport { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'\nimport { AbstractViewModel } from '@jbrowse/core/util/types'\n\n// locals\nimport { GridBookmarkModel } from './model'\n\ntype LGV = LinearGenomeViewModel\n\ntype MaybeLGV = LGV | undefined\n\nexport async function navToBookmark(\n locString: string,\n assembly: string,\n views: AbstractViewModel[],\n model: GridBookmarkModel,\n) {\n const session = getSession(model)\n try {\n // get the focused view\n let view = views.find(view => view.id === session.focusedViewId) as MaybeLGV\n\n // check if the focused view is the appropriate assembly, if not proceed\n if (view?.assemblyNames[0] !== assembly) {\n view = views.find(\n elt =>\n // @ts-expect-error\n elt.type === 'LinearGenomeView' && elt.assemblyNames[0] === assembly,\n ) as MaybeLGV\n }\n\n // if no view is opened of the selectedAssembly, open a new\n // view with that assembly\n if (!view) {\n const newViewId = `${model.id}_${assembly}`\n view = session.addView('LinearGenomeView', {\n id: newViewId,\n }) as LGV\n }\n await view.navToLocString(locString, assembly)\n } catch (e) {\n console.error(e)\n session.notifyError(`${e}`, e)\n }\n}\n\nexport function downloadBookmarkFile(\n fileFormat: string,\n model: GridBookmarkModel,\n) {\n const { selectedBookmarks, bookmarksWithValidAssemblies } = model\n const bookmarksToDownload =\n selectedBookmarks.length === 0\n ? bookmarksWithValidAssemblies\n : selectedBookmarks\n\n if (fileFormat === 'BED') {\n const fileHeader = ''\n const fileContents: Record<string, string[]> = {}\n bookmarksToDownload.forEach(bookmark => {\n const { label } = bookmark\n const labelVal = label === '' ? '.' : label\n const line = `${bookmark.refName}\\t${bookmark.start}\\t${bookmark.end}\\t${labelVal}\\n`\n\n if (fileContents[bookmark.assemblyName]) {\n fileContents[bookmark.assemblyName]!.push(line)\n } else {\n fileContents[bookmark.assemblyName] = [line]\n }\n })\n\n for (const assembly in fileContents) {\n const fileContent = fileContents[assembly]!.reduce(\n (a, b) => a + b,\n fileHeader,\n )\n const blob = new Blob([fileContent || ''], {\n type: 'text/x-bed;charset=utf-8',\n })\n const fileName = `jbrowse_bookmarks_${assembly}.bed`\n saveAs(blob, fileName)\n }\n } else {\n // TSV\n const fileHeader = 'chrom\\tstart\\tend\\tlabel\\tassembly_name\\tcoord_range\\n'\n\n const fileContents = bookmarksToDownload\n .map(bookmark => {\n const { label } = bookmark\n const labelVal = label === '' ? '.' : label\n const locString = assembleLocString(bookmark)\n return `${bookmark.refName}\\t${bookmark.start + 1}\\t${\n bookmark.end\n }\\t${labelVal}\\t${bookmark.assemblyName}\\t${locString}\\n`\n })\n .reduce((a, b) => a + b, fileHeader)\n\n const blob = new Blob([fileContents || ''], {\n type: 'text/tab-separated-values;charset=utf-8',\n })\n const fileName = 'jbrowse_bookmarks.tsv'\n saveAs(blob, fileName)\n }\n}\n\n/**\n * Pad the end of a base64 string with \"=\" to make it valid\n * @param b64 - unpadded b64 string\n */\nexport function b64PadSuffix(b64: string): string {\n let num = 0\n const mo = b64.length % 4\n switch (mo) {\n case 3:\n num = 1\n break\n case 2:\n num = 2\n break\n case 0:\n num = 0\n break\n default:\n throw new Error('base64 not a valid length')\n }\n return b64 + '='.repeat(num)\n}\n\n/**\n * Decode and inflate a url-safe base64 to a string\n * See {@link https://en.wikipedia.org/wiki/Base64#URL_applications}\n * @param b64 - a base64 string to decode and inflate\n */\nexport async function fromUrlSafeB64(b64: string) {\n const originalB64 = b64PadSuffix(\n b64.replaceAll('-', '+').replaceAll('_', '/'),\n )\n const { toByteArray } = await import('base64-js')\n const { inflate } = await import('pako')\n const bytes = toByteArray(originalB64)\n const inflated = inflate(bytes)\n return new TextDecoder().decode(inflated)\n}\n\n/**\n * Compress and encode a string as url-safe base64\n * See {@link https://en.wikipedia.org/wiki/Base64#URL_applications}\n * @param str- a string to compress and encode\n */\nexport async function toUrlSafeB64(str: string) {\n const bytes = new TextEncoder().encode(str)\n const { deflate } = await import('pako')\n const { fromByteArray } = await import('base64-js')\n const deflated = deflate(bytes)\n const encoded = fromByteArray(deflated)\n const pos = encoded.indexOf('=')\n return pos > 0\n ? encoded.slice(0, pos).replaceAll('+', '-').replaceAll('/', '_')\n : encoded.replaceAll('+', '-').replaceAll('/', '_')\n}\n"],"names":["EditBookmarkLabelDialog","lazy","useStyles","makeStyles","cell","whiteSpace","overflow","textOverflow","observer","model","classes","bookmarks","bookmarksWithValidAssemblies","selectedAssemblies","selectedBookmarks","session","getSession","selectedSet","Set","rows","filter","r","has","assemblyName","map","region","index","rest","id","locString","assembleLocString","correspondingObj","widths","Math","max","measureText","measureGridWidth","row","label","React","DataGrid","autoHeight","density","columns","GRID_CHECKBOX_SELECTION_COL_DEF","width","field","headerName","renderCell","value","Link","className","href","onClick","async","event","preventDefault","views","navToBookmark","editable","ColorPicker","color","onChange","updateBookmarkHighlight","onCellDoubleClick","queueDialog","onClose","dialogRow","processRowUpdate","target","updateBookmarkLabel","onProcessRowUpdateError","e","notifyError","checkboxSelection","onRowSelectionModelChange","newRowSelectionModel","length","setSelectedBookmarks","rowSelectionModel","disableRowSelectionOnClick","validAssemblies","noAssemblies","size","isAllSelected","every","FormControl","disabled","fullWidth","InputLabel","Select","labelId","multiple","setSelectedAssemblies","input","OutlinedInput","renderValue","selected","join","MenuItem","onClickCapture","undefined","Checkbox","checked","indeterminate","ListItemText","primary","name","key","includes","ExportBookmarksDialog","ImportBookmarksDialog","ShareBookmarksDialog","HighlightSettingsDialog","EditHighlightColorDialog","DeleteBookmarksDialog","flex","display","Alert","severity","CascadingMenuButton","menuItems","icon","GetApp","Publish","Delete","Share","Palette","Settings","Menu","AssemblySelector","BookmarkGrid","assembly","view","find","focusedViewId","assemblyNames","elt","type","newViewId","addView","navToLocString","console","error","downloadBookmarkFile","fileFormat","bookmarksToDownload","fileHeader","fileContents","forEach","bookmark","labelVal","line","refName","start","end","push","fileContent","reduce","a","b","blob","Blob","fileName","saveAs","fromUrlSafeB64","b64","originalB64","num","Error","repeat","b64PadSuffix","replaceAll","toByteArray","inflate","inflated","TextDecoder","decode","toUrlSafeB64","str","bytes","TextEncoder","encode","deflate","fromByteArray","encoded","pos","indexOf","slice"],"sourceRoot":""}