@dxos/plugin-illustrator 0.10.0
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/LICENSE +105 -0
- package/PLUGIN.mdl +55 -0
- package/dist/lib/IllustratorPlugin.mjs +18 -0
- package/dist/lib/IllustratorPlugin.mjs.map +1 -0
- package/dist/lib/IllustratorPlugin.node.mjs +18 -0
- package/dist/lib/IllustratorPlugin.node.mjs.map +1 -0
- package/dist/lib/IllustratorPlugin.workerd.mjs +10 -0
- package/dist/lib/IllustratorPlugin.workerd.mjs.map +1 -0
- package/dist/lib/capabilities.mjs +11 -0
- package/dist/lib/capabilities.mjs.map +1 -0
- package/dist/lib/chunk-IllustratorCapabilities.mjs +16 -0
- package/dist/lib/chunk-IllustratorCapabilities.mjs.map +1 -0
- package/dist/lib/chunk-comment-config.mjs +16 -0
- package/dist/lib/chunk-comment-config.mjs.map +1 -0
- package/dist/lib/chunk-create-object.mjs +46 -0
- package/dist/lib/chunk-create-object.mjs.map +1 -0
- package/dist/lib/chunk-create.mjs +20 -0
- package/dist/lib/chunk-create.mjs.map +1 -0
- package/dist/lib/chunk-edit.mjs +20 -0
- package/dist/lib/chunk-edit.mjs.map +1 -0
- package/dist/lib/chunk-load-sketch.mjs +64 -0
- package/dist/lib/chunk-load-sketch.mjs.map +1 -0
- package/dist/lib/chunk-meta.mjs +40 -0
- package/dist/lib/chunk-meta.mjs.map +1 -0
- package/dist/lib/chunk-model.mjs +202 -0
- package/dist/lib/chunk-model.mjs.map +1 -0
- package/dist/lib/chunk-operation-handler.mjs +11 -0
- package/dist/lib/chunk-operation-handler.mjs.map +1 -0
- package/dist/lib/chunk-react-surface.mjs +31 -0
- package/dist/lib/chunk-react-surface.mjs.map +1 -0
- package/dist/lib/chunk-read.mjs +13 -0
- package/dist/lib/chunk-read.mjs.map +1 -0
- package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
- package/dist/lib/chunk-skill-definition.mjs +10 -0
- package/dist/lib/chunk-skill-definition.mjs.map +1 -0
- package/dist/lib/chunk-skills.mjs +65 -0
- package/dist/lib/chunk-skills.mjs.map +1 -0
- package/dist/lib/chunk-types.mjs +108 -0
- package/dist/lib/chunk-types.mjs.map +1 -0
- package/dist/lib/components.mjs +45 -0
- package/dist/lib/components.mjs.map +1 -0
- package/dist/lib/containers.mjs +58 -0
- package/dist/lib/containers.mjs.map +1 -0
- package/dist/lib/index.mjs +9 -0
- package/dist/lib/meta.mjs +2 -0
- package/dist/lib/model.mjs +2 -0
- package/dist/lib/operations.mjs +7 -0
- package/dist/lib/operations.mjs.map +1 -0
- package/dist/lib/plugin.mjs +9 -0
- package/dist/lib/plugin.mjs.map +1 -0
- package/dist/lib/skills.mjs +2 -0
- package/dist/lib/translations.mjs +27 -0
- package/dist/lib/translations.mjs.map +1 -0
- package/dist/lib/types.mjs +3 -0
- package/dist/lib/util.mjs +2 -0
- package/dist/types/dx.config.d.ts +28 -0
- package/dist/types/dx.config.d.ts.map +1 -0
- package/dist/types/src/IllustratorPlugin.d.ts +4 -0
- package/dist/types/src/IllustratorPlugin.d.ts.map +1 -0
- package/dist/types/src/IllustratorPlugin.node.d.ts +10 -0
- package/dist/types/src/IllustratorPlugin.node.d.ts.map +1 -0
- package/dist/types/src/IllustratorPlugin.workerd.d.ts +4 -0
- package/dist/types/src/IllustratorPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/capabilities/comment-config.d.ts +5 -0
- package/dist/types/src/capabilities/comment-config.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +5 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +8 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/skill-definition.d.ts +5 -0
- package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -0
- package/dist/types/src/components/CreateSketchPanel.d.ts +15 -0
- package/dist/types/src/components/CreateSketchPanel.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/containers/SketchArticle/SketchArticle.d.ts +11 -0
- package/dist/types/src/containers/SketchArticle/SketchArticle.d.ts.map +1 -0
- package/dist/types/src/containers/SketchArticle/index.d.ts +2 -0
- package/dist/types/src/containers/SketchArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/SketchCard/SketchCard.d.ts +10 -0
- package/dist/types/src/containers/SketchCard/SketchCard.d.ts.map +1 -0
- package/dist/types/src/containers/SketchCard/index.d.ts +2 -0
- package/dist/types/src/containers/SketchCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +7 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +33 -0
- package/dist/types/src/meta.d.ts.map +1 -0
- package/dist/types/src/model/builder.d.ts +32 -0
- package/dist/types/src/model/builder.d.ts.map +1 -0
- package/dist/types/src/model/dialect.d.ts +19 -0
- package/dist/types/src/model/dialect.d.ts.map +1 -0
- package/dist/types/src/model/index.d.ts +4 -0
- package/dist/types/src/model/index.d.ts.map +1 -0
- package/dist/types/src/model/scene.d.ts +843 -0
- package/dist/types/src/model/scene.d.ts.map +1 -0
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/edit.d.ts +5 -0
- package/dist/types/src/operations/edit.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/read.d.ts +5 -0
- package/dist/types/src/operations/read.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/skills/index.d.ts +2 -0
- package/dist/types/src/skills/index.d.ts.map +1 -0
- package/dist/types/src/skills/sketch-skill.d.ts +4 -0
- package/dist/types/src/skills/sketch-skill.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +34 -0
- package/dist/types/src/translations.d.ts.map +1 -0
- package/dist/types/src/types/IllustratorCapabilities.d.ts +10 -0
- package/dist/types/src/types/IllustratorCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/Sketch.d.ts +50 -0
- package/dist/types/src/types/Sketch.d.ts.map +1 -0
- package/dist/types/src/types/SketchOperation.d.ts +427 -0
- package/dist/types/src/types/SketchOperation.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +5 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/types.d.ts +45 -0
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +2 -0
- package/dist/types/src/util/index.d.ts.map +1 -0
- package/dist/types/src/util/load-sketch.d.ts +37 -0
- package/dist/types/src/util/load-sketch.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/dx.config.ts +35 -0
- package/package.json +144 -0
- package/src/IllustratorPlugin.node.tsx +27 -0
- package/src/IllustratorPlugin.tsx +30 -0
- package/src/IllustratorPlugin.workerd.tsx +16 -0
- package/src/capabilities/comment-config.ts +20 -0
- package/src/capabilities/create-object.ts +66 -0
- package/src/capabilities/index.ts +15 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +37 -0
- package/src/capabilities/skill-definition.ts +14 -0
- package/src/components/CreateSketchPanel.tsx +68 -0
- package/src/components/index.ts +5 -0
- package/src/containers/SketchArticle/SketchArticle.tsx +48 -0
- package/src/containers/SketchArticle/index.ts +5 -0
- package/src/containers/SketchCard/SketchCard.tsx +41 -0
- package/src/containers/SketchCard/index.ts +5 -0
- package/src/containers/index.ts +6 -0
- package/src/index.ts +10 -0
- package/src/meta.ts +9 -0
- package/src/model/builder.ts +41 -0
- package/src/model/dialect.ts +53 -0
- package/src/model/index.ts +7 -0
- package/src/model/scene.ts +208 -0
- package/src/operations/create.ts +27 -0
- package/src/operations/edit.ts +23 -0
- package/src/operations/index.ts +11 -0
- package/src/operations/read.ts +21 -0
- package/src/plugin.ts +11 -0
- package/src/skills/index.ts +5 -0
- package/src/skills/sketch-skill.ts +70 -0
- package/src/translations.ts +33 -0
- package/src/types/IllustratorCapabilities.ts +19 -0
- package/src/types/Sketch.ts +69 -0
- package/src/types/SketchOperation.ts +76 -0
- package/src/types/index.ts +9 -0
- package/src/types/types.ts +53 -0
- package/src/util/index.ts +5 -0
- package/src/util/load-sketch.ts +74 -0
- package/src/vite-env.d.ts +10 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
package/PLUGIN.mdl
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: org.dxos.plugin.illustrator
|
|
3
|
+
name: IllustratorPlugin
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
A headless diagramming host plugin for `DXOS` Composer. Owns the base `Sketch` ECHO type, the
|
|
8
|
+
renderer-neutral scene DSL and dialect registry, and the agent-facing sketch skill/operations.
|
|
9
|
+
Canvas renderers (e.g. plugin-tldraw, plugin-excalidraw) contribute a `SketchVariant` capability
|
|
10
|
+
supplying their canvas schema, a builder that maps the scene DSL onto their records, and surface
|
|
11
|
+
components; plugin-illustrator resolves the variant at runtime and delegates.
|
|
12
|
+
|
|
13
|
+
## Extensions
|
|
14
|
+
|
|
15
|
+
The following extension dialects are used in this document.
|
|
16
|
+
Each extension is defined in the Appendix or resolved via its URI.
|
|
17
|
+
|
|
18
|
+
| Term | URI |
|
|
19
|
+
|-------------|--------------------------------|
|
|
20
|
+
| `type` | `org.dxos.mdl.type@1.0` |
|
|
21
|
+
| `feat` | `org.dxos.mdl.feat@1.0` |
|
|
22
|
+
| `test` | `org.dxos.mdl.test@1.0` |
|
|
23
|
+
| `component` | `org.dxos.mdl.component@1.0` |
|
|
24
|
+
| `op` | `org.dxos.mdl.op@1.0` |
|
|
25
|
+
|
|
26
|
+
## Types
|
|
27
|
+
|
|
28
|
+
```mdl
|
|
29
|
+
type Sketch
|
|
30
|
+
desc: Named handle around a renderer-specific canvas object.
|
|
31
|
+
fields:
|
|
32
|
+
name?: string
|
|
33
|
+
canvas: Ref<Unknown> # reference to the renderer-specific canvas (e.g. Tldraw.Canvas)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Capabilities
|
|
37
|
+
|
|
38
|
+
```mdl
|
|
39
|
+
component VariantProvider
|
|
40
|
+
desc: Contributed by renderer plugins; supplies the canvas type, a scene-DSL builder
|
|
41
|
+
(read/apply), a create factory, and Article/Card surface components.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Operations
|
|
45
|
+
|
|
46
|
+
```mdl
|
|
47
|
+
op create
|
|
48
|
+
desc: Creates a Sketch with an empty canvas for the requested (or default) variant.
|
|
49
|
+
|
|
50
|
+
op read
|
|
51
|
+
desc: Returns the current scene of a sketch as world objects with object-local coordinates.
|
|
52
|
+
|
|
53
|
+
op edit
|
|
54
|
+
desc: Applies scene commands to a sketch via the variant's builder; returns the resulting scene.
|
|
55
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Plugin } from "@dxos/app-framework";
|
|
2
|
+
import { Sketch } from "#types";
|
|
3
|
+
import { meta } from "#meta";
|
|
4
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
5
|
+
import { CommentConfig, CreateObject, OperationHandler, ReactSurface, SkillDefinition } from "#capabilities";
|
|
6
|
+
import { translations } from "#translations";
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/IllustratorPlugin.tsx
|
|
9
|
+
var IllustratorPlugin = Plugin.define(meta).pipe(AppPlugin.addCommentConfigModule({ activate: CommentConfig }), AppPlugin.addCreateObjectModule({ activate: CreateObject }), AppPlugin.addOperationHandlerModule({ activate: OperationHandler }), AppPlugin.addSchemaModule({ schema: [Sketch.Sketch] }), AppPlugin.addSkillDefinitionModule({ activate: SkillDefinition }), AppPlugin.addSurfaceModule({ activate: ReactSurface }), AppPlugin.addTranslationsModule({ translations }), AppPlugin.addPluginAssetModule({ asset: {
|
|
10
|
+
pluginId: meta.profile.key,
|
|
11
|
+
path: "PLUGIN.mdl",
|
|
12
|
+
content: "---\nid: org.dxos.plugin.illustrator\nname: IllustratorPlugin\nversion: 0.1.0\n---\n\nA headless diagramming host plugin for `DXOS` Composer. Owns the base `Sketch` ECHO type, the\nrenderer-neutral scene DSL and dialect registry, and the agent-facing sketch skill/operations.\nCanvas renderers (e.g. plugin-tldraw, plugin-excalidraw) contribute a `SketchVariant` capability\nsupplying their canvas schema, a builder that maps the scene DSL onto their records, and surface\ncomponents; plugin-illustrator resolves the variant at runtime and delegates.\n\n## Extensions\n\nThe following extension dialects are used in this document.\nEach extension is defined in the Appendix or resolved via its URI.\n\n| Term | URI |\n|-------------|--------------------------------|\n| `type` | `org.dxos.mdl.type@1.0` |\n| `feat` | `org.dxos.mdl.feat@1.0` |\n| `test` | `org.dxos.mdl.test@1.0` |\n| `component` | `org.dxos.mdl.component@1.0` |\n| `op` | `org.dxos.mdl.op@1.0` |\n\n## Types\n\n```mdl\ntype Sketch\n desc: Named handle around a renderer-specific canvas object.\n fields:\n name?: string\n canvas: Ref<Unknown> # reference to the renderer-specific canvas (e.g. Tldraw.Canvas)\n```\n\n## Capabilities\n\n```mdl\ncomponent VariantProvider\n desc: Contributed by renderer plugins; supplies the canvas type, a scene-DSL builder\n (read/apply), a create factory, and Article/Card surface components.\n```\n\n## Operations\n\n```mdl\nop create\n desc: Creates a Sketch with an empty canvas for the requested (or default) variant.\n\nop read\n desc: Returns the current scene of a sketch as world objects with object-local coordinates.\n\nop edit\n desc: Applies scene commands to a sketch via the variant's builder; returns the resulting scene.\n```\n",
|
|
13
|
+
mimeType: "application/x-mdl"
|
|
14
|
+
} }), Plugin.make);
|
|
15
|
+
//#endregion
|
|
16
|
+
export { IllustratorPlugin, IllustratorPlugin as default };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=IllustratorPlugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IllustratorPlugin.mjs","names":[],"sources":["../../src/IllustratorPlugin.tsx"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { CommentConfig, CreateObject, OperationHandler, ReactSurface, SkillDefinition } from '#capabilities';\nimport { meta } from '#meta';\nimport { translations } from '#translations';\nimport { Sketch } from '#types';\n\n// eslint-disable-next-line import/no-relative-packages\nimport pluginSpec from '../PLUGIN.mdl?raw';\n\nexport const IllustratorPlugin = Plugin.define(meta).pipe(\n AppPlugin.addCommentConfigModule({ activate: CommentConfig }),\n AppPlugin.addCreateObjectModule({ activate: CreateObject }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({ schema: [Sketch.Sketch] }),\n AppPlugin.addSkillDefinitionModule({ activate: SkillDefinition }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations }),\n AppPlugin.addPluginAssetModule({\n asset: { pluginId: meta.profile.key, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },\n }),\n Plugin.make,\n);\n\nexport default IllustratorPlugin;\n"],"mappings":";;;;;;;;AAeA,IAAa,oBAAoB,OAAO,OAAO,IAAI,CAAC,CAAC,KACnD,UAAU,uBAAuB,EAAE,UAAU,cAAc,CAAC,GAC5D,UAAU,sBAAsB,EAAE,UAAU,aAAa,CAAC,GAC1D,UAAU,0BAA0B,EAAE,UAAU,iBAAiB,CAAC,GAClE,UAAU,gBAAgB,EAAE,QAAQ,CAAC,OAAO,MAAM,EAAE,CAAC,GACrD,UAAU,yBAAyB,EAAE,UAAU,gBAAgB,CAAC,GAChE,UAAU,iBAAiB,EAAE,UAAU,aAAa,CAAC,GACrD,UAAU,sBAAsB,EAAE,aAAa,CAAC,GAChD,UAAU,qBAAqB,EAC7B,OAAO;CAAE,UAAU,KAAK,QAAQ;CAAK,MAAM;CAAc,SAAS;CAAY,UAAU;AAAoB,EAC9G,CAAC,GACD,OAAO,IACT"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Plugin } from "@dxos/app-framework";
|
|
2
|
+
import { Sketch } from "#types";
|
|
3
|
+
import { meta } from "#meta";
|
|
4
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
5
|
+
import { OperationHandler, SkillDefinition } from "#capabilities";
|
|
6
|
+
import { translations } from "#translations";
|
|
7
|
+
//#region src/IllustratorPlugin.node.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Headless variant of IllustratorPlugin (no React surfaces / CreateObject panel).
|
|
10
|
+
* Used in node contexts (CLI, agents, tests) where rendering is unavailable —
|
|
11
|
+
* the full variant lazy-loads `CreateSketchPanel` from `react-ui-search` which
|
|
12
|
+
* downstream bundlers don't resolve cleanly under nested pnpm symlinks.
|
|
13
|
+
*/
|
|
14
|
+
var IllustratorPlugin = Plugin.define(meta).pipe(AppPlugin.addOperationHandlerModule({ activate: OperationHandler }), AppPlugin.addSchemaModule({ schema: [Sketch.Sketch] }), AppPlugin.addSkillDefinitionModule({ activate: SkillDefinition }), AppPlugin.addTranslationsModule({ translations }), Plugin.make);
|
|
15
|
+
//#endregion
|
|
16
|
+
export { IllustratorPlugin, IllustratorPlugin as default };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=IllustratorPlugin.node.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IllustratorPlugin.node.mjs","names":[],"sources":["../../src/IllustratorPlugin.node.tsx"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { OperationHandler, SkillDefinition } from '#capabilities';\nimport { meta } from '#meta';\nimport { translations } from '#translations';\nimport { Sketch } from '#types';\n\n/**\n * Headless variant of IllustratorPlugin (no React surfaces / CreateObject panel).\n * Used in node contexts (CLI, agents, tests) where rendering is unavailable —\n * the full variant lazy-loads `CreateSketchPanel` from `react-ui-search` which\n * downstream bundlers don't resolve cleanly under nested pnpm symlinks.\n */\nexport const IllustratorPlugin = Plugin.define(meta).pipe(\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({ schema: [Sketch.Sketch] }),\n AppPlugin.addSkillDefinitionModule({ activate: SkillDefinition }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.make,\n);\n\nexport default IllustratorPlugin;\n"],"mappings":";;;;;;;;;;;;;AAkBA,IAAa,oBAAoB,OAAO,OAAO,IAAI,CAAC,CAAC,KACnD,UAAU,0BAA0B,EAAE,UAAU,iBAAiB,CAAC,GAClE,UAAU,gBAAgB,EAAE,QAAQ,CAAC,OAAO,MAAM,EAAE,CAAC,GACrD,UAAU,yBAAyB,EAAE,UAAU,gBAAgB,CAAC,GAChE,UAAU,sBAAsB,EAAE,aAAa,CAAC,GAChD,OAAO,IACT"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Plugin } from "@dxos/app-framework";
|
|
2
|
+
import { Sketch } from "#types";
|
|
3
|
+
import { meta } from "#meta";
|
|
4
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
5
|
+
//#region src/IllustratorPlugin.workerd.tsx
|
|
6
|
+
var IllustratorPlugin = Plugin.define(meta).pipe(AppPlugin.addSchemaModule({ schema: [Sketch.Sketch] }), Plugin.make);
|
|
7
|
+
//#endregion
|
|
8
|
+
export { IllustratorPlugin, IllustratorPlugin as default };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=IllustratorPlugin.workerd.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IllustratorPlugin.workerd.mjs","names":[],"sources":["../../src/IllustratorPlugin.workerd.tsx"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { meta } from '#meta';\nimport { Sketch } from '#types';\n\nexport const IllustratorPlugin = Plugin.define(meta).pipe(\n AppPlugin.addSchemaModule({ schema: [Sketch.Sketch] }),\n Plugin.make,\n);\n\nexport default IllustratorPlugin;\n"],"mappings":";;;;;AAUA,IAAa,oBAAoB,OAAO,OAAO,IAAI,CAAC,CAAC,KACnD,UAAU,gBAAgB,EAAE,QAAQ,CAAC,OAAO,MAAM,EAAE,CAAC,GACrD,OAAO,IACT"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Capability } from "@dxos/app-framework";
|
|
2
|
+
//#region src/capabilities/index.ts
|
|
3
|
+
var CommentConfig = Capability.lazy("CommentConfig", () => import("./chunk-comment-config.mjs"));
|
|
4
|
+
var CreateObject = Capability.lazy("CreateObject", () => import("./chunk-create-object.mjs"));
|
|
5
|
+
var OperationHandler = Capability.lazy("OperationHandler", () => import("./chunk-operation-handler.mjs"));
|
|
6
|
+
var ReactSurface = Capability.lazy("ReactSurface", () => import("./chunk-react-surface.mjs"));
|
|
7
|
+
var SkillDefinition = Capability.lazy("SkillDefinition", () => import("./chunk-skill-definition.mjs"));
|
|
8
|
+
//#endregion
|
|
9
|
+
export { CommentConfig, CreateObject, OperationHandler, ReactSurface, SkillDefinition };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=capabilities.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.mjs","names":[],"sources":["../../src/capabilities/index.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\nimport { OperationHandlerSet } from '@dxos/compute';\n\nexport const CommentConfig = Capability.lazy('CommentConfig', () => import('./comment-config'));\nexport const CreateObject = Capability.lazy('CreateObject', () => import('./create-object'));\nexport const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(\n 'OperationHandler',\n () => import('./operation-handler'),\n);\nexport const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));\nexport const SkillDefinition = Capability.lazy('SkillDefinition', () => import('./skill-definition'));\n"],"mappings":";;AAOA,IAAa,gBAAgB,WAAW,KAAK,uBAAuB,OAAO,6BAAmB;AAC9F,IAAa,eAAe,WAAW,KAAK,sBAAsB,OAAO,4BAAkB;AAC3F,IAAa,mBAAmB,WAAW,KACzC,0BACM,OAAO,gCACf;AACA,IAAa,eAAe,WAAW,KAAK,sBAAsB,OAAO,4BAAkB;AAC3F,IAAa,kBAAkB,WAAW,KAAK,yBAAyB,OAAO,+BAAqB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
|
|
2
|
+
import { Capability } from "@dxos/app-framework";
|
|
3
|
+
import { meta } from "#meta";
|
|
4
|
+
//#region src/types/IllustratorCapabilities.ts
|
|
5
|
+
var IllustratorCapabilities_exports = /* @__PURE__ */ __exportAll({ VariantProvider: () => VariantProvider });
|
|
6
|
+
/**
|
|
7
|
+
* A sketch variant contribution. Each renderer plugin (tldraw, excalidraw, ...)
|
|
8
|
+
* contributes one of these via `Capability.contributes(IllustratorCapabilities.VariantProvider, variant)`.
|
|
9
|
+
* Consumers iterate via `Capability.getAll(IllustratorCapabilities.VariantProvider)` (Effect) or
|
|
10
|
+
* `useCapabilities(IllustratorCapabilities.VariantProvider)` (React).
|
|
11
|
+
*/
|
|
12
|
+
var VariantProvider = Capability.make(`${meta.profile.key}.capability.variant`);
|
|
13
|
+
//#endregion
|
|
14
|
+
export { VariantProvider as n, IllustratorCapabilities_exports as t };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=chunk-IllustratorCapabilities.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-IllustratorCapabilities.mjs","names":[],"sources":["../../src/types/IllustratorCapabilities.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport { Capability } from '@dxos/app-framework';\n\nimport { meta } from '#meta';\n\nimport type { SketchVariant } from './types';\n\n/**\n * A sketch variant contribution. Each renderer plugin (tldraw, excalidraw, ...)\n * contributes one of these via `Capability.contributes(IllustratorCapabilities.VariantProvider, variant)`.\n * Consumers iterate via `Capability.getAll(IllustratorCapabilities.VariantProvider)` (Effect) or\n * `useCapabilities(IllustratorCapabilities.VariantProvider)` (React).\n */\nexport const VariantProvider = Capability.make<SketchVariant>(`${meta.profile.key}.capability.variant`);\n"],"mappings":";;;;;;;;;;;AAkBA,IAAa,kBAAkB,WAAW,KAAoB,GAAG,KAAK,QAAQ,IAAI,oBAAoB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Capability } from "@dxos/app-framework";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { Sketch } from "#types";
|
|
4
|
+
import { Type } from "@dxos/echo";
|
|
5
|
+
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
6
|
+
//#region src/capabilities/comment-config.ts
|
|
7
|
+
var activate = Effect.fnUntraced(function* () {
|
|
8
|
+
return Capability.contributes(AppCapabilities.CommentConfig, {
|
|
9
|
+
id: Type.getTypename(Sketch.Sketch),
|
|
10
|
+
comments: "unanchored"
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { activate as default };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=chunk-comment-config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-comment-config.mjs","names":[],"sources":["../../src/capabilities/comment-config.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport { Type } from '@dxos/echo';\n\nimport { Sketch } from '#types';\n\nconst activate = Effect.fnUntraced(function* () {\n return Capability.contributes(AppCapabilities.CommentConfig, {\n id: Type.getTypename(Sketch.Sketch),\n comments: 'unanchored',\n });\n});\n\nexport default activate;\n"],"mappings":";;;;;;AAYA,IAAM,WAAW,OAAO,WAAW,aAAa;CAC9C,OAAO,WAAW,YAAY,gBAAgB,eAAe;EAC3D,IAAI,KAAK,YAAY,OAAO,MAAM;EAClC,UAAU;CACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { n as VariantProvider } from "./chunk-IllustratorCapabilities.mjs";
|
|
2
|
+
import { a as Sketch, s as make } from "./chunk-types.mjs";
|
|
3
|
+
import { Capability } from "@dxos/app-framework";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import { invariant } from "@dxos/invariant";
|
|
6
|
+
import { Operation } from "@dxos/compute";
|
|
7
|
+
import { Database, Type } from "@dxos/echo";
|
|
8
|
+
import { SpaceCapabilities, SpaceOperation } from "@dxos/plugin-space";
|
|
9
|
+
import { CreateSketchPanel } from "#components";
|
|
10
|
+
//#region src/capabilities/create-object.ts
|
|
11
|
+
var __dxlog_file = "/Users/burdon/Code/dxos/dxos/.claude/worktrees/peaceful-allen-9b542f/packages/plugins/plugin-illustrator/src/capabilities/create-object.ts";
|
|
12
|
+
var create_object_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
13
|
+
return Capability.contributes(SpaceCapabilities.CreateObjectEntry, {
|
|
14
|
+
id: Type.getTypename(Sketch),
|
|
15
|
+
customPanel: CreateSketchPanel,
|
|
16
|
+
createObject: ({ variantId, input }, options) => Effect.gen(function* () {
|
|
17
|
+
const variant = (yield* Capability.getAll(VariantProvider)).find((entry) => entry.id === variantId);
|
|
18
|
+
invariant(variant, `Unknown sketch variant: ${variantId}`, {
|
|
19
|
+
"~LogMeta": "~LogMeta",
|
|
20
|
+
F: __dxlog_file,
|
|
21
|
+
L: 31,
|
|
22
|
+
S: this,
|
|
23
|
+
A: ["variant", "`Unknown sketch variant: ${variantId}`"]
|
|
24
|
+
});
|
|
25
|
+
const canvas = yield* variant.createCanvas(input ?? {}).pipe(Effect.provideService(Database.Service, Database.makeService(options.db)));
|
|
26
|
+
yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
27
|
+
object: canvas,
|
|
28
|
+
target: options.target,
|
|
29
|
+
targetNodeId: options.targetNodeId
|
|
30
|
+
});
|
|
31
|
+
const sketch = make({
|
|
32
|
+
name: typeof input?.name === "string" ? input.name : void 0,
|
|
33
|
+
canvas
|
|
34
|
+
});
|
|
35
|
+
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
36
|
+
object: sketch,
|
|
37
|
+
target: options.target,
|
|
38
|
+
targetNodeId: options.targetNodeId
|
|
39
|
+
}).pipe(Effect.tapError(() => Operation.invoke(SpaceOperation.RemoveObjects, { objects: [canvas] }).pipe(Effect.ignore)));
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}));
|
|
43
|
+
//#endregion
|
|
44
|
+
export { create_object_default as default };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=chunk-create-object.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-create-object.mjs","names":[],"sources":["../../src/capabilities/create-object.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { Operation } from '@dxos/compute';\nimport { Database, Type } from '@dxos/echo';\nimport { invariant } from '@dxos/invariant';\nimport { SpaceCapabilities, SpaceOperation } from '@dxos/plugin-space';\n\nimport { CreateSketchPanel } from '#components';\n\nimport { IllustratorCapabilities, Sketch } from '../types';\n\ntype CreateOptions = Parameters<SpaceCapabilities.CreateObjectEntry['createObject']>[1];\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n return Capability.contributes(SpaceCapabilities.CreateObjectEntry, {\n id: Type.getTypename(Sketch.Sketch),\n customPanel: CreateSketchPanel,\n createObject: (\n { variantId, input }: { variantId: string; input?: Record<string, any> },\n options: CreateOptions,\n ) =>\n Effect.gen(function* () {\n const variants = yield* Capability.getAll(IllustratorCapabilities.VariantProvider);\n const variant = variants.find((entry) => entry.id === variantId);\n invariant(variant, `Unknown sketch variant: ${variantId}`);\n\n // Build the canvas object via the variant's factory.\n const canvas = yield* variant\n .createCanvas(input ?? {})\n .pipe(Effect.provideService(Database.Service, Database.makeService(options.db)));\n\n // Add the canvas to the database. Stays hidden — it's referenced by the Sketch and\n // shouldn't appear as a top-level item in the user's space.\n yield* Operation.invoke(SpaceOperation.AddObject, {\n object: canvas,\n target: options.target,\n targetNodeId: options.targetNodeId,\n });\n\n const sketch = Sketch.make({\n name: typeof input?.name === 'string' ? input.name : undefined,\n canvas,\n });\n\n // Add the user-facing Sketch wrapper. Not hidden — this is the object the user sees\n // and navigates to. If this second write fails, roll back the canvas so we don't\n // leak an orphaned object into the space.\n return yield* Operation.invoke(SpaceOperation.AddObject, {\n object: sketch,\n target: options.target,\n targetNodeId: options.targetNodeId,\n }).pipe(\n Effect.tapError(() =>\n Operation.invoke(SpaceOperation.RemoveObjects, { objects: [canvas] }).pipe(Effect.ignore),\n ),\n );\n }),\n });\n }),\n);\n"],"mappings":";;;;;;;;;;;AAkBA,IAAA,wBAAe,WAAW,WACxB,OAAO,WAAW,aAAa;CAC7B,OAAO,WAAW,YAAY,kBAAkB,mBAAmB;EACjE,IAAI,KAAK,YAAY,MAAa;EAClC,aAAa;EACb,eACE,EAAE,WAAW,SACb,YAEA,OAAO,IAAI,aAAa;GAEtB,MAAM,WAAU,OADQ,WAAW,OAAO,eAAuC,EAAA,CACxD,MAAM,UAAU,MAAM,OAAO,SAAS;GAC/D,UAAU,SAAS,2BAA2B,aAAU;IAAA,YAAA;IAAA,GAAA;IAAA,GAAA;IAAA,GAAA;IAAA,GAAA,CAAA,WAAA,wCAAA;GAAA,CAAC;GAGzD,MAAM,SAAS,OAAO,QACnB,aAAa,SAAS,CAAC,CAAC,CAAA,CACxB,KAAK,OAAO,eAAe,SAAS,SAAS,SAAS,YAAY,QAAQ,EAAE,CAAC,CAAC;GAIjF,OAAO,UAAU,OAAO,eAAe,WAAW;IAChD,QAAQ;IACR,QAAQ,QAAQ;IAChB,cAAc,QAAQ;GACxB,CAAC;GAED,MAAM,SAAS,KAAY;IACzB,MAAM,OAAO,OAAO,SAAS,WAAW,MAAM,OAAO,KAAA;IACrD;GACF,CAAC;GAKD,OAAO,OAAO,UAAU,OAAO,eAAe,WAAW;IACvD,QAAQ;IACR,QAAQ,QAAQ;IAChB,cAAc,QAAQ;GACxB,CAAC,CAAC,CAAC,KACD,OAAO,eACL,UAAU,OAAO,eAAe,eAAe,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,CAC1F,CACF;EACF,CAAC;CACL,CAAC;AACH,CAAC,CACH"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { n as VariantProvider } from "./chunk-IllustratorCapabilities.mjs";
|
|
2
|
+
import { s as make, t as Create } from "./chunk-types.mjs";
|
|
3
|
+
import { n as UnknownSketchVariantError } from "./chunk-load-sketch.mjs";
|
|
4
|
+
import { Capability } from "@dxos/app-framework";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import { Operation } from "@dxos/compute";
|
|
7
|
+
//#region src/operations/create.ts
|
|
8
|
+
var handler = Create.pipe(Operation.withHandler(Effect.fn(function* ({ name, variant: variantId }) {
|
|
9
|
+
const variants = yield* Capability.getAll(VariantProvider);
|
|
10
|
+
const variant = variantId ? variants.find((entry) => entry.id === variantId) : variants[0];
|
|
11
|
+
if (!variant) return yield* Effect.fail(new UnknownSketchVariantError(variantId ?? "(none registered)"));
|
|
12
|
+
return { object: make({
|
|
13
|
+
name,
|
|
14
|
+
canvas: yield* variant.createCanvas()
|
|
15
|
+
}) };
|
|
16
|
+
})));
|
|
17
|
+
//#endregion
|
|
18
|
+
export { handler as default };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=chunk-create.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-create.mjs","names":[],"sources":["../../src/operations/create.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { Operation } from '@dxos/compute';\n\nimport { IllustratorCapabilities, Sketch, SketchOperation } from '../types';\nimport { UnknownSketchVariantError } from '../util/load-sketch';\n\nconst handler: Operation.WithHandler<typeof SketchOperation.Create> = SketchOperation.Create.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ name, variant: variantId }) {\n const variants = yield* Capability.getAll(IllustratorCapabilities.VariantProvider);\n const variant = variantId ? variants.find((entry) => entry.id === variantId) : variants[0];\n if (!variant) {\n return yield* Effect.fail(new UnknownSketchVariantError(variantId ?? '(none registered)'));\n }\n const canvas = yield* variant.createCanvas();\n return { object: Sketch.make({ name, canvas }) };\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;;;AAYA,IAAM,UAAA,OAAuF,KAC3F,UAAU,YACR,OAAO,GAAG,WAAW,EAAE,MAAM,SAAS,aAAa;CACjD,MAAM,WAAW,OAAO,WAAW,OAAO,eAAuC;CACjF,MAAM,UAAU,YAAY,SAAS,MAAM,UAAU,MAAM,OAAO,SAAS,IAAI,SAAS;CACxF,IAAI,CAAC,SACH,OAAO,OAAO,OAAO,KAAK,IAAI,0BAA0B,aAAa,mBAAmB,CAAC;CAG3F,OAAO,EAAE,QAAQ,KAAY;EAAE;EAAM,eADf,QAAQ,aAAa;CACC,CAAC,EAAE;AACjD,CAAC,CACH,CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { n as Edit } from "./chunk-types.mjs";
|
|
2
|
+
import { i as resolveVariant } from "./chunk-load-sketch.mjs";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import { Operation } from "@dxos/compute";
|
|
5
|
+
//#region src/operations/edit.ts
|
|
6
|
+
var handler = Edit.pipe(Operation.withHandler(Effect.fn(function* ({ sketch, commands }) {
|
|
7
|
+
const { canvas, variant } = yield* resolveVariant(sketch);
|
|
8
|
+
const { upserted, removed } = variant.builder.apply(canvas, commands);
|
|
9
|
+
const { scene, unmanaged } = variant.builder.read(canvas);
|
|
10
|
+
return {
|
|
11
|
+
scene,
|
|
12
|
+
unmanaged,
|
|
13
|
+
upserted,
|
|
14
|
+
removed
|
|
15
|
+
};
|
|
16
|
+
})));
|
|
17
|
+
//#endregion
|
|
18
|
+
export { handler as default };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=chunk-edit.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-edit.mjs","names":[],"sources":["../../src/operations/edit.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Operation } from '@dxos/compute';\n\nimport { SketchOperation } from '../types';\nimport { resolveVariant } from '../util/load-sketch';\n\nconst handler: Operation.WithHandler<typeof SketchOperation.Edit> = SketchOperation.Edit.pipe(\n Operation.withHandler(\n Effect.fn(function* ({ sketch, commands }) {\n const { canvas, variant } = yield* resolveVariant(sketch);\n const { upserted, removed } = variant.builder.apply(canvas, commands);\n const { scene, unmanaged } = variant.builder.read(canvas);\n return { scene, unmanaged, upserted, removed };\n }),\n ),\n);\n\nexport default handler;\n"],"mappings":";;;;;AAWA,IAAM,UAAA,KAAmF,KACvF,UAAU,YACR,OAAO,GAAG,WAAW,EAAE,QAAQ,YAAY;CACzC,MAAM,EAAE,QAAQ,YAAY,OAAO,eAAe,MAAM;CACxD,MAAM,EAAE,UAAU,YAAY,QAAQ,QAAQ,MAAM,QAAQ,QAAQ;CACpE,MAAM,EAAE,OAAO,cAAc,QAAQ,QAAQ,KAAK,MAAM;CACxD,OAAO;EAAE;EAAO;EAAW;EAAU;CAAQ;AAC/C,CAAC,CACH,CACF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { n as VariantProvider } from "./chunk-IllustratorCapabilities.mjs";
|
|
2
|
+
import { Capability } from "@dxos/app-framework";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import { Database, Obj, Type } from "@dxos/echo";
|
|
5
|
+
//#region src/util/load-sketch.ts
|
|
6
|
+
var SketchVariantMismatchError = class extends Error {
|
|
7
|
+
sketchId;
|
|
8
|
+
expectedTypename;
|
|
9
|
+
actualTypename;
|
|
10
|
+
_tag = "SketchVariantMismatchError";
|
|
11
|
+
constructor(sketchId, expectedTypename, actualTypename) {
|
|
12
|
+
super(`Sketch ${sketchId} canvas typename mismatch: expected ${expectedTypename}, got ${actualTypename}.`);
|
|
13
|
+
this.sketchId = sketchId;
|
|
14
|
+
this.expectedTypename = expectedTypename;
|
|
15
|
+
this.actualTypename = actualTypename;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var UnknownSketchVariantError = class extends Error {
|
|
19
|
+
typename;
|
|
20
|
+
_tag = "UnknownSketchVariantError";
|
|
21
|
+
constructor(typename) {
|
|
22
|
+
super(`No sketch variant registered for canvas type: ${typename}.`);
|
|
23
|
+
this.typename = typename;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Loads a Sketch from a Ref and resolves its canvas, asserting the canvas matches
|
|
28
|
+
* the expected type. Returns the typed pair.
|
|
29
|
+
*
|
|
30
|
+
* Use in operation handlers that declare `input.sketch: SketchRef<MyCanvas>`.
|
|
31
|
+
*/
|
|
32
|
+
var loadSketch = (ref, canvasType) => Effect.gen(function* () {
|
|
33
|
+
const sketch = yield* Database.load(ref);
|
|
34
|
+
const canvas = yield* Database.load(sketch.canvas);
|
|
35
|
+
if (!Obj.instanceOf(canvasType, canvas)) {
|
|
36
|
+
const expected = Type.getTypename(canvasType) ?? "unknown";
|
|
37
|
+
const actual = Obj.getTypename(canvas) ?? "unknown";
|
|
38
|
+
return yield* Effect.fail(new SketchVariantMismatchError(sketch.id, expected, actual));
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
sketch,
|
|
42
|
+
canvas
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Loads a Sketch and resolves the variant provider matching its canvas typename.
|
|
47
|
+
* Used by the renderer-agnostic read/edit operations.
|
|
48
|
+
*/
|
|
49
|
+
var resolveVariant = (ref) => Effect.gen(function* () {
|
|
50
|
+
const sketch = yield* Database.load(ref);
|
|
51
|
+
const canvas = yield* Database.load(sketch.canvas);
|
|
52
|
+
const typename = Obj.getTypename(canvas) ?? "unknown";
|
|
53
|
+
const variant = (yield* Capability.getAll(VariantProvider)).find((entry) => entry.id === typename);
|
|
54
|
+
if (!variant) return yield* Effect.fail(new UnknownSketchVariantError(typename));
|
|
55
|
+
return {
|
|
56
|
+
sketch,
|
|
57
|
+
canvas,
|
|
58
|
+
variant
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
//#endregion
|
|
62
|
+
export { resolveVariant as i, UnknownSketchVariantError as n, loadSketch as r, SketchVariantMismatchError as t };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=chunk-load-sketch.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-load-sketch.mjs","names":[],"sources":["../../src/util/load-sketch.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { Database, Obj, type Ref, Type } from '@dxos/echo';\n\nimport * as IllustratorCapabilities from '../types/IllustratorCapabilities';\nimport * as Sketch from '../types/Sketch';\nimport { type SketchVariant } from '../types/types';\n\nexport class SketchVariantMismatchError extends Error {\n readonly _tag = 'SketchVariantMismatchError';\n constructor(\n readonly sketchId: string,\n readonly expectedTypename: string,\n readonly actualTypename: string,\n ) {\n super(`Sketch ${sketchId} canvas typename mismatch: expected ${expectedTypename}, got ${actualTypename}.`);\n }\n}\n\nexport class UnknownSketchVariantError extends Error {\n readonly _tag = 'UnknownSketchVariantError';\n constructor(readonly typename: string) {\n super(`No sketch variant registered for canvas type: ${typename}.`);\n }\n}\n\n/**\n * Loads a Sketch from a Ref and resolves its canvas, asserting the canvas matches\n * the expected type. Returns the typed pair.\n *\n * Use in operation handlers that declare `input.sketch: SketchRef<MyCanvas>`.\n */\nexport const loadSketch = <S extends Type.AnyObj>(\n ref: Ref.Ref<Sketch.Sketch>,\n canvasType: S,\n): Effect.Effect<{ sketch: Sketch.Sketch; canvas: Type.InstanceType<S> }, Error, Database.Service> =>\n Effect.gen(function* () {\n const sketch = yield* Database.load(ref);\n const canvas = yield* Database.load(sketch.canvas);\n if (!Obj.instanceOf(canvasType, canvas)) {\n const expected = Type.getTypename(canvasType) ?? 'unknown';\n const actual = Obj.getTypename(canvas as Obj.Any) ?? 'unknown';\n return yield* Effect.fail(new SketchVariantMismatchError(sketch.id, expected, actual));\n }\n return { sketch, canvas: canvas as Type.InstanceType<S> };\n });\n\n/**\n * Loads a Sketch and resolves the variant provider matching its canvas typename.\n * Used by the renderer-agnostic read/edit operations.\n */\nexport const resolveVariant = (\n ref: Ref.Ref<Sketch.Sketch>,\n): Effect.Effect<\n { sketch: Sketch.Sketch; canvas: Obj.Any; variant: SketchVariant },\n Error,\n Database.Service | Capability.Service\n> =>\n Effect.gen(function* () {\n const sketch = yield* Database.load(ref);\n const canvas = (yield* Database.load(sketch.canvas)) as Obj.Any;\n const typename = Obj.getTypename(canvas) ?? 'unknown';\n const variants = yield* Capability.getAll(IllustratorCapabilities.VariantProvider);\n const variant = variants.find((entry) => entry.id === typename);\n if (!variant) {\n return yield* Effect.fail(new UnknownSketchVariantError(typename));\n }\n return { sketch, canvas, variant };\n });\n"],"mappings":";;;;;AAaA,IAAa,6BAAb,cAAgD,MAAM;CAGzC;CACA;CACA;CAJX,OAAgB;CAChB,YACE,UACA,kBACA,gBACA;EACA,MAAM,UAAU,SAAS,sCAAsC,iBAAiB,QAAQ,eAAe,EAAE;EAJhG,KAAA,WAAA;EACA,KAAA,mBAAA;EACA,KAAA,iBAAA;CAGX;AACF;AAEA,IAAa,4BAAb,cAA+C,MAAM;CAE9B;CADrB,OAAgB;CAChB,YAAY,UAA2B;EACrC,MAAM,iDAAiD,SAAS,EAAE;EAD/C,KAAA,WAAA;CAErB;AACF;;;;;;;AAQA,IAAa,cACX,KACA,eAEA,OAAO,IAAI,aAAa;CACtB,MAAM,SAAS,OAAO,SAAS,KAAK,GAAG;CACvC,MAAM,SAAS,OAAO,SAAS,KAAK,OAAO,MAAM;CACjD,IAAI,CAAC,IAAI,WAAW,YAAY,MAAM,GAAG;EACvC,MAAM,WAAW,KAAK,YAAY,UAAU,KAAK;EACjD,MAAM,SAAS,IAAI,YAAY,MAAiB,KAAK;EACrD,OAAO,OAAO,OAAO,KAAK,IAAI,2BAA2B,OAAO,IAAI,UAAU,MAAM,CAAC;CACvF;CACA,OAAO;EAAE;EAAgB;CAA+B;AAC1D,CAAC;;;;;AAMH,IAAa,kBACX,QAMA,OAAO,IAAI,aAAa;CACtB,MAAM,SAAS,OAAO,SAAS,KAAK,GAAG;CACvC,MAAM,SAAU,OAAO,SAAS,KAAK,OAAO,MAAM;CAClD,MAAM,WAAW,IAAI,YAAY,MAAM,KAAK;CAE5C,MAAM,WAAU,OADQ,WAAW,OAAO,eAAuC,EAAA,CACxD,MAAM,UAAU,MAAM,OAAO,QAAQ;CAC9D,IAAI,CAAC,SACH,OAAO,OAAO,OAAO,KAAK,IAAI,0BAA0B,QAAQ,CAAC;CAEnE,OAAO;EAAE;EAAQ;EAAQ;CAAQ;AACnC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Plugin } from "@dxos/app-framework";
|
|
2
|
+
import { Config2 } from "@dxos/app-framework/config";
|
|
3
|
+
import { trim } from "@dxos/util";
|
|
4
|
+
//#region dx.config.ts
|
|
5
|
+
var dx_config_default = Config2.make({ plugin: {
|
|
6
|
+
key: "org.dxos.plugin.illustrator",
|
|
7
|
+
name: "Illustrator",
|
|
8
|
+
author: "DXOS",
|
|
9
|
+
description: trim`
|
|
10
|
+
Headless diagramming host plugin that provides shared infrastructure for local-first
|
|
11
|
+
drawing and diagramming inside DXOS Composer. The plugin owns the base \`Sketch\` ECHO
|
|
12
|
+
type — a named handle referencing a renderer-specific canvas object — together with the
|
|
13
|
+
renderer-neutral scene DSL, the diagram dialect registry, and the agent-facing sketch
|
|
14
|
+
skill and operations (create, read, edit).
|
|
15
|
+
|
|
16
|
+
Canvas renderers (tldraw, excalidraw, and others) are contributed by separate plugins
|
|
17
|
+
via the \`IllustratorCapabilities.VariantProvider\` capability. Each variant supplies its
|
|
18
|
+
own canvas schema, a builder that maps the scene DSL onto its records, and surface
|
|
19
|
+
components (Article and Card). Plugin-illustrator resolves the correct variant at
|
|
20
|
+
runtime and delegates rendering and DSL compilation, keeping the host layer fully
|
|
21
|
+
decoupled from renderer internals.
|
|
22
|
+
|
|
23
|
+
Canvas objects are stored as hidden ECHO objects alongside the top-level \`Sketch\`,
|
|
24
|
+
ensuring they replicate to all peers but do not appear as independent items in the
|
|
25
|
+
user's space graph.
|
|
26
|
+
`,
|
|
27
|
+
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-illustrator",
|
|
28
|
+
icon: {
|
|
29
|
+
key: "ph--compass-tool--regular",
|
|
30
|
+
hue: "indigo"
|
|
31
|
+
},
|
|
32
|
+
spec: "PLUGIN.mdl"
|
|
33
|
+
} });
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/meta.ts
|
|
36
|
+
var meta = Plugin.getMetaFromConfig(dx_config_default);
|
|
37
|
+
//#endregion
|
|
38
|
+
export { meta as t };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=chunk-meta.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-meta.mjs","names":[],"sources":["../../dx.config.ts","../../src/meta.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { Config2 } from '@dxos/app-framework/config';\nimport { trim } from '@dxos/util';\n\nexport default Config2.make({\n plugin: {\n key: 'org.dxos.plugin.illustrator',\n name: 'Illustrator',\n author: 'DXOS',\n description: trim`\n Headless diagramming host plugin that provides shared infrastructure for local-first\n drawing and diagramming inside DXOS Composer. The plugin owns the base \\`Sketch\\` ECHO\n type — a named handle referencing a renderer-specific canvas object — together with the\n renderer-neutral scene DSL, the diagram dialect registry, and the agent-facing sketch\n skill and operations (create, read, edit).\n\n Canvas renderers (tldraw, excalidraw, and others) are contributed by separate plugins\n via the \\`IllustratorCapabilities.VariantProvider\\` capability. Each variant supplies its\n own canvas schema, a builder that maps the scene DSL onto its records, and surface\n components (Article and Card). Plugin-illustrator resolves the correct variant at\n runtime and delegates rendering and DSL compilation, keeping the host layer fully\n decoupled from renderer internals.\n\n Canvas objects are stored as hidden ECHO objects alongside the top-level \\`Sketch\\`,\n ensuring they replicate to all peers but do not appear as independent items in the\n user's space graph.\n `,\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-illustrator',\n icon: { key: 'ph--compass-tool--regular', hue: 'indigo' },\n spec: 'PLUGIN.mdl',\n },\n});\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\n\nimport config from '../dx.config';\n\nexport const meta = Plugin.getMetaFromConfig(config);\n"],"mappings":";;;;AAOA,IAAA,oBAAe,QAAQ,KAAK,EAC1B,QAAQ;CACN,KAAK;CACL,MAAM;CACN,QAAQ;CACR,aAAa,IAAI;;;;;;;;;;;;;;;;;;CAkBjB,QAAQ;CACR,MAAM;EAAE,KAAK;EAA6B,KAAK;CAAS;CACxD,MAAM;AACR,EACF,CAAC;;;AC1BD,IAAa,OAAO,OAAO,kBAAkB,iBAAM"}
|