manga-renderer 1.0.7 → 1.0.8
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/index.d.ts +31 -0
- package/dist/lib/book/book.d.ts +133 -0
- package/dist/lib/book/envelope.d.ts +26 -0
- package/dist/lib/book/imagePacking.d.ts +10 -0
- package/dist/lib/book/layout.d.ts +41 -0
- package/dist/lib/book/notebook.d.ts +72 -0
- package/dist/lib/book/richChat.d.ts +36 -0
- package/dist/lib/book/storyboard.d.ts +125 -0
- package/dist/lib/layeredCanvas/dataModels/bubble.d.ts +97 -0
- package/dist/lib/layeredCanvas/dataModels/effect.d.ts +25 -0
- package/dist/lib/layeredCanvas/dataModels/film.d.ts +46 -0
- package/dist/lib/layeredCanvas/dataModels/frameTree.d.ts +100 -0
- package/dist/lib/layeredCanvas/dataModels/media.d.ts +39 -0
- package/dist/lib/layeredCanvas/layers/SampleLayer.d.ts +6 -0
- package/dist/lib/layeredCanvas/layers/arrayLayer.d.ts +49 -0
- package/dist/lib/layeredCanvas/layers/bubbleLayer.d.ts +97 -0
- package/dist/lib/layeredCanvas/layers/floorLayer.d.ts +13 -0
- package/dist/lib/layeredCanvas/layers/frameLayer.d.ts +106 -0
- package/dist/lib/layeredCanvas/layers/inlinePainterLayer.d.ts +33 -0
- package/dist/lib/layeredCanvas/layers/paperRendererLayer.d.ts +64 -0
- package/dist/lib/layeredCanvas/layers/undoLayer.d.ts +8 -0
- package/dist/lib/layeredCanvas/system/keyCache.d.ts +4 -0
- package/dist/lib/layeredCanvas/system/layeredCanvas.d.ts +174 -0
- package/dist/lib/layeredCanvas/system/paperArray.d.ts +29 -0
- package/dist/lib/layeredCanvas/tools/draw/bubbleGraphic.d.ts +7 -0
- package/dist/lib/layeredCanvas/tools/draw/clickableIcon.d.ts +42 -0
- package/dist/lib/layeredCanvas/tools/draw/drawFilmStack.d.ts +4 -0
- package/dist/lib/layeredCanvas/tools/draw/drawText.d.ts +8 -0
- package/dist/lib/layeredCanvas/tools/draw/richText.d.ts +15 -0
- package/dist/lib/layeredCanvas/tools/draw/selectionFrame.d.ts +5 -0
- package/dist/lib/layeredCanvas/tools/draw/typeSetting.d.ts +16 -0
- package/dist/lib/layeredCanvas/tools/draw/verticalText.d.ts +3 -0
- package/dist/lib/layeredCanvas/tools/focusKeeper.d.ts +8 -0
- package/dist/lib/layeredCanvas/tools/frameExamples.d.ts +382 -0
- package/dist/lib/layeredCanvas/tools/geometry/bubbleGeometry.d.ts +12 -0
- package/dist/lib/layeredCanvas/tools/geometry/convertPoint.d.ts +2 -0
- package/dist/lib/layeredCanvas/tools/geometry/geometry.d.ts +69 -0
- package/dist/lib/layeredCanvas/tools/geometry/geometry.vitest.d.ts +1 -0
- package/dist/lib/layeredCanvas/tools/geometry/quickHull.d.ts +10 -0
- package/dist/lib/layeredCanvas/tools/geometry/trapezoid.d.ts +18 -0
- package/dist/lib/layeredCanvas/tools/grid.d.ts +7 -0
- package/dist/lib/layeredCanvas/tools/haiku.d.ts +1 -0
- package/dist/lib/layeredCanvas/tools/imageUtil.d.ts +8 -0
- package/dist/lib/layeredCanvas/tools/kinsoku.d.ts +26 -0
- package/dist/lib/layeredCanvas/tools/misc.d.ts +25 -0
- package/dist/lib/layeredCanvas/tools/perfectFreehandUtil.d.ts +2 -0
- package/dist/lib/layeredCanvas/tools/pictureControl.d.ts +4 -0
- package/dist/lib/layeredCanvas/tools/rectHandle.d.ts +6 -0
- package/package.json +8 -6
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LayeredCanvas } from './lib/layeredCanvas/system/layeredCanvas';
|
|
2
|
+
import { ArrayLayer } from './lib/layeredCanvas/layers/arrayLayer';
|
|
3
|
+
import { Book, Page, WrapMode, ReadingDirection } from './lib/book/book';
|
|
4
|
+
import { FocusKeeper } from './lib/layeredCanvas/tools/focusKeeper';
|
|
5
|
+
export { readEnvelope } from './lib/book/envelope';
|
|
6
|
+
export { initPaperJs } from './lib/layeredCanvas/tools/draw/bubbleGraphic';
|
|
7
|
+
export type { Book, Page, WrapMode, ReadingDirection };
|
|
8
|
+
export declare class Renderer {
|
|
9
|
+
arrayLayer: ArrayLayer;
|
|
10
|
+
layeredCanvas: LayeredCanvas;
|
|
11
|
+
focusKeeper: FocusKeeper;
|
|
12
|
+
marks: boolean[];
|
|
13
|
+
constructor(arrayLayer: ArrayLayer, layeredCanvas: LayeredCanvas, focusKeeper: FocusKeeper, marks: boolean[]);
|
|
14
|
+
cleanup(): void;
|
|
15
|
+
focusToPage(index: number, pageScale?: number): void;
|
|
16
|
+
getScale(): number;
|
|
17
|
+
}
|
|
18
|
+
export declare function buildRenderer(canvas: HTMLCanvasElement, book: Book, startIndex?: number, length?: number): Renderer;
|
|
19
|
+
export declare function destroyRenderer(renderer: Renderer): void;
|
|
20
|
+
export declare function listFonts(book: Book): {
|
|
21
|
+
family: string;
|
|
22
|
+
weight: string;
|
|
23
|
+
}[];
|
|
24
|
+
export declare const localFonts: {
|
|
25
|
+
[key: string]: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function isLocalFont(fontFamily: string): boolean;
|
|
28
|
+
export declare function isGoogleFont(fontFamily: string): boolean;
|
|
29
|
+
export declare function loadGoogleFont(family: string, weights?: string[]): Promise<void>;
|
|
30
|
+
export declare function loadGoogleFontForCanvas(family: string, weights?: string[]): Promise<void>;
|
|
31
|
+
export declare function checkCanvasFontAvailable(family: string, weight?: string, maxRetries?: number, interval?: number): Promise<boolean>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Bubble } from '../layeredCanvas/dataModels/bubble';
|
|
2
|
+
import { FrameElement, Layout, Border } from '../layeredCanvas/dataModels/frameTree';
|
|
3
|
+
import { Film, FilmStack } from '../layeredCanvas/dataModels/film';
|
|
4
|
+
import { Rect, Vector } from '../layeredCanvas/tools/geometry/geometry';
|
|
5
|
+
import { RichChatLog, ProtocolChatLog } from './richChat';
|
|
6
|
+
import { Notebook } from './notebook';
|
|
7
|
+
export type Prefix = 'shortcut-' | 'paste-' | 'drop-' | 'add-in-folder-' | 'shared-' | 'initial-' | 'hiruma-' | 'weaved-' | 'envelope-';
|
|
8
|
+
export type Revision = {
|
|
9
|
+
id: string;
|
|
10
|
+
revision: number;
|
|
11
|
+
prefix: Prefix;
|
|
12
|
+
};
|
|
13
|
+
export type Page = {
|
|
14
|
+
id: string;
|
|
15
|
+
frameTree: FrameElement;
|
|
16
|
+
bubbles: Bubble[];
|
|
17
|
+
paperSize: [number, number];
|
|
18
|
+
paperColor: string;
|
|
19
|
+
frameColor: string;
|
|
20
|
+
frameWidth: number;
|
|
21
|
+
source: any;
|
|
22
|
+
};
|
|
23
|
+
export type HistoryTag = 'bubble' | 'page-attribute' | "effect" | null;
|
|
24
|
+
export type HistoryWeight = "light" | "heavy";
|
|
25
|
+
export type HistoryEntry = {
|
|
26
|
+
pages: Page[];
|
|
27
|
+
tag: HistoryTag;
|
|
28
|
+
};
|
|
29
|
+
export type History = {
|
|
30
|
+
entries: HistoryEntry[];
|
|
31
|
+
cursor: number;
|
|
32
|
+
};
|
|
33
|
+
export type ReadingDirection = 'left-to-right' | 'right-to-left';
|
|
34
|
+
export type WrapMode = 'none' | 'two-pages' | 'one-page';
|
|
35
|
+
export type VideoSettings = {
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
moveDuration: number;
|
|
39
|
+
standardWait: number;
|
|
40
|
+
standardScale: number;
|
|
41
|
+
};
|
|
42
|
+
export type Book = {
|
|
43
|
+
revision: Revision;
|
|
44
|
+
pages: Page[];
|
|
45
|
+
history: History;
|
|
46
|
+
direction: ReadingDirection;
|
|
47
|
+
wrapMode: WrapMode;
|
|
48
|
+
chatLogs: RichChatLog[];
|
|
49
|
+
notebook: Notebook;
|
|
50
|
+
video?: VideoSettings;
|
|
51
|
+
};
|
|
52
|
+
export type SerializedPage = {
|
|
53
|
+
id: string;
|
|
54
|
+
frameTree: any;
|
|
55
|
+
bubbles: any[];
|
|
56
|
+
paperSize: [number, number];
|
|
57
|
+
paperColor: string;
|
|
58
|
+
frameColor: string;
|
|
59
|
+
frameWidth: number;
|
|
60
|
+
};
|
|
61
|
+
export type SerializedBook = {
|
|
62
|
+
revision: {
|
|
63
|
+
id: string;
|
|
64
|
+
revision: number;
|
|
65
|
+
prefix: Prefix;
|
|
66
|
+
};
|
|
67
|
+
pages: SerializedPage[];
|
|
68
|
+
direction: ReadingDirection;
|
|
69
|
+
wrapMode: WrapMode;
|
|
70
|
+
chatLogs: ProtocolChatLog[];
|
|
71
|
+
notebook: Notebook;
|
|
72
|
+
};
|
|
73
|
+
export declare function incrementRevision(revision: Revision): void;
|
|
74
|
+
export declare function revisionEqual(a: Revision, b: Revision): boolean;
|
|
75
|
+
export declare function getHistoryWeight(book: Book): HistoryWeight;
|
|
76
|
+
export declare function addBookHistory(book: Book, tag: HistoryTag): void;
|
|
77
|
+
export declare function undoBookHistory(book: Book): void;
|
|
78
|
+
export declare function redoBookHistory(book: Book): void;
|
|
79
|
+
export declare function commitBook(book: Book, tag: HistoryTag): void;
|
|
80
|
+
export declare function revertBook(book: Book): void;
|
|
81
|
+
export declare function newPage(frameTree: FrameElement, bubbles: Bubble[]): Page;
|
|
82
|
+
export declare function newBook(id: string, prefix: Prefix, exampleIndex: number): Book;
|
|
83
|
+
export declare function newImageBook(id: string, canvas: HTMLCanvasElement, prefix: Prefix): Book;
|
|
84
|
+
export interface BookOperators {
|
|
85
|
+
hint: (r: [number, number, number, number], s: string | null) => void;
|
|
86
|
+
commit: (tag: HistoryTag) => void;
|
|
87
|
+
forceDelayedCommit(): void;
|
|
88
|
+
cancelDelayedCommit(): void;
|
|
89
|
+
revert: () => void;
|
|
90
|
+
undo: () => void;
|
|
91
|
+
redo: () => void;
|
|
92
|
+
shift: (page: Page, frameElement: FrameElement) => void;
|
|
93
|
+
unshift: (page: Page, frameElement: FrameElement) => void;
|
|
94
|
+
swap: (page: Page, frameElement0: FrameElement, frameElement1: FrameElement) => void;
|
|
95
|
+
insert: (page: Page, border: Border) => void;
|
|
96
|
+
focusFrame: (page: Page, frame: FrameElement | null, p: Vector | null) => void;
|
|
97
|
+
focusBubble: (page: Page, bubble: Bubble | null) => void;
|
|
98
|
+
viewportChanged: () => void;
|
|
99
|
+
insertPage: (index: number) => void;
|
|
100
|
+
deletePage: (index: number) => void;
|
|
101
|
+
movePages: (from: number[], to: number) => void;
|
|
102
|
+
copyPageToClipboard: (index: number) => void;
|
|
103
|
+
batchImaging: (index: number) => void;
|
|
104
|
+
editBubbles: (index: number) => void;
|
|
105
|
+
tweak: (index: number) => void;
|
|
106
|
+
chase: () => void;
|
|
107
|
+
getMarks: () => boolean[];
|
|
108
|
+
setMarks: (marks: boolean[]) => void;
|
|
109
|
+
getFocusedPage: () => Page;
|
|
110
|
+
}
|
|
111
|
+
export declare function clonePage(page: Page): Page;
|
|
112
|
+
export declare function cloneBook(book: Book): Book;
|
|
113
|
+
export type FrameContent = {
|
|
114
|
+
sourcePage: Page;
|
|
115
|
+
sourceRect: Rect;
|
|
116
|
+
filmStack: FilmStack;
|
|
117
|
+
bubbles: Bubble[];
|
|
118
|
+
prompt: string | null;
|
|
119
|
+
};
|
|
120
|
+
export type FrameSlot = {
|
|
121
|
+
layout: Layout;
|
|
122
|
+
page: Page;
|
|
123
|
+
pageNumber: number;
|
|
124
|
+
};
|
|
125
|
+
export type FrameSequence = {
|
|
126
|
+
slots: FrameSlot[];
|
|
127
|
+
contents: FrameContent[];
|
|
128
|
+
};
|
|
129
|
+
export declare function collectBookContents(book: Book): FrameSequence;
|
|
130
|
+
export declare function collectPageContents(page: Page, pageNumber: number, dir: ReadingDirection): FrameSequence;
|
|
131
|
+
export declare function dealBookContents(seq: FrameSequence, insertElement: FrameElement | null, spliceElement: FrameElement | null): void;
|
|
132
|
+
export declare function swapBookContents(seq: FrameSequence, frameElement0: FrameElement, frameElement1: FrameElement): void;
|
|
133
|
+
export declare function collectAllFilms(book: Book): Film[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Book, WrapMode, ReadingDirection, SerializedPage } from './book';
|
|
2
|
+
import { Notebook } from './notebook';
|
|
3
|
+
export type EnvelopedBook = {
|
|
4
|
+
pages: SerializedPage[];
|
|
5
|
+
direction: ReadingDirection;
|
|
6
|
+
wrapMode: WrapMode;
|
|
7
|
+
images: {
|
|
8
|
+
[fileId: string]: Uint8Array;
|
|
9
|
+
};
|
|
10
|
+
notebook: Notebook | null;
|
|
11
|
+
};
|
|
12
|
+
export type CanvasBag = {
|
|
13
|
+
[fileId: string]: HTMLCanvasElement;
|
|
14
|
+
};
|
|
15
|
+
export declare function readEnvelope(blob: Blob): Promise<Book>;
|
|
16
|
+
export declare function writeEnvelope(book: Book): Promise<Blob>;
|
|
17
|
+
export type OldEnvelopedBook = {
|
|
18
|
+
pages: SerializedPage[];
|
|
19
|
+
direction: ReadingDirection;
|
|
20
|
+
wrapMode: WrapMode;
|
|
21
|
+
images: {
|
|
22
|
+
[fileId: string]: string;
|
|
23
|
+
};
|
|
24
|
+
notebook: Notebook | null;
|
|
25
|
+
};
|
|
26
|
+
export declare function readOldEnvelope(json: string): Promise<Book>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Vector } from '../layeredCanvas/tools/geometry/geometry';
|
|
2
|
+
import { FrameElement } from '../layeredCanvas/dataModels/frameTree';
|
|
3
|
+
import { Bubble } from '../layeredCanvas/dataModels/bubble';
|
|
4
|
+
import { Film } from '../layeredCanvas/dataModels/film';
|
|
5
|
+
export declare function dryUnpackFrameImages(paperSize: Vector, markUp: any, images: string[]): Promise<void>;
|
|
6
|
+
export declare function dryUnpackBubbleImages(paperSize: Vector, markUps: any[], images: string[]): Promise<void>;
|
|
7
|
+
export declare function unpackFrameImages(paperSize: Vector, markUp: any, loadCanvasFunc: (imageId: string) => Promise<HTMLCanvasElement | null>): Promise<FrameElement>;
|
|
8
|
+
export declare function unpackBubbleImages(paperSize: Vector, markUps: any[], loadImageFunc: (imageId: string) => Promise<HTMLCanvasElement | null>): Promise<Bubble[]>;
|
|
9
|
+
export declare function packFilms(films: Film[], saveCanvasFunc: (canvas: HTMLCanvasElement) => Promise<string>): Promise<any[]>;
|
|
10
|
+
export declare function unpackFilms(markUp: any, loadImageFunc: (imageId: string) => Promise<HTMLCanvasElement | null>): Promise<Film[]>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
export declare const LayoutColumn: import('typai').AnnotatedType<{
|
|
3
|
+
id: string;
|
|
4
|
+
ratio: number;
|
|
5
|
+
}, {
|
|
6
|
+
id: string;
|
|
7
|
+
ratio: number;
|
|
8
|
+
}, unknown>;
|
|
9
|
+
export type LayoutColumn = t.TypeOf<typeof LayoutColumn>;
|
|
10
|
+
export declare const LayoutRow: import('typai').AnnotatedType<{
|
|
11
|
+
columns: {
|
|
12
|
+
id: string;
|
|
13
|
+
ratio: number;
|
|
14
|
+
}[];
|
|
15
|
+
ratio: number;
|
|
16
|
+
}, {
|
|
17
|
+
columns: {
|
|
18
|
+
id: string;
|
|
19
|
+
ratio: number;
|
|
20
|
+
}[];
|
|
21
|
+
ratio: number;
|
|
22
|
+
}, unknown>;
|
|
23
|
+
export type LayoutRow = t.TypeOf<typeof LayoutRow>;
|
|
24
|
+
export declare const LayoutPage: import('typai').AnnotatedType<{
|
|
25
|
+
rows: {
|
|
26
|
+
columns: {
|
|
27
|
+
id: string;
|
|
28
|
+
ratio: number;
|
|
29
|
+
}[];
|
|
30
|
+
ratio: number;
|
|
31
|
+
}[];
|
|
32
|
+
}, {
|
|
33
|
+
rows: {
|
|
34
|
+
columns: {
|
|
35
|
+
id: string;
|
|
36
|
+
ratio: number;
|
|
37
|
+
}[];
|
|
38
|
+
ratio: number;
|
|
39
|
+
}[];
|
|
40
|
+
}, unknown>;
|
|
41
|
+
export type LayoutPage = t.TypeOf<typeof LayoutPage>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
export declare const Character: t.TypeC<{
|
|
3
|
+
ulid: import('typai').IgnoreType<string, string>;
|
|
4
|
+
name: t.StringC;
|
|
5
|
+
personality: t.StringC;
|
|
6
|
+
appearance: t.StringC;
|
|
7
|
+
themeColor: t.StringC;
|
|
8
|
+
portrait: import('typai').IgnoreType<any, any>;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const Notebook: t.TypeC<{
|
|
11
|
+
theme: t.StringC;
|
|
12
|
+
characters: t.ArrayC<t.TypeC<{
|
|
13
|
+
ulid: import('typai').IgnoreType<string, string>;
|
|
14
|
+
name: t.StringC;
|
|
15
|
+
personality: t.StringC;
|
|
16
|
+
appearance: t.StringC;
|
|
17
|
+
themeColor: t.StringC;
|
|
18
|
+
portrait: import('typai').IgnoreType<any, any>;
|
|
19
|
+
}>>;
|
|
20
|
+
plot: t.StringC;
|
|
21
|
+
scenario: t.StringC;
|
|
22
|
+
storyboard: t.UnionC<[t.TypeC<{
|
|
23
|
+
format: import('typai').AnnotatedType<string, string, unknown>;
|
|
24
|
+
characters: t.ArrayC<import('typai').AnnotatedType<{
|
|
25
|
+
name: string;
|
|
26
|
+
appearance: string;
|
|
27
|
+
themeColor: string;
|
|
28
|
+
}, {
|
|
29
|
+
name: string;
|
|
30
|
+
appearance: string;
|
|
31
|
+
themeColor: string;
|
|
32
|
+
}, unknown>>;
|
|
33
|
+
pages: t.ArrayC<t.TypeC<{
|
|
34
|
+
panels: t.ArrayC<t.TypeC<{
|
|
35
|
+
composition: import('typai').AnnotatedType<string, string, unknown>;
|
|
36
|
+
camera: import('typai').AnnotatedType<string, string, unknown>;
|
|
37
|
+
bubbles: import('typai').AnnotatedType<{
|
|
38
|
+
owner: string;
|
|
39
|
+
speech: string;
|
|
40
|
+
color: string;
|
|
41
|
+
shape: string;
|
|
42
|
+
}[], {
|
|
43
|
+
owner: string;
|
|
44
|
+
speech: string;
|
|
45
|
+
color: string;
|
|
46
|
+
shape: string;
|
|
47
|
+
}[], unknown>;
|
|
48
|
+
}>>;
|
|
49
|
+
layout: import('typai').AnnotatedType<{
|
|
50
|
+
rows: {
|
|
51
|
+
columns: {
|
|
52
|
+
id: string;
|
|
53
|
+
ratio: number;
|
|
54
|
+
}[];
|
|
55
|
+
ratio: number;
|
|
56
|
+
}[];
|
|
57
|
+
}, {
|
|
58
|
+
rows: {
|
|
59
|
+
columns: {
|
|
60
|
+
id: string;
|
|
61
|
+
ratio: number;
|
|
62
|
+
}[];
|
|
63
|
+
ratio: number;
|
|
64
|
+
}[];
|
|
65
|
+
}, unknown>;
|
|
66
|
+
}>>;
|
|
67
|
+
}>, t.NullC]>;
|
|
68
|
+
critique: t.StringC;
|
|
69
|
+
}>;
|
|
70
|
+
export type Character = t.TypeOf<typeof Character>;
|
|
71
|
+
export type Notebook = t.TypeOf<typeof Notebook>;
|
|
72
|
+
export declare function emptyNotebook(): Notebook;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type ProtocolChatLog = {
|
|
2
|
+
role: string;
|
|
3
|
+
content: string;
|
|
4
|
+
};
|
|
5
|
+
export type Role = 'system' | 'assistant' | 'user' | 'error';
|
|
6
|
+
export type RichChatLog = {
|
|
7
|
+
role: Role;
|
|
8
|
+
content: RichChatContent;
|
|
9
|
+
hidden?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type RichChatContent = {
|
|
12
|
+
type: 'speech';
|
|
13
|
+
body: string;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'image';
|
|
16
|
+
body: RichChatImage;
|
|
17
|
+
} | {
|
|
18
|
+
type: 'document';
|
|
19
|
+
body: RichChatDocument;
|
|
20
|
+
} | {
|
|
21
|
+
type: 'error';
|
|
22
|
+
body: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'waiting';
|
|
25
|
+
};
|
|
26
|
+
export type RichChatImage = {
|
|
27
|
+
id: string;
|
|
28
|
+
image: HTMLImageElement;
|
|
29
|
+
};
|
|
30
|
+
export type RichChatDocument = {
|
|
31
|
+
id: string;
|
|
32
|
+
text: string;
|
|
33
|
+
};
|
|
34
|
+
export declare function richChatLogToProtocolChatLog(log: RichChatLog[]): ProtocolChatLog[];
|
|
35
|
+
export declare function protocolChatLogToRichChatLog(log: ProtocolChatLog[]): RichChatLog[];
|
|
36
|
+
export declare function rollback(log: RichChatLog[], role: 'user' | 'assistant'): RichChatLog[];
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { LayoutPage, LayoutColumn, LayoutRow } from './layout';
|
|
2
|
+
import * as t from "io-ts";
|
|
3
|
+
declare const Format: import('typai').AnnotatedType<string, string, unknown>;
|
|
4
|
+
declare const Character: import('typai').AnnotatedType<{
|
|
5
|
+
name: string;
|
|
6
|
+
appearance: string;
|
|
7
|
+
themeColor: string;
|
|
8
|
+
}, {
|
|
9
|
+
name: string;
|
|
10
|
+
appearance: string;
|
|
11
|
+
themeColor: string;
|
|
12
|
+
}, unknown>;
|
|
13
|
+
declare const Bubble: import('typai').AnnotatedType<{
|
|
14
|
+
owner: string;
|
|
15
|
+
speech: string;
|
|
16
|
+
color: string;
|
|
17
|
+
shape: string;
|
|
18
|
+
}, {
|
|
19
|
+
owner: string;
|
|
20
|
+
speech: string;
|
|
21
|
+
color: string;
|
|
22
|
+
shape: string;
|
|
23
|
+
}, unknown>;
|
|
24
|
+
declare const Panel: t.TypeC<{
|
|
25
|
+
composition: import('typai').AnnotatedType<string, string, unknown>;
|
|
26
|
+
camera: import('typai').AnnotatedType<string, string, unknown>;
|
|
27
|
+
bubbles: import('typai').AnnotatedType<{
|
|
28
|
+
owner: string;
|
|
29
|
+
speech: string;
|
|
30
|
+
color: string;
|
|
31
|
+
shape: string;
|
|
32
|
+
}[], {
|
|
33
|
+
owner: string;
|
|
34
|
+
speech: string;
|
|
35
|
+
color: string;
|
|
36
|
+
shape: string;
|
|
37
|
+
}[], unknown>;
|
|
38
|
+
}>;
|
|
39
|
+
declare const Page: t.TypeC<{
|
|
40
|
+
panels: t.ArrayC<t.TypeC<{
|
|
41
|
+
composition: import('typai').AnnotatedType<string, string, unknown>;
|
|
42
|
+
camera: import('typai').AnnotatedType<string, string, unknown>;
|
|
43
|
+
bubbles: import('typai').AnnotatedType<{
|
|
44
|
+
owner: string;
|
|
45
|
+
speech: string;
|
|
46
|
+
color: string;
|
|
47
|
+
shape: string;
|
|
48
|
+
}[], {
|
|
49
|
+
owner: string;
|
|
50
|
+
speech: string;
|
|
51
|
+
color: string;
|
|
52
|
+
shape: string;
|
|
53
|
+
}[], unknown>;
|
|
54
|
+
}>>;
|
|
55
|
+
layout: import('typai').AnnotatedType<{
|
|
56
|
+
rows: {
|
|
57
|
+
columns: {
|
|
58
|
+
id: string;
|
|
59
|
+
ratio: number;
|
|
60
|
+
}[];
|
|
61
|
+
ratio: number;
|
|
62
|
+
}[];
|
|
63
|
+
}, {
|
|
64
|
+
rows: {
|
|
65
|
+
columns: {
|
|
66
|
+
id: string;
|
|
67
|
+
ratio: number;
|
|
68
|
+
}[];
|
|
69
|
+
ratio: number;
|
|
70
|
+
}[];
|
|
71
|
+
}, unknown>;
|
|
72
|
+
}>;
|
|
73
|
+
declare const Storyboard: t.TypeC<{
|
|
74
|
+
format: import('typai').AnnotatedType<string, string, unknown>;
|
|
75
|
+
characters: t.ArrayC<import('typai').AnnotatedType<{
|
|
76
|
+
name: string;
|
|
77
|
+
appearance: string;
|
|
78
|
+
themeColor: string;
|
|
79
|
+
}, {
|
|
80
|
+
name: string;
|
|
81
|
+
appearance: string;
|
|
82
|
+
themeColor: string;
|
|
83
|
+
}, unknown>>;
|
|
84
|
+
pages: t.ArrayC<t.TypeC<{
|
|
85
|
+
panels: t.ArrayC<t.TypeC<{
|
|
86
|
+
composition: import('typai').AnnotatedType<string, string, unknown>;
|
|
87
|
+
camera: import('typai').AnnotatedType<string, string, unknown>;
|
|
88
|
+
bubbles: import('typai').AnnotatedType<{
|
|
89
|
+
owner: string;
|
|
90
|
+
speech: string;
|
|
91
|
+
color: string;
|
|
92
|
+
shape: string;
|
|
93
|
+
}[], {
|
|
94
|
+
owner: string;
|
|
95
|
+
speech: string;
|
|
96
|
+
color: string;
|
|
97
|
+
shape: string;
|
|
98
|
+
}[], unknown>;
|
|
99
|
+
}>>;
|
|
100
|
+
layout: import('typai').AnnotatedType<{
|
|
101
|
+
rows: {
|
|
102
|
+
columns: {
|
|
103
|
+
id: string;
|
|
104
|
+
ratio: number;
|
|
105
|
+
}[];
|
|
106
|
+
ratio: number;
|
|
107
|
+
}[];
|
|
108
|
+
}, {
|
|
109
|
+
rows: {
|
|
110
|
+
columns: {
|
|
111
|
+
id: string;
|
|
112
|
+
ratio: number;
|
|
113
|
+
}[];
|
|
114
|
+
ratio: number;
|
|
115
|
+
}[];
|
|
116
|
+
}, unknown>;
|
|
117
|
+
}>>;
|
|
118
|
+
}>;
|
|
119
|
+
type Format = t.TypeOf<typeof Format>;
|
|
120
|
+
type Character = t.TypeOf<typeof Character>;
|
|
121
|
+
type Bubble = t.TypeOf<typeof Bubble>;
|
|
122
|
+
type Panel = t.TypeOf<typeof Panel>;
|
|
123
|
+
type Page = t.TypeOf<typeof Page>;
|
|
124
|
+
type Storyboard = t.TypeOf<typeof Storyboard>;
|
|
125
|
+
export { Format, Character, Bubble, Panel, Page, Storyboard, LayoutPage, LayoutRow, LayoutColumn, };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Vector, Rect } from '../tools/geometry/geometry';
|
|
2
|
+
import { RectHandle } from '../tools/rectHandle';
|
|
3
|
+
import { Film, FilmStack } from './film';
|
|
4
|
+
export interface BubbleRenderInfo {
|
|
5
|
+
pathJson: string;
|
|
6
|
+
path: paper.PathItem | null;
|
|
7
|
+
unitedPath: paper.PathItem | null;
|
|
8
|
+
children: Bubble[];
|
|
9
|
+
textJson: string;
|
|
10
|
+
textCanvas: HTMLCanvasElement;
|
|
11
|
+
textCtx: CanvasRenderingContext2D;
|
|
12
|
+
}
|
|
13
|
+
export declare class Bubble {
|
|
14
|
+
n_p0: Vector;
|
|
15
|
+
n_p1: Vector;
|
|
16
|
+
n_offset: Vector;
|
|
17
|
+
rotation: number;
|
|
18
|
+
text: string;
|
|
19
|
+
shape: string;
|
|
20
|
+
embedded: boolean;
|
|
21
|
+
fontStyle: string;
|
|
22
|
+
fontWeight: string;
|
|
23
|
+
n_fontSize: number;
|
|
24
|
+
charSkip: number;
|
|
25
|
+
lineSkip: number;
|
|
26
|
+
fontFamily: string;
|
|
27
|
+
direction: string;
|
|
28
|
+
fontColor: string;
|
|
29
|
+
fillColor: string;
|
|
30
|
+
strokeColor: string;
|
|
31
|
+
n_strokeWidth: number;
|
|
32
|
+
outlineColor: string;
|
|
33
|
+
n_outlineWidth: number;
|
|
34
|
+
autoNewline: boolean;
|
|
35
|
+
uuid: string;
|
|
36
|
+
parent: string | null;
|
|
37
|
+
creationContext: string;
|
|
38
|
+
filmStack: FilmStack;
|
|
39
|
+
scaleLock: boolean;
|
|
40
|
+
rubySize: number;
|
|
41
|
+
rubyDistance: number;
|
|
42
|
+
optionContext: any;
|
|
43
|
+
pageNumber?: number;
|
|
44
|
+
fontRenderVersion?: number;
|
|
45
|
+
appearanceDelay?: number;
|
|
46
|
+
hidesText?: boolean;
|
|
47
|
+
prompt: string;
|
|
48
|
+
gallery: HTMLCanvasElement[];
|
|
49
|
+
renderInfo?: BubbleRenderInfo;
|
|
50
|
+
constructor();
|
|
51
|
+
reset(): void;
|
|
52
|
+
getStackTrace(): string;
|
|
53
|
+
clone(hard: boolean): Bubble;
|
|
54
|
+
copyStyleFrom(c: Bubble): void;
|
|
55
|
+
static getUnit(paperSize: Vector): number;
|
|
56
|
+
static compile(paperSize: Vector, json: any): Bubble;
|
|
57
|
+
static decompile(b: Bubble): any;
|
|
58
|
+
static getPhysicalPoint(paperSize: Vector, n_p: Vector): Vector;
|
|
59
|
+
getPhysicalRect(paperSize: Vector): Rect;
|
|
60
|
+
getPhysicalBox(paperSize: Vector): [Vector, Vector];
|
|
61
|
+
getPhysicalCenter(paperSize: Vector): Vector;
|
|
62
|
+
getPhysicalSize(paperSize: Vector): Vector;
|
|
63
|
+
getPhysicalOffset(paperSize: Vector): Vector;
|
|
64
|
+
getPhysicalFontSize(paperSize: Vector): number;
|
|
65
|
+
getPhysicalStrokeWidth(paperSize: Vector): number;
|
|
66
|
+
getPhysicalOutlineWidth(paperSize: Vector): number;
|
|
67
|
+
getPhysicalRegularizedRect(paperSize: Vector): Rect;
|
|
68
|
+
getPhysicalRegularizedBox(paperSize: Vector): [Vector, Vector];
|
|
69
|
+
hasEnoughSize(paperSize: Vector): boolean;
|
|
70
|
+
static enoughSize(size: Vector): Vector;
|
|
71
|
+
setPhysicalCenter(paperSize: Vector, p: Vector): void;
|
|
72
|
+
setPhysicalSize(paperSize: Vector, size: Vector): void;
|
|
73
|
+
setPhysicalRect(paperSize: Vector, rect: Rect): void;
|
|
74
|
+
setPhysicalFontSize(paperSize: Vector, n: number): void;
|
|
75
|
+
setPhysicalStrokeWidth(paperSize: Vector, n: number): void;
|
|
76
|
+
setPhysicalOutlineWidth(paperSize: Vector, n: number): void;
|
|
77
|
+
setPhysicalOffset(paperSize: Vector, p: Vector): void;
|
|
78
|
+
forceEnoughSize(paperSize: Vector): void;
|
|
79
|
+
contains(paperSize: Vector, p: Vector): boolean;
|
|
80
|
+
getHandleAt(paperSize: Vector, p: Vector): RectHandle | null;
|
|
81
|
+
getHandleRect(paperSize: Vector, handle: RectHandle): Rect;
|
|
82
|
+
regularized(): [Vector, Vector];
|
|
83
|
+
regularize(): void;
|
|
84
|
+
canLink(): boolean;
|
|
85
|
+
linkTo(b: Bubble): void;
|
|
86
|
+
linkedTo(b: Bubble): boolean;
|
|
87
|
+
static normalizedPosition(paperSize: Vector, p: Vector): Vector;
|
|
88
|
+
static denormalizedPosition(paperSize: Vector, p: Vector): Vector;
|
|
89
|
+
get optionSet(): any;
|
|
90
|
+
initOptions(): void;
|
|
91
|
+
static getInitialOptions(b: Bubble, sample?: boolean): any;
|
|
92
|
+
calculateFitSize(paperSize: Vector): Vector;
|
|
93
|
+
}
|
|
94
|
+
export declare function insertBubbleLayers(paperSize: Vector, bubble: Bubble, index: number, films: Film[]): void;
|
|
95
|
+
export declare const bubbleOptionSets: {
|
|
96
|
+
[key: string]: any;
|
|
97
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Media } from './media';
|
|
2
|
+
import { FloatField } from 'fastsdf';
|
|
3
|
+
export declare class Effect {
|
|
4
|
+
ulid: string;
|
|
5
|
+
inputMedia: Media | null;
|
|
6
|
+
outputMedia: Media | null;
|
|
7
|
+
constructor();
|
|
8
|
+
get tag(): string;
|
|
9
|
+
clone(): Effect;
|
|
10
|
+
cleanInput(): void;
|
|
11
|
+
setOutputDirty(): void;
|
|
12
|
+
apply(inputMedia: Media): Promise<Media>;
|
|
13
|
+
decompile(): any;
|
|
14
|
+
static compile(markUp: any): OutlineEffect;
|
|
15
|
+
}
|
|
16
|
+
export declare class OutlineEffect extends Effect {
|
|
17
|
+
color: string;
|
|
18
|
+
width: number;
|
|
19
|
+
sharp: number;
|
|
20
|
+
rawDistanceField: FloatField | null;
|
|
21
|
+
constructor(color: string, width: number, sharp: number);
|
|
22
|
+
clone(): Effect;
|
|
23
|
+
apply(inputMedia: Media): Promise<Media>;
|
|
24
|
+
decompile(): any;
|
|
25
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Vector, Rect } from '../tools/geometry/geometry';
|
|
2
|
+
import { Media } from './media';
|
|
3
|
+
import { Effect } from './effect';
|
|
4
|
+
export declare class Film {
|
|
5
|
+
ulid: string;
|
|
6
|
+
media: Media;
|
|
7
|
+
n_scale: number;
|
|
8
|
+
n_translation: Vector;
|
|
9
|
+
rotation: number;
|
|
10
|
+
reverse: [number, number];
|
|
11
|
+
visible: boolean;
|
|
12
|
+
prompt: string | null;
|
|
13
|
+
effects: Effect[];
|
|
14
|
+
selected: boolean;
|
|
15
|
+
matrix: DOMMatrix | undefined;
|
|
16
|
+
index: number | undefined;
|
|
17
|
+
constructor(media: Media);
|
|
18
|
+
clone(): Film;
|
|
19
|
+
getPlainRect(): Rect;
|
|
20
|
+
static getShiftedScale(paperSize: Vector, media: Media, n_scale: number): number;
|
|
21
|
+
getShiftedScale(paperSize: Vector): number;
|
|
22
|
+
setShiftedScale(paperSize: Vector, scale: number): void;
|
|
23
|
+
static getShiftedTranslation(paperSize: Vector, media: Media, n_translation: Vector): Vector;
|
|
24
|
+
getShiftedTranslation(paperSize: Vector): Vector;
|
|
25
|
+
setShiftedTranslation(paperSize: Vector, translation: Vector): void;
|
|
26
|
+
static getShiftedRect(paperSize: Vector, media: Media, n_scale: number, n_translation: Vector, rotation: number): Rect;
|
|
27
|
+
getShiftedRect(paperSize: Vector): Rect;
|
|
28
|
+
makeMatrix(paperSize: Vector): DOMMatrix;
|
|
29
|
+
}
|
|
30
|
+
export declare class FilmStack {
|
|
31
|
+
films: Film[];
|
|
32
|
+
constructor();
|
|
33
|
+
getSelectedFilms(): Film[];
|
|
34
|
+
getOperationTargetFilms(): Film[];
|
|
35
|
+
}
|
|
36
|
+
export declare class FilmStackTransformer {
|
|
37
|
+
paperSize: Vector;
|
|
38
|
+
films: Film[];
|
|
39
|
+
pivot: Vector;
|
|
40
|
+
constructor(paperSize: Vector, films: Film[]);
|
|
41
|
+
scale(s: number): void;
|
|
42
|
+
rotate(q: number): void;
|
|
43
|
+
}
|
|
44
|
+
export declare function calculateMinimumBoundingRect(paperSize: Vector, films: Film[]): Rect | null;
|
|
45
|
+
export declare function fitFilms(paperSize: Vector, constraintRect: Rect, films: Film[]): void;
|
|
46
|
+
export declare function insertFilms(paperSize: Vector, constraintRect: Rect, index: number, films: Film[], targetFilms: Film[], gallery: HTMLCanvasElement[]): void;
|