@dxos/plugin-template 0.8.4-main.84f28bd → 0.8.4-main.937b3ca
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/chunk-HRH4SQLU.mjs +18 -0
- package/dist/lib/browser/chunk-HRH4SQLU.mjs.map +7 -0
- package/dist/lib/browser/chunk-TRYLFURO.mjs +18 -0
- package/dist/lib/browser/chunk-TRYLFURO.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +33 -57
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-FXQGYDUN.mjs +39 -0
- package/dist/lib/browser/react-surface-FXQGYDUN.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -0
- package/dist/types/src/TemplatePlugin.d.ts +2 -1
- package/dist/types/src/TemplatePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/TemplateContainer.d.ts +4 -5
- package/dist/types/src/components/TemplateContainer.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +5 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/schema.d.ts +12 -0
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +36 -29
- package/src/TemplatePlugin.tsx +23 -52
- package/src/capabilities/index.ts +1 -4
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +29 -0
- package/src/components/TemplateContainer.tsx +9 -7
- package/src/meta.ts +9 -5
- package/src/translations.ts +5 -2
- package/src/types/index.ts +5 -0
- package/src/types/schema.ts +22 -0
- package/dist/lib/browser/chunk-FARPQI2D.mjs +0 -49
- package/dist/lib/browser/chunk-FARPQI2D.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-AYJTEW6K.mjs +0 -22
- package/dist/lib/browser/intent-resolver-AYJTEW6K.mjs.map +0 -7
- package/dist/lib/browser/react-surface-H7UCIT3M.mjs +0 -39
- package/dist/lib/browser/react-surface-H7UCIT3M.mjs.map +0 -7
- package/dist/lib/browser/types.mjs +0 -11
- package/dist/lib/node-esm/chunk-B3O6VLCP.mjs +0 -51
- package/dist/lib/node-esm/chunk-B3O6VLCP.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -86
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-KY2OPU2S.mjs +0 -23
- package/dist/lib/node-esm/intent-resolver-KY2OPU2S.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-VJDBNR3U.mjs +0 -40
- package/dist/lib/node-esm/react-surface-VJDBNR3U.mjs.map +0 -7
- package/dist/lib/node-esm/types.mjs +0 -12
- package/dist/lib/node-esm/types.mjs.map +0 -7
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -27
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -19
- package/src/capabilities/react-surface.tsx +0 -23
- package/src/types.ts +0 -36
- /package/dist/lib/browser/{types.mjs.map → types/index.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -1,28 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-template",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.937b3ca",
|
|
4
4
|
"description": "Template for new plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
10
14
|
"type": "module",
|
|
11
15
|
"exports": {
|
|
12
16
|
".": {
|
|
17
|
+
"source": "./src/index.ts",
|
|
13
18
|
"types": "./dist/types/src/index.d.ts",
|
|
14
19
|
"browser": "./dist/lib/browser/index.mjs"
|
|
15
20
|
},
|
|
16
21
|
"./types": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
22
|
+
"source": "./src/types/index.ts",
|
|
23
|
+
"types": "./dist/types/src/types/index.d.ts",
|
|
24
|
+
"browser": "./dist/lib/browser/types/index.mjs"
|
|
19
25
|
}
|
|
20
26
|
},
|
|
21
27
|
"types": "dist/types/src/index.d.ts",
|
|
22
28
|
"typesVersions": {
|
|
23
29
|
"*": {
|
|
24
30
|
"types": [
|
|
25
|
-
"dist/types/src/types.d.ts"
|
|
31
|
+
"dist/types/src/types/index.d.ts"
|
|
26
32
|
]
|
|
27
33
|
}
|
|
28
34
|
},
|
|
@@ -31,35 +37,36 @@
|
|
|
31
37
|
"src"
|
|
32
38
|
],
|
|
33
39
|
"dependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/echo
|
|
41
|
-
"@dxos/plugin-client": "0.8.4-main.
|
|
42
|
-
"@dxos/plugin-
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/react-
|
|
45
|
-
"@dxos/react-ui-
|
|
40
|
+
"@radix-ui/react-context": "1.1.1",
|
|
41
|
+
"effect": "3.19.11",
|
|
42
|
+
"@dxos/app-framework": "0.8.4-main.937b3ca",
|
|
43
|
+
"@dxos/async": "0.8.4-main.937b3ca",
|
|
44
|
+
"@dxos/operation": "0.8.4-main.937b3ca",
|
|
45
|
+
"@dxos/plugin-graph": "0.8.4-main.937b3ca",
|
|
46
|
+
"@dxos/echo": "0.8.4-main.937b3ca",
|
|
47
|
+
"@dxos/plugin-client": "0.8.4-main.937b3ca",
|
|
48
|
+
"@dxos/plugin-space": "0.8.4-main.937b3ca",
|
|
49
|
+
"@dxos/react-client": "0.8.4-main.937b3ca",
|
|
50
|
+
"@dxos/react-ui-stack": "0.8.4-main.937b3ca",
|
|
51
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.937b3ca",
|
|
52
|
+
"@dxos/util": "0.8.4-main.937b3ca"
|
|
46
53
|
},
|
|
47
54
|
"devDependencies": {
|
|
48
|
-
"@types/react": "~
|
|
49
|
-
"@types/react-dom": "~
|
|
50
|
-
"react": "~
|
|
51
|
-
"react-dom": "~
|
|
52
|
-
"vite": "
|
|
53
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
55
|
+
"@types/react": "~19.2.7",
|
|
56
|
+
"@types/react-dom": "~19.2.3",
|
|
57
|
+
"react": "~19.2.3",
|
|
58
|
+
"react-dom": "~19.2.3",
|
|
59
|
+
"vite": "7.1.9",
|
|
60
|
+
"@dxos/react-ui": "0.8.4-main.937b3ca",
|
|
61
|
+
"@dxos/ui-theme": "0.8.4-main.937b3ca",
|
|
62
|
+
"@dxos/storybook-utils": "0.8.4-main.937b3ca"
|
|
56
63
|
},
|
|
57
64
|
"peerDependencies": {
|
|
58
|
-
"effect": "
|
|
59
|
-
"react": "~
|
|
60
|
-
"react-dom": "~
|
|
61
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
62
|
-
"@dxos/
|
|
65
|
+
"effect": "3.19.11",
|
|
66
|
+
"react": "~19.2.3",
|
|
67
|
+
"react-dom": "~19.2.3",
|
|
68
|
+
"@dxos/react-ui": "0.8.4-main.937b3ca",
|
|
69
|
+
"@dxos/ui-theme": "0.8.4-main.937b3ca"
|
|
63
70
|
},
|
|
64
71
|
"publishConfig": {
|
|
65
72
|
"access": "public"
|
package/src/TemplatePlugin.tsx
CHANGED
|
@@ -2,59 +2,30 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
7
|
-
import { SpaceCapabilities } from '@dxos/plugin-space';
|
|
8
|
-
import { defineObjectForm } from '@dxos/plugin-space/types';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
9
6
|
|
|
10
|
-
import {
|
|
7
|
+
import { Common, Plugin } from '@dxos/app-framework';
|
|
8
|
+
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
9
|
+
|
|
10
|
+
import { ReactSurface } from './capabilities';
|
|
11
11
|
import { meta } from './meta';
|
|
12
12
|
import { translations } from './translations';
|
|
13
|
-
import {
|
|
13
|
+
import { Template } from './types';
|
|
14
14
|
|
|
15
|
-
export const TemplatePlugin = ()
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}),
|
|
33
|
-
defineModule({
|
|
34
|
-
id: `${meta.id}/module/object-form`,
|
|
35
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
36
|
-
activate: () =>
|
|
37
|
-
contributes(
|
|
38
|
-
SpaceCapabilities.ObjectForm,
|
|
39
|
-
defineObjectForm({
|
|
40
|
-
objectSchema: TemplateType,
|
|
41
|
-
getIntent: () => createIntent(TemplateAction.Create),
|
|
42
|
-
}),
|
|
43
|
-
),
|
|
44
|
-
}),
|
|
45
|
-
defineModule({
|
|
46
|
-
id: `${meta.id}/module/schema`,
|
|
47
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
48
|
-
activate: () => contributes(ClientCapabilities.Schema, [TemplateType]),
|
|
49
|
-
}),
|
|
50
|
-
defineModule({
|
|
51
|
-
id: `${meta.id}/module/react-surface`,
|
|
52
|
-
activatesOn: Events.SetupReactSurface,
|
|
53
|
-
activate: ReactSurface,
|
|
54
|
-
}),
|
|
55
|
-
defineModule({
|
|
56
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
57
|
-
activatesOn: Events.SetupIntentResolver,
|
|
58
|
-
activate: IntentResolver,
|
|
59
|
-
}),
|
|
60
|
-
]);
|
|
15
|
+
export const TemplatePlugin = Plugin.define(meta).pipe(
|
|
16
|
+
Common.Plugin.addTranslationsModule({ translations }),
|
|
17
|
+
Common.Plugin.addMetadataModule({
|
|
18
|
+
metadata: {
|
|
19
|
+
id: Template.Data.typename,
|
|
20
|
+
metadata: {
|
|
21
|
+
icon: 'ph--asterisk--regular',
|
|
22
|
+
iconHue: 'sky',
|
|
23
|
+
createObject: ((props) => Effect.sync(() => Template.make(props))) satisfies CreateObject,
|
|
24
|
+
addToCollectionOnCreate: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
}),
|
|
28
|
+
Common.Plugin.addSchemaModule({ schema: [Template.Data] }),
|
|
29
|
+
Common.Plugin.addSurfaceModule({ activate: ReactSurface }),
|
|
30
|
+
Plugin.make,
|
|
31
|
+
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
|
|
11
|
+
import { TemplateContainer } from '../../components';
|
|
12
|
+
import { meta } from '../../meta';
|
|
13
|
+
import { Template } from '../../types';
|
|
14
|
+
|
|
15
|
+
export default Capability.makeModule(() =>
|
|
16
|
+
Effect.succeed(
|
|
17
|
+
Capability.contributes(
|
|
18
|
+
Common.Capability.ReactSurface,
|
|
19
|
+
Common.createSurface({
|
|
20
|
+
id: meta.id,
|
|
21
|
+
role: 'article',
|
|
22
|
+
filter: (data): data is { subject: Obj.Unknown } => Obj.instanceOf(Template.Data, data.subject),
|
|
23
|
+
component: ({ data, role }: { data: { subject: Obj.Unknown }; role: string }) => (
|
|
24
|
+
<TemplateContainer role={role} subject={data.subject} />
|
|
25
|
+
),
|
|
26
|
+
}),
|
|
27
|
+
),
|
|
28
|
+
),
|
|
29
|
+
);
|
|
@@ -4,16 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
8
|
+
import { Obj } from '@dxos/echo';
|
|
9
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
10
10
|
|
|
11
|
-
export
|
|
11
|
+
export type TemplateContainerProps = SurfaceComponentProps<Obj.Unknown>;
|
|
12
|
+
|
|
13
|
+
export const TemplateContainer = ({ role, subject: object }: TemplateContainerProps) => {
|
|
12
14
|
return (
|
|
13
|
-
<
|
|
15
|
+
<Layout.Main role={role}>
|
|
14
16
|
<pre className='m-4 p-2 ring'>
|
|
15
|
-
<span>{
|
|
17
|
+
<span>{Obj.getDXN(object).toString()}</span>
|
|
16
18
|
</pre>
|
|
17
|
-
</
|
|
19
|
+
</Layout.Main>
|
|
18
20
|
);
|
|
19
21
|
};
|
package/src/meta.ts
CHANGED
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
export const meta: PluginMeta = {
|
|
10
|
-
id: TEMPLATE_PLUGIN,
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'dxos.org/plugin/template',
|
|
11
10
|
name: 'Template',
|
|
11
|
+
description: trim`
|
|
12
|
+
Create reusable templates for documents, tables, and other objects.
|
|
13
|
+
Define structured patterns that can be quickly instantiated with pre-configured content and settings.
|
|
14
|
+
`,
|
|
12
15
|
icon: 'ph--asterisk--regular',
|
|
16
|
+
iconHue: 'sky',
|
|
13
17
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-template',
|
|
14
18
|
};
|
package/src/translations.ts
CHANGED
|
@@ -5,17 +5,20 @@
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
7
|
import { meta } from './meta';
|
|
8
|
-
import {
|
|
8
|
+
import { Template } from './types';
|
|
9
9
|
|
|
10
10
|
export const translations = [
|
|
11
11
|
{
|
|
12
12
|
'en-US': {
|
|
13
|
-
[
|
|
13
|
+
[Template.Data.typename]: {
|
|
14
14
|
'typename label': 'Template',
|
|
15
15
|
'typename label_zero': 'Templates',
|
|
16
16
|
'typename label_one': 'Template',
|
|
17
17
|
'typename label_other': 'Templates',
|
|
18
18
|
'object name placeholder': 'New template',
|
|
19
|
+
'rename object label': 'Rename template',
|
|
20
|
+
'delete object label': 'Delete template',
|
|
21
|
+
'object deleted label': 'Template deleted',
|
|
19
22
|
},
|
|
20
23
|
[meta.id]: {
|
|
21
24
|
'plugin name': 'Template',
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Obj, Type } from '@dxos/echo';
|
|
8
|
+
|
|
9
|
+
export namespace Template {
|
|
10
|
+
export const Data = Schema.Struct({
|
|
11
|
+
name: Schema.optional(Schema.String),
|
|
12
|
+
}).pipe(
|
|
13
|
+
Type.object({
|
|
14
|
+
typename: 'dxos.org/type/Data',
|
|
15
|
+
version: '0.1.0',
|
|
16
|
+
}),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export type Data = Schema.Schema.Type<typeof Data>;
|
|
20
|
+
|
|
21
|
+
export const make = (props: Partial<Data>) => Obj.make(Data, props);
|
|
22
|
+
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// src/types.ts
|
|
2
|
-
import { Schema } from "effect";
|
|
3
|
-
import { Obj } from "@dxos/echo";
|
|
4
|
-
import { TypedObject } from "@dxos/echo-schema";
|
|
5
|
-
import { ReactiveObjectSchema } from "@dxos/react-client/echo";
|
|
6
|
-
|
|
7
|
-
// src/meta.ts
|
|
8
|
-
var TEMPLATE_PLUGIN = "dxos.org/plugin/template";
|
|
9
|
-
var meta = {
|
|
10
|
-
id: TEMPLATE_PLUGIN,
|
|
11
|
-
name: "Template",
|
|
12
|
-
icon: "ph--asterisk--regular",
|
|
13
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-template"
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// src/types.ts
|
|
17
|
-
(function(TemplateAction2) {
|
|
18
|
-
const TEMPLATE_ACTION = `${TEMPLATE_PLUGIN}/action`;
|
|
19
|
-
class Create extends Schema.TaggedClass()(`${TEMPLATE_ACTION}/create`, {
|
|
20
|
-
input: Schema.Struct({
|
|
21
|
-
name: Schema.optional(Schema.String)
|
|
22
|
-
}),
|
|
23
|
-
output: Schema.Struct({
|
|
24
|
-
object: ReactiveObjectSchema
|
|
25
|
-
})
|
|
26
|
-
}) {
|
|
27
|
-
}
|
|
28
|
-
TemplateAction2.Create = Create;
|
|
29
|
-
})(TemplateAction || (TemplateAction = {}));
|
|
30
|
-
var isObject = (object) => {
|
|
31
|
-
return Obj.isObject(object) && object.type === "template";
|
|
32
|
-
};
|
|
33
|
-
var TemplateType = class extends TypedObject({
|
|
34
|
-
typename: "dxos.org/type/Template",
|
|
35
|
-
version: "0.1.0"
|
|
36
|
-
})({
|
|
37
|
-
name: Schema.optional(Schema.String)
|
|
38
|
-
}) {
|
|
39
|
-
};
|
|
40
|
-
var TemplateAction;
|
|
41
|
-
|
|
42
|
-
export {
|
|
43
|
-
TEMPLATE_PLUGIN,
|
|
44
|
-
meta,
|
|
45
|
-
isObject,
|
|
46
|
-
TemplateType,
|
|
47
|
-
TemplateAction
|
|
48
|
-
};
|
|
49
|
-
//# sourceMappingURL=chunk-FARPQI2D.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types.ts", "../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Obj } from '@dxos/echo';\nimport { TypedObject } from '@dxos/echo-schema';\nimport { ReactiveObjectSchema } from '@dxos/react-client/echo';\n\nimport { TEMPLATE_PLUGIN } from './meta';\n\nexport namespace TemplateAction {\n const TEMPLATE_ACTION = `${TEMPLATE_PLUGIN}/action`;\n\n export class Create extends Schema.TaggedClass<Create>()(`${TEMPLATE_ACTION}/create`, {\n input: Schema.Struct({\n name: Schema.optional(Schema.String),\n }),\n output: Schema.Struct({\n object: ReactiveObjectSchema,\n }),\n }) {}\n}\n\nexport const isObject = (object: unknown): object is Obj.Any => {\n // TODO(dmaretskyi): Can this be Obj.instanceOf(TemplateType)?\n return Obj.isObject(object) && (object as any).type === 'template';\n};\n\nexport class TemplateType extends TypedObject({\n typename: 'dxos.org/type/Template',\n version: '0.1.0',\n})({\n name: Schema.optional(Schema.String),\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const TEMPLATE_PLUGIN = 'dxos.org/plugin/template';\n\nexport const meta: PluginMeta = {\n id: TEMPLATE_PLUGIN,\n name: 'Template',\n icon: 'ph--asterisk--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-template',\n};\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,cAAc;AAEvB,SAASC,WAAW;AACpB,SAASC,mBAAmB;AAC5B,SAASC,4BAA4B;;;ACF9B,IAAMC,kBAAkB;AAExB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,MAAM;EACNC,QAAQ;AACV;;;UDDiBC,iBAAAA;AACf,QAAMC,kBAAkB,GAAGC,eAAAA;EAEpB,MAAMC,eAAeC,OAAOC,YAAW,EAAW,GAAGJ,eAAAA,WAA0B;IACpFK,OAAOF,OAAOG,OAAO;MACnBC,MAAMJ,OAAOK,SAASL,OAAOM,MAAM;IACrC,CAAA;IACAC,QAAQP,OAAOG,OAAO;MACpBK,QAAQC;IACV,CAAA;EACF,CAAA,EAAA;EAAI;kBAPSV,SAAAA;AAQf,GAXiBH,mBAAAA,iBAAAA,CAAAA,EAAAA;AAaV,IAAMc,WAAW,CAACF,WAAAA;AAEvB,SAAOG,IAAID,SAASF,MAAAA,KAAYA,OAAeI,SAAS;AAC1D;AAEO,IAAMC,eAAN,cAA2BC,YAAY;EAC5CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDZ,MAAMJ,OAAOK,SAASL,OAAOM,MAAM;AACrC,CAAA,EAAA;AAAI;;",
|
|
6
|
-
"names": ["Schema", "Obj", "TypedObject", "ReactiveObjectSchema", "TEMPLATE_PLUGIN", "meta", "id", "name", "icon", "source", "TemplateAction", "TEMPLATE_ACTION", "TEMPLATE_PLUGIN", "Create", "Schema", "TaggedClass", "input", "Struct", "name", "optional", "String", "output", "object", "ReactiveObjectSchema", "isObject", "Obj", "type", "TemplateType", "TypedObject", "typename", "version"]
|
|
7
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TemplateAction,
|
|
3
|
-
TemplateType
|
|
4
|
-
} from "./chunk-FARPQI2D.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/intent-resolver.ts
|
|
7
|
-
import { contributes, Capabilities, createResolver } from "@dxos/app-framework";
|
|
8
|
-
import { Obj } from "@dxos/echo";
|
|
9
|
-
var intent_resolver_default = () => contributes(Capabilities.IntentResolver, createResolver({
|
|
10
|
-
intent: TemplateAction.Create,
|
|
11
|
-
resolve: ({ name }) => ({
|
|
12
|
-
data: {
|
|
13
|
-
object: Obj.make(TemplateType, {
|
|
14
|
-
name
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
})
|
|
18
|
-
}));
|
|
19
|
-
export {
|
|
20
|
-
intent_resolver_default as default
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=intent-resolver-AYJTEW6K.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/intent-resolver.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, Capabilities, createResolver } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\n\nimport { TemplateAction, TemplateType } from '../types';\n\nexport default () =>\n contributes(\n Capabilities.IntentResolver,\n createResolver({\n intent: TemplateAction.Create,\n resolve: ({ name }) => ({\n data: { object: Obj.make(TemplateType, { name }) },\n }),\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,SAASA,aAAaC,cAAcC,sBAAsB;AAC1D,SAASC,WAAW;AAIpB,IAAA,0BAAe,MACbC,YACEC,aAAaC,gBACbC,eAAe;EACbC,QAAQC,eAAeC;EACvBC,SAAS,CAAC,EAAEC,KAAI,OAAQ;IACtBC,MAAM;MAAEC,QAAQC,IAAIC,KAAKC,cAAc;QAAEL;MAAK,CAAA;IAAG;EACnD;AACF,CAAA,CAAA;",
|
|
6
|
-
"names": ["contributes", "Capabilities", "createResolver", "Obj", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "TemplateAction", "Create", "resolve", "name", "data", "object", "Obj", "make", "TemplateType"]
|
|
7
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TEMPLATE_PLUGIN,
|
|
3
|
-
isObject
|
|
4
|
-
} from "./chunk-FARPQI2D.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/react-surface.tsx
|
|
7
|
-
import React2 from "react";
|
|
8
|
-
import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
|
|
9
|
-
|
|
10
|
-
// src/components/TemplateContainer.tsx
|
|
11
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
12
|
-
import React from "react";
|
|
13
|
-
import { fullyQualifiedId } from "@dxos/react-client/echo";
|
|
14
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
15
|
-
var TemplateContainer = ({ object }) => {
|
|
16
|
-
var _effect = _useSignals();
|
|
17
|
-
try {
|
|
18
|
-
return /* @__PURE__ */ React.createElement(StackItem.Content, null, /* @__PURE__ */ React.createElement("pre", {
|
|
19
|
-
className: "m-4 p-2 ring"
|
|
20
|
-
}, /* @__PURE__ */ React.createElement("span", null, fullyQualifiedId(object))));
|
|
21
|
-
} finally {
|
|
22
|
-
_effect.f();
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// src/capabilities/react-surface.tsx
|
|
27
|
-
var react_surface_default = () => contributes(Capabilities.ReactSurface, createSurface({
|
|
28
|
-
id: TEMPLATE_PLUGIN,
|
|
29
|
-
role: "article",
|
|
30
|
-
filter: (data) => isObject(data.subject),
|
|
31
|
-
component: ({ data, role }) => /* @__PURE__ */ React2.createElement(TemplateContainer, {
|
|
32
|
-
role,
|
|
33
|
-
object: data.subject
|
|
34
|
-
})
|
|
35
|
-
}));
|
|
36
|
-
export {
|
|
37
|
-
react_surface_default as default
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=react-surface-H7UCIT3M.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-surface.tsx", "../../../src/components/TemplateContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface } from '@dxos/app-framework';\nimport { type Obj } from '@dxos/echo';\n\nimport { TemplateContainer } from '../components';\nimport { TEMPLATE_PLUGIN } from '../meta';\nimport { isObject } from '../types';\n\nexport default () =>\n contributes(\n Capabilities.ReactSurface,\n createSurface({\n id: TEMPLATE_PLUGIN,\n role: 'article',\n filter: (data): data is { subject: Obj.Any } => isObject(data.subject),\n component: ({ data, role }) => <TemplateContainer role={role} object={data.subject} />,\n }),\n );\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Obj } from '@dxos/echo';\nimport { fullyQualifiedId } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nexport const TemplateContainer = ({ object }: { object: Obj.Any; role: string }) => {\n return (\n <StackItem.Content>\n <pre className='m-4 p-2 ring'>\n <span>{fullyQualifiedId(object)}</span>\n </pre>\n </StackItem.Content>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,OAAOA,YAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;;;;ACFzD,OAAOC,WAAW;AAGlB,SAASC,wBAAwB;AACjC,SAASC,iBAAiB;AAEnB,IAAMC,oBAAoB,CAAC,EAAEC,OAAM,MAAqC;;;AAC7E,WACE,sBAAA,cAACC,UAAUC,SAAO,MAChB,sBAAA,cAACC,OAAAA;MAAIC,WAAU;OACb,sBAAA,cAACC,QAAAA,MAAMC,iBAAiBN,MAAAA,CAAAA,CAAAA,CAAAA;;;;AAIhC;;;ADLA,IAAA,wBAAe,MACbO,YACEC,aAAaC,cACbC,cAAc;EACZC,IAAIC;EACJC,MAAM;EACNC,QAAQ,CAACC,SAAuCC,SAASD,KAAKE,OAAO;EACrEC,WAAW,CAAC,EAAEH,MAAMF,KAAI,MAAO,gBAAAM,OAAA,cAACC,mBAAAA;IAAkBP;IAAYQ,QAAQN,KAAKE;;AAC7E,CAAA,CAAA;",
|
|
6
|
-
"names": ["React", "Capabilities", "contributes", "createSurface", "React", "fullyQualifiedId", "StackItem", "TemplateContainer", "object", "StackItem", "Content", "pre", "className", "span", "fullyQualifiedId", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "TEMPLATE_PLUGIN", "role", "filter", "data", "isObject", "subject", "component", "React", "TemplateContainer", "object"]
|
|
7
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
|
|
3
|
-
// src/types.ts
|
|
4
|
-
import { Schema } from "effect";
|
|
5
|
-
import { Obj } from "@dxos/echo";
|
|
6
|
-
import { TypedObject } from "@dxos/echo-schema";
|
|
7
|
-
import { ReactiveObjectSchema } from "@dxos/react-client/echo";
|
|
8
|
-
|
|
9
|
-
// src/meta.ts
|
|
10
|
-
var TEMPLATE_PLUGIN = "dxos.org/plugin/template";
|
|
11
|
-
var meta = {
|
|
12
|
-
id: TEMPLATE_PLUGIN,
|
|
13
|
-
name: "Template",
|
|
14
|
-
icon: "ph--asterisk--regular",
|
|
15
|
-
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-template"
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// src/types.ts
|
|
19
|
-
(function(TemplateAction2) {
|
|
20
|
-
const TEMPLATE_ACTION = `${TEMPLATE_PLUGIN}/action`;
|
|
21
|
-
class Create extends Schema.TaggedClass()(`${TEMPLATE_ACTION}/create`, {
|
|
22
|
-
input: Schema.Struct({
|
|
23
|
-
name: Schema.optional(Schema.String)
|
|
24
|
-
}),
|
|
25
|
-
output: Schema.Struct({
|
|
26
|
-
object: ReactiveObjectSchema
|
|
27
|
-
})
|
|
28
|
-
}) {
|
|
29
|
-
}
|
|
30
|
-
TemplateAction2.Create = Create;
|
|
31
|
-
})(TemplateAction || (TemplateAction = {}));
|
|
32
|
-
var isObject = (object) => {
|
|
33
|
-
return Obj.isObject(object) && object.type === "template";
|
|
34
|
-
};
|
|
35
|
-
var TemplateType = class extends TypedObject({
|
|
36
|
-
typename: "dxos.org/type/Template",
|
|
37
|
-
version: "0.1.0"
|
|
38
|
-
})({
|
|
39
|
-
name: Schema.optional(Schema.String)
|
|
40
|
-
}) {
|
|
41
|
-
};
|
|
42
|
-
var TemplateAction;
|
|
43
|
-
|
|
44
|
-
export {
|
|
45
|
-
TEMPLATE_PLUGIN,
|
|
46
|
-
meta,
|
|
47
|
-
isObject,
|
|
48
|
-
TemplateType,
|
|
49
|
-
TemplateAction
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=chunk-B3O6VLCP.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types.ts", "../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { Obj } from '@dxos/echo';\nimport { TypedObject } from '@dxos/echo-schema';\nimport { ReactiveObjectSchema } from '@dxos/react-client/echo';\n\nimport { TEMPLATE_PLUGIN } from './meta';\n\nexport namespace TemplateAction {\n const TEMPLATE_ACTION = `${TEMPLATE_PLUGIN}/action`;\n\n export class Create extends Schema.TaggedClass<Create>()(`${TEMPLATE_ACTION}/create`, {\n input: Schema.Struct({\n name: Schema.optional(Schema.String),\n }),\n output: Schema.Struct({\n object: ReactiveObjectSchema,\n }),\n }) {}\n}\n\nexport const isObject = (object: unknown): object is Obj.Any => {\n // TODO(dmaretskyi): Can this be Obj.instanceOf(TemplateType)?\n return Obj.isObject(object) && (object as any).type === 'template';\n};\n\nexport class TemplateType extends TypedObject({\n typename: 'dxos.org/type/Template',\n version: '0.1.0',\n})({\n name: Schema.optional(Schema.String),\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const TEMPLATE_PLUGIN = 'dxos.org/plugin/template';\n\nexport const meta: PluginMeta = {\n id: TEMPLATE_PLUGIN,\n name: 'Template',\n icon: 'ph--asterisk--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-template',\n};\n"],
|
|
5
|
-
"mappings": ";;;AAIA,SAASA,cAAc;AAEvB,SAASC,WAAW;AACpB,SAASC,mBAAmB;AAC5B,SAASC,4BAA4B;;;ACF9B,IAAMC,kBAAkB;AAExB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,MAAM;EACNC,QAAQ;AACV;;;UDDiBC,iBAAAA;AACf,QAAMC,kBAAkB,GAAGC,eAAAA;EAEpB,MAAMC,eAAeC,OAAOC,YAAW,EAAW,GAAGJ,eAAAA,WAA0B;IACpFK,OAAOF,OAAOG,OAAO;MACnBC,MAAMJ,OAAOK,SAASL,OAAOM,MAAM;IACrC,CAAA;IACAC,QAAQP,OAAOG,OAAO;MACpBK,QAAQC;IACV,CAAA;EACF,CAAA,EAAA;EAAI;kBAPSV,SAAAA;AAQf,GAXiBH,mBAAAA,iBAAAA,CAAAA,EAAAA;AAaV,IAAMc,WAAW,CAACF,WAAAA;AAEvB,SAAOG,IAAID,SAASF,MAAAA,KAAYA,OAAeI,SAAS;AAC1D;AAEO,IAAMC,eAAN,cAA2BC,YAAY;EAC5CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDZ,MAAMJ,OAAOK,SAASL,OAAOM,MAAM;AACrC,CAAA,EAAA;AAAI;;",
|
|
6
|
-
"names": ["Schema", "Obj", "TypedObject", "ReactiveObjectSchema", "TEMPLATE_PLUGIN", "meta", "id", "name", "icon", "source", "TemplateAction", "TEMPLATE_ACTION", "TEMPLATE_PLUGIN", "Create", "Schema", "TaggedClass", "input", "Struct", "name", "optional", "String", "output", "object", "ReactiveObjectSchema", "isObject", "Obj", "type", "TemplateType", "TypedObject", "typename", "version"]
|
|
7
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
TEMPLATE_PLUGIN,
|
|
4
|
-
TemplateAction,
|
|
5
|
-
TemplateType,
|
|
6
|
-
meta
|
|
7
|
-
} from "./chunk-B3O6VLCP.mjs";
|
|
8
|
-
|
|
9
|
-
// src/TemplatePlugin.tsx
|
|
10
|
-
import { createIntent, Capabilities, contributes, Events, defineModule, definePlugin } from "@dxos/app-framework";
|
|
11
|
-
import { ClientCapabilities, ClientEvents } from "@dxos/plugin-client";
|
|
12
|
-
import { SpaceCapabilities } from "@dxos/plugin-space";
|
|
13
|
-
import { defineObjectForm } from "@dxos/plugin-space/types";
|
|
14
|
-
|
|
15
|
-
// src/capabilities/index.ts
|
|
16
|
-
import { lazy } from "@dxos/app-framework";
|
|
17
|
-
var IntentResolver = lazy(() => import("./intent-resolver-KY2OPU2S.mjs"));
|
|
18
|
-
var ReactSurface = lazy(() => import("./react-surface-VJDBNR3U.mjs"));
|
|
19
|
-
|
|
20
|
-
// src/translations.ts
|
|
21
|
-
var translations = [
|
|
22
|
-
{
|
|
23
|
-
"en-US": {
|
|
24
|
-
[TemplateType.typename]: {
|
|
25
|
-
"typename label": "Template",
|
|
26
|
-
"typename label_zero": "Templates",
|
|
27
|
-
"typename label_one": "Template",
|
|
28
|
-
"typename label_other": "Templates",
|
|
29
|
-
"object name placeholder": "New template"
|
|
30
|
-
},
|
|
31
|
-
[meta.id]: {
|
|
32
|
-
"plugin name": "Template"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
// src/TemplatePlugin.tsx
|
|
39
|
-
var TemplatePlugin = () => definePlugin(meta, [
|
|
40
|
-
defineModule({
|
|
41
|
-
id: `${meta.id}/module/translations`,
|
|
42
|
-
activatesOn: Events.SetupTranslations,
|
|
43
|
-
activate: () => contributes(Capabilities.Translations, translations)
|
|
44
|
-
}),
|
|
45
|
-
defineModule({
|
|
46
|
-
id: `${meta.id}/module/metadata`,
|
|
47
|
-
activatesOn: Events.SetupMetadata,
|
|
48
|
-
activate: () => contributes(Capabilities.Metadata, {
|
|
49
|
-
id: TemplateType.typename,
|
|
50
|
-
metadata: {
|
|
51
|
-
icon: "ph--asterisk--regular"
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
}),
|
|
55
|
-
defineModule({
|
|
56
|
-
id: `${meta.id}/module/object-form`,
|
|
57
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
58
|
-
activate: () => contributes(SpaceCapabilities.ObjectForm, defineObjectForm({
|
|
59
|
-
objectSchema: TemplateType,
|
|
60
|
-
getIntent: () => createIntent(TemplateAction.Create)
|
|
61
|
-
}))
|
|
62
|
-
}),
|
|
63
|
-
defineModule({
|
|
64
|
-
id: `${meta.id}/module/schema`,
|
|
65
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
66
|
-
activate: () => contributes(ClientCapabilities.Schema, [
|
|
67
|
-
TemplateType
|
|
68
|
-
])
|
|
69
|
-
}),
|
|
70
|
-
defineModule({
|
|
71
|
-
id: `${meta.id}/module/react-surface`,
|
|
72
|
-
activatesOn: Events.SetupReactSurface,
|
|
73
|
-
activate: ReactSurface
|
|
74
|
-
}),
|
|
75
|
-
defineModule({
|
|
76
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
77
|
-
activatesOn: Events.SetupIntentResolver,
|
|
78
|
-
activate: IntentResolver
|
|
79
|
-
})
|
|
80
|
-
]);
|
|
81
|
-
export {
|
|
82
|
-
TEMPLATE_PLUGIN,
|
|
83
|
-
TemplatePlugin,
|
|
84
|
-
meta
|
|
85
|
-
};
|
|
86
|
-
//# sourceMappingURL=index.mjs.map
|