@dxos/plugin-wnfs 0.8.3-staging.0fa589b → 0.8.4-main.1068cf700f

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 (139) hide show
  1. package/dist/lib/browser/FileContainer-FUAINNAS.mjs +91 -0
  2. package/dist/lib/browser/FileContainer-FUAINNAS.mjs.map +7 -0
  3. package/dist/lib/browser/{blockstore-UT7233RJ.mjs → blockstore-U42RF6KA.mjs} +20 -20
  4. package/dist/lib/browser/blockstore-U42RF6KA.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-YYAW4U6J.mjs → chunk-NCTUASHL.mjs} +23 -15
  6. package/dist/lib/browser/chunk-NCTUASHL.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-PCYQNMXS.mjs +155 -0
  8. package/dist/lib/browser/chunk-PCYQNMXS.mjs.map +7 -0
  9. package/dist/lib/browser/file-uploader-VBBUS2GG.mjs +35 -0
  10. package/dist/lib/browser/file-uploader-VBBUS2GG.mjs.map +7 -0
  11. package/dist/lib/browser/index.mjs +92 -91
  12. package/dist/lib/browser/index.mjs.map +4 -4
  13. package/dist/lib/browser/{markdown-BWBHUHHH.mjs → markdown-ZLOS5HZU.mjs} +32 -27
  14. package/dist/lib/browser/markdown-ZLOS5HZU.mjs.map +7 -0
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/operation-resolver-7TLMWGST.mjs +99 -0
  17. package/dist/lib/browser/operation-resolver-7TLMWGST.mjs.map +7 -0
  18. package/dist/lib/browser/react-surface-YTIVVF2C.mjs +82 -0
  19. package/dist/lib/browser/react-surface-YTIVVF2C.mjs.map +7 -0
  20. package/dist/lib/browser/types/index.mjs +9 -6
  21. package/dist/types/src/WnfsPlugin.d.ts +2 -1
  22. package/dist/types/src/WnfsPlugin.d.ts.map +1 -1
  23. package/dist/types/src/capabilities/blockstore/blockstore.d.ts +5 -0
  24. package/dist/types/src/capabilities/blockstore/blockstore.d.ts.map +1 -0
  25. package/dist/types/src/capabilities/blockstore/index.d.ts +3 -0
  26. package/dist/types/src/capabilities/blockstore/index.d.ts.map +1 -0
  27. package/dist/types/src/capabilities/file-uploader/file-uploader.d.ts +6 -0
  28. package/dist/types/src/capabilities/file-uploader/file-uploader.d.ts.map +1 -0
  29. package/dist/types/src/capabilities/file-uploader/index.d.ts +3 -0
  30. package/dist/types/src/capabilities/file-uploader/index.d.ts.map +1 -0
  31. package/dist/types/src/capabilities/index.d.ts +5 -6
  32. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  33. package/dist/types/src/capabilities/markdown/index.d.ts +3 -0
  34. package/dist/types/src/capabilities/markdown/index.d.ts.map +1 -0
  35. package/dist/types/src/capabilities/markdown/markdown.d.ts +5 -0
  36. package/dist/types/src/capabilities/markdown/markdown.d.ts.map +1 -0
  37. package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
  38. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  39. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
  40. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  41. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  42. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  43. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  44. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  45. package/dist/types/src/components/FileContainer.d.ts +4 -5
  46. package/dist/types/src/components/FileContainer.d.ts.map +1 -1
  47. package/dist/types/src/components/FileInput.d.ts +1 -1
  48. package/dist/types/src/components/FileInput.d.ts.map +1 -1
  49. package/dist/types/src/components/index.d.ts +1 -4
  50. package/dist/types/src/components/index.d.ts.map +1 -1
  51. package/dist/types/src/extensions/image.d.ts +1 -1
  52. package/dist/types/src/extensions/image.d.ts.map +1 -1
  53. package/dist/types/src/extensions/image.stories.d.ts +5 -4
  54. package/dist/types/src/extensions/image.stories.d.ts.map +1 -1
  55. package/dist/types/src/helpers/load.d.ts +2 -2
  56. package/dist/types/src/helpers/load.d.ts.map +1 -1
  57. package/dist/types/src/helpers/upload.d.ts +1 -1
  58. package/dist/types/src/helpers/upload.d.ts.map +1 -1
  59. package/dist/types/src/index.d.ts +1 -1
  60. package/dist/types/src/index.d.ts.map +1 -1
  61. package/dist/types/src/meta.d.ts +2 -3
  62. package/dist/types/src/meta.d.ts.map +1 -1
  63. package/dist/types/src/translations.d.ts +17 -12
  64. package/dist/types/src/translations.d.ts.map +1 -1
  65. package/dist/types/src/types/File.d.ts +16 -0
  66. package/dist/types/src/types/File.d.ts.map +1 -0
  67. package/dist/types/src/{capabilities → types}/capabilities.d.ts +3 -2
  68. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  69. package/dist/types/src/types/index.d.ts +2 -1
  70. package/dist/types/src/types/index.d.ts.map +1 -1
  71. package/dist/types/src/types/types.d.ts +108 -47
  72. package/dist/types/src/types/types.d.ts.map +1 -1
  73. package/dist/types/tsconfig.tsbuildinfo +1 -1
  74. package/package.json +48 -42
  75. package/src/WnfsPlugin.tsx +64 -81
  76. package/src/blockstore.ts +2 -2
  77. package/src/capabilities/blockstore/blockstore.ts +22 -0
  78. package/src/capabilities/blockstore/index.ts +7 -0
  79. package/src/capabilities/file-uploader/file-uploader.ts +34 -0
  80. package/src/capabilities/file-uploader/index.ts +7 -0
  81. package/src/capabilities/index.ts +5 -9
  82. package/src/capabilities/markdown/index.ts +7 -0
  83. package/src/capabilities/markdown/markdown.ts +33 -0
  84. package/src/capabilities/operation-resolver/index.ts +7 -0
  85. package/src/capabilities/operation-resolver/operation-resolver.ts +62 -0
  86. package/src/capabilities/react-surface/index.ts +7 -0
  87. package/src/capabilities/react-surface/react-surface.tsx +50 -0
  88. package/src/components/FileContainer.tsx +30 -19
  89. package/src/components/FileInput.tsx +5 -5
  90. package/src/components/FilePreview.tsx +4 -4
  91. package/src/extensions/image.stories.tsx +18 -14
  92. package/src/extensions/image.tsx +9 -9
  93. package/src/helpers/load.ts +14 -8
  94. package/src/helpers/upload.ts +6 -2
  95. package/src/index.ts +1 -1
  96. package/src/meta.ts +9 -6
  97. package/src/translations.ts +14 -7
  98. package/src/types/File.ts +24 -0
  99. package/src/{capabilities → types}/capabilities.ts +4 -4
  100. package/src/types/index.ts +2 -1
  101. package/src/types/types.ts +58 -17
  102. package/dist/lib/browser/FileContainer-7YOCEQ6P.mjs +0 -106
  103. package/dist/lib/browser/FileContainer-7YOCEQ6P.mjs.map +0 -7
  104. package/dist/lib/browser/blockstore-UT7233RJ.mjs.map +0 -7
  105. package/dist/lib/browser/chunk-DL7BBH57.mjs +0 -16
  106. package/dist/lib/browser/chunk-DL7BBH57.mjs.map +0 -7
  107. package/dist/lib/browser/chunk-PHTWWADN.mjs +0 -15
  108. package/dist/lib/browser/chunk-PHTWWADN.mjs.map +0 -7
  109. package/dist/lib/browser/chunk-SCL6PT4P.mjs +0 -64
  110. package/dist/lib/browser/chunk-SCL6PT4P.mjs.map +0 -7
  111. package/dist/lib/browser/chunk-WJVYRUYQ.mjs +0 -16
  112. package/dist/lib/browser/chunk-WJVYRUYQ.mjs.map +0 -7
  113. package/dist/lib/browser/chunk-YYAW4U6J.mjs.map +0 -7
  114. package/dist/lib/browser/file-uploader-RHINBPDQ.mjs +0 -29
  115. package/dist/lib/browser/file-uploader-RHINBPDQ.mjs.map +0 -7
  116. package/dist/lib/browser/intent-resolver-JDRRPIZC.mjs +0 -49
  117. package/dist/lib/browser/intent-resolver-JDRRPIZC.mjs.map +0 -7
  118. package/dist/lib/browser/markdown-BWBHUHHH.mjs.map +0 -7
  119. package/dist/lib/browser/react-surface-6GM4J4YG.mjs +0 -88
  120. package/dist/lib/browser/react-surface-6GM4J4YG.mjs.map +0 -7
  121. package/dist/types/src/capabilities/blockstore.d.ts +0 -4
  122. package/dist/types/src/capabilities/blockstore.d.ts.map +0 -1
  123. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  124. package/dist/types/src/capabilities/file-uploader.d.ts +0 -4
  125. package/dist/types/src/capabilities/file-uploader.d.ts.map +0 -1
  126. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  127. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  128. package/dist/types/src/capabilities/markdown.d.ts +0 -4
  129. package/dist/types/src/capabilities/markdown.d.ts.map +0 -1
  130. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  131. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  132. package/dist/types/src/types/file.d.ts +0 -16
  133. package/dist/types/src/types/file.d.ts.map +0 -1
  134. package/src/capabilities/blockstore.ts +0 -18
  135. package/src/capabilities/file-uploader.ts +0 -24
  136. package/src/capabilities/intent-resolver.ts +0 -32
  137. package/src/capabilities/markdown.ts +0 -25
  138. package/src/capabilities/react-surface.tsx +0 -45
  139. package/src/types/file.ts +0 -17
@@ -1,114 +1,115 @@
1
1
  import {
2
- Blockstore,
3
- FileUploader,
4
- IntentResolver,
5
- Markdown,
6
- ReactSurface
7
- } from "./chunk-WJVYRUYQ.mjs";
8
- import {
9
- WnfsCapabilities
10
- } from "./chunk-DL7BBH57.mjs";
11
- import {
12
- FileType,
13
- WnfsAction
14
- } from "./chunk-SCL6PT4P.mjs";
15
- import {
16
- WNFS_PLUGIN,
2
+ File_exports,
3
+ WnfsAction,
4
+ WnfsCapabilities,
5
+ WnfsOperation,
17
6
  meta
18
- } from "./chunk-PHTWWADN.mjs";
7
+ } from "./chunk-PCYQNMXS.mjs";
19
8
 
20
- // packages/plugins/plugin-wnfs/src/WnfsPlugin.tsx
21
- import { pipe } from "effect";
22
- import { Capabilities, Events, chain, contributes, createIntent, defineModule, definePlugin } from "@dxos/app-framework";
9
+ // src/WnfsPlugin.tsx
10
+ import * as Effect from "effect/Effect";
11
+ import { Capability as Capability6, Plugin } from "@dxos/app-framework";
12
+ import { AppPlugin } from "@dxos/app-toolkit";
13
+ import { Operation } from "@dxos/operation";
23
14
  import { ClientEvents } from "@dxos/plugin-client";
24
15
  import { MarkdownEvents } from "@dxos/plugin-markdown";
25
- import { SpaceCapabilities } from "@dxos/plugin-space";
26
- import { defineObjectForm } from "@dxos/plugin-space/types";
16
+ import { SpaceCapabilities, SpaceEvents } from "@dxos/plugin-space";
17
+
18
+ // src/capabilities/blockstore/index.ts
19
+ import { Capability } from "@dxos/app-framework";
20
+ var Blockstore = Capability.lazy("Blockstore", () => import("./blockstore-U42RF6KA.mjs"));
21
+
22
+ // src/capabilities/file-uploader/index.ts
23
+ import { Capability as Capability2 } from "@dxos/app-framework";
24
+ var FileUploader = Capability2.lazy("FileUploader", () => import("./file-uploader-VBBUS2GG.mjs"));
27
25
 
28
- // packages/plugins/plugin-wnfs/src/translations.ts
29
- var translations_default = [
26
+ // src/capabilities/markdown/index.ts
27
+ import { Capability as Capability3 } from "@dxos/app-framework";
28
+ var Markdown = Capability3.lazy("Markdown", () => import("./markdown-ZLOS5HZU.mjs"));
29
+
30
+ // src/capabilities/operation-resolver/index.ts
31
+ import { Capability as Capability4 } from "@dxos/app-framework";
32
+ var OperationResolver = Capability4.lazy("OperationResolver", () => import("./operation-resolver-7TLMWGST.mjs"));
33
+
34
+ // src/capabilities/react-surface/index.ts
35
+ import { Capability as Capability5 } from "@dxos/app-framework";
36
+ var ReactSurface = Capability5.lazy("ReactSurface", () => import("./react-surface-YTIVVF2C.mjs"));
37
+
38
+ // src/translations.ts
39
+ var translations = [
30
40
  {
31
41
  "en-US": {
32
- [FileType.typename]: {
42
+ [File_exports.File.typename]: {
33
43
  "typename label": "File",
34
- "object name placeholder": "New file"
44
+ "typename label_zero": "Files",
45
+ "typename label_one": "File",
46
+ "typename label_other": "Files",
47
+ "object name placeholder": "New file",
48
+ "rename object label": "Rename file",
49
+ "delete object label": "Delete file",
50
+ "object deleted label": "File deleted"
35
51
  },
36
- [WNFS_PLUGIN]: {
52
+ [meta.id]: {
37
53
  "plugin name": "Files",
38
- "delete object label": "Delete",
39
54
  "file input placeholder": "Drop a file here, or click to select a file"
40
55
  }
41
56
  }
42
57
  }
43
58
  ];
44
59
 
45
- // packages/plugins/plugin-wnfs/src/WnfsPlugin.tsx
46
- var WnfsPlugin = () => definePlugin(meta, [
47
- defineModule({
48
- id: `${meta.id}/module/blockstore`,
49
- activatesOn: ClientEvents.ClientReady,
50
- activate: Blockstore
51
- }),
52
- defineModule({
53
- id: `${meta.id}/module/instances`,
54
- activatesOn: ClientEvents.ClientReady,
55
- activate: () => {
56
- const instances = {};
57
- return contributes(WnfsCapabilities.Instances, instances);
60
+ // src/WnfsPlugin.tsx
61
+ var WnfsPlugin = Plugin.define(meta).pipe(AppPlugin.addMetadataModule({
62
+ metadata: {
63
+ id: File_exports.File.typename,
64
+ metadata: {
65
+ // TODO(wittjosiah): Would be nice if icon could change based on the type of the file.
66
+ icon: "ph--file--regular",
67
+ iconHue: "teal",
68
+ inputSchema: WnfsAction.UploadFileSchema,
69
+ createObject: (props, { db }) => Effect.gen(function* () {
70
+ const { object } = yield* Operation.invoke(WnfsOperation.CreateFile, {
71
+ ...props,
72
+ db
73
+ });
74
+ return object;
75
+ })
58
76
  }
59
- }),
60
- defineModule({
61
- id: `${meta.id}/module/translations`,
62
- activatesOn: Events.SetupTranslations,
63
- activate: () => contributes(Capabilities.Translations, translations_default)
64
- }),
65
- defineModule({
66
- id: `${meta.id}/module/metadata`,
67
- activatesOn: Events.SetupMetadata,
68
- activate: () => contributes(Capabilities.Metadata, {
69
- id: FileType.typename,
70
- metadata: {
71
- label: (object) => object instanceof FileType ? object.name : void 0,
72
- // TODO(wittjosiah): Would be nice if icon could change based on the type of the file.
73
- icon: "ph--file--regular"
74
- }
75
- })
76
- }),
77
- defineModule({
78
- id: `${meta.id}/module/object-form`,
79
- activatesOn: ClientEvents.SetupSchema,
80
- activate: () => contributes(SpaceCapabilities.ObjectForm, defineObjectForm({
81
- objectSchema: FileType,
82
- formSchema: WnfsAction.UploadFileSchema,
83
- getIntent: (props, options) => pipe(createIntent(WnfsAction.Upload, {
84
- ...props,
85
- space: options.space
86
- }), chain(WnfsAction.Create, {}))
87
- }))
88
- }),
89
- defineModule({
90
- id: `${meta.id}/module/file-uploader`,
91
- activatesOn: ClientEvents.ClientReady,
92
- activate: FileUploader
93
- }),
94
- defineModule({
95
- id: `${meta.id}/module/markdown`,
96
- activatesOn: MarkdownEvents.SetupExtensions,
97
- activate: Markdown
98
- }),
99
- defineModule({
100
- id: `${meta.id}/module/react-surface`,
101
- activatesOn: Events.SetupReactSurface,
102
- activate: ReactSurface
103
- }),
104
- defineModule({
105
- id: `${meta.id}/module/intent-resolver`,
106
- activatesOn: Events.SetupIntentResolver,
107
- activate: IntentResolver
77
+ }
78
+ }), AppPlugin.addOperationResolverModule({
79
+ activate: OperationResolver
80
+ }), AppPlugin.addSchemaModule({
81
+ schema: [
82
+ File_exports.File
83
+ ]
84
+ }), AppPlugin.addSurfaceModule({
85
+ activate: ReactSurface
86
+ }), AppPlugin.addTranslationsModule({
87
+ translations
88
+ }), Plugin.addModule({
89
+ id: "blockstore",
90
+ activatesOn: ClientEvents.ClientReady,
91
+ activate: Blockstore
92
+ }), Plugin.addModule({
93
+ id: "instances",
94
+ activatesOn: ClientEvents.ClientReady,
95
+ activate: () => Effect.sync(() => {
96
+ const instances = {};
97
+ return Capability6.contributes(WnfsCapabilities.Instances, instances);
108
98
  })
109
- ]);
99
+ }), Plugin.addModule({
100
+ id: "on-space-created",
101
+ activatesOn: SpaceEvents.SpaceCreated,
102
+ activate: () => Effect.succeed(Capability6.contributes(SpaceCapabilities.OnCreateSpace, (params) => Operation.invoke(WnfsOperation.OnCreateSpace, params)))
103
+ }), Plugin.addModule({
104
+ id: "file-uploader",
105
+ activatesOn: ClientEvents.ClientReady,
106
+ activate: FileUploader
107
+ }), Plugin.addModule({
108
+ id: "markdown",
109
+ activatesOn: MarkdownEvents.SetupExtensions,
110
+ activate: Markdown
111
+ }), Plugin.make);
110
112
  export {
111
- WNFS_PLUGIN,
112
113
  WnfsCapabilities,
113
114
  WnfsPlugin,
114
115
  meta
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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} from '@dxos/app-framework';\nimport { ClientEvents } from '@dxos/plugin-client';\nimport { MarkdownEvents } from '@dxos/plugin-markdown';\nimport { SpaceCapabilities } from '@dxos/plugin-space';\nimport { defineObjectForm } from '@dxos/plugin-space/types';\n\nimport { Blockstore, FileUploader, IntentResolver, Markdown, ReactSurface, WnfsCapabilities } from './capabilities';\nimport { meta } 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: ClientEvents.ClientReady,\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: Events.SetupMetadata,\n activate: () =>\n contributes(Capabilities.Metadata, {\n id: FileType.typename,\n metadata: {\n label: (object: any) => (object instanceof FileType ? object.name : undefined),\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/object-form`,\n activatesOn: ClientEvents.SetupSchema,\n activate: () =>\n contributes(\n SpaceCapabilities.ObjectForm,\n defineObjectForm({\n objectSchema: FileType,\n formSchema: WnfsAction.UploadFileSchema,\n getIntent: (props, options) =>\n pipe(createIntent(WnfsAction.Upload, { ...props, space: options.space }), chain(WnfsAction.Create, {})),\n }),\n ),\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: MarkdownEvents.SetupExtensions,\n activate: Markdown,\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupReactSurface,\n activate: ReactSurface,\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntentResolver,\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 'object name placeholder': 'New file',\n },\n [WNFS_PLUGIN]: {\n 'plugin name': 'Files',\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,oBACK;AACP,SAASC,oBAAoB;AAC7B,SAASC,sBAAsB;AAC/B,SAASC,yBAAyB;AAClC,SAASC,wBAAwB;;;ACXjC,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACC,SAASC,QAAQ,GAAG;QACnB,kBAAkB;QAClB,2BAA2B;MAC7B;MACA,CAACC,WAAAA,GAAc;QACb,eAAe;QACf,uBAAuB;QACvB,0BAA0B;MAC5B;IACF;EACF;;;;ADKK,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,aAAaC,aAAaC;IAC1BC,UAAU,MAAA;AACR,YAAME,YAAwC,CAAC;AAC/C,aAAOC,YAAYC,iBAAiBC,WAAWH,SAAAA;IACjD;EACF,CAAA;EACAP,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaS,OAAOC;IACpBP,UAAU,MAAMG,YAAYK,aAAaC,cAAcC,oBAAAA;EACzD,CAAA;EACAf,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaS,OAAOK;IACpBX,UAAU,MACRG,YAAYK,aAAaI,UAAU;MACjChB,IAAIiB,SAASC;MACbC,UAAU;QACRC,OAAO,CAACC,WAAiBA,kBAAkBJ,WAAWI,OAAOC,OAAOC;;QAEpEC,MAAM;MACR;IACF,CAAA;EACJ,CAAA;EACAzB,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,aAAauB;IAC1BrB,UAAU,MACRG,YACEmB,kBAAkBC,YAClBC,iBAAiB;MACfC,cAAcZ;MACda,YAAYC,WAAWC;MACvBC,WAAW,CAACC,OAAOC,YACjBC,KAAKC,aAAaN,WAAWO,QAAQ;QAAE,GAAGJ;QAAOK,OAAOJ,QAAQI;MAAM,CAAA,GAAIC,MAAMT,WAAWU,QAAQ,CAAC,CAAA,CAAA;IACxG,CAAA,CAAA;EAEN,CAAA;EACA1C,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,aAAaC;IAC1BC,UAAUsC;EACZ,CAAA;EACA3C,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAa0C,eAAeC;IAC5BxC,UAAUyC;EACZ,CAAA;EACA9C,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaS,OAAOoC;IACpB1C,UAAU2C;EACZ,CAAA;EACAhD,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaS,OAAOsC;IACpB5C,UAAU6C;EACZ,CAAA;CACD;",
6
- "names": ["pipe", "Capabilities", "Events", "chain", "contributes", "createIntent", "defineModule", "definePlugin", "ClientEvents", "MarkdownEvents", "SpaceCapabilities", "defineObjectForm", "FileType", "typename", "WNFS_PLUGIN", "WnfsPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "ClientEvents", "ClientReady", "activate", "Blockstore", "instances", "contributes", "WnfsCapabilities", "Instances", "Events", "SetupTranslations", "Capabilities", "Translations", "translations", "SetupMetadata", "Metadata", "FileType", "typename", "metadata", "label", "object", "name", "undefined", "icon", "SetupSchema", "SpaceCapabilities", "ObjectForm", "defineObjectForm", "objectSchema", "formSchema", "WnfsAction", "UploadFileSchema", "getIntent", "props", "options", "pipe", "createIntent", "Upload", "space", "chain", "Create", "FileUploader", "MarkdownEvents", "SetupExtensions", "Markdown", "SetupReactSurface", "ReactSurface", "SetupIntentResolver", "IntentResolver"]
3
+ "sources": ["../../../src/WnfsPlugin.tsx", "../../../src/capabilities/blockstore/index.ts", "../../../src/capabilities/file-uploader/index.ts", "../../../src/capabilities/markdown/index.ts", "../../../src/capabilities/operation-resolver/index.ts", "../../../src/capabilities/react-surface/index.ts", "../../../src/translations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability, Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/operation';\nimport { ClientEvents } from '@dxos/plugin-client';\nimport { MarkdownEvents } from '@dxos/plugin-markdown';\nimport { SpaceCapabilities, SpaceEvents } from '@dxos/plugin-space';\nimport { type CreateObject } from '@dxos/plugin-space/types';\n\nimport { Blockstore, FileUploader, Markdown, OperationResolver, ReactSurface } from './capabilities';\nimport { meta } from './meta';\nimport { translations } from './translations';\nimport { WnfsAction, WnfsCapabilities, WnfsFile, WnfsOperation } from './types';\n\nexport const WnfsPlugin = Plugin.define(meta).pipe(\n AppPlugin.addMetadataModule({\n metadata: {\n id: WnfsFile.File.typename,\n metadata: {\n // TODO(wittjosiah): Would be nice if icon could change based on the type of the file.\n icon: 'ph--file--regular',\n iconHue: 'teal',\n inputSchema: WnfsAction.UploadFileSchema,\n createObject: ((props, { db }) =>\n Effect.gen(function* () {\n const { object } = yield* Operation.invoke(WnfsOperation.CreateFile, { ...props, db });\n return object;\n })) satisfies CreateObject,\n },\n },\n }),\n AppPlugin.addOperationResolverModule({ activate: OperationResolver }),\n AppPlugin.addSchemaModule({ schema: [WnfsFile.File] }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.addModule({\n id: 'blockstore',\n activatesOn: ClientEvents.ClientReady,\n activate: Blockstore,\n }),\n Plugin.addModule({\n id: 'instances',\n activatesOn: ClientEvents.ClientReady,\n activate: () =>\n Effect.sync(() => {\n const instances: WnfsCapabilities.Instances = {};\n return Capability.contributes(WnfsCapabilities.Instances, instances);\n }),\n }),\n Plugin.addModule({\n id: 'on-space-created',\n activatesOn: SpaceEvents.SpaceCreated,\n activate: () =>\n Effect.succeed(\n Capability.contributes(SpaceCapabilities.OnCreateSpace, (params) =>\n Operation.invoke(WnfsOperation.OnCreateSpace, params),\n ),\n ),\n }),\n Plugin.addModule({\n id: 'file-uploader',\n activatesOn: ClientEvents.ClientReady,\n activate: FileUploader,\n }),\n Plugin.addModule({\n id: 'markdown',\n activatesOn: MarkdownEvents.SetupExtensions,\n activate: Markdown,\n }),\n Plugin.make,\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const Blockstore = Capability.lazy('Blockstore', () => import('./blockstore'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const FileUploader = Capability.lazy('FileUploader', () => import('./file-uploader'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const Markdown = Capability.lazy('Markdown', () => import('./markdown'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const OperationResolver = Capability.lazy('OperationResolver', () => import('./operation-resolver'));\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nexport const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nimport { meta } from './meta';\nimport { WnfsFile } from './types';\n\nexport const translations = [\n {\n 'en-US': {\n [WnfsFile.File.typename]: {\n 'typename label': 'File',\n 'typename label_zero': 'Files',\n 'typename label_one': 'File',\n 'typename label_other': 'Files',\n 'object name placeholder': 'New file',\n 'rename object label': 'Rename file',\n 'delete object label': 'Delete file',\n 'object deleted label': 'File deleted',\n },\n [meta.id]: {\n 'plugin name': 'Files',\n 'file input placeholder': 'Drop a file here, or click to select a file',\n },\n },\n },\n] as const satisfies Resource[];\n"],
5
+ "mappings": ";;;;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,cAAAA,aAAYC,cAAc;AACnC,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAC1B,SAASC,oBAAoB;AAC7B,SAASC,sBAAsB;AAC/B,SAASC,mBAAmBC,mBAAmB;;;ACP/C,SAASC,kBAAkB;AAEpB,IAAMC,aAAaC,WAAWC,KAAK,cAAc,MAAM,OAAO,2BAAA,CAAA;;;ACFrE,SAASC,cAAAA,mBAAkB;AAEpB,IAAMC,eAAeC,YAAWC,KAAK,gBAAgB,MAAM,OAAO,8BAAA,CAAA;;;ACFzE,SAASC,cAAAA,mBAAkB;AAEpB,IAAMC,WAAWC,YAAWC,KAAK,YAAY,MAAM,OAAO,yBAAA,CAAA;;;ACFjE,SAASC,cAAAA,mBAAkB;AAEpB,IAAMC,oBAAoBC,YAAWC,KAAK,qBAAqB,MAAM,OAAO,mCAAA,CAAA;;;ACFnF,SAASC,cAAAA,mBAAkB;AAEpB,IAAMC,eAAeC,YAAWC,KAAK,gBAAgB,MAAM,OAAO,8BAAA,CAAA;;;ACGlE,IAA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YM,kBAAkBC,eAAe,CAACC,WACvD7B,UAAUC,OAAOC,cAAc0B,eAAeC,MAAAA,CAAAA,CAAAA;AAGtD,CAAA,GACAlD,OAAOkC,UAAU;EACf3B,IAAI;EACJ4B,aAAaC,aAAaC;EAC1BX,UAAUyB;AACZ,CAAA,GACAnD,OAAOkC,UAAU;EACf3B,IAAI;EACJ4B,aAAaiB,eAAeC;EAC5B3B,UAAU4B;AACZ,CAAA,GACAtD,OAAOuD,IAAI;",
6
+ "names": ["Effect", "Capability", "Plugin", "AppPlugin", "Operation", "ClientEvents", "MarkdownEvents", "SpaceCapabilities", "SpaceEvents", "Capability", "Blockstore", "Capability", "lazy", "Capability", "FileUploader", "Capability", "lazy", "Capability", "Markdown", "Capability", "lazy", "Capability", "OperationResolver", "Capability", "lazy", "Capability", "ReactSurface", "Capability", "lazy", "translations", "WnfsFile", "File", "typename", "meta", "id", "WnfsPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addMetadataModule", "metadata", "id", "WnfsFile", "File", "typename", "icon", "iconHue", "inputSchema", "WnfsAction", "UploadFileSchema", "createObject", "props", "db", "gen", "object", "Operation", "invoke", "WnfsOperation", "CreateFile", "addOperationResolverModule", "activate", "OperationResolver", "addSchemaModule", "schema", "addSurfaceModule", "ReactSurface", "addTranslationsModule", "translations", "addModule", "activatesOn", "ClientEvents", "ClientReady", "Blockstore", "sync", "instances", "Capability", "contributes", "WnfsCapabilities", "Instances", "SpaceEvents", "SpaceCreated", "succeed", "SpaceCapabilities", "OnCreateSpace", "params", "FileUploader", "MarkdownEvents", "SetupExtensions", "Markdown", "make"]
7
7
  }
@@ -2,26 +2,26 @@ import {
2
2
  getBlobUrl,
3
3
  getPathFromUrl,
4
4
  loadWnfs
5
- } from "./chunk-YYAW4U6J.mjs";
5
+ } from "./chunk-NCTUASHL.mjs";
6
6
  import {
7
7
  WnfsCapabilities
8
- } from "./chunk-DL7BBH57.mjs";
9
- import "./chunk-PHTWWADN.mjs";
8
+ } from "./chunk-PCYQNMXS.mjs";
10
9
 
11
- // packages/plugins/plugin-wnfs/src/capabilities/markdown.ts
12
- import { contributes } from "@dxos/app-framework";
10
+ // src/capabilities/markdown/markdown.ts
11
+ import * as Effect from "effect/Effect";
12
+ import { Capability } from "@dxos/app-framework";
13
13
  import { MarkdownCapabilities } from "@dxos/plugin-markdown";
14
14
  import { getSpace } from "@dxos/react-client/echo";
15
15
 
16
- // packages/plugins/plugin-wnfs/src/extensions/image.tsx
16
+ // src/extensions/image.tsx
17
17
  import { syntaxTree } from "@codemirror/language";
18
18
  import { StateField } from "@codemirror/state";
19
19
  import { Decoration, EditorView, WidgetType } from "@codemirror/view";
20
20
  import React from "react";
21
21
  import { createRoot } from "react-dom/client";
22
22
  import { Status, ThemeProvider } from "@dxos/react-ui";
23
- import { focusField } from "@dxos/react-ui-editor";
24
- import { defaultTx } from "@dxos/react-ui-theme";
23
+ import { focusField } from "@dxos/ui-editor";
24
+ import { defaultTx } from "@dxos/ui-theme";
25
25
  var WAIT_UNTIL_LOADER = 1500;
26
26
  var image = (options) => {
27
27
  const blobUrlCache = {};
@@ -77,7 +77,7 @@ var image = (options) => {
77
77
  })
78
78
  ];
79
79
  };
80
- var buildDecorations = ({ from, to, state, blobUrlCache, preload, options: { blockstore, instances, space } }) => {
80
+ var buildDecorations = ({ state, from, to, blobUrlCache, preload, options: { blockstore, instances, space } }) => {
81
81
  const decorations = [];
82
82
  const cursor = state.selection.main.head;
83
83
  syntaxTree(state).iterate({
@@ -137,6 +137,8 @@ var createImg = (view, url) => {
137
137
  return img;
138
138
  };
139
139
  var WnfsImageWidget = class extends WidgetType {
140
+ _wnfsUrl;
141
+ _url;
140
142
  constructor(_wnfsUrl, _url) {
141
143
  super(), this._wnfsUrl = _wnfsUrl, this._url = _url;
142
144
  }
@@ -172,25 +174,28 @@ var WnfsImageWidget = class extends WidgetType {
172
174
  }
173
175
  };
174
176
 
175
- // packages/plugins/plugin-wnfs/src/capabilities/markdown.ts
176
- var markdown_default = (context) => contributes(MarkdownCapabilities.Extensions, [
177
- ({ document: document2 }) => {
178
- const blockstore = context.getCapability(WnfsCapabilities.Blockstore);
179
- const instances = context.getCapability(WnfsCapabilities.Instances);
180
- if (document2) {
181
- const space = getSpace(document2);
182
- return space ? [
183
- image({
184
- blockstore,
185
- instances,
186
- space
187
- })
188
- ] : [];
177
+ // src/capabilities/markdown/markdown.ts
178
+ var markdown_default = Capability.makeModule(Effect.fnUntraced(function* () {
179
+ const capabilities = yield* Capability.Service;
180
+ return Capability.contributes(MarkdownCapabilities.Extensions, [
181
+ ({ document: document2 }) => {
182
+ const blockstore = capabilities.get(WnfsCapabilities.Blockstore);
183
+ const instances = capabilities.get(WnfsCapabilities.Instances);
184
+ if (document2) {
185
+ const space = getSpace(document2);
186
+ return space ? [
187
+ image({
188
+ blockstore,
189
+ instances,
190
+ space
191
+ })
192
+ ] : [];
193
+ }
194
+ return [];
189
195
  }
190
- return [];
191
- }
192
- ]);
196
+ ]);
197
+ }));
193
198
  export {
194
199
  markdown_default as default
195
200
  };
196
- //# sourceMappingURL=markdown-BWBHUHHH.mjs.map
201
+ //# sourceMappingURL=markdown-ZLOS5HZU.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/markdown/markdown.ts", "../../../src/extensions/image.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { MarkdownCapabilities } from '@dxos/plugin-markdown';\nimport { getSpace } from '@dxos/react-client/echo';\n\nimport { image } from '../../extensions';\nimport { WnfsCapabilities } from '../../types';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n // Get context for lazy capability access in callbacks.\n const capabilities = yield* Capability.Service;\n\n return Capability.contributes(MarkdownCapabilities.Extensions, [\n ({ document }: { document?: any }) => {\n const blockstore = capabilities.get(WnfsCapabilities.Blockstore);\n const instances = capabilities.get(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);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { syntaxTree } from '@codemirror/language';\nimport { type EditorState, type Extension, type Range, StateField } 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/ui-editor';\nimport { defaultTx } from '@dxos/ui-theme';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { getBlobUrl, getPathFromUrl, loadWnfs } from '../helpers';\nimport { type WnfsCapabilities } from '../types';\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 state,\n from,\n to,\n blobUrlCache,\n preload,\n options: { blockstore, instances, space },\n}: {\n state: EditorState;\n from: number;\n to: number;\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._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,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,4BAA4B;AACrC,SAASC,gBAAgB;;;ACJzB,SAASC,kBAAkB;AAC3B,SAAuDC,kBAAkB;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,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AiBC,UAAU;AAC/D,YAAMC,YAAYV,aAAaO,IAAIC,iBAAiBG,SAAS;AAE7D,UAAIN,WAAU;AACZ,cAAMO,QAAQC,SAASR,SAAAA;AACvB,eAAOO,QAAQ;UAACE,MAAM;YAAER;YAAYI;YAAWE;UAAM,CAAA;YAAM,CAAA;MAC7D;AAEA,aAAO,CAAA;IACT;GACD;AACH,CAAA,CAAA;",
6
+ "names": ["Effect", "Capability", "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", "_wnfsUrl", "_url", "eq", "other", "toDOM", "className", "loader", "loaderAdded", "timeout", "setTimeout", "root", "createRoot", "render", "ThemeProvider", "tx", "defaultTx", "Status", "indeterminate", "appendChild", "then", "clearTimeout", "removeChild", "Capability", "makeModule", "fnUntraced", "capabilities", "Service", "contributes", "MarkdownCapabilities", "Extensions", "document", "blockstore", "get", "WnfsCapabilities", "Blockstore", "instances", "Instances", "space", "getSpace", "image"]
7
+ }