@weasel-js/text-tools 0.0.0-stage → 2.0.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 +21 -0
- package/README.md +37 -2
- package/dist/chunk-VLXWRY3D.js +1179 -0
- package/dist/chunk-VLXWRY3D.js.map +1 -0
- package/dist/index.d.ts +213 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/presets-oTMEI2UF.d.ts +378 -0
- package/dist/presets.d.ts +9 -0
- package/dist/presets.js +3 -0
- package/dist/presets.js.map +1 -0
- package/package.json +74 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 orochi235
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @weasel-js/text-tools
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Text for a weasel canvas: the text node kind, its in-place editor, and the text
|
|
4
|
+
and sticky-note tools, as presets an app turns on beside core's own.
|
|
5
|
+
|
|
6
|
+
Part of [weasel](https://github.com/orochi235/weasel), a domain-agnostic
|
|
7
|
+
scene-graph engine for React. See the
|
|
8
|
+
[API reference](https://orochi235.github.io/weasel/#pkg/text-tools).
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @weasel-js/text-tools
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Core knows no text. A canvas whose scene holds text nodes (data with a string
|
|
15
|
+
`text`) turns them on with `textTools.text`:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { SceneCanvas } from '@weasel-js/core';
|
|
19
|
+
import * as textTools from '@weasel-js/text-tools/presets';
|
|
20
|
+
import * as presets from '@weasel-js/editing/presets';
|
|
21
|
+
|
|
22
|
+
<SceneCanvas scene={scene} features={[presets.draw, textTools.textTools]} />;
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
| Preset | What it adds |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `textTools.text` | the `kit:text` painter, whose glyphs are its outline for booleans and Create Outlines; `'text'` routing and properties; the `text` and `sticky` inserts; the canvas's own editor and the `textEdit` dep; `enterTextEdit`, a double-click opening text in place, and a click opening a path effect's hidden text; plain-text paste |
|
|
28
|
+
| `createTextPreset({ editor })` | the same, with the editor configured by `useSceneTextEdit`'s options, or `editor: false` for none |
|
|
29
|
+
| `textTools.textTools` | the text and sticky-note tools, with `textTools.text` |
|
|
30
|
+
| `textTools.whiteboard` | the pencil, text and the sticky note on an open canvas, with view, pick, move, resize and edit |
|
|
31
|
+
|
|
32
|
+
A canvas taking its tools through `<SceneCanvas tools>` gets the same two from
|
|
33
|
+
`useTextToolsTools()`, beside `textTools.text`. A scene drawn with no canvas
|
|
34
|
+
(`renderSceneToPixels`, an export) paints text once `TEXT_PAINTER` is
|
|
35
|
+
registered for it: `nodeShapesOf(scene).register(TEXT_PAINTER)`.
|
|
36
|
+
|
|
37
|
+
The text engine itself (runs, styles, layout, measurement, glyph outlines) is
|
|
38
|
+
`@weasel-js/text`; the DOM editing surface is `@weasel-js/text-dom`.
|