@dxos/plugin-template 0.8.2 → 0.8.3-main.7f5a14c
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-3HYGWWDQ.mjs → chunk-GMDXCSM2.mjs} +4 -3
- package/dist/lib/browser/chunk-GMDXCSM2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3 -3
- package/dist/lib/browser/{intent-resolver-LEEW7WF5.mjs → intent-resolver-THP6KTJU.mjs} +4 -4
- package/dist/lib/browser/intent-resolver-THP6KTJU.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-QKHEP25U.mjs → react-surface-RRVJU3OV.mjs} +2 -2
- package/dist/lib/browser/react-surface-RRVJU3OV.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/types/src/components/TemplateContainer.d.ts +2 -2
- package/dist/types/src/components/TemplateContainer.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +2 -2
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/capabilities/intent-resolver.ts +2 -2
- package/src/capabilities/react-surface.tsx +2 -2
- package/src/components/TemplateContainer.tsx +3 -2
- package/src/types.ts +9 -6
- package/dist/lib/browser/chunk-3HYGWWDQ.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-LEEW7WF5.mjs.map +0 -7
- package/dist/lib/browser/react-surface-QKHEP25U.mjs.map +0 -7
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// packages/plugins/plugin-template/src/types.ts
|
|
2
2
|
import { Schema } from "effect";
|
|
3
|
+
import { Obj } from "@dxos/echo";
|
|
3
4
|
import { TypedObject } from "@dxos/echo-schema";
|
|
4
|
-
import {
|
|
5
|
+
import { ReactiveObjectSchema } from "@dxos/react-client/echo";
|
|
5
6
|
|
|
6
7
|
// packages/plugins/plugin-template/src/meta.ts
|
|
7
8
|
var TEMPLATE_PLUGIN = "dxos.org/plugin/template";
|
|
@@ -27,7 +28,7 @@ var meta = {
|
|
|
27
28
|
TemplateAction2.Create = Create;
|
|
28
29
|
})(TemplateAction || (TemplateAction = {}));
|
|
29
30
|
var isObject = (object) => {
|
|
30
|
-
return
|
|
31
|
+
return Obj.isObject(object) && object.type === "template";
|
|
31
32
|
};
|
|
32
33
|
var TemplateType = class extends TypedObject({
|
|
33
34
|
typename: "dxos.org/type/Template",
|
|
@@ -45,4 +46,4 @@ export {
|
|
|
45
46
|
TemplateType,
|
|
46
47
|
TemplateAction
|
|
47
48
|
};
|
|
48
|
-
//# sourceMappingURL=chunk-
|
|
49
|
+
//# sourceMappingURL=chunk-GMDXCSM2.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
TemplateAction,
|
|
4
4
|
TemplateType,
|
|
5
5
|
meta
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GMDXCSM2.mjs";
|
|
7
7
|
|
|
8
8
|
// packages/plugins/plugin-template/src/TemplatePlugin.tsx
|
|
9
9
|
import { createIntent, Capabilities, contributes, Events, defineModule, definePlugin } from "@dxos/app-framework";
|
|
@@ -13,8 +13,8 @@ import { defineObjectForm } from "@dxos/plugin-space/types";
|
|
|
13
13
|
|
|
14
14
|
// packages/plugins/plugin-template/src/capabilities/index.ts
|
|
15
15
|
import { lazy } from "@dxos/app-framework";
|
|
16
|
-
var IntentResolver = lazy(() => import("./intent-resolver-
|
|
17
|
-
var ReactSurface = lazy(() => import("./react-surface-
|
|
16
|
+
var IntentResolver = lazy(() => import("./intent-resolver-THP6KTJU.mjs"));
|
|
17
|
+
var ReactSurface = lazy(() => import("./react-surface-RRVJU3OV.mjs"));
|
|
18
18
|
|
|
19
19
|
// packages/plugins/plugin-template/src/translations.ts
|
|
20
20
|
var translations_default = [
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TemplateAction,
|
|
3
3
|
TemplateType
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GMDXCSM2.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/plugins/plugin-template/src/capabilities/intent-resolver.ts
|
|
7
7
|
import { contributes, Capabilities, createResolver } from "@dxos/app-framework";
|
|
8
|
-
import {
|
|
8
|
+
import { Obj } from "@dxos/echo";
|
|
9
9
|
var intent_resolver_default = () => contributes(Capabilities.IntentResolver, createResolver({
|
|
10
10
|
intent: TemplateAction.Create,
|
|
11
11
|
resolve: ({ name }) => ({
|
|
12
12
|
data: {
|
|
13
|
-
object:
|
|
13
|
+
object: Obj.make(TemplateType, {
|
|
14
14
|
name
|
|
15
15
|
})
|
|
16
16
|
}
|
|
@@ -19,4 +19,4 @@ var intent_resolver_default = () => contributes(Capabilities.IntentResolver, cre
|
|
|
19
19
|
export {
|
|
20
20
|
intent_resolver_default as default
|
|
21
21
|
};
|
|
22
|
-
//# sourceMappingURL=intent-resolver-
|
|
22
|
+
//# sourceMappingURL=intent-resolver-THP6KTJU.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 } 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 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/plugins/plugin-template/src/meta.ts":{"bytes":1283,"imports":[],"format":"esm"},"packages/plugins/plugin-template/src/types.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/plugins/plugin-template/src/meta.ts":{"bytes":1283,"imports":[],"format":"esm"},"packages/plugins/plugin-template/src/types.ts":{"bytes":3854,"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","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-template/src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"},"packages/plugins/plugin-template/src/capabilities/intent-resolver.ts":{"bytes":2136,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-template/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-template/src/components/TemplateContainer.tsx":{"bytes":2058,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","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}],"format":"esm"},"packages/plugins/plugin-template/src/components/index.ts":{"bytes":508,"imports":[{"path":"packages/plugins/plugin-template/src/components/TemplateContainer.tsx","kind":"import-statement","original":"./TemplateContainer"}],"format":"esm"},"packages/plugins/plugin-template/src/capabilities/react-surface.tsx":{"bytes":2591,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-template/src/components/index.ts","kind":"import-statement","original":"../components"},{"path":"packages/plugins/plugin-template/src/meta.ts","kind":"import-statement","original":"../meta"},{"path":"packages/plugins/plugin-template/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/plugins/plugin-template/src/capabilities/index.ts":{"bytes":1051,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-template/src/capabilities/intent-resolver.ts","kind":"dynamic-import","original":"./intent-resolver"},{"path":"packages/plugins/plugin-template/src/capabilities/react-surface.tsx","kind":"dynamic-import","original":"./react-surface"}],"format":"esm"},"packages/plugins/plugin-template/src/translations.ts":{"bytes":1774,"imports":[{"path":"packages/plugins/plugin-template/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-template/src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-template/src/TemplatePlugin.tsx":{"bytes":7433,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-template/src/capabilities/index.ts","kind":"import-statement","original":"./capabilities"},{"path":"packages/plugins/plugin-template/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-template/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/plugins/plugin-template/src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/plugins/plugin-template/src/index.ts":{"bytes":570,"imports":[{"path":"packages/plugins/plugin-template/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/plugins/plugin-template/src/TemplatePlugin.tsx","kind":"import-statement","original":"./TemplatePlugin"}],"format":"esm"}},"outputs":{"packages/plugins/plugin-template/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4858},"packages/plugins/plugin-template/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/plugins/plugin-template/dist/lib/browser/chunk-GMDXCSM2.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/plugin-client","kind":"import-statement","external":true},{"path":"@dxos/plugin-space","kind":"import-statement","external":true},{"path":"@dxos/plugin-space/types","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"packages/plugins/plugin-template/dist/lib/browser/intent-resolver-THP6KTJU.mjs","kind":"dynamic-import"},{"path":"packages/plugins/plugin-template/dist/lib/browser/react-surface-RRVJU3OV.mjs","kind":"dynamic-import"}],"exports":["TEMPLATE_PLUGIN","TemplatePlugin","meta"],"entryPoint":"packages/plugins/plugin-template/src/index.ts","inputs":{"packages/plugins/plugin-template/src/index.ts":{"bytesInOutput":0},"packages/plugins/plugin-template/src/TemplatePlugin.tsx":{"bytesInOutput":1561},"packages/plugins/plugin-template/src/capabilities/index.ts":{"bytesInOutput":190},"packages/plugins/plugin-template/src/translations.ts":{"bytesInOutput":301}},"bytes":2483},"packages/plugins/plugin-template/dist/lib/browser/types.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"packages/plugins/plugin-template/dist/lib/browser/types.mjs":{"imports":[{"path":"packages/plugins/plugin-template/dist/lib/browser/chunk-GMDXCSM2.mjs","kind":"import-statement"}],"exports":["TemplateAction","TemplateType","isObject"],"entryPoint":"packages/plugins/plugin-template/src/types.ts","inputs":{},"bytes":177},"packages/plugins/plugin-template/dist/lib/browser/intent-resolver-THP6KTJU.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1071},"packages/plugins/plugin-template/dist/lib/browser/intent-resolver-THP6KTJU.mjs":{"imports":[{"path":"packages/plugins/plugin-template/dist/lib/browser/chunk-GMDXCSM2.mjs","kind":"import-statement"},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/plugins/plugin-template/src/capabilities/intent-resolver.ts","inputs":{"packages/plugins/plugin-template/src/capabilities/intent-resolver.ts":{"bytesInOutput":359}},"bytes":608},"packages/plugins/plugin-template/dist/lib/browser/react-surface-RRVJU3OV.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2236},"packages/plugins/plugin-template/dist/lib/browser/react-surface-RRVJU3OV.mjs":{"imports":[{"path":"packages/plugins/plugin-template/dist/lib/browser/chunk-GMDXCSM2.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","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}],"exports":["default"],"entryPoint":"packages/plugins/plugin-template/src/capabilities/react-surface.tsx","inputs":{"packages/plugins/plugin-template/src/capabilities/react-surface.tsx":{"bytesInOutput":419},"packages/plugins/plugin-template/src/components/TemplateContainer.tsx":{"bytesInOutput":572},"packages/plugins/plugin-template/src/components/index.ts":{"bytesInOutput":0}},"bytes":1378},"packages/plugins/plugin-template/dist/lib/browser/chunk-GMDXCSM2.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2537},"packages/plugins/plugin-template/dist/lib/browser/chunk-GMDXCSM2.mjs":{"imports":[{"path":"effect","kind":"import-statement","external":true},{"path":"@dxos/echo","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":["TEMPLATE_PLUGIN","TemplateAction","TemplateType","isObject","meta"],"inputs":{"packages/plugins/plugin-template/src/types.ts":{"bytesInOutput":847},"packages/plugins/plugin-template/src/meta.ts":{"bytesInOutput":226}},"bytes":1350}}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TEMPLATE_PLUGIN,
|
|
3
3
|
isObject
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GMDXCSM2.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/plugins/plugin-template/src/capabilities/react-surface.tsx
|
|
7
7
|
import React2 from "react";
|
|
@@ -36,4 +36,4 @@ var react_surface_default = () => contributes(Capabilities.ReactSurface, createS
|
|
|
36
36
|
export {
|
|
37
37
|
react_surface_default as default
|
|
38
38
|
};
|
|
39
|
-
//# sourceMappingURL=react-surface-
|
|
39
|
+
//# sourceMappingURL=react-surface-RRVJU3OV.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type Obj } from '@dxos/echo';
|
|
3
3
|
export declare const TemplateContainer: ({ object }: {
|
|
4
|
-
object:
|
|
4
|
+
object: Obj.Any;
|
|
5
5
|
role: string;
|
|
6
6
|
}) => React.JSX.Element;
|
|
7
7
|
//# sourceMappingURL=TemplateContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/TemplateContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"TemplateContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/TemplateContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAItC,eAAO,MAAM,iBAAiB,GAAI,YAAY;IAAE,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,sBAQ9E,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
|
-
import {
|
|
2
|
+
import { Obj } from '@dxos/echo';
|
|
3
3
|
export declare namespace TemplateAction {
|
|
4
4
|
const Create_base: Schema.TaggedClass<Create, "dxos.org/plugin/template/action/create", {
|
|
5
5
|
readonly _tag: Schema.tag<"dxos.org/plugin/template/action/create">;
|
|
@@ -15,7 +15,7 @@ export declare namespace TemplateAction {
|
|
|
15
15
|
}
|
|
16
16
|
export {};
|
|
17
17
|
}
|
|
18
|
-
export declare const isObject: (object: unknown) => object is
|
|
18
|
+
export declare const isObject: (object: unknown) => object is Obj.Any;
|
|
19
19
|
declare const TemplateType_base: import("@dxos/echo-schema").TypedObjectPrototype<import("@dxos/echo-schema").TypedObjectFields<{
|
|
20
20
|
name: Schema.optional<typeof Schema.String>;
|
|
21
21
|
}, import("@dxos/echo-schema").TypedObjectOptions>, Schema.Struct.Encoded<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAMjC,yBAAiB,cAAc,CAAC;;;;;;;;;;;IAG9B,MAAM,OAAO,MAAO,SAAQ,WAO1B;KAAG;;CACN;AAED,eAAO,MAAM,QAAQ,GAAI,QAAQ,OAAO,KAAG,MAAM,IAAI,GAAG,CAAC,GAGxD,CAAC;;;;;;AAEF,qBAAa,YAAa,SAAQ,iBAKhC;CAAG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-template",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3-main.7f5a14c",
|
|
4
4
|
"description": "Template for new plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"@preact-signals/safe-react": "^0.9.0",
|
|
35
35
|
"@preact/signals-core": "^1.9.0",
|
|
36
36
|
"effect": "3.14.21",
|
|
37
|
-
"@dxos/app-framework": "0.8.
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/echo
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/plugin-client": "0.8.
|
|
42
|
-
"@dxos/plugin-graph": "0.8.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/react-ui-stack": "0.8.
|
|
37
|
+
"@dxos/app-framework": "0.8.3-main.7f5a14c",
|
|
38
|
+
"@dxos/async": "0.8.3-main.7f5a14c",
|
|
39
|
+
"@dxos/echo": "0.8.3-main.7f5a14c",
|
|
40
|
+
"@dxos/echo-schema": "0.8.3-main.7f5a14c",
|
|
41
|
+
"@dxos/plugin-client": "0.8.3-main.7f5a14c",
|
|
42
|
+
"@dxos/plugin-graph": "0.8.3-main.7f5a14c",
|
|
43
|
+
"@dxos/react-client": "0.8.3-main.7f5a14c",
|
|
44
|
+
"@dxos/plugin-space": "0.8.3-main.7f5a14c",
|
|
45
|
+
"@dxos/react-ui-stack": "0.8.3-main.7f5a14c"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -51,17 +51,17 @@
|
|
|
51
51
|
"react": "~18.2.0",
|
|
52
52
|
"react-dom": "~18.2.0",
|
|
53
53
|
"vite": "5.4.7",
|
|
54
|
-
"@dxos/react-ui": "0.8.
|
|
55
|
-
"@dxos/react-ui-theme": "0.8.
|
|
56
|
-
"@dxos/storybook-utils": "0.8.
|
|
54
|
+
"@dxos/react-ui": "0.8.3-main.7f5a14c",
|
|
55
|
+
"@dxos/react-ui-theme": "0.8.3-main.7f5a14c",
|
|
56
|
+
"@dxos/storybook-utils": "0.8.3-main.7f5a14c"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@phosphor-icons/react": "^2.1.5",
|
|
60
60
|
"effect": "^3.13.3",
|
|
61
61
|
"react": "~18.2.0",
|
|
62
62
|
"react-dom": "~18.2.0",
|
|
63
|
-
"@dxos/react-ui
|
|
64
|
-
"@dxos/react-ui": "0.8.
|
|
63
|
+
"@dxos/react-ui": "0.8.3-main.7f5a14c",
|
|
64
|
+
"@dxos/react-ui-theme": "0.8.3-main.7f5a14c"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { contributes, Capabilities, createResolver } from '@dxos/app-framework';
|
|
6
|
-
import {
|
|
6
|
+
import { Obj } from '@dxos/echo';
|
|
7
7
|
|
|
8
8
|
import { TemplateAction, TemplateType } from '../types';
|
|
9
9
|
|
|
@@ -13,7 +13,7 @@ export default () =>
|
|
|
13
13
|
createResolver({
|
|
14
14
|
intent: TemplateAction.Create,
|
|
15
15
|
resolve: ({ name }) => ({
|
|
16
|
-
data: { object:
|
|
16
|
+
data: { object: Obj.make(TemplateType, { name }) },
|
|
17
17
|
}),
|
|
18
18
|
}),
|
|
19
19
|
);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
|
-
import { type
|
|
8
|
+
import { type Obj } from '@dxos/echo';
|
|
9
9
|
|
|
10
10
|
import { TemplateContainer } from '../components';
|
|
11
11
|
import { TEMPLATE_PLUGIN } from '../meta';
|
|
@@ -17,7 +17,7 @@ export default () =>
|
|
|
17
17
|
createSurface({
|
|
18
18
|
id: TEMPLATE_PLUGIN,
|
|
19
19
|
role: 'article',
|
|
20
|
-
filter: (data): data is { subject:
|
|
20
|
+
filter: (data): data is { subject: Obj.Any } => isObject(data.subject),
|
|
21
21
|
component: ({ data, role }) => <TemplateContainer role={role} object={data.subject} />,
|
|
22
22
|
}),
|
|
23
23
|
);
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type Obj } from '@dxos/echo';
|
|
8
|
+
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
8
9
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
9
10
|
|
|
10
|
-
export const TemplateContainer = ({ object }: { object:
|
|
11
|
+
export const TemplateContainer = ({ object }: { object: Obj.Any; role: string }) => {
|
|
11
12
|
return (
|
|
12
13
|
<StackItem.Content>
|
|
13
14
|
<pre className='m-4 p-2 ring'>
|
package/src/types.ts
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
6
|
|
|
7
|
+
import { Obj } from '@dxos/echo';
|
|
7
8
|
import { TypedObject } from '@dxos/echo-schema';
|
|
8
|
-
import {
|
|
9
|
+
import { ReactiveObjectSchema } from '@dxos/react-client/echo';
|
|
9
10
|
|
|
10
11
|
import { TEMPLATE_PLUGIN } from './meta';
|
|
11
12
|
|
|
@@ -22,12 +23,14 @@ export namespace TemplateAction {
|
|
|
22
23
|
}) {}
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
// TODO(
|
|
27
|
-
|
|
28
|
-
return isEchoObject(object) && object.type === 'template';
|
|
26
|
+
export const isObject = (object: unknown): object is Obj.Any => {
|
|
27
|
+
// TODO(dmaretskyi): Can this be Obj.instanceOf(TemplateType)?
|
|
28
|
+
return Obj.isObject(object) && (object as any).type === 'template';
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
export class TemplateType extends TypedObject({
|
|
31
|
+
export class TemplateType extends TypedObject({
|
|
32
|
+
typename: 'dxos.org/type/Template',
|
|
33
|
+
version: '0.1.0',
|
|
34
|
+
})({
|
|
32
35
|
name: Schema.optional(Schema.String),
|
|
33
36
|
}) {}
|
|
@@ -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 { TypedObject } from '@dxos/echo-schema';\nimport { isEchoObject, ReactiveObjectSchema, type AnyLiveObject } 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\n// TODO(burdon): Warning: Encountered two children with the same key, `dxos.org/plugin/template`.\n// TODO(burdon): Better way to detect?\nexport const isObject = (object: unknown): object is AnyLiveObject<any> => {\n return isEchoObject(object) && object.type === 'template';\n};\n\nexport class TemplateType extends TypedObject({ typename: 'dxos.org/type/Template', version: '0.1.0' })({\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,mBAAmB;AAC5B,SAASC,cAAcC,4BAAgD;;;ACDhE,IAAMC,kBAAkB;AAExB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,MAAM;EACNC,QAAQ;AACV;;;UDFiBC,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;AAeV,IAAMc,WAAW,CAACF,WAAAA;AACvB,SAAOG,aAAaH,MAAAA,KAAWA,OAAOI,SAAS;AACjD;AAEO,IAAMC,eAAN,cAA2BC,YAAY;EAAEC,UAAU;EAA0BC,SAAS;AAAQ,CAAA,EAAG;EACtGZ,MAAMJ,OAAOK,SAASL,OAAOM,MAAM;AACrC,CAAA,EAAA;AAAI;;",
|
|
6
|
-
"names": ["Schema", "TypedObject", "isEchoObject", "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", "isEchoObject", "type", "TemplateType", "TypedObject", "typename", "version"]
|
|
7
|
-
}
|
|
@@ -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 { live } from '@dxos/react-client/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: live(TemplateType, { name }) },\n }),\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,SAASA,aAAaC,cAAcC,sBAAsB;AAC1D,SAASC,YAAY;AAIrB,IAAA,0BAAe,MACbC,YACEC,aAAaC,gBACbC,eAAe;EACbC,QAAQC,eAAeC;EACvBC,SAAS,CAAC,EAAEC,KAAI,OAAQ;IACtBC,MAAM;MAAEC,QAAQC,KAAKC,cAAc;QAAEJ;MAAK,CAAA;IAAG;EAC/C;AACF,CAAA,CAAA;",
|
|
6
|
-
"names": ["contributes", "Capabilities", "createResolver", "live", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "TemplateAction", "Create", "resolve", "name", "data", "object", "live", "TemplateType"]
|
|
7
|
-
}
|
|
@@ -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 AnyLiveObject } from '@dxos/react-client/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: AnyLiveObject<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 AnyLiveObject, fullyQualifiedId } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nexport const TemplateContainer = ({ object }: { object: AnyLiveObject<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;AAElB,SAA6BC,wBAAwB;AACrD,SAASC,iBAAiB;AAEnB,IAAMC,oBAAoB,CAAC,EAAEC,OAAM,MAAgD;;;AACxF,WACE,sBAAA,cAACC,UAAUC,SAAO,MAChB,sBAAA,cAACC,OAAAA;MAAIC,WAAU;OACb,sBAAA,cAACC,QAAAA,MAAMC,iBAAiBN,MAAAA,CAAAA,CAAAA,CAAAA;;;;AAIhC;;;ADJA,IAAA,wBAAe,MACbO,YACEC,aAAaC,cACbC,cAAc;EACZC,IAAIC;EACJC,MAAM;EACNC,QAAQ,CAACC,SAAkDC,SAASD,KAAKE,OAAO;EAChFC,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
|
-
}
|