@dxos/plugin-wnfs 0.7.4 → 0.7.5-labs.5f04cf6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/lib/browser/FileContainer-4FF5D2ZF.mjs +94 -0
  2. package/dist/lib/browser/FileContainer-4FF5D2ZF.mjs.map +7 -0
  3. package/dist/lib/browser/blockstore-6U5XTSIH.mjs +192 -0
  4. package/dist/lib/browser/blockstore-6U5XTSIH.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-357BWHML.mjs +16 -0
  6. package/dist/lib/browser/chunk-357BWHML.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-VL3H7P4F.mjs → chunk-6YFT42F7.mjs} +5 -8
  8. package/dist/lib/browser/chunk-6YFT42F7.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-ED7HMPYN.mjs +16 -0
  10. package/dist/lib/browser/chunk-ED7HMPYN.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-EMRQJXBW.mjs +60 -0
  12. package/dist/lib/browser/chunk-EMRQJXBW.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-SCQWJNHD.mjs +157 -0
  14. package/dist/lib/browser/chunk-SCQWJNHD.mjs.map +7 -0
  15. package/dist/lib/browser/file-uploader-EDHMSKYS.mjs +29 -0
  16. package/dist/lib/browser/file-uploader-EDHMSKYS.mjs.map +7 -0
  17. package/dist/lib/browser/index.mjs +96 -494
  18. package/dist/lib/browser/index.mjs.map +4 -4
  19. package/dist/lib/browser/intent-resolver-WDO4EIG3.mjs +43 -0
  20. package/dist/lib/browser/intent-resolver-WDO4EIG3.mjs.map +7 -0
  21. package/dist/lib/browser/markdown-MGSH5CVQ.mjs +198 -0
  22. package/dist/lib/browser/markdown-MGSH5CVQ.mjs.map +7 -0
  23. package/dist/lib/browser/meta.json +1 -1
  24. package/dist/lib/browser/react-surface-OUVGXVOP.mjs +81 -0
  25. package/dist/lib/browser/react-surface-OUVGXVOP.mjs.map +7 -0
  26. package/dist/lib/browser/types/index.mjs +2 -2
  27. package/dist/types/src/WnfsPlugin.d.ts +1 -3
  28. package/dist/types/src/WnfsPlugin.d.ts.map +1 -1
  29. package/dist/types/src/blockstore.d.ts +4 -1
  30. package/dist/types/src/blockstore.d.ts.map +1 -1
  31. package/dist/types/src/capabilities/blockstore.d.ts +4 -0
  32. package/dist/types/src/capabilities/blockstore.d.ts.map +1 -0
  33. package/dist/types/src/capabilities/capabilities.d.ts +12 -0
  34. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  35. package/dist/types/src/capabilities/file-uploader.d.ts +4 -0
  36. package/dist/types/src/capabilities/file-uploader.d.ts.map +1 -0
  37. package/dist/types/src/capabilities/index.d.ts +7 -0
  38. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  39. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  40. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  41. package/dist/types/src/capabilities/markdown.d.ts +4 -0
  42. package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
  43. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  44. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  45. package/dist/types/src/components/FileContainer.d.ts +8 -0
  46. package/dist/types/src/components/FileContainer.d.ts.map +1 -0
  47. package/dist/types/src/components/FileInput.d.ts +8 -0
  48. package/dist/types/src/components/FileInput.d.ts.map +1 -0
  49. package/dist/types/src/components/index.d.ts +4 -11
  50. package/dist/types/src/components/index.d.ts.map +1 -1
  51. package/dist/types/src/extensions/image.d.ts +5 -0
  52. package/dist/types/src/extensions/image.d.ts.map +1 -1
  53. package/dist/types/src/extensions/image.stories.d.ts.map +1 -1
  54. package/dist/types/src/helpers/common.d.ts.map +1 -0
  55. package/dist/types/src/helpers/index.d.ts +5 -0
  56. package/dist/types/src/helpers/index.d.ts.map +1 -0
  57. package/dist/types/src/helpers/load.d.ts +13 -0
  58. package/dist/types/src/helpers/load.d.ts.map +1 -0
  59. package/dist/types/src/helpers/upload.d.ts +15 -0
  60. package/dist/types/src/helpers/upload.d.ts.map +1 -0
  61. package/dist/types/src/helpers/wnfs-url.d.ts +11 -0
  62. package/dist/types/src/helpers/wnfs-url.d.ts.map +1 -0
  63. package/dist/types/src/index.d.ts +2 -2
  64. package/dist/types/src/index.d.ts.map +1 -1
  65. package/dist/types/src/meta.d.ts +1 -3
  66. package/dist/types/src/meta.d.ts.map +1 -1
  67. package/dist/types/src/translations.d.ts +14 -0
  68. package/dist/types/src/translations.d.ts.map +1 -1
  69. package/dist/types/src/types/file.d.ts +7 -11
  70. package/dist/types/src/types/file.d.ts.map +1 -1
  71. package/dist/types/src/types/types.d.ts +49 -6
  72. package/dist/types/src/types/types.d.ts.map +1 -1
  73. package/dist/types/tsconfig.tsbuildinfo +1 -0
  74. package/package.json +28 -26
  75. package/src/WnfsPlugin.tsx +77 -92
  76. package/src/blockstore.ts +151 -21
  77. package/src/capabilities/blockstore.ts +18 -0
  78. package/src/capabilities/capabilities.ts +18 -0
  79. package/src/capabilities/file-uploader.ts +24 -0
  80. package/src/capabilities/index.ts +13 -0
  81. package/src/capabilities/intent-resolver.ts +26 -0
  82. package/src/capabilities/markdown.ts +25 -0
  83. package/src/capabilities/react-surface.tsx +41 -0
  84. package/src/components/FileContainer.tsx +46 -0
  85. package/src/components/FileInput.tsx +46 -0
  86. package/src/components/index.ts +3 -5
  87. package/src/extensions/image.stories.tsx +26 -68
  88. package/src/extensions/image.tsx +203 -0
  89. package/src/{common.ts → helpers/common.ts} +1 -1
  90. package/src/helpers/index.ts +8 -0
  91. package/src/{load.ts → helpers/load.ts} +38 -9
  92. package/src/{upload.ts → helpers/upload.ts} +18 -4
  93. package/src/helpers/wnfs-url.ts +36 -0
  94. package/src/index.ts +2 -4
  95. package/src/meta.ts +1 -2
  96. package/src/translations.ts +5 -0
  97. package/src/types/file.ts +2 -3
  98. package/src/types/types.ts +30 -19
  99. package/dist/lib/browser/FileCard-HJIZDWJF.mjs +0 -39
  100. package/dist/lib/browser/FileCard-HJIZDWJF.mjs.map +0 -7
  101. package/dist/lib/browser/FileMain-WEWTX7QB.mjs +0 -27
  102. package/dist/lib/browser/FileMain-WEWTX7QB.mjs.map +0 -7
  103. package/dist/lib/browser/FileSection-BEUGJ7EI.mjs +0 -24
  104. package/dist/lib/browser/FileSection-BEUGJ7EI.mjs.map +0 -7
  105. package/dist/lib/browser/FileSlide-NYBGZEZS.mjs +0 -21
  106. package/dist/lib/browser/FileSlide-NYBGZEZS.mjs.map +0 -7
  107. package/dist/lib/browser/chunk-2I63TM7M.mjs +0 -27
  108. package/dist/lib/browser/chunk-2I63TM7M.mjs.map +0 -7
  109. package/dist/lib/browser/chunk-JDSKIDDR.mjs +0 -30
  110. package/dist/lib/browser/chunk-JDSKIDDR.mjs.map +0 -7
  111. package/dist/lib/browser/chunk-VL3H7P4F.mjs.map +0 -7
  112. package/dist/lib/browser/meta.mjs +0 -9
  113. package/dist/lib/browser/meta.mjs.map +0 -7
  114. package/dist/types/src/common.d.ts.map +0 -1
  115. package/dist/types/src/components/FileCard.d.ts +0 -9
  116. package/dist/types/src/components/FileCard.d.ts.map +0 -1
  117. package/dist/types/src/components/FileMain.d.ts +0 -7
  118. package/dist/types/src/components/FileMain.d.ts.map +0 -1
  119. package/dist/types/src/components/FileSection.d.ts +0 -8
  120. package/dist/types/src/components/FileSection.d.ts.map +0 -1
  121. package/dist/types/src/components/FileSlide.d.ts +0 -8
  122. package/dist/types/src/components/FileSlide.d.ts.map +0 -1
  123. package/dist/types/src/load.d.ts +0 -8
  124. package/dist/types/src/load.d.ts.map +0 -1
  125. package/dist/types/src/upload.d.ts +0 -10
  126. package/dist/types/src/upload.d.ts.map +0 -1
  127. package/dist/types/src/wnfs-url.d.ts +0 -2
  128. package/dist/types/src/wnfs-url.d.ts.map +0 -1
  129. package/src/components/FileCard.tsx +0 -45
  130. package/src/components/FileMain.tsx +0 -28
  131. package/src/components/FileSection.tsx +0 -20
  132. package/src/components/FileSlide.tsx +0 -20
  133. package/src/extensions/image.ts +0 -244
  134. package/src/wnfs-url.ts +0 -7
  135. /package/dist/types/src/{common.d.ts → helpers/common.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/WnfsPlugin.tsx", "../../../src/blockstore.ts", "../../../src/common.ts", "../../../src/components/index.ts", "../../../src/extensions/image.ts", "../../../src/load.ts", "../../../src/translations.ts", "../../../src/upload.ts", "../../../src/wnfs-url.ts", "../../../src/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { FileCloud, type IconProps } from '@phosphor-icons/react';\nimport React, { type Ref } from 'react';\n\nimport { type PluginDefinition, isObject, resolvePlugin } from '@dxos/app-framework';\nimport { invariant } from '@dxos/invariant';\nimport { parseClientPlugin } from '@dxos/plugin-client';\nimport { type DocumentType } from '@dxos/plugin-markdown/types';\nimport { type Space, getSpace } from '@dxos/react-client/echo';\nimport { isTileComponentProps } from '@dxos/react-ui-mosaic';\n\nimport * as Blockstore from './blockstore';\nimport { FileCard, FileMain, FileSection, FileSlide } from './components';\nimport { image as imageExtension } from './extensions';\nimport meta, { WNFS_PLUGIN } from './meta';\nimport translations from './translations';\nimport { FileType } from './types';\nimport { type WnfsPluginProvides } from './types';\nimport { upload } from './upload';\n\nexport const WnfsPlugin = (): PluginDefinition<WnfsPluginProvides> => {\n let blockstore: Blockstore.MixedBlockstore | undefined;\n\n return {\n meta,\n ready: async (plugins) => {\n const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;\n invariant(client);\n const apiHost = client.config.values.runtime?.services?.edge?.url || 'http://localhost:8787';\n blockstore = Blockstore.create(apiHost);\n await blockstore.open();\n },\n provides: {\n translations,\n metadata: {\n records: {\n [FileType.typename]: {\n placeholder: ['file title placeholder', { ns: WNFS_PLUGIN }],\n icon: (props: IconProps) => <FileCloud {...props} />,\n },\n },\n },\n echo: {\n system: [FileType],\n },\n // TODO(burdon): Add intent to upload file.\n file: {\n upload: async (file: File, space: Space) => {\n if (!blockstore) {\n throw new Error('Blockstore is not ready yet');\n }\n\n return await upload({ blockstore, file, space });\n },\n },\n markdown: {\n extensions: ({ document }: { document?: DocumentType }) => {\n if (!blockstore) {\n throw new Error('Blockstore is not ready yet');\n }\n\n if (document) {\n const space = getSpace(document);\n return space ? [imageExtension({ blockstore, space })] : [];\n }\n\n return [];\n },\n },\n surface: {\n component: ({ data, role, ...props }, forwardedRef) => {\n switch (role) {\n case 'main':\n return data.active instanceof FileType ? <FileMain file={data.active} /> : null;\n case 'slide':\n return data.slide instanceof FileType ? <FileSlide file={data.slide} cover={false} /> : null;\n case 'section':\n return data.object instanceof FileType ? <FileSection file={data.object} /> : null;\n case 'card': {\n if (\n isObject(data.content) &&\n typeof data.content.id === 'string' &&\n data.content.object instanceof FileType\n ) {\n const cardProps = { ...props, item: { id: data.content.id, object: data.content.object } };\n return isTileComponentProps(cardProps) ? (\n <FileCard {...cardProps} ref={forwardedRef as Ref<HTMLDivElement>} />\n ) : null;\n }\n break;\n }\n }\n\n return null;\n },\n },\n },\n };\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { BaseBlockstore } from 'blockstore-core';\nimport { IDBBlockstore } from 'blockstore-idb';\nimport type { CID } from 'multiformats';\n\nimport { storeName } from './common';\n\nexport const create = (apiHost?: string) => {\n return new MixedBlockstore(apiHost);\n};\n\n/**\n * A blockstore that communicates with the DXOS blob service,\n * and which uses an indexedDB blockstore as a client cache.\n */\nexport class MixedBlockstore extends BaseBlockstore {\n readonly #apiHost: string | undefined;\n readonly #idbStore: IDBBlockstore;\n\n constructor(apiHost?: string) {\n super();\n\n this.#apiHost = apiHost;\n this.#idbStore = new IDBBlockstore(storeName());\n }\n\n async open() {\n await this.#idbStore.open();\n }\n\n url(apiHost: string, cid?: CID) {\n const path = cid ? cid.toString() : '';\n return `${apiHost}/api/file/${path}`;\n }\n\n // Blockstore implementation\n override async delete(key: CID): Promise<void> {\n await this.#idbStore.delete(key);\n\n if (this.#apiHost) {\n await fetch(this.url(this.#apiHost, key), {\n method: 'DELETE',\n });\n }\n }\n\n override async get(key: CID): Promise<Uint8Array> {\n if (await this.#idbStore.has(key)) {\n return await this.#idbStore.get(key);\n }\n\n if (this.#apiHost) {\n return await fetch(this.url(this.#apiHost, key), {\n method: 'GET',\n })\n .then((r) => r.arrayBuffer())\n .then((r) => new Uint8Array(r));\n }\n\n return await this.#idbStore.get(key);\n }\n\n override async has(key: CID): Promise<boolean> {\n if (await this.#idbStore.has(key)) {\n return true;\n }\n\n if (this.#apiHost) {\n return await fetch(this.url(this.#apiHost, key), {\n method: 'HEAD',\n }).then((r) => r.ok);\n }\n\n return false;\n }\n\n override async put(key: CID, val: Uint8Array): Promise<CID> {\n await this.#idbStore.put(key, val);\n\n if (this.#apiHost) {\n await fetch(this.url(this.#apiHost, key), {\n method: 'POST',\n body: val,\n });\n }\n\n return key;\n }\n\n async destroy(): Promise<void> {\n await this.#idbStore.destroy();\n }\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { Blockstore } from 'interface-blockstore';\nimport { CID } from 'multiformats/cid';\nimport { sha256 } from 'multiformats/hashes/sha2';\nimport { type BlockStore as WnfsBlockStore } from 'wnfs';\n\nimport * as crypto from '@dxos/crypto';\nimport { type Space } from '@dxos/react-client/echo';\n\n//\n// PATH\n//\n\nexport const filePath = (fileName: string, space: Space) => {\n return ['spaces', space.properties.id, 'files', fileName];\n};\n\n//\n// RNG\n//\n\nexport class Rng {\n randomBytes(count: number): Uint8Array {\n return new Uint8Array(crypto.randomBytes(count));\n }\n}\n\n//\n// STORE\n//\n\nexport const store = (blockstore: Blockstore): WnfsBlockStore => {\n const getBlock = async (cid: Uint8Array): Promise<Uint8Array | undefined> => {\n const decodedCid = CID.decode(cid);\n return await blockstore.get(decodedCid);\n };\n\n const hasBlock = async (cid: Uint8Array): Promise<boolean> => {\n const decodedCid = CID.decode(cid);\n return await blockstore.has(decodedCid);\n };\n\n const putBlockKeyed = async (cid: Uint8Array, bytes: Uint8Array): Promise<void> => {\n const decodedCid = CID.decode(cid);\n await blockstore.put(decodedCid, bytes);\n };\n\n // Don't hash blocks with the rs-wnfs default Blake 3, sha256 has better support.\n const putBlock = async (bytes: Uint8Array, codec: number): Promise<Uint8Array> => {\n const hash = await sha256.digest(bytes);\n const cid = CID.create(1, codec, hash);\n await blockstore.put(cid, bytes);\n return cid.bytes;\n };\n\n return { getBlock, hasBlock, putBlockKeyed, putBlock };\n};\n\nexport const storeName = () => 'dxos/wnfs';\n\n//\n// OTHER\n//\n\nexport const readFile = (file: File): Promise<Uint8Array> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = (event) => {\n const result = event.target?.result;\n if (result === null || result === undefined || typeof result === 'string') {\n reject(new Error('Expected an ArrayBuffer'));\n return;\n }\n resolve(new Uint8Array(result));\n };\n reader.onerror = (err) => {\n reject(err);\n };\n reader.readAsArrayBuffer(file);\n });\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\n// Lazily load components for content surfaces.\nexport const FileCard = React.lazy(() => import('./FileCard'));\nexport const FileMain = React.lazy(() => import('./FileMain'));\nexport const FileSection = React.lazy(() => import('./FileSection'));\nexport const FileSlide = React.lazy(() => import('./FileSlide'));\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { syntaxTree } from '@codemirror/language';\nimport { type EditorState, type Extension, StateField, type Range, StateEffect } from '@codemirror/state';\nimport { Decoration, EditorView, WidgetType, ViewPlugin, type ViewUpdate } from '@codemirror/view';\nimport type { Blockstore } from 'interface-blockstore';\nimport type { PrivateDirectory, PrivateForest } from 'wnfs';\n\nimport { log } from '@dxos/log';\nimport { type Space } from '@dxos/react-client/echo';\n\nimport { store } from '../common';\nimport { loadWnfs } from '../load';\n\nexport type ImageOptions = {\n blockstore: Blockstore;\n space: Space;\n};\n\nexport const image = (options: ImageOptions): Extension[] => {\n return [stateField(options), viewPlugin(options)];\n};\n\n// GLOBAL STATE\n\n/** Indexed by space id */\nconst loadedWnfsInstances: Record<string, { directory: PrivateDirectory; forest: PrivateForest }> = {};\n\n// EFFECT + EXTENSIONS\n\nconst stateEffect = StateEffect.define<{\n decorations: Range<Decoration>[];\n from: number;\n to: number;\n}>({});\n\nconst stateField = (options: ImageOptions) =>\n StateField.define({\n create: () => {\n return Decoration.none;\n },\n update: (value, tr) => {\n for (const effect of tr.effects) {\n if (effect.is(stateEffect)) {\n return value.map(tr.changes).update({\n filterFrom: effect.value.from,\n filterTo: effect.value.to,\n filter: () => false,\n add: effect.value.decorations,\n });\n }\n }\n\n return value;\n },\n provide: (f) => {\n return EditorView.decorations.from(f);\n },\n });\n\nconst viewPlugin = (options: ImageOptions) =>\n ViewPlugin.define((view: EditorView) => {\n // Initial decoration set on document load\n buildDecorations({\n from: 0,\n to: view.state.doc.length,\n state: view.state,\n options,\n })\n .then((decorations) => {\n view.dispatch({\n effects: stateEffect.of({\n decorations,\n from: 0,\n to: view.state.doc.length,\n }),\n });\n })\n .catch((err) => {\n throw new Error(err);\n });\n\n const update = (update: ViewUpdate) => {\n if (!update.docChanged) {\n return;\n }\n\n const { from, to } = changedRange(update);\n buildDecorations({\n from,\n to,\n state: view.state,\n options,\n })\n .then((decorations) => {\n view.dispatch({\n effects: stateEffect.of({\n decorations,\n from,\n to,\n }),\n });\n })\n .catch((err) => {\n log.catch(err);\n });\n };\n\n return { update };\n });\n\n// 🛠️\n\nconst changedRange = (update: ViewUpdate) => {\n // Find range of changes and cursor changes.\n const cursor = update.state.selection.main.head;\n const oldCursor = update.changes.mapPos(update.startState.selection.main.head);\n\n let from = Math.min(cursor, oldCursor);\n let to = Math.max(cursor, oldCursor);\n\n update.changes.iterChangedRanges((fromA, toA, fromB, toB) => {\n from = Math.min(from, fromB);\n to = Math.max(to, toB);\n });\n\n // Expand to cover lines.\n from = update.state.doc.lineAt(from).from;\n to = update.state.doc.lineAt(to).to;\n\n // Fin\n return { from, to };\n};\n\nconst buildDecorations = async ({\n from,\n to,\n state,\n options,\n}: {\n from: number;\n to: number;\n state: EditorState;\n options: ImageOptions;\n}) => {\n const cursor = state.selection.main.head;\n let nodes: { from: number; hide: boolean; to: number; url: string }[] = [];\n\n syntaxTree(state).iterate({\n enter: (node) => {\n if (node.name === 'Image') {\n const urlNode = node.node.getChild('URL');\n if (urlNode) {\n const hide = state.readOnly || cursor < node.from || cursor > node.to;\n const url = state.sliceDoc(urlNode.from, urlNode.to);\n\n if (url.startsWith('wnfs://')) {\n nodes.push({\n from: node.from,\n to: node.to,\n hide,\n url,\n });\n }\n }\n }\n },\n from,\n to,\n });\n\n // Nodes must be sorted by `from`\n nodes = nodes.sort((a, b) => {\n return a.from - b.from;\n });\n\n const decorations = await nodes.reduce(\n async (acc, node) => {\n const array = await acc;\n const path = node.url\n .replace(/^wnfs:\\/\\//, '')\n .split('/')\n .map((p) => decodeURIComponent(p));\n\n // Cannot load images from other spaces\n const spaceIdFromUrl = path[1];\n if (spaceIdFromUrl !== options.space.properties.id) {\n return array;\n }\n\n const cacheKey = options.space.properties.wnfs_private_forest_cid;\n\n const { directory, forest } = loadedWnfsInstances[cacheKey]\n ? loadedWnfsInstances[cacheKey]\n : await loadWnfs(options.space, options.blockstore);\n\n loadedWnfsInstances[cacheKey] = {\n directory,\n forest,\n };\n\n const wnfsStore = store(options.blockstore);\n\n // Load image contents into memory blob\n const { result } = await directory.read(path, true, forest, wnfsStore);\n const blob = new Blob([result]);\n const blobUrl = URL.createObjectURL(blob);\n\n // Create decoration\n return [\n ...array,\n Decoration.replace({\n block: true, // Prevent cursor from entering.\n widget: new WnfsImageWidget(blobUrl),\n }).range(node.hide ? node.from : node.to, node.to),\n ];\n },\n Promise.resolve([] as Range<Decoration>[]),\n );\n\n return decorations;\n};\n\nclass WnfsImageWidget extends WidgetType {\n constructor(readonly _url: string) {\n super();\n }\n\n override eq(other: this) {\n return this._url === (other as any as WnfsImageWidget)._url;\n }\n\n override toDOM(view: EditorView) {\n const img = document.createElement('img');\n img.setAttribute('loading', 'lazy');\n img.setAttribute('src', this._url);\n img.setAttribute('class', 'cm-image');\n // Images are hidden until successfully loaded to avoid flickering effects.\n img.onload = () => img.classList.add('cm-loaded-image');\n return img;\n }\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { Blockstore } from 'interface-blockstore';\nimport { CID } from 'multiformats';\nimport * as Uint8Arrays from 'uint8arrays';\nimport { AccessKey, PrivateForest, PrivateDirectory, PrivateNode } from 'wnfs';\n\nimport { type Space } from '@dxos/react-client/echo';\n\nimport { Rng, store } from './common';\n\n//\n// LOAD\n//\n\nexport const loadWnfs = async (space: Space, blockstore: Blockstore) => {\n const exists =\n space.properties.wnfs_access_key !== undefined && space.properties.wnfs_private_forest_cid !== undefined;\n\n return exists ? await loadWnfsDir(blockstore, space) : await createWnfsDir(blockstore, space);\n};\n\n//\n// PRIVATE\n//\n\nconst createWnfsDir = async (blockstore: Blockstore, space: Space) => {\n const wnfsStore = store(blockstore);\n const rng = new Rng();\n const forest = new PrivateForest(rng);\n\n const dirResult = await PrivateDirectory.newAndStore(forest.emptyName(), new Date(), forest, wnfsStore, rng);\n const dir = dirResult.rootDir as PrivateDirectory;\n\n const [accessKeyRaw, newForest]: [AccessKey, PrivateForest] = await dir\n .asNode()\n .store(dirResult.forest as PrivateForest, wnfsStore, rng);\n\n const cidBytes = await newForest.store(wnfsStore);\n\n space.properties.wnfs_access_key = Uint8Arrays.toString(accessKeyRaw.toBytes(), 'base64');\n space.properties.wnfs_private_forest_cid = CID.decode(cidBytes).toString();\n\n return {\n directory: dir,\n forest: newForest,\n };\n};\n\nconst loadWnfsDir = async (blockstore: Blockstore, space: Space) => {\n const wnfsStore = store(blockstore);\n\n const accessKey = AccessKey.fromBytes(Uint8Arrays.fromString(space.properties.wnfs_access_key, 'base64'));\n const forest = await PrivateForest.load(CID.parse(space.properties.wnfs_private_forest_cid).bytes, wnfsStore);\n const node: PrivateNode = await PrivateNode.load(accessKey, forest, wnfsStore);\n\n return {\n directory: node.asDir(),\n forest,\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { WNFS_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [WNFS_PLUGIN]: {\n 'plugin name': 'Files',\n 'file title placeholder': 'New file',\n 'delete object label': 'Delete',\n },\n },\n },\n];\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { Blockstore } from 'interface-blockstore';\nimport { CID } from 'multiformats';\nimport * as Raw from 'multiformats/codecs/raw';\nimport { sha256 } from 'multiformats/hashes/sha2';\n\nimport type { Space } from '@dxos/client/echo';\nimport { log } from '@dxos/log';\n\nimport { Rng, filePath, store } from './common';\nimport { loadWnfs } from './load';\nimport { wnfsUrl } from './wnfs-url';\n\nexport const upload = async ({ blockstore, file, space }: { blockstore: Blockstore; file: File; space: Space }) => {\n const { directory, forest } = await loadWnfs(space, blockstore);\n const wnfsStore = store(blockstore);\n\n const bytes = new Uint8Array(await file.arrayBuffer());\n const hash = await sha256.digest(bytes);\n const cid = CID.create(1, Raw.code, hash);\n\n const path = filePath(cid.toString(), space);\n\n // Given the root directory of the private file system,\n // write the file contents to `path` in said directory.\n const result = await directory.write(path, true, bytes, new Date(), forest, wnfsStore, new Rng());\n\n // Given the new immutable instance of the root directory after writing to it,\n // **store** the changes in the \"dark forest\" and the associated (block) store.\n const [_, updatedForest] = await result.rootDir.store(result.forest, wnfsStore, new Rng());\n const cidBytes = await updatedForest.store(wnfsStore);\n\n // Update the forest pointer on the associated space.\n space.properties.wnfs_private_forest_cid = CID.decode(cidBytes).toString();\n\n // Generate `wnfs://` URL & return the info.\n const info = {\n url: wnfsUrl(path),\n };\n\n log('upload', { file, info });\n return info;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nexport const wnfsUrl = (filePath: string[]) => {\n return 'wnfs://' + filePath.map((f) => encodeURIComponent(f)).join('/');\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { WnfsPlugin } from './WnfsPlugin';\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3D;AAEA,iBAAO,CAAA;QACT;MACF;MACAO,SAAS;QACPC,WAAW,CAAC,EAAEC,MAAMC,MAAM,GAAGjB,MAAAA,GAASkB,iBAAAA;AACpC,kBAAQD,MAAAA;YACN,KAAK;AACH,qBAAOD,KAAKG,kBAAkBzB,WAAW,gBAAAO,OAAA,cAACmB,UAAAA;gBAASf,MAAMW,KAAKG;mBAAa;YAC7E,KAAK;AACH,qBAAOH,KAAKK,iBAAiB3B,WAAW,gBAAAO,OAAA,cAACqB,WAAAA;gBAAUjB,MAAMW,KAAKK;gBAAOE,OAAO;mBAAY;YAC1F,KAAK;AACH,qBAAOP,KAAKQ,kBAAkB9B,WAAW,gBAAAO,OAAA,cAACwB,aAAAA;gBAAYpB,MAAMW,KAAKQ;mBAAa;YAChF,KAAK,QAAQ;AACX,kBACEE,SAASV,KAAKW,OAAO,KACrB,OAAOX,KAAKW,QAAQC,OAAO,YAC3BZ,KAAKW,QAAQH,kBAAkB9B,UAC/B;AACA,sBAAMmC,YAAY;kBAAE,GAAG7B;kBAAO8B,MAAM;oBAAEF,IAAIZ,KAAKW,QAAQC;oBAAIJ,QAAQR,KAAKW,QAAQH;kBAAO;gBAAE;AACzF,uBAAOO,qBAAqBF,SAAAA,IAC1B,gBAAA5B,OAAA,cAAC+B,UAAAA;kBAAU,GAAGH;kBAAWI,KAAKf;qBAC5B;cACN;AACA;YACF;UACF;AAEA,iBAAO;QACT;MACF;IACF;EACF;AACF;;;AS/FA,IAAA,cAAegB;",
6
- "names": ["FileCloud", "React", "isObject", "resolvePlugin", "invariant", "parseClientPlugin", "getSpace", "isTileComponentProps", "BaseBlockstore", "IDBBlockstore", "CID", "sha256", "crypto", "filePath", "fileName", "space", "properties", "id", "Rng", "randomBytes", "count", "Uint8Array", "store", "blockstore", "getBlock", "cid", "decodedCid", "CID", "decode", "get", "hasBlock", "has", "putBlockKeyed", "bytes", "put", "putBlock", "codec", "hash", "sha256", "digest", "create", "storeName", "create", "apiHost", "MixedBlockstore", "BaseBlockstore", "constructor", "IDBBlockstore", "storeName", "open", "url", "cid", "path", "toString", "delete", "key", "fetch", "method", "get", "has", "then", "r", "arrayBuffer", "Uint8Array", "ok", "put", "val", "body", "destroy", "React", "FileCard", "React", "lazy", "FileMain", "FileSection", "FileSlide", "syntaxTree", "StateField", "StateEffect", "Decoration", "EditorView", "WidgetType", "ViewPlugin", "log", "CID", "Uint8Arrays", "AccessKey", "PrivateForest", "PrivateDirectory", "PrivateNode", "loadWnfs", "space", "blockstore", "exists", "properties", "wnfs_access_key", "undefined", "wnfs_private_forest_cid", "loadWnfsDir", "createWnfsDir", "wnfsStore", "store", "rng", "Rng", "forest", "PrivateForest", "dirResult", "PrivateDirectory", "newAndStore", "emptyName", "Date", "dir", "rootDir", "accessKeyRaw", "newForest", "asNode", "cidBytes", "toString", "toBytes", "CID", "decode", "directory", "accessKey", "AccessKey", "fromBytes", "fromString", "load", "parse", "bytes", "node", "PrivateNode", "asDir", "image", "options", "stateField", "viewPlugin", "loadedWnfsInstances", "stateEffect", "StateEffect", "define", "StateField", "create", "Decoration", "none", "update", "value", "tr", "effect", "effects", "is", "map", "changes", "filterFrom", "from", "filterTo", "to", "filter", "add", "decorations", "provide", "f", "EditorView", "ViewPlugin", "view", "buildDecorations", "state", "doc", "length", "then", "dispatch", "of", "catch", "err", "Error", "docChanged", "changedRange", "log", "cursor", "selection", "main", "head", "oldCursor", "mapPos", "startState", "Math", "min", "max", "iterChangedRanges", "fromA", "toA", "fromB", "toB", "lineAt", "nodes", "syntaxTree", "iterate", "enter", "node", "name", "urlNode", "getChild", "hide", "readOnly", "url", "sliceDoc", "startsWith", "push", "sort", "a", "b", "reduce", "acc", "array", "path", "replace", "split", "p", "decodeURIComponent", "spaceIdFromUrl", "space", "properties", "id", "cacheKey", "wnfs_private_forest_cid", "directory", "forest", "loadWnfs", "blockstore", "wnfsStore", "store", "result", "read", "blob", "Blob", "blobUrl", "URL", "createObjectURL", "block", "widget", "WnfsImageWidget", "range", "Promise", "resolve", "WidgetType", "constructor", "_url", "eq", "other", "toDOM", "img", "document", "createElement", "setAttribute", "onload", "classList", "WNFS_PLUGIN", "CID", "Raw", "sha256", "log", "wnfsUrl", "filePath", "map", "f", "encodeURIComponent", "join", "upload", "blockstore", "file", "space", "directory", "forest", "loadWnfs", "wnfsStore", "store", "bytes", "Uint8Array", "arrayBuffer", "hash", "sha256", "digest", "cid", "CID", "create", "code", "path", "filePath", "toString", "result", "write", "Date", "Rng", "_", "updatedForest", "rootDir", "cidBytes", "properties", "wnfs_private_forest_cid", "decode", "info", "url", "wnfsUrl", "log", "WnfsPlugin", "blockstore", "meta", "ready", "plugins", "client", "resolvePlugin", "parseClientPlugin", "provides", "invariant", "apiHost", "config", "values", "runtime", "services", "edge", "url", "create", "open", "translations", "metadata", "records", "FileType", "typename", "placeholder", "ns", "WNFS_PLUGIN", "icon", "props", "React", "FileCloud", "echo", "system", "file", "upload", "space", "Error", "markdown", "extensions", "document", "getSpace", "imageExtension", "surface", "component", "data", "role", "forwardedRef", "active", "FileMain", "slide", "FileSlide", "cover", "object", "FileSection", "isObject", "content", "id", "cardProps", "item", "isTileComponentProps", "FileCard", "ref", "WnfsPlugin"]
3
+ "sources": ["../../../src/WnfsPlugin.tsx", "../../../src/translations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { pipe } from 'effect';\n\nimport {\n Capabilities,\n Events,\n chain,\n contributes,\n createIntent,\n defineModule,\n definePlugin,\n oneOf,\n} from '@dxos/app-framework';\nimport { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';\nimport { type Space } from '@dxos/react-client/echo';\n\nimport { Blockstore, FileUploader, IntentResolver, Markdown, ReactSurface, WnfsCapabilities } from './capabilities';\nimport { meta, WNFS_PLUGIN } from './meta';\nimport translations from './translations';\nimport { FileType, WnfsAction } from './types';\n\nexport const WnfsPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/blockstore`,\n activatesOn: ClientEvents.ClientReady,\n activate: Blockstore,\n }),\n defineModule({\n id: `${meta.id}/module/instances`,\n activatesOn: Events.Startup,\n activate: () => {\n const instances: WnfsCapabilities.Instances = {};\n return contributes(WnfsCapabilities.Instances, instances);\n },\n }),\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/metadata`,\n activatesOn: oneOf(Events.Startup, Events.SetupAppGraph),\n activate: () =>\n contributes(Capabilities.Metadata, {\n id: FileType.typename,\n metadata: {\n creationSchema: WnfsAction.UploadFileSchema,\n createObject: ({ file }: WnfsAction.UploadFileForm, { space }: { space: Space }) =>\n pipe(createIntent(WnfsAction.Upload, { file, space }), chain(WnfsAction.Create, {})),\n label: (object: any) => (object instanceof FileType ? object.name : undefined),\n placeholder: ['file title placeholder', { ns: WNFS_PLUGIN }],\n // TODO(wittjosiah): Would be nice if icon could change based on the type of the file.\n icon: 'ph--file--regular',\n },\n }),\n }),\n defineModule({\n id: `${meta.id}/module/schema`,\n activatesOn: ClientEvents.SetupClient,\n activate: () => contributes(ClientCapabilities.Schema, [FileType]),\n }),\n defineModule({\n id: `${meta.id}/module/file-uploader`,\n activatesOn: ClientEvents.ClientReady,\n activate: FileUploader,\n }),\n defineModule({\n id: `${meta.id}/module/markdown`,\n activatesOn: Events.Startup,\n activate: Markdown,\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.Startup,\n activate: ReactSurface,\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntents,\n activate: IntentResolver,\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { WNFS_PLUGIN } from './meta';\nimport { FileType } from './types';\n\nexport default [\n {\n 'en-US': {\n [FileType.typename]: {\n 'typename label': 'File',\n },\n [WNFS_PLUGIN]: {\n 'plugin name': 'Files',\n 'file title placeholder': 'New file',\n 'delete object label': 'Delete',\n 'file input placeholder': 'Drop a file here, or click to select a file',\n },\n },\n },\n];\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAIA,SAASA,YAAY;AAErB,SACEC,cACAC,QACAC,OACAC,aACAC,cACAC,cACAC,cACAC,aACK;AACP,SAASC,oBAAoBC,oBAAoB;;;ACTjD,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACC,SAASC,QAAQ,GAAG;QACnB,kBAAkB;MACpB;MACA,CAACC,WAAAA,GAAc;QACb,eAAe;QACf,0BAA0B;QAC1B,uBAAuB;QACvB,0BAA0B;MAC5B;IACF;EACF;;;;ADIK,IAAMC,aAAa,MACxBC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,aAAaC;IAC1BC,UAAUC;EACZ,CAAA;EACAN,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaK,OAAOC;IACpBH,UAAU,MAAA;AACR,YAAMI,YAAwC,CAAC;AAC/C,aAAOC,YAAYC,iBAAiBC,WAAWH,SAAAA;IACjD;EACF,CAAA;EACAT,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaK,OAAOM;IACpBR,UAAU,MAAMK,YAAYI,aAAaC,cAAcC,oBAAAA;EACzD,CAAA;EACAhB,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAae,MAAMV,OAAOC,SAASD,OAAOW,aAAa;IACvDb,UAAU,MACRK,YAAYI,aAAaK,UAAU;MACjClB,IAAImB,SAASC;MACbC,UAAU;QACRC,gBAAgBC,WAAWC;QAC3BC,cAAc,CAAC,EAAEC,KAAI,GAA+B,EAAEC,MAAK,MACzDC,KAAKC,aAAaN,WAAWO,QAAQ;UAAEJ;UAAMC;QAAM,CAAA,GAAII,MAAMR,WAAWS,QAAQ,CAAC,CAAA,CAAA;QACnFC,OAAO,CAACC,WAAiBA,kBAAkBf,WAAWe,OAAOC,OAAOC;QACpEC,aAAa;UAAC;UAA0B;YAAEC,IAAIC;UAAY;;;QAE1DC,MAAM;MACR;IACF,CAAA;EACJ,CAAA;EACAzC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,aAAauC;IAC1BrC,UAAU,MAAMK,YAAYiC,mBAAmBC,QAAQ;MAACxB;KAAS;EACnE,CAAA;EACApB,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,aAAaC;IAC1BC,UAAUwC;EACZ,CAAA;EACA7C,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaK,OAAOC;IACpBH,UAAUyC;EACZ,CAAA;EACA9C,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaK,OAAOC;IACpBH,UAAU0C;EACZ,CAAA;EACA/C,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaK,OAAOyC;IACpB3C,UAAU4C;EACZ,CAAA;CACD;",
6
+ "names": ["pipe", "Capabilities", "Events", "chain", "contributes", "createIntent", "defineModule", "definePlugin", "oneOf", "ClientCapabilities", "ClientEvents", "FileType", "typename", "WNFS_PLUGIN", "WnfsPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "ClientEvents", "ClientReady", "activate", "Blockstore", "Events", "Startup", "instances", "contributes", "WnfsCapabilities", "Instances", "SetupTranslations", "Capabilities", "Translations", "translations", "oneOf", "SetupAppGraph", "Metadata", "FileType", "typename", "metadata", "creationSchema", "WnfsAction", "UploadFileSchema", "createObject", "file", "space", "pipe", "createIntent", "Upload", "chain", "Create", "label", "object", "name", "undefined", "placeholder", "ns", "WNFS_PLUGIN", "icon", "SetupClient", "ClientCapabilities", "Schema", "FileUploader", "Markdown", "ReactSurface", "SetupIntents", "IntentResolver"]
7
7
  }
@@ -0,0 +1,43 @@
1
+ import {
2
+ upload
3
+ } from "./chunk-SCQWJNHD.mjs";
4
+ import {
5
+ WnfsCapabilities
6
+ } from "./chunk-357BWHML.mjs";
7
+ import {
8
+ FileType,
9
+ WnfsAction
10
+ } from "./chunk-EMRQJXBW.mjs";
11
+ import "./chunk-6YFT42F7.mjs";
12
+
13
+ // packages/plugins/plugin-wnfs/src/capabilities/intent-resolver.ts
14
+ import { contributes, Capabilities, createResolver } from "@dxos/app-framework";
15
+ import { create } from "@dxos/react-client/echo";
16
+ var intent_resolver_default = (context) => contributes(Capabilities.IntentResolver, [
17
+ // TODO(wittjosiah): Deleting the object doesn't delete the wnfs blob.
18
+ // Consider ways to trigger blob deletion based on object deletion and/or adding file system manager.
19
+ createResolver(WnfsAction.Create, ({ name, type, cid }) => ({
20
+ data: {
21
+ object: create(FileType, {
22
+ name,
23
+ type,
24
+ cid
25
+ })
26
+ }
27
+ })),
28
+ createResolver(WnfsAction.Upload, async ({ file, space }) => {
29
+ const blockstore = context.requestCapability(WnfsCapabilities.Blockstore);
30
+ const info = await upload({
31
+ file,
32
+ blockstore,
33
+ space
34
+ });
35
+ return {
36
+ data: info
37
+ };
38
+ })
39
+ ]);
40
+ export {
41
+ intent_resolver_default as default
42
+ };
43
+ //# sourceMappingURL=intent-resolver-WDO4EIG3.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/intent-resolver.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, Capabilities, createResolver, type PluginsContext } from '@dxos/app-framework';\nimport { create } from '@dxos/react-client/echo';\n\nimport { WnfsCapabilities } from './capabilities';\nimport { upload } from '../helpers';\nimport { FileType, WnfsAction } from '../types';\n\nexport default (context: PluginsContext) =>\n contributes(Capabilities.IntentResolver, [\n // TODO(wittjosiah): Deleting the object doesn't delete the wnfs blob.\n // Consider ways to trigger blob deletion based on object deletion and/or adding file system manager.\n createResolver(WnfsAction.Create, ({ name, type, cid }) => ({\n data: {\n object: create(FileType, { name, type, cid }),\n },\n })),\n createResolver(WnfsAction.Upload, async ({ file, space }) => {\n const blockstore = context.requestCapability(WnfsCapabilities.Blockstore);\n const info = await upload({ file, blockstore, space });\n return { data: info };\n }),\n ]);\n"],
5
+ "mappings": ";;;;;;;;;;;;;AAIA,SAASA,aAAaC,cAAcC,sBAA2C;AAC/E,SAASC,cAAc;AAMvB,IAAA,0BAAe,CAACC,YACdC,YAAYC,aAAaC,gBAAgB;;;EAGvCC,eAAeC,WAAWC,QAAQ,CAAC,EAAEC,MAAMC,MAAMC,IAAG,OAAQ;IAC1DC,MAAM;MACJC,QAAQC,OAAOC,UAAU;QAAEN;QAAMC;QAAMC;MAAI,CAAA;IAC7C;EACF,EAAA;EACAL,eAAeC,WAAWS,QAAQ,OAAO,EAAEC,MAAMC,MAAK,MAAE;AACtD,UAAMC,aAAajB,QAAQkB,kBAAkBC,iBAAiBC,UAAU;AACxE,UAAMC,OAAO,MAAMC,OAAO;MAAEP;MAAME;MAAYD;IAAM,CAAA;AACpD,WAAO;MAAEN,MAAMW;IAAK;EACtB,CAAA;CACD;",
6
+ "names": ["contributes", "Capabilities", "createResolver", "create", "context", "contributes", "Capabilities", "IntentResolver", "createResolver", "WnfsAction", "Create", "name", "type", "cid", "data", "object", "create", "FileType", "Upload", "file", "space", "blockstore", "requestCapability", "WnfsCapabilities", "Blockstore", "info", "upload"]
7
+ }
@@ -0,0 +1,198 @@
1
+ import {
2
+ getBlobUrl,
3
+ getPathFromUrl,
4
+ loadWnfs
5
+ } from "./chunk-SCQWJNHD.mjs";
6
+ import {
7
+ WnfsCapabilities
8
+ } from "./chunk-357BWHML.mjs";
9
+ import "./chunk-6YFT42F7.mjs";
10
+
11
+ // packages/plugins/plugin-wnfs/src/capabilities/markdown.ts
12
+ import { contributes } from "@dxos/app-framework";
13
+ import { MarkdownCapabilities } from "@dxos/plugin-markdown";
14
+ import { getSpace } from "@dxos/react-client/echo";
15
+
16
+ // packages/plugins/plugin-wnfs/src/extensions/image.tsx
17
+ import { syntaxTree } from "@codemirror/language";
18
+ import { StateField } from "@codemirror/state";
19
+ import { Decoration, EditorView, WidgetType } from "@codemirror/view";
20
+ import React from "react";
21
+ import { createRoot } from "react-dom/client";
22
+ import { Status, ThemeProvider } from "@dxos/react-ui";
23
+ import { focusField } from "@dxos/react-ui-editor";
24
+ import { defaultTx } from "@dxos/react-ui-theme";
25
+ var WAIT_UNTIL_LOADER = 1500;
26
+ var image = (options) => {
27
+ const blobUrlCache = {};
28
+ const preloaded = /* @__PURE__ */ new Set();
29
+ const preload = (url) => {
30
+ if (!preloaded.has(url)) {
31
+ const img = document.createElement("img");
32
+ img.src = url;
33
+ preloaded.add(url);
34
+ }
35
+ };
36
+ return [
37
+ StateField.define({
38
+ create: (state) => {
39
+ return Decoration.set(buildDecorations({
40
+ from: 0,
41
+ to: state.doc.length,
42
+ state,
43
+ blobUrlCache,
44
+ preload,
45
+ options
46
+ }));
47
+ },
48
+ update: (value, tr) => {
49
+ if (!tr.docChanged && !tr.selection) {
50
+ return value;
51
+ }
52
+ const cursor = tr.state.selection.main.head;
53
+ const oldCursor = tr.changes.mapPos(tr.startState.selection.main.head);
54
+ let from = Math.min(cursor, oldCursor);
55
+ let to = Math.max(cursor, oldCursor);
56
+ tr.changes.iterChangedRanges((fromA, toA, fromB, toB) => {
57
+ from = Math.min(from, fromB);
58
+ to = Math.max(to, toB);
59
+ });
60
+ from = tr.state.doc.lineAt(from).from;
61
+ to = tr.state.doc.lineAt(to).to;
62
+ return value.map(tr.changes).update({
63
+ filterFrom: from,
64
+ filterTo: to,
65
+ filter: () => false,
66
+ add: buildDecorations({
67
+ from,
68
+ to,
69
+ state: tr.state,
70
+ blobUrlCache,
71
+ preload,
72
+ options
73
+ })
74
+ });
75
+ },
76
+ provide: (field) => EditorView.decorations.from(field)
77
+ })
78
+ ];
79
+ };
80
+ var buildDecorations = ({ from, to, state, blobUrlCache, preload, options: { blockstore, instances, space } }) => {
81
+ const decorations = [];
82
+ const cursor = state.selection.main.head;
83
+ syntaxTree(state).iterate({
84
+ enter: (node) => {
85
+ if (node.name !== "Image") {
86
+ return;
87
+ }
88
+ const urlNode = node.node.getChild("URL");
89
+ if (!urlNode) {
90
+ return;
91
+ }
92
+ const hide = state.readOnly || cursor < node.from || cursor > node.to;
93
+ const wnfsUrl = state.sliceDoc(urlNode.from, urlNode.to);
94
+ if (!wnfsUrl.startsWith("wnfs://")) {
95
+ return;
96
+ }
97
+ const path = getPathFromUrl(wnfsUrl);
98
+ const spaceId = path[1];
99
+ if (spaceId !== space.id) {
100
+ return;
101
+ }
102
+ const blobUrlPromise = (async () => {
103
+ const { directory, forest } = await loadWnfs({
104
+ blockstore,
105
+ instances,
106
+ space
107
+ });
108
+ const url = await getBlobUrl({
109
+ wnfsUrl,
110
+ blockstore,
111
+ directory,
112
+ forest
113
+ });
114
+ blobUrlCache[path.join("/")] = url;
115
+ preload(url);
116
+ return url;
117
+ })();
118
+ decorations.push(Decoration.replace({
119
+ block: true,
120
+ widget: new WnfsImageWidget(wnfsUrl, blobUrlCache[path.join("/")] ?? blobUrlPromise)
121
+ }).range(hide ? node.from : node.to, node.to));
122
+ },
123
+ from,
124
+ to
125
+ });
126
+ return decorations;
127
+ };
128
+ var createImg = (view, url) => {
129
+ const img = document.createElement("img");
130
+ img.setAttribute("src", url);
131
+ img.setAttribute("class", "cm-image-with-loader");
132
+ if (view.state.field(focusField)) {
133
+ img.onload = () => img.classList.add("cm-loaded-image");
134
+ } else {
135
+ img.classList.add("cm-loaded-image");
136
+ }
137
+ return img;
138
+ };
139
+ var WnfsImageWidget = class extends WidgetType {
140
+ constructor(_wnfsUrl, _url) {
141
+ super();
142
+ this._wnfsUrl = _wnfsUrl;
143
+ this._url = _url;
144
+ }
145
+ eq(other) {
146
+ return this._wnfsUrl === other._wnfsUrl;
147
+ }
148
+ toDOM(view) {
149
+ if (typeof this._url === "string") {
150
+ return createImg(view, this._url);
151
+ }
152
+ const widget = document.createElement("div");
153
+ widget.className = "cm-image-wrapper";
154
+ const loader = document.createElement("div");
155
+ loader.className = "mx-auto transition-opacity";
156
+ let loaderAdded = false;
157
+ const timeout = setTimeout(() => {
158
+ const root = createRoot(loader);
159
+ root.render(/* @__PURE__ */ React.createElement(ThemeProvider, {
160
+ tx: defaultTx
161
+ }, /* @__PURE__ */ React.createElement(Status, {
162
+ indeterminate: true
163
+ })));
164
+ widget.appendChild(loader);
165
+ loaderAdded = true;
166
+ }, WAIT_UNTIL_LOADER);
167
+ void this._url.then((url) => {
168
+ clearTimeout(timeout);
169
+ const img = createImg(view, url);
170
+ loaderAdded && widget.removeChild(loader);
171
+ widget.appendChild(img);
172
+ });
173
+ return widget;
174
+ }
175
+ };
176
+
177
+ // packages/plugins/plugin-wnfs/src/capabilities/markdown.ts
178
+ var markdown_default = (context) => contributes(MarkdownCapabilities.Extensions, [
179
+ ({ document: document2 }) => {
180
+ const blockstore = context.requestCapability(WnfsCapabilities.Blockstore);
181
+ const instances = context.requestCapability(WnfsCapabilities.Instances);
182
+ if (document2) {
183
+ const space = getSpace(document2);
184
+ return space ? [
185
+ image({
186
+ blockstore,
187
+ instances,
188
+ space
189
+ })
190
+ ] : [];
191
+ }
192
+ return [];
193
+ }
194
+ ]);
195
+ export {
196
+ markdown_default as default
197
+ };
198
+ //# sourceMappingURL=markdown-MGSH5CVQ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/markdown.ts", "../../../src/extensions/image.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, type PluginsContext } from '@dxos/app-framework';\nimport { MarkdownCapabilities } from '@dxos/plugin-markdown';\nimport { getSpace } from '@dxos/react-client/echo';\n\nimport { WnfsCapabilities } from './capabilities';\nimport { image } from '../extensions';\n\nexport default (context: PluginsContext) =>\n contributes(MarkdownCapabilities.Extensions, [\n ({ document }) => {\n const blockstore = context.requestCapability(WnfsCapabilities.Blockstore);\n const instances = context.requestCapability(WnfsCapabilities.Instances);\n\n if (document) {\n const space = getSpace(document);\n return space ? [image({ blockstore, instances, space })] : [];\n }\n\n return [];\n },\n ]);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { syntaxTree } from '@codemirror/language';\nimport { type EditorState, type Extension, StateField, type Range } from '@codemirror/state';\nimport { Decoration, EditorView, WidgetType } from '@codemirror/view';\nimport type { Blockstore } from 'interface-blockstore';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport { type Space } from '@dxos/react-client/echo';\nimport { Status, ThemeProvider } from '@dxos/react-ui';\nimport { focusField } from '@dxos/react-ui-editor';\nimport { defaultTx } from '@dxos/react-ui-theme';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { type WnfsCapabilities } from '../capabilities';\nimport { getBlobUrl, getPathFromUrl, loadWnfs } from '../helpers';\n\nconst WAIT_UNTIL_LOADER = 1500;\n\nexport type ImageOptions = {\n blockstore: Blockstore;\n instances: WnfsCapabilities.Instances;\n space: Space;\n};\n\n/**\n * Create WNFS image decorations.\n */\nexport const image = (options: ImageOptions): Extension[] => {\n const blobUrlCache: Record<string, string> = {};\n const preloaded = new Set<string>();\n\n const preload = (url: string) => {\n if (!preloaded.has(url)) {\n const img = document.createElement('img');\n img.src = url;\n preloaded.add(url);\n }\n };\n\n return [\n StateField.define({\n create: (state) => {\n return Decoration.set(\n buildDecorations({ from: 0, to: state.doc.length, state, blobUrlCache, preload, options }),\n );\n },\n update: (value, tr) => {\n if (!tr.docChanged && !tr.selection) {\n return value;\n }\n\n // Find range of changes and cursor changes.\n const cursor = tr.state.selection.main.head;\n const oldCursor = tr.changes.mapPos(tr.startState.selection.main.head);\n let from = Math.min(cursor, oldCursor);\n let to = Math.max(cursor, oldCursor);\n tr.changes.iterChangedRanges((fromA, toA, fromB, toB) => {\n from = Math.min(from, fromB);\n to = Math.max(to, toB);\n });\n\n // Expand to cover lines.\n from = tr.state.doc.lineAt(from).from;\n to = tr.state.doc.lineAt(to).to;\n\n return value.map(tr.changes).update({\n filterFrom: from,\n filterTo: to,\n filter: () => false,\n add: buildDecorations({ from, to, state: tr.state, blobUrlCache, preload, options }),\n });\n },\n provide: (field) => EditorView.decorations.from(field),\n }),\n ];\n};\n\nconst buildDecorations = ({\n from,\n to,\n state,\n blobUrlCache,\n preload,\n options: { blockstore, instances, space },\n}: {\n from: number;\n to: number;\n state: EditorState;\n blobUrlCache: Record<string, string>;\n preload: (url: string) => void;\n options: ImageOptions;\n}) => {\n const decorations: Range<Decoration>[] = [];\n const cursor = state.selection.main.head;\n syntaxTree(state).iterate({\n enter: (node) => {\n if (node.name !== 'Image') {\n return;\n }\n\n const urlNode = node.node.getChild('URL');\n if (!urlNode) {\n return;\n }\n\n const hide = state.readOnly || cursor < node.from || cursor > node.to;\n const wnfsUrl = state.sliceDoc(urlNode.from, urlNode.to);\n if (!wnfsUrl.startsWith('wnfs://')) {\n return;\n }\n\n const path = getPathFromUrl(wnfsUrl);\n\n // Cannot load images from other spaces\n const spaceId = path[1];\n if (spaceId !== space.id) {\n return;\n }\n\n // Load image contents into memory blob\n const blobUrlPromise = (async () => {\n const { directory, forest } = await loadWnfs({ blockstore, instances, space });\n const url = await getBlobUrl({ wnfsUrl, blockstore, directory, forest });\n blobUrlCache[path.join('/')] = url;\n preload(url);\n return url;\n })();\n\n decorations.push(\n Decoration.replace({\n block: true, // Prevent cursor from entering.\n widget: new WnfsImageWidget(wnfsUrl, blobUrlCache[path.join('/')] ?? blobUrlPromise),\n }).range(hide ? node.from : node.to, node.to),\n );\n },\n from,\n to,\n });\n\n return decorations;\n};\n\nconst createImg = (view: EditorView, url: string) => {\n const img = document.createElement('img');\n img.setAttribute('src', url);\n img.setAttribute('class', 'cm-image-with-loader');\n // If focused, hide image until successfully loaded to avoid flickering effects.\n if (view.state.field(focusField)) {\n img.onload = () => img.classList.add('cm-loaded-image');\n } else {\n img.classList.add('cm-loaded-image');\n }\n return img;\n};\n\nclass WnfsImageWidget extends WidgetType {\n constructor(\n readonly _wnfsUrl: string,\n readonly _url: MaybePromise<string>,\n ) {\n super();\n }\n\n override eq(other: this) {\n return this._wnfsUrl === (other as any as WnfsImageWidget)._wnfsUrl;\n }\n\n override toDOM(view: EditorView) {\n if (typeof this._url === 'string') {\n return createImg(view, this._url);\n }\n\n const widget = document.createElement('div');\n widget.className = 'cm-image-wrapper';\n const loader = document.createElement('div');\n loader.className = 'mx-auto transition-opacity';\n let loaderAdded = false;\n\n const timeout = setTimeout(() => {\n const root = createRoot(loader);\n root.render(\n <ThemeProvider tx={defaultTx}>\n <Status indeterminate />\n </ThemeProvider>,\n );\n widget.appendChild(loader);\n loaderAdded = true;\n }, WAIT_UNTIL_LOADER);\n\n void this._url.then((url) => {\n clearTimeout(timeout);\n const img = createImg(view, url);\n loaderAdded && widget.removeChild(loader);\n widget.appendChild(img);\n });\n\n return widget;\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;AAIA,SAASA,mBAAwC;AACjD,SAASC,4BAA4B;AACrC,SAASC,gBAAgB;;;ACFzB,SAASC,kBAAkB;AAC3B,SAA2CC,kBAA8B;AACzE,SAASC,YAAYC,YAAYC,kBAAkB;AAEnD,OAAOC,WAAW;AAClB,SAASC,kBAAkB;AAG3B,SAASC,QAAQC,qBAAqB;AACtC,SAASC,kBAAkB;AAC3B,SAASC,iBAAiB;AAM1B,IAAMC,oBAAoB;AAWnB,IAAMC,QAAQ,CAACC,YAAAA;AACpB,QAAMC,eAAuC,CAAC;AAC9C,QAAMC,YAAY,oBAAIC,IAAAA;AAEtB,QAAMC,UAAU,CAACC,QAAAA;AACf,QAAI,CAACH,UAAUI,IAAID,GAAAA,GAAM;AACvB,YAAME,MAAMC,SAASC,cAAc,KAAA;AACnCF,UAAIG,MAAML;AACVH,gBAAUS,IAAIN,GAAAA;IAChB;EACF;AAEA,SAAO;IACLO,WAAWC,OAAO;MAChBC,QAAQ,CAACC,UAAAA;AACP,eAAOC,WAAWC,IAChBC,iBAAiB;UAAEC,MAAM;UAAGC,IAAIL,MAAMM,IAAIC;UAAQP;UAAOd;UAAcG;UAASJ;QAAQ,CAAA,CAAA;MAE5F;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;UAAER;UAAYI;UAAWE;QAAM,CAAA;UAAM,CAAA;IAC7D;AAEA,WAAO,CAAA;EACT;CACD;",
6
+ "names": ["contributes", "MarkdownCapabilities", "getSpace", "syntaxTree", "StateField", "Decoration", "EditorView", "WidgetType", "React", "createRoot", "Status", "ThemeProvider", "focusField", "defaultTx", "WAIT_UNTIL_LOADER", "image", "options", "blobUrlCache", "preloaded", "Set", "preload", "url", "has", "img", "document", "createElement", "src", "add", "StateField", "define", "create", "state", "Decoration", "set", "buildDecorations", "from", "to", "doc", "length", "update", "value", "tr", "docChanged", "selection", "cursor", "main", "head", "oldCursor", "changes", "mapPos", "startState", "Math", "min", "max", "iterChangedRanges", "fromA", "toA", "fromB", "toB", "lineAt", "map", "filterFrom", "filterTo", "filter", "provide", "field", "EditorView", "decorations", "blockstore", "instances", "space", "syntaxTree", "iterate", "enter", "node", "name", "urlNode", "getChild", "hide", "readOnly", "wnfsUrl", "sliceDoc", "startsWith", "path", "getPathFromUrl", "spaceId", "id", "blobUrlPromise", "directory", "forest", "loadWnfs", "getBlobUrl", "join", "push", "replace", "block", "widget", "WnfsImageWidget", "range", "createImg", "view", "setAttribute", "focusField", "onload", "classList", "WidgetType", "constructor", "_wnfsUrl", "_url", "eq", "other", "toDOM", "className", "loader", "loaderAdded", "timeout", "setTimeout", "root", "createRoot", "render", "ThemeProvider", "tx", "defaultTx", "Status", "indeterminate", "appendChild", "then", "clearTimeout", "removeChild", "context", "contributes", "MarkdownCapabilities", "Extensions", "document", "blockstore", "requestCapability", "WnfsCapabilities", "Blockstore", "instances", "Instances", "space", "getSpace", "image"]
7
+ }
@@ -1 +1 @@
1
- {"inputs":{"packages/plugins/experimental/plugin-wnfs/src/common.ts":{"bytes":7811,"imports":[{"path":"multiformats/cid","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/blockstore.ts":{"bytes":8224,"imports":[{"path":"blockstore-core","kind":"import-statement","external":true},{"path":"blockstore-idb","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-wnfs/src/common.ts","kind":"import-statement","original":"./common"}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/components/FileCard.tsx":{"bytes":5241,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-card","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/components/FilePreview.tsx":{"bytes":2928,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/components/FileMain.tsx":{"bytes":2672,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-wnfs/src/components/FilePreview.tsx","kind":"import-statement","original":"./FilePreview"}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/components/FileSection.tsx":{"bytes":2081,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-wnfs/src/components/FilePreview.tsx","kind":"import-statement","original":"./FilePreview"}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/components/FileSlide.tsx":{"bytes":1990,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-wnfs/src/components/FilePreview.tsx","kind":"import-statement","original":"./FilePreview"}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/components/index.ts":{"bytes":1687,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-wnfs/src/components/FileCard.tsx","kind":"dynamic-import","original":"./FileCard"},{"path":"packages/plugins/experimental/plugin-wnfs/src/components/FileMain.tsx","kind":"dynamic-import","original":"./FileMain"},{"path":"packages/plugins/experimental/plugin-wnfs/src/components/FileSection.tsx","kind":"dynamic-import","original":"./FileSection"},{"path":"packages/plugins/experimental/plugin-wnfs/src/components/FileSlide.tsx","kind":"dynamic-import","original":"./FileSlide"}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/load.ts":{"bytes":7140,"imports":[{"path":"multiformats","kind":"import-statement","external":true},{"path":"uint8arrays","kind":"import-statement","external":true},{"path":"wnfs","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-wnfs/src/common.ts","kind":"import-statement","original":"./common"}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/extensions/image.ts":{"bytes":22790,"imports":[{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-wnfs/src/common.ts","kind":"import-statement","original":"../common"},{"path":"packages/plugins/experimental/plugin-wnfs/src/load.ts","kind":"import-statement","original":"../load"}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/extensions/index.ts":{"bytes":517,"imports":[{"path":"packages/plugins/experimental/plugin-wnfs/src/extensions/image.ts","kind":"import-statement","original":"./image"}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/meta.ts":{"bytes":1559,"imports":[],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/translations.ts":{"bytes":1280,"imports":[{"path":"packages/plugins/experimental/plugin-wnfs/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/types/file.ts":{"bytes":1678,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/types/types.ts":{"bytes":1750,"imports":[{"path":"packages/plugins/experimental/plugin-wnfs/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/types/index.ts":{"bytes":592,"imports":[{"path":"packages/plugins/experimental/plugin-wnfs/src/types/file.ts","kind":"import-statement","original":"./file"},{"path":"packages/plugins/experimental/plugin-wnfs/src/types/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/wnfs-url.ts":{"bytes":943,"imports":[],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/upload.ts":{"bytes":6174,"imports":[{"path":"multiformats","kind":"import-statement","external":true},{"path":"multiformats/codecs/raw","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-wnfs/src/common.ts","kind":"import-statement","original":"./common"},{"path":"packages/plugins/experimental/plugin-wnfs/src/load.ts","kind":"import-statement","original":"./load"},{"path":"packages/plugins/experimental/plugin-wnfs/src/wnfs-url.ts","kind":"import-statement","original":"./wnfs-url"}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/WnfsPlugin.tsx":{"bytes":14058,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-wnfs/src/blockstore.ts","kind":"import-statement","original":"./blockstore"},{"path":"packages/plugins/experimental/plugin-wnfs/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/plugins/experimental/plugin-wnfs/src/extensions/index.ts","kind":"import-statement","original":"./extensions"},{"path":"packages/plugins/experimental/plugin-wnfs/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/experimental/plugin-wnfs/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/plugins/experimental/plugin-wnfs/src/types/index.ts","kind":"import-statement","original":"./types"},{"path":"packages/plugins/experimental/plugin-wnfs/src/upload.ts","kind":"import-statement","original":"./upload"}],"format":"esm"},"packages/plugins/experimental/plugin-wnfs/src/index.ts":{"bytes":765,"imports":[{"path":"packages/plugins/experimental/plugin-wnfs/src/WnfsPlugin.tsx","kind":"import-statement","original":"./WnfsPlugin"},{"path":"packages/plugins/experimental/plugin-wnfs/src/WnfsPlugin.tsx","kind":"import-statement","original":"./WnfsPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":33984},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/chunk-JDSKIDDR.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/chunk-VL3H7P4F.mjs","kind":"import-statement"},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"blockstore-core","kind":"import-statement","external":true},{"path":"blockstore-idb","kind":"import-statement","external":true},{"path":"multiformats/cid","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/FileCard-HJIZDWJF.mjs","kind":"dynamic-import"},{"path":"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/FileMain-WEWTX7QB.mjs","kind":"dynamic-import"},{"path":"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/FileSection-BEUGJ7EI.mjs","kind":"dynamic-import"},{"path":"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/FileSlide-NYBGZEZS.mjs","kind":"dynamic-import"},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"uint8arrays","kind":"import-statement","external":true},{"path":"wnfs","kind":"import-statement","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"multiformats/codecs/raw","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["WnfsPlugin","default"],"entryPoint":"packages/plugins/experimental/plugin-wnfs/src/index.ts","inputs":{"packages/plugins/experimental/plugin-wnfs/src/WnfsPlugin.tsx":{"bytesInOutput":3617},"packages/plugins/experimental/plugin-wnfs/src/blockstore.ts":{"bytesInOutput":1609},"packages/plugins/experimental/plugin-wnfs/src/common.ts":{"bytesInOutput":1088},"packages/plugins/experimental/plugin-wnfs/src/components/index.ts":{"bytesInOutput":307},"packages/plugins/experimental/plugin-wnfs/src/extensions/image.ts":{"bytesInOutput":4729},"packages/plugins/experimental/plugin-wnfs/src/load.ts":{"bytesInOutput":1569},"packages/plugins/experimental/plugin-wnfs/src/extensions/index.ts":{"bytesInOutput":0},"packages/plugins/experimental/plugin-wnfs/src/translations.ts":{"bytesInOutput":210},"packages/plugins/experimental/plugin-wnfs/src/upload.ts":{"bytesInOutput":1192},"packages/plugins/experimental/plugin-wnfs/src/wnfs-url.ts":{"bytesInOutput":110},"packages/plugins/experimental/plugin-wnfs/src/index.ts":{"bytesInOutput":30}},"bytes":15561},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/meta.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/meta.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/chunk-VL3H7P4F.mjs","kind":"import-statement"}],"exports":["WNFS_PLUGIN","default"],"entryPoint":"packages/plugins/experimental/plugin-wnfs/src/meta.ts","inputs":{},"bytes":157},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/types/index.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/chunk-JDSKIDDR.mjs","kind":"import-statement"},{"path":"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/chunk-VL3H7P4F.mjs","kind":"import-statement"}],"exports":["FileType","WnfsAction"],"entryPoint":"packages/plugins/experimental/plugin-wnfs/src/types/index.ts","inputs":{},"bytes":170},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/chunk-JDSKIDDR.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1723},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/chunk-JDSKIDDR.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/chunk-VL3H7P4F.mjs","kind":"import-statement"},{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"exports":["FileType","WnfsAction"],"inputs":{"packages/plugins/experimental/plugin-wnfs/src/types/file.ts":{"bytesInOutput":294},"packages/plugins/experimental/plugin-wnfs/src/types/index.ts":{"bytesInOutput":0},"packages/plugins/experimental/plugin-wnfs/src/types/types.ts":{"bytesInOutput":196}},"bytes":755},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/chunk-VL3H7P4F.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":734},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/chunk-VL3H7P4F.mjs":{"imports":[],"exports":["WNFS_PLUGIN","meta_default"],"inputs":{"packages/plugins/experimental/plugin-wnfs/src/meta.ts":{"bytesInOutput":312}},"bytes":456},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/FileCard-HJIZDWJF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2773},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/FileCard-HJIZDWJF.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-card","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/experimental/plugin-wnfs/src/components/FileCard.tsx","inputs":{"packages/plugins/experimental/plugin-wnfs/src/components/FileCard.tsx":{"bytesInOutput":1299}},"bytes":1461},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/FileMain-WEWTX7QB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1372},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/FileMain-WEWTX7QB.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/chunk-2I63TM7M.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/experimental/plugin-wnfs/src/components/FileMain.tsx","inputs":{"packages/plugins/experimental/plugin-wnfs/src/components/FileMain.tsx":{"bytesInOutput":566}},"bytes":783},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/FileSection-BEUGJ7EI.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1000},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/FileSection-BEUGJ7EI.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/chunk-2I63TM7M.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/experimental/plugin-wnfs/src/components/FileSection.tsx","inputs":{"packages/plugins/experimental/plugin-wnfs/src/components/FileSection.tsx":{"bytesInOutput":413}},"bytes":639},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/FileSlide-NYBGZEZS.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":964},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/FileSlide-NYBGZEZS.mjs":{"imports":[{"path":"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/chunk-2I63TM7M.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/experimental/plugin-wnfs/src/components/FileSlide.tsx","inputs":{"packages/plugins/experimental/plugin-wnfs/src/components/FileSlide.tsx":{"bytesInOutput":388}},"bytes":608},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/chunk-2I63TM7M.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1430},"packages/plugins/experimental/plugin-wnfs/dist/lib/browser/chunk-2I63TM7M.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["FilePreview"],"inputs":{"packages/plugins/experimental/plugin-wnfs/src/components/FilePreview.tsx":{"bytesInOutput":674}},"bytes":821}}}
1
+ {"inputs":{"packages/plugins/plugin-wnfs/src/meta.ts":{"bytes":1461,"imports":[],"format":"esm"},"packages/plugins/plugin-wnfs/src/capabilities/capabilities.ts":{"bytes":1989,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/helpers/common.ts":{"bytes":7743,"imports":[{"path":"multiformats/cid","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-wnfs/src/helpers/load.ts":{"bytes":9037,"imports":[{"path":"multiformats","kind":"import-statement","external":true},{"path":"uint8arrays","kind":"import-statement","external":true},{"path":"wnfs","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/helpers/common.ts","kind":"import-statement","original":"./common"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/helpers/wnfs-url.ts":{"bytes":3266,"imports":[{"path":"packages/plugins/plugin-wnfs/src/helpers/common.ts","kind":"import-statement","original":"./common"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/helpers/upload.ts":{"bytes":6784,"imports":[{"path":"multiformats","kind":"import-statement","external":true},{"path":"multiformats/codecs/raw","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/helpers/common.ts","kind":"import-statement","original":"./common"},{"path":"packages/plugins/plugin-wnfs/src/helpers/load.ts","kind":"import-statement","original":"./load"},{"path":"packages/plugins/plugin-wnfs/src/helpers/wnfs-url.ts","kind":"import-statement","original":"./wnfs-url"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/helpers/index.ts":{"bytes":756,"imports":[{"path":"packages/plugins/plugin-wnfs/src/helpers/common.ts","kind":"import-statement","original":"./common"},{"path":"packages/plugins/plugin-wnfs/src/helpers/load.ts","kind":"import-statement","original":"./load"},{"path":"packages/plugins/plugin-wnfs/src/helpers/upload.ts","kind":"import-statement","original":"./upload"},{"path":"packages/plugins/plugin-wnfs/src/helpers/wnfs-url.ts","kind":"import-statement","original":"./wnfs-url"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/blockstore.ts":{"bytes":20352,"imports":[{"path":"@ipld/car","kind":"import-statement","external":true},{"path":"blockstore-core","kind":"import-statement","external":true},{"path":"blockstore-idb","kind":"import-statement","external":true},{"path":"debounce","kind":"import-statement","external":true},{"path":"idb-keyval","kind":"import-statement","external":true},{"path":"it-all","kind":"import-statement","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"uint8arrays","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/helpers/index.ts","kind":"import-statement","original":"./helpers"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/capabilities/blockstore.ts":{"bytes":2590,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/capabilities/capabilities.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-wnfs/src/blockstore.ts","kind":"import-statement","original":"../blockstore"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/types/file.ts":{"bytes":1513,"imports":[{"path":"@dxos/echo-schema","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-wnfs/src/types/types.ts":{"bytes":4735,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/types/file.ts","kind":"import-statement","original":"./file"},{"path":"packages/plugins/plugin-wnfs/src/meta.ts","kind":"import-statement","original":"../meta"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/types/index.ts":{"bytes":579,"imports":[{"path":"packages/plugins/plugin-wnfs/src/types/file.ts","kind":"import-statement","original":"./file"},{"path":"packages/plugins/plugin-wnfs/src/types/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/capabilities/file-uploader.ts":{"bytes":3468,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/capabilities/intent-resolver.ts":{"bytes":4171,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/capabilities/capabilities.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-wnfs/src/helpers/index.ts","kind":"import-statement","original":"../helpers"},{"path":"packages/plugins/plugin-wnfs/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/extensions/image.tsx":{"bytes":21460,"imports":[{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-dom/client","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/helpers/index.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/extensions/index.ts":{"bytes":504,"imports":[{"path":"packages/plugins/plugin-wnfs/src/extensions/image.tsx","kind":"import-statement","original":"./image"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/capabilities/markdown.ts":{"bytes":3222,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/capabilities/capabilities.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-wnfs/src/extensions/index.ts","kind":"import-statement","original":"../extensions"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/components/FileInput.tsx":{"bytes":4980,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react-dropzone","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"packages/plugins/plugin-wnfs/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/components/FilePreview.tsx":{"bytes":2915,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/plugins/plugin-wnfs/src/components/FileContainer.tsx":{"bytes":6000,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/components/FilePreview.tsx","kind":"import-statement","original":"./FilePreview"},{"path":"packages/plugins/plugin-wnfs/src/capabilities/index.ts","kind":"import-statement","original":"../capabilities"},{"path":"packages/plugins/plugin-wnfs/src/helpers/index.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/components/index.ts":{"bytes":911,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/components/FileInput.tsx","kind":"import-statement","original":"./FileInput"},{"path":"packages/plugins/plugin-wnfs/src/components/FileContainer.tsx","kind":"dynamic-import","original":"./FileContainer"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/capabilities/react-surface.tsx":{"bytes":5790,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/components/index.ts","kind":"import-statement","original":"../components"},{"path":"packages/plugins/plugin-wnfs/src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"packages/plugins/plugin-wnfs/src/types/index.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/capabilities/index.ts":{"bytes":1872,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/capabilities/capabilities.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-wnfs/src/capabilities/blockstore.ts","kind":"dynamic-import","original":"./blockstore"},{"path":"packages/plugins/plugin-wnfs/src/capabilities/file-uploader.ts","kind":"dynamic-import","original":"./file-uploader"},{"path":"packages/plugins/plugin-wnfs/src/capabilities/intent-resolver.ts","kind":"dynamic-import","original":"./intent-resolver"},{"path":"packages/plugins/plugin-wnfs/src/capabilities/markdown.ts","kind":"dynamic-import","original":"./markdown"},{"path":"packages/plugins/plugin-wnfs/src/capabilities/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/translations.ts":{"bytes":1903,"imports":[{"path":"packages/plugins/plugin-wnfs/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-wnfs/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/WnfsPlugin.tsx":{"bytes":11033,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-wnfs/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-wnfs/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/plugins/plugin-wnfs/src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-wnfs/src/index.ts":{"bytes":773,"imports":[{"path":"packages/plugins/plugin-wnfs/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-wnfs/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-wnfs/src/WnfsPlugin.tsx","kind":"import-statement","original":"./WnfsPlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-wnfs/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6007},"packages/plugins/plugin-wnfs/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-ED7HMPYN.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-357BWHML.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-EMRQJXBW.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-6YFT42F7.mjs","kind":"import-statement"},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true}],"exports":["WNFS_PLUGIN","WnfsCapabilities","WnfsPlugin","meta"],"entryPoint":"packages/plugins/plugin-wnfs/src/index.ts","inputs":{"packages/plugins/plugin-wnfs/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-wnfs/src/WnfsPlugin.tsx":{"bytesInOutput":2299},"packages/plugins/plugin-wnfs/src/translations.ts":{"bytesInOutput":362}},"bytes":3222},"packages/plugins/plugin-wnfs/dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-wnfs/dist/lib/browser/types/index.mjs":{"imports":[{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-EMRQJXBW.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-6YFT42F7.mjs","kind":"import-statement"}],"exports":["FileType","WnfsAction"],"entryPoint":"packages/plugins/plugin-wnfs/src/types/index.ts","inputs":{},"bytes":170},"packages/plugins/plugin-wnfs/dist/lib/browser/blockstore-6U5XTSIH.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":10905},"packages/plugins/plugin-wnfs/dist/lib/browser/blockstore-6U5XTSIH.mjs":{"imports":[{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-SCQWJNHD.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-357BWHML.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-6YFT42F7.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@ipld/car","kind":"import-statement","external":true},{"path":"blockstore-core","kind":"import-statement","external":true},{"path":"blockstore-idb","kind":"import-statement","external":true},{"path":"debounce","kind":"import-statement","external":true},{"path":"idb-keyval","kind":"import-statement","external":true},{"path":"it-all","kind":"import-statement","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"uint8arrays","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-wnfs/src/capabilities/blockstore.ts","inputs":{"packages/plugins/plugin-wnfs/src/capabilities/blockstore.ts":{"bytesInOutput":453},"packages/plugins/plugin-wnfs/src/blockstore.ts":{"bytesInOutput":4300}},"bytes":5167},"packages/plugins/plugin-wnfs/dist/lib/browser/file-uploader-EDHMSKYS.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1841},"packages/plugins/plugin-wnfs/dist/lib/browser/file-uploader-EDHMSKYS.mjs":{"imports":[{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-EMRQJXBW.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-6YFT42F7.mjs","kind":"import-statement"},{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-wnfs/src/capabilities/file-uploader.ts","inputs":{"packages/plugins/plugin-wnfs/src/capabilities/file-uploader.ts":{"bytesInOutput":746}},"bytes":996},"packages/plugins/plugin-wnfs/dist/lib/browser/intent-resolver-WDO4EIG3.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1948},"packages/plugins/plugin-wnfs/dist/lib/browser/intent-resolver-WDO4EIG3.mjs":{"imports":[{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-SCQWJNHD.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-357BWHML.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-EMRQJXBW.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-6YFT42F7.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-wnfs/src/capabilities/intent-resolver.ts","inputs":{"packages/plugins/plugin-wnfs/src/capabilities/intent-resolver.ts":{"bytesInOutput":838}},"bytes":1214},"packages/plugins/plugin-wnfs/dist/lib/browser/markdown-MGSH5CVQ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":12473},"packages/plugins/plugin-wnfs/dist/lib/browser/markdown-MGSH5CVQ.mjs":{"imports":[{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-SCQWJNHD.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-357BWHML.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-6YFT42F7.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-markdown","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@codemirror/language","kind":"import-statement","external":true},{"path":"@codemirror/state","kind":"import-statement","external":true},{"path":"@codemirror/view","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-dom/client","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-editor","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-wnfs/src/capabilities/markdown.ts","inputs":{"packages/plugins/plugin-wnfs/src/capabilities/markdown.ts":{"bytesInOutput":651},"packages/plugins/plugin-wnfs/src/extensions/image.tsx":{"bytesInOutput":4794},"packages/plugins/plugin-wnfs/src/extensions/index.ts":{"bytesInOutput":0}},"bytes":5889},"packages/plugins/plugin-wnfs/dist/lib/browser/FileContainer-4FF5D2ZF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4327},"packages/plugins/plugin-wnfs/dist/lib/browser/FileContainer-4FF5D2ZF.mjs":{"imports":[{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-ED7HMPYN.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-SCQWJNHD.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-357BWHML.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-6YFT42F7.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-ui-stack","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-wnfs/src/components/FileContainer.tsx","inputs":{"packages/plugins/plugin-wnfs/src/components/FileContainer.tsx":{"bytesInOutput":1519},"packages/plugins/plugin-wnfs/src/components/FilePreview.tsx":{"bytesInOutput":674}},"bytes":2697},"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-ED7HMPYN.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":909},"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-ED7HMPYN.mjs":{"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/blockstore-6U5XTSIH.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/file-uploader-EDHMSKYS.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/intent-resolver-WDO4EIG3.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/markdown-MGSH5CVQ.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/react-surface-OUVGXVOP.mjs","kind":"dynamic-import"}],"exports":["Blockstore","FileUploader","IntentResolver","Markdown","ReactSurface"],"inputs":{"packages/plugins/plugin-wnfs/src/capabilities/index.ts":{"bytesInOutput":389}},"bytes":579},"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-SCQWJNHD.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":13316},"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-SCQWJNHD.mjs":{"imports":[{"path":"multiformats/cid","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@dxos/crypto","kind":"import-statement","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"uint8arrays","kind":"import-statement","external":true},{"path":"wnfs","kind":"import-statement","external":true},{"path":"multiformats","kind":"import-statement","external":true},{"path":"multiformats/codecs/raw","kind":"import-statement","external":true},{"path":"multiformats/hashes/sha2","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["filePath","getBlobUrl","getPathFromUrl","loadWnfs","storeName","upload","wnfsUrl"],"inputs":{"packages/plugins/plugin-wnfs/src/helpers/common.ts":{"bytesInOutput":1077},"packages/plugins/plugin-wnfs/src/helpers/load.ts":{"bytesInOutput":1918},"packages/plugins/plugin-wnfs/src/helpers/wnfs-url.ts":{"bytesInOutput":545},"packages/plugins/plugin-wnfs/src/helpers/upload.ts":{"bytesInOutput":1281},"packages/plugins/plugin-wnfs/src/helpers/index.ts":{"bytesInOutput":0}},"bytes":5186},"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-357BWHML.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1040},"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-357BWHML.mjs":{"imports":[{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-6YFT42F7.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true}],"exports":["WnfsCapabilities"],"inputs":{"packages/plugins/plugin-wnfs/src/capabilities/capabilities.ts":{"bytesInOutput":338}},"bytes":534},"packages/plugins/plugin-wnfs/dist/lib/browser/react-surface-OUVGXVOP.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5752},"packages/plugins/plugin-wnfs/dist/lib/browser/react-surface-OUVGXVOP.mjs":{"imports":[{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-EMRQJXBW.mjs","kind":"import-statement"},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-6YFT42F7.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-dropzone","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/FileContainer-4FF5D2ZF.mjs","kind":"dynamic-import"}],"exports":["default"],"entryPoint":"packages/plugins/plugin-wnfs/src/capabilities/react-surface.tsx","inputs":{"packages/plugins/plugin-wnfs/src/capabilities/react-surface.tsx":{"bytesInOutput":1203},"packages/plugins/plugin-wnfs/src/components/index.ts":{"bytesInOutput":107},"packages/plugins/plugin-wnfs/src/components/FileInput.tsx":{"bytesInOutput":1137}},"bytes":2977},"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-EMRQJXBW.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3061},"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-EMRQJXBW.mjs":{"imports":[{"path":"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-6YFT42F7.mjs","kind":"import-statement"},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/react-client/echo","kind":"import-statement","external":true}],"exports":["FileType","WnfsAction"],"inputs":{"packages/plugins/plugin-wnfs/src/types/file.ts":{"bytesInOutput":260},"packages/plugins/plugin-wnfs/src/types/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-wnfs/src/types/types.ts":{"bytesInOutput":1096}},"bytes":1595},"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-6YFT42F7.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":697},"packages/plugins/plugin-wnfs/dist/lib/browser/chunk-6YFT42F7.mjs":{"imports":[],"exports":["WNFS_PLUGIN","meta"],"inputs":{"packages/plugins/plugin-wnfs/src/meta.ts":{"bytesInOutput":270}},"bytes":393}}}