@drawback/core 0.0.0-stage → 0.2.0-rc.20261201103337
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/README.md +20 -2
- package/dist/geometry/index.d.mts +3 -0
- package/dist/geometry/index.mjs +1 -0
- package/dist/geometry-Brsa66kT.mjs +943 -0
- package/dist/grid/index.d.mts +2 -0
- package/dist/grid/index.mjs +1 -0
- package/dist/grid-BR8od5w8.mjs +354 -0
- package/dist/index-Bt8yLTLG.d.mts +68 -0
- package/dist/index-CYSqrhal.d.mts +174 -0
- package/dist/index.d.mts +3557 -0
- package/dist/index.mjs +19024 -0
- package/dist/types-lGTlHviS.d.mts +70 -0
- package/package.json +67 -4
- package/src/assets/abort.ts +43 -0
- package/src/assets/assets.ts +1010 -0
- package/src/assets/references.ts +67 -0
- package/src/assets/sniff.ts +55 -0
- package/src/assets/types.ts +198 -0
- package/src/assets/url.ts +67 -0
- package/src/bindings/bindings.ts +862 -0
- package/src/bindings/derivation.ts +15 -0
- package/src/bindings/derive.ts +396 -0
- package/src/bindings/overlay.ts +62 -0
- package/src/bindings/types.ts +75 -0
- package/src/clipboard/clipboard.ts +600 -0
- package/src/clipboard/format.ts +123 -0
- package/src/clipboard/insert.ts +351 -0
- package/src/commands/builtin.ts +827 -0
- package/src/commands/commands.ts +136 -0
- package/src/editing-host.ts +39 -0
- package/src/editor.ts +2549 -0
- package/src/errors.ts +98 -0
- package/src/events.ts +426 -0
- package/src/fonts/fonts.ts +509 -0
- package/src/frames/derivation.ts +18 -0
- package/src/frames/frames.ts +527 -0
- package/src/geometry/boxes.ts +97 -0
- package/src/geometry/curves.ts +332 -0
- package/src/geometry/index.ts +44 -0
- package/src/geometry/matrix.ts +95 -0
- package/src/geometry/shapes.ts +671 -0
- package/src/geometry/simplify.ts +75 -0
- package/src/geometry/types.ts +68 -0
- package/src/grid/grid.ts +168 -0
- package/src/grid/hex.ts +102 -0
- package/src/grid/index.ts +32 -0
- package/src/grid/math.ts +286 -0
- package/src/groups/cleanup.ts +89 -0
- package/src/groups/groups.ts +359 -0
- package/src/history/history.ts +509 -0
- package/src/image/derivation.ts +49 -0
- package/src/image/images.ts +721 -0
- package/src/index.ts +753 -0
- package/src/input/handle-sessions.ts +254 -0
- package/src/input/keymap.ts +255 -0
- package/src/input/router.ts +991 -0
- package/src/input/types.ts +175 -0
- package/src/interactions/interactions.ts +816 -0
- package/src/interactions/remote.ts +435 -0
- package/src/io/io.ts +752 -0
- package/src/laser/laser.ts +228 -0
- package/src/layers/layers.ts +501 -0
- package/src/linear/elbow.ts +417 -0
- package/src/linear/linear.ts +840 -0
- package/src/links/links.ts +377 -0
- package/src/masks/masks.ts +149 -0
- package/src/model/builtins.ts +22 -0
- package/src/model/elements.ts +404 -0
- package/src/model/frame.ts +100 -0
- package/src/model/freedraw.ts +128 -0
- package/src/model/ids.ts +101 -0
- package/src/model/image.ts +148 -0
- package/src/model/json.ts +317 -0
- package/src/model/label.ts +95 -0
- package/src/model/linear.ts +501 -0
- package/src/model/order.ts +31 -0
- package/src/model/record-inputs.ts +107 -0
- package/src/model/records.ts +743 -0
- package/src/model/schema.ts +43 -0
- package/src/model/settings.ts +167 -0
- package/src/model/style.ts +399 -0
- package/src/model/text.ts +49 -0
- package/src/model/types.ts +108 -0
- package/src/modes/modes.ts +229 -0
- package/src/order/ordering.ts +253 -0
- package/src/overlays/overlays.ts +254 -0
- package/src/permissions/capabilities.ts +188 -0
- package/src/permissions/permissions.ts +842 -0
- package/src/plugins/plugins.ts +193 -0
- package/src/presence/presence.ts +744 -0
- package/src/runtime/element-runtime.ts +66 -0
- package/src/scene/order.ts +158 -0
- package/src/scene/scene.ts +638 -0
- package/src/selection/selection.ts +444 -0
- package/src/snapping/snapping.ts +975 -0
- package/src/spatial/index.ts +55 -0
- package/src/styles/styles.ts +492 -0
- package/src/sync/projection.ts +364 -0
- package/src/text/derivation.ts +21 -0
- package/src/text/label-geometry.ts +72 -0
- package/src/text/layout.ts +224 -0
- package/src/text/measure.ts +170 -0
- package/src/text/text.ts +919 -0
- package/src/text/types.ts +122 -0
- package/src/tools/builtin.ts +609 -0
- package/src/tools/eraser.ts +236 -0
- package/src/tools/freedraw.ts +193 -0
- package/src/tools/image.ts +79 -0
- package/src/tools/laser.ts +46 -0
- package/src/tools/linear.ts +363 -0
- package/src/tools/text.ts +100 -0
- package/src/tools/tools.ts +291 -0
- package/src/transform/math.ts +373 -0
- package/src/transform/transform.ts +593 -0
- package/src/tx/change-set.ts +556 -0
- package/src/tx/derivation.ts +90 -0
- package/src/tx/document-steps.ts +56 -0
- package/src/tx/element-events.ts +67 -0
- package/src/tx/record-diff.ts +223 -0
- package/src/tx/record-patch.ts +164 -0
- package/src/tx/record-writer.ts +393 -0
- package/src/tx/stage.ts +163 -0
- package/src/tx/staging.ts +196 -0
- package/src/viewport/types.ts +97 -0
- package/src/viewport/viewport.ts +715 -0
package/README.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @drawback/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The headless engine of [drawback](https://github.com/johannes-z/drawback): the document model, editor, tools, selection, history, layers, groups, frames, permissions, change sets and sync contracts. No DOM, so it also runs on servers (for example to validate and apply collaborators' changes).
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install @drawback/core
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { createEditor } from '@drawback/core';
|
|
11
|
+
|
|
12
|
+
const editor = createEditor();
|
|
13
|
+
const id = editor.elements.create({ type: 'core.rectangle', x: 0, y: 0, w: 120, h: 80 });
|
|
14
|
+
|
|
15
|
+
editor.document.onChange((changeSet) => send(changeSet)); // forward to your server
|
|
16
|
+
remoteEditor.sync.applyChanges(changeSet, { trust: 'authoritative' });
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Subpaths: `@drawback/core/geometry` (pure geometry) and `@drawback/core/grid` (grid math). Render it in the browser with `@drawback/canvas`. See the [guides](https://github.com/johannes-z/drawback/tree/main/docs/guides) and the [document format](https://github.com/johannes-z/drawback/blob/main/docs/spec/document-format.md).
|
|
20
|
+
|
|
21
|
+
MIT licensed.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as PathSubpath, i as PathSegment, n as Box, o as Point, r as Matrix2D, s as Shape, t as BoundsKind } from "../types-lGTlHviS.mjs";
|
|
2
|
+
import { $ as boxArea, C as scaleMatrix, S as rotationMatrix, T as viewportMatrix, _ as IDENTITY_MATRIX, a as distanceToPolyline, at as boxUnion, b as invertMatrix, c as rayOutlineIntersections, ct as transformBox, d as containsPoint, et as boxContains, f as distanceToOutline, g as shapeSubpaths, h as shapeBounds, i as closestPointOnOutline, it as boxIntersects, l as roundedPolygonSegments, m as intersectsBox, n as Projection, nt as boxCorners, o as polylineSegments, ot as boxesEqual, p as flattenPath, r as catmullRomSegments, rt as boxFromPoints, s as projectOnPolyline, st as expandBox, t as simplifyPoints, tt as boxContainsPoint, u as containedInBox, v as applyMatrix, w as translationMatrix, x as multiplyMatrix, y as elementMatrix } from "../index-CYSqrhal.mjs";
|
|
3
|
+
export { type BoundsKind, type Box, IDENTITY_MATRIX, type Matrix2D, type PathSegment, type PathSubpath, type Point, type Projection, type Shape, applyMatrix, boxArea, boxContains, boxContainsPoint, boxCorners, boxFromPoints, boxIntersects, boxUnion, boxesEqual, catmullRomSegments, closestPointOnOutline, containedInBox, containsPoint, distanceToOutline, distanceToPolyline, elementMatrix, expandBox, flattenPath, intersectsBox, invertMatrix, multiplyMatrix, polylineSegments, projectOnPolyline, rayOutlineIntersections, rotationMatrix, roundedPolygonSegments, scaleMatrix, shapeBounds, shapeSubpaths, simplifyPoints, transformBox, translationMatrix, viewportMatrix };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { O as IDENTITY_MATRIX, k as applyMatrix, v as boxArea, y as boxContains, b as boxContainsPoint, x as boxCorners, S as boxFromPoints, C as boxIntersects, w as boxUnion, T as boxesEqual, r as catmullRomSegments, i as closestPointOnOutline, d as containedInBox, f as containsPoint, p as distanceToOutline, a as distanceToPolyline, A as elementMatrix, E as expandBox, m as flattenPath, h as intersectsBox, j as invertMatrix, M as multiplyMatrix, o as polylineSegments, s as projectOnPolyline, l as rayOutlineIntersections, N as rotationMatrix, u as roundedPolygonSegments, P as scaleMatrix, g as shapeBounds, _ as shapeSubpaths, n as simplifyPoints, D as transformBox, F as translationMatrix, I as viewportMatrix } from "../geometry-Brsa66kT.mjs";
|