@ideare/kit 0.0.0-stage → 0.1.0-next.1
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 +148 -2
- package/THIRD_PARTY.md +52 -0
- package/dist/brand/schema.d.ts +265 -0
- package/dist/brand/schema.js +271 -0
- package/dist/check/copy.d.ts +27 -0
- package/dist/check/copy.js +139 -0
- package/dist/check/index.d.ts +54 -0
- package/dist/check/index.js +568 -0
- package/dist/color/contrast.d.ts +41 -0
- package/dist/color/contrast.js +84 -0
- package/dist/color/palette.d.ts +27 -0
- package/dist/color/palette.js +114 -0
- package/dist/color/wcag.d.ts +22 -0
- package/dist/color/wcag.js +50 -0
- package/dist/draft/draft.d.ts +61 -0
- package/dist/draft/draft.js +383 -0
- package/dist/editor/history.d.ts +78 -0
- package/dist/editor/history.js +221 -0
- package/dist/editor/operations.d.ts +112 -0
- package/dist/editor/operations.js +621 -0
- package/dist/files/docs.d.ts +49 -0
- package/dist/files/docs.js +392 -0
- package/dist/files/generate.d.ts +47 -0
- package/dist/files/generate.js +254 -0
- package/dist/files/png.d.ts +40 -0
- package/dist/files/png.js +168 -0
- package/dist/files/raster.d.ts +14 -0
- package/dist/files/raster.js +0 -0
- package/dist/files/templates.d.ts +162 -0
- package/dist/files/templates.js +390 -0
- package/dist/files/tokens.d.ts +22 -0
- package/dist/files/tokens.js +204 -0
- package/dist/fonts/catalog.d.ts +3 -0
- package/dist/fonts/catalog.js +345 -0
- package/dist/fonts/ofl.d.ts +5 -0
- package/dist/fonts/ofl.js +5 -0
- package/dist/fonts/pick.d.ts +33 -0
- package/dist/fonts/pick.js +73 -0
- package/dist/imports/folder.d.ts +80 -0
- package/dist/imports/folder.js +124 -0
- package/dist/imports/unzip.d.ts +32 -0
- package/dist/imports/unzip.js +128 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +34 -0
- package/dist/marks/draw.d.ts +48 -0
- package/dist/marks/draw.js +149 -0
- package/dist/marks/icons.data.d.ts +5 -0
- package/dist/marks/icons.data.js +600 -0
- package/dist/marks/one-color.d.ts +45 -0
- package/dist/marks/one-color.js +304 -0
- package/dist/marks/svg.d.ts +53 -0
- package/dist/marks/svg.js +393 -0
- package/dist/node/index.d.ts +13 -0
- package/dist/node/index.js +41 -0
- package/dist/posts/pix.d.ts +19 -0
- package/dist/posts/pix.js +49 -0
- package/dist/posts/templates.d.ts +45 -0
- package/dist/posts/templates.js +868 -0
- package/dist/resvg/index.d.ts +2 -0
- package/dist/resvg/index.js +22 -0
- package/dist/scene/brand-art.d.ts +61 -0
- package/dist/scene/brand-art.js +217 -0
- package/dist/scene/frame.d.ts +89 -0
- package/dist/scene/frame.js +213 -0
- package/dist/scene/grain.d.ts +7 -0
- package/dist/scene/grain.js +7 -0
- package/dist/scene/qr.d.ts +10 -0
- package/dist/scene/qr.js +359 -0
- package/dist/scene/render.d.ts +76 -0
- package/dist/scene/render.js +557 -0
- package/dist/scene/schema.d.ts +271 -0
- package/dist/scene/schema.js +257 -0
- package/dist/sign.d.ts +47 -0
- package/dist/sign.js +88 -0
- package/dist/text/engine.d.ts +128 -0
- package/dist/text/engine.js +245 -0
- package/dist/text/fonts.d.ts +56 -0
- package/dist/text/fonts.js +65 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/dist/wasm/index.d.ts +15 -0
- package/dist/wasm/index.js +46 -0
- package/package.json +78 -5
- package/schema/brand.v1.json +442 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { type Guides, type Handle, type Point } from "../scene/frame.ts";
|
|
2
|
+
import type { Frame, Layer, Lock, Scene } from "../scene/schema.ts";
|
|
3
|
+
/**
|
|
4
|
+
* The editor's scene operations: pure functions from a scene to a new scene, with no DOM, so the
|
|
5
|
+
* studio, an agent and a test all edit the same way (docs/spikes/editor.md). Layers are found by
|
|
6
|
+
* id on a page, inside groups too. Positions come in the page's space and are turned into each
|
|
7
|
+
* layer's own parent space here, so a layer inside a turned group still follows the finger.
|
|
8
|
+
* Layers an operation does not touch keep their objects, so an editor can skip them.
|
|
9
|
+
*
|
|
10
|
+
* A gesture is computed from the scene at the press on every frame (`resizeLayers(start, ...)`),
|
|
11
|
+
* never from the last frame, so rounding never adds up.
|
|
12
|
+
*/
|
|
13
|
+
/** What an operation that changes the picked layers gives back: the scene and the new pick. */
|
|
14
|
+
export type Edit = {
|
|
15
|
+
scene: Scene;
|
|
16
|
+
selection: string[];
|
|
17
|
+
};
|
|
18
|
+
export type AlignMode = "left" | "center" | "right" | "top" | "middle" | "bottom";
|
|
19
|
+
export type ZOrder = "front" | "forward" | "backward" | "back";
|
|
20
|
+
/** How far a copy lands from its original, down and to the right, in design units. */
|
|
21
|
+
export declare const DUPLICATE_OFFSET = 24;
|
|
22
|
+
/** The most pages a scene holds, as its schema says. */
|
|
23
|
+
export declare const MAX_PAGES = 20;
|
|
24
|
+
/**
|
|
25
|
+
* Path data scaled by kx across and ky down. ponytail: an arc's radii scale with the axes, which
|
|
26
|
+
* is exact for upright arcs only, and data whose numbers do not split into whole commands (arc
|
|
27
|
+
* flags written with no space, like `a1 1 0 0110 10`) comes back unchanged.
|
|
28
|
+
*/
|
|
29
|
+
export declare function scalePath(d: string, kx: number, ky: number): string;
|
|
30
|
+
/** The page-space frame of a layer and the layer itself, found by id anywhere on the page. */
|
|
31
|
+
export declare function findLayer(scene: Scene, page: number, id: string): {
|
|
32
|
+
layer: Layer;
|
|
33
|
+
frame: Frame;
|
|
34
|
+
} | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* The box the editor draws around the pick: one layer's own frame, turned with it, or the
|
|
37
|
+
* upright box around several. Its `rotate` is where a turn gesture starts.
|
|
38
|
+
*/
|
|
39
|
+
export declare function selectionFrame(scene: Scene, page: number, ids: readonly string[]): Frame | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Where a moving pick can land: the page's edges and middle, and the edges and middles of the
|
|
42
|
+
* other visible layers on the page. Feed it to snapBox with the stage's scale.
|
|
43
|
+
*/
|
|
44
|
+
export declare function snapTargets(scene: Scene, page: number, ids: readonly string[]): Guides;
|
|
45
|
+
/** Put a layer on top of the page. Ids already taken on the page get a number. */
|
|
46
|
+
export declare function addLayer(scene: Scene, page: number, layer: Layer): Edit;
|
|
47
|
+
/** Take layers off the page. Locked ones stay, and stay picked. */
|
|
48
|
+
export declare function removeLayers(scene: Scene, page: number, ids: readonly string[]): Edit;
|
|
49
|
+
/** A copy of each picked layer right above it, moved by `offset` on the page. */
|
|
50
|
+
export declare function duplicateLayers(scene: Scene, page: number, ids: readonly string[], offset?: number): Edit;
|
|
51
|
+
/** Move the picked layers by dx and dy on the page. Layers locked in place stay. */
|
|
52
|
+
export declare function moveLayers(scene: Scene, page: number, ids: readonly string[], dx: number, dy: number): Scene;
|
|
53
|
+
/**
|
|
54
|
+
* Pull a handle of the pick to `to`, a point on the page (the handle's start plus the pointer's
|
|
55
|
+
* travel), from the scene at the press. One layer resizes in its own turned frame with the
|
|
56
|
+
* opposite corner or side held still; a corner also scales its type, radii and strokes, and a
|
|
57
|
+
* group's layers. Several layers, and a group, resize from the corners only: the box around
|
|
58
|
+
* them scales, and every layer in it, about the opposite corner.
|
|
59
|
+
*/
|
|
60
|
+
export declare function resizeLayers(start: Scene, page: number, ids: readonly string[], handle: Handle, to: Point, options?: {
|
|
61
|
+
min?: number;
|
|
62
|
+
keepRatio?: boolean;
|
|
63
|
+
}): Scene;
|
|
64
|
+
/**
|
|
65
|
+
* Turn the pick to `angle` degrees, from the scene at the press. One layer turns about its own
|
|
66
|
+
* center to that angle. Several turn together by `angle` about the center of the box around
|
|
67
|
+
* them, which starts every gesture upright (selectionFrame's `rotate` is 0). Use turnAngle for
|
|
68
|
+
* the angle a handle gives.
|
|
69
|
+
*/
|
|
70
|
+
export declare function rotateLayers(start: Scene, page: number, ids: readonly string[], angle: number): Scene;
|
|
71
|
+
/**
|
|
72
|
+
* Line the pick up: one layer with the page, several with the box around them. It uses each
|
|
73
|
+
* layer's upright box, so a turned layer lines up by what it covers.
|
|
74
|
+
*/
|
|
75
|
+
export declare function alignLayers(scene: Scene, page: number, ids: readonly string[], mode: AlignMode): Scene;
|
|
76
|
+
/**
|
|
77
|
+
* Space three or more layers evenly: the first and the last stay, and the gaps between the
|
|
78
|
+
* others' upright boxes become equal. Layers locked in place are left out.
|
|
79
|
+
*/
|
|
80
|
+
export declare function distributeLayers(scene: Scene, page: number, ids: readonly string[], direction: "horizontal" | "vertical"): Scene;
|
|
81
|
+
/**
|
|
82
|
+
* Change the drawing order: to the front or the back of their list, or one step past the next
|
|
83
|
+
* layer that is not picked. Picked layers keep their order among themselves, and a layer inside
|
|
84
|
+
* a group moves within its group.
|
|
85
|
+
*/
|
|
86
|
+
export declare function reorderLayers(scene: Scene, page: number, ids: readonly string[], order: ZOrder): Scene;
|
|
87
|
+
/**
|
|
88
|
+
* Put two or more layers that share a list into one group, where the top one of them was. The
|
|
89
|
+
* group is the upright box around them, and they keep their place on the page.
|
|
90
|
+
*/
|
|
91
|
+
export declare function groupLayers(scene: Scene, page: number, ids: readonly string[], id?: string): Edit;
|
|
92
|
+
/**
|
|
93
|
+
* Break picked groups apart: their layers take the group's place, keep their place on the page,
|
|
94
|
+
* and take on the group's opacity and hidden state. ponytail: a group's blend mode goes to each
|
|
95
|
+
* layer that has none, which blends them one by one instead of as one picture.
|
|
96
|
+
*/
|
|
97
|
+
export declare function ungroupLayers(scene: Scene, page: number, ids: readonly string[]): Edit;
|
|
98
|
+
/** Lock the picked layers (true: all five locks), unlock them (false), or set some locks. */
|
|
99
|
+
export declare function lockLayers(scene: Scene, page: number, ids: readonly string[], lock: Lock | boolean): Scene;
|
|
100
|
+
/**
|
|
101
|
+
* A text box's new height (from its lines, as someone types), with its turned top-left corner
|
|
102
|
+
* held still, so turned text never slides (rule E2).
|
|
103
|
+
*/
|
|
104
|
+
export declare function setTextHeight(scene: Scene, page: number, id: string, h: number): Scene;
|
|
105
|
+
/** A blank page at `at` (the end by default), on the same background as the page before it. */
|
|
106
|
+
export declare function addPage(scene: Scene, at?: number): Scene;
|
|
107
|
+
/** A copy of a page, right after it. */
|
|
108
|
+
export declare function duplicatePage(scene: Scene, index: number): Scene;
|
|
109
|
+
/** Take a page out. The last page always stays. */
|
|
110
|
+
export declare function removePage(scene: Scene, index: number): Scene;
|
|
111
|
+
/** Move a page from one place in the order to another. */
|
|
112
|
+
export declare function movePage(scene: Scene, from: number, to: number): Scene;
|