@segnavia/format 0.9.1 → 0.11.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.
@@ -0,0 +1,35 @@
1
+ import { Board, BoardItem } from "./board.js";
2
+ import { Box, Point, Size } from "./deck.js";
3
+ //#region src/board-geometry.d.ts
4
+ export interface BoardShapes {
5
+ items: Record<string, Size>;
6
+ labels: Record<string, Size>;
7
+ }
8
+ export interface BoardView {
9
+ zoom: number;
10
+ pan: Point;
11
+ viewport: Size;
12
+ }
13
+ export interface ZoomBounds {
14
+ minZoom?: number;
15
+ maxZoom?: number;
16
+ }
17
+ export interface ArrangeOptions {
18
+ layout: 'grid' | 'row';
19
+ gap: number;
20
+ columns?: number;
21
+ sectionPadding?: number;
22
+ }
23
+ export declare const MIN_BOARD_ZOOM = 0.05;
24
+ export declare const MAX_BOARD_ZOOM = 8;
25
+ export declare function itemHeight(item: BoardItem, shape: Size): number;
26
+ export declare function boardBounds(board: Board, shapes: BoardShapes): Box;
27
+ export declare function boardToScreen(view: BoardView, point: Point): Point;
28
+ export declare function screenToBoard(view: BoardView, point: Point): Point;
29
+ export declare function zoomToFit(bounds: Box, viewport: Size, padding: number): BoardView;
30
+ export declare function revealView(bounds: Box, viewport: Size, padding: number, options?: ZoomBounds): BoardView;
31
+ export declare function zoomAt(view: BoardView, point: Point, factor: number, options?: ZoomBounds): BoardView;
32
+ export declare function visibleItems(board: Board, shapes: BoardShapes, view: BoardView, margin: number): BoardItem[];
33
+ export declare function itemAt(board: Board, shapes: BoardShapes, point: Point): BoardItem | undefined;
34
+ export declare function arrange(board: Board, shapes: BoardShapes, options: ArrangeOptions): Board;
35
+ //#endregion
@@ -0,0 +1,199 @@
1
+ //#region src/board-geometry.ts
2
+ const MIN_BOARD_ZOOM = .05;
3
+ const MAX_BOARD_ZOOM = 8;
4
+ function requireShape(shapes, kind, id) {
5
+ if (!Object.hasOwn(shapes[kind], id)) throw new Error(`${kind === "items" ? "item" : "label"} "${id}" has no supplied shape; supply shapes.${kind}["${id}"]`);
6
+ const shape = shapes[kind][id];
7
+ if (!shape) throw new Error(`${kind === "items" ? "item" : "label"} "${id}" has no supplied shape; supply shapes.${kind}["${id}"]`);
8
+ return shape;
9
+ }
10
+ function requireView(view) {
11
+ if (!(view.zoom > 0)) throw new Error(`board view zoom is ${view.zoom}; provide a zoom greater than zero`);
12
+ }
13
+ function itemHeight(item, shape) {
14
+ return item.width * shape.height / shape.width;
15
+ }
16
+ function itemRectangle(item, shapes) {
17
+ const shape = requireShape(shapes, "items", item.id);
18
+ return {
19
+ x: item.x,
20
+ y: item.y,
21
+ width: item.width,
22
+ height: itemHeight(item, shape)
23
+ };
24
+ }
25
+ function union(rectangles) {
26
+ if (rectangles.length === 0) return {
27
+ x: 0,
28
+ y: 0,
29
+ width: 0,
30
+ height: 0
31
+ };
32
+ const left = Math.min(...rectangles.map((rectangle) => rectangle.x));
33
+ const top = Math.min(...rectangles.map((rectangle) => rectangle.y));
34
+ const right = Math.max(...rectangles.map((rectangle) => rectangle.x + rectangle.width));
35
+ const bottom = Math.max(...rectangles.map((rectangle) => rectangle.y + rectangle.height));
36
+ return {
37
+ x: left,
38
+ y: top,
39
+ width: right - left,
40
+ height: bottom - top
41
+ };
42
+ }
43
+ function boardBounds(board, shapes) {
44
+ return union([
45
+ ...board.items.map((item) => itemRectangle(item, shapes)),
46
+ ...board.labels.map((label) => {
47
+ const shape = requireShape(shapes, "labels", label.id);
48
+ return {
49
+ x: label.x,
50
+ y: label.y,
51
+ width: shape.width,
52
+ height: shape.height
53
+ };
54
+ }),
55
+ ...board.sections.map((section) => section.rectangle)
56
+ ]);
57
+ }
58
+ function boardToScreen(view, point) {
59
+ requireView(view);
60
+ return {
61
+ x: point.x * view.zoom + view.pan.x,
62
+ y: point.y * view.zoom + view.pan.y
63
+ };
64
+ }
65
+ function screenToBoard(view, point) {
66
+ requireView(view);
67
+ return {
68
+ x: (point.x - view.pan.x) / view.zoom,
69
+ y: (point.y - view.pan.y) / view.zoom
70
+ };
71
+ }
72
+ function zoomToFit(bounds, viewport, padding) {
73
+ const availableWidth = viewport.width - padding * 2;
74
+ const availableHeight = viewport.height - padding * 2;
75
+ if (!(availableWidth > 0 && availableHeight > 0 && bounds.width > 0 && bounds.height > 0)) throw new Error("zoom to fit needs positive bounds and a viewport larger than twice its padding; provide non-empty bounds and usable space");
76
+ const zoom = Math.min(availableWidth / bounds.width, availableHeight / bounds.height);
77
+ return {
78
+ zoom,
79
+ pan: {
80
+ x: (viewport.width - bounds.width * zoom) / 2 - bounds.x * zoom,
81
+ y: (viewport.height - bounds.height * zoom) / 2 - bounds.y * zoom
82
+ },
83
+ viewport
84
+ };
85
+ }
86
+ function revealView(bounds, viewport, padding, options = {}) {
87
+ const fitted = zoomToFit(bounds, viewport, padding);
88
+ const minZoom = options.minZoom ?? .05;
89
+ const maxZoom = options.maxZoom ?? 8;
90
+ if (!(minZoom > 0 && maxZoom >= minZoom)) throw new Error("zoom bounds are invalid; provide a positive minZoom no greater than maxZoom");
91
+ const zoom = Math.min(maxZoom, Math.max(minZoom, fitted.zoom));
92
+ return {
93
+ zoom,
94
+ pan: {
95
+ x: viewport.width / 2 - (bounds.x + bounds.width / 2) * zoom,
96
+ y: viewport.height / 2 - (bounds.y + bounds.height / 2) * zoom
97
+ },
98
+ viewport
99
+ };
100
+ }
101
+ function zoomAt(view, point, factor, options = {}) {
102
+ requireView(view);
103
+ if (!(factor > 0)) throw new Error(`zoom factor is ${factor}; provide a factor greater than zero`);
104
+ const minZoom = options.minZoom ?? .05;
105
+ const maxZoom = options.maxZoom ?? 8;
106
+ if (!(minZoom > 0 && maxZoom >= minZoom)) throw new Error("zoom bounds are invalid; provide a positive minZoom no greater than maxZoom");
107
+ const zoom = Math.min(maxZoom, Math.max(minZoom, view.zoom * factor));
108
+ const boardPoint = screenToBoard(view, point);
109
+ return {
110
+ ...view,
111
+ zoom,
112
+ pan: {
113
+ x: point.x - boardPoint.x * zoom,
114
+ y: point.y - boardPoint.y * zoom
115
+ }
116
+ };
117
+ }
118
+ function intersects(a, b) {
119
+ return a.x <= b.x + b.width && a.x + a.width >= b.x && a.y <= b.y + b.height && a.y + a.height >= b.y;
120
+ }
121
+ function visibleItems(board, shapes, view, margin) {
122
+ requireView(view);
123
+ const viewport = {
124
+ x: -margin,
125
+ y: -margin,
126
+ width: view.viewport.width + margin * 2,
127
+ height: view.viewport.height + margin * 2
128
+ };
129
+ return board.items.filter((item) => {
130
+ const rectangle = itemRectangle(item, shapes);
131
+ const screen = boardToScreen(view, {
132
+ x: rectangle.x,
133
+ y: rectangle.y
134
+ });
135
+ return intersects({
136
+ x: screen.x,
137
+ y: screen.y,
138
+ width: rectangle.width * view.zoom,
139
+ height: rectangle.height * view.zoom
140
+ }, viewport);
141
+ });
142
+ }
143
+ function itemAt(board, shapes, point) {
144
+ for (let index = board.items.length - 1; index >= 0; index -= 1) {
145
+ const item = board.items[index];
146
+ if (!item) continue;
147
+ const rectangle = itemRectangle(item, shapes);
148
+ if (point.x >= rectangle.x && point.x <= rectangle.x + rectangle.width && point.y >= rectangle.y && point.y <= rectangle.y + rectangle.height) return item;
149
+ }
150
+ }
151
+ function arrangedItems(board, shapes, options) {
152
+ if (options.layout === "grid" && options.columns !== void 0 && (!Number.isFinite(options.columns) || !Number.isInteger(options.columns) || options.columns <= 0)) throw new Error(`grid columns is ${options.columns}; provide a positive integer`);
153
+ const columns = options.layout === "row" ? Math.max(1, board.items.length) : Math.max(1, options.columns ?? Math.ceil(Math.sqrt(board.items.length)));
154
+ const columnWidths = Array.from({ length: columns }, () => 0);
155
+ const rowHeights = Array.from({ length: Math.ceil(board.items.length / columns) }, () => 0);
156
+ board.items.forEach((item, index) => {
157
+ const column = index % columns;
158
+ const row = Math.floor(index / columns);
159
+ columnWidths[column] = Math.max(columnWidths[column] ?? 0, item.width);
160
+ rowHeights[row] = Math.max(rowHeights[row] ?? 0, itemHeight(item, requireShape(shapes, "items", item.id)));
161
+ });
162
+ const offsets = (sizes) => sizes.map((_, index) => sizes.slice(0, index).reduce((total, size) => total + size, 0) + index * options.gap);
163
+ const xOffsets = offsets(columnWidths);
164
+ const yOffsets = offsets(rowHeights);
165
+ return board.items.map((item, index) => {
166
+ const column = index % columns;
167
+ const x = xOffsets[column] ?? 0;
168
+ return {
169
+ ...item,
170
+ x: board.direction === "rtl" ? -x - item.width : x,
171
+ y: yOffsets[Math.floor(index / columns)] ?? 0
172
+ };
173
+ });
174
+ }
175
+ function arrange(board, shapes, options) {
176
+ const items = arrangedItems(board, shapes, options);
177
+ const byId = new Map(items.map((item) => [item.id, item]));
178
+ const padding = options.sectionPadding ?? options.gap;
179
+ const sections = board.sections.map((section) => {
180
+ if (section.items.length === 0) return section;
181
+ const rectangle = union(section.items.map((id) => itemRectangle(byId.get(id), shapes)));
182
+ return {
183
+ ...section,
184
+ rectangle: {
185
+ x: rectangle.x - padding,
186
+ y: rectangle.y - padding,
187
+ width: rectangle.width + padding * 2,
188
+ height: rectangle.height + padding * 2
189
+ }
190
+ };
191
+ });
192
+ return {
193
+ ...board,
194
+ items,
195
+ sections
196
+ };
197
+ }
198
+ //#endregion
199
+ export { MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, arrange, boardBounds, boardToScreen, itemAt, itemHeight, revealView, screenToBoard, visibleItems, zoomAt, zoomToFit };
@@ -0,0 +1,15 @@
1
+ import { Board, BoardItem, BoardSection } from "./board.js";
2
+ //#region src/board-listing.d.ts
3
+ export type BoardListingGroup = {
4
+ kind: 'section';
5
+ section: BoardSection;
6
+ items: BoardItem[];
7
+ } | {
8
+ kind: 'loose';
9
+ items: BoardItem[];
10
+ };
11
+ export declare function foldForSearch(text: string): string;
12
+ export declare function nameMatches(name: string, query: string): boolean;
13
+ export declare function boardListingIsEmpty(query: string, groups: BoardListingGroup[]): boolean;
14
+ export declare function boardListing(board: Board, nameOf: (item: BoardItem) => string, query: string, contentMatches?: Iterable<string>): BoardListingGroup[];
15
+ //#endregion
@@ -0,0 +1,47 @@
1
+ //#region src/board-listing.ts
2
+ const FINAL_LETTERS = {
3
+ ך: "כ",
4
+ ם: "מ",
5
+ ן: "נ",
6
+ ף: "פ",
7
+ ץ: "צ"
8
+ };
9
+ function foldForSearch(text) {
10
+ return text.normalize("NFD").replace(/\p{M}/gu, "").replace(/[ךםןףץ]/g, (letter) => FINAL_LETTERS[letter] ?? letter).toLowerCase().trim().replace(/\s+/g, " ");
11
+ }
12
+ function nameMatches(name, query) {
13
+ return foldForSearch(name).includes(foldForSearch(query));
14
+ }
15
+ function boardListingIsEmpty(query, groups) {
16
+ return foldForSearch(query).length > 0 && groups.length === 0;
17
+ }
18
+ function boardListing(board, nameOf, query, contentMatches = []) {
19
+ const folded = foldForSearch(query);
20
+ const byId = new Map(board.items.map((item) => [item.id, item]));
21
+ const content = new Set(contentMatches);
22
+ const claimed = /* @__PURE__ */ new Set();
23
+ const groups = [];
24
+ for (const section of board.sections) {
25
+ const members = section.items.flatMap((id) => {
26
+ if (claimed.has(id)) return [];
27
+ claimed.add(id);
28
+ const item = byId.get(id);
29
+ return item ? [item] : [];
30
+ });
31
+ const items = !folded || nameMatches(section.title, folded) ? members : members.filter((item) => nameMatches(nameOf(item), folded) || content.has(item.id));
32
+ if (!folded || items.length > 0) groups.push({
33
+ kind: "section",
34
+ section,
35
+ items
36
+ });
37
+ }
38
+ const loose = board.items.filter((item) => !claimed.has(item.id));
39
+ const visibleLoose = folded ? loose.filter((item) => nameMatches(nameOf(item), folded) || content.has(item.id)) : loose;
40
+ if (visibleLoose.length > 0) groups.push({
41
+ kind: "loose",
42
+ items: visibleLoose
43
+ });
44
+ return groups;
45
+ }
46
+ //#endregion
47
+ export { boardListing, boardListingIsEmpty, foldForSearch, nameMatches };
@@ -0,0 +1,79 @@
1
+ import { z } from "zod";
2
+ //#region src/board.d.ts
3
+ export declare const BoardItem: z.ZodObject<{
4
+ id: z.ZodString;
5
+ kind: z.ZodEnum<{
6
+ paper: "paper";
7
+ page: "page";
8
+ book: "book";
9
+ shot: "shot";
10
+ image: "image";
11
+ deck: "deck";
12
+ }>;
13
+ address: z.ZodString;
14
+ x: z.ZodNumber;
15
+ y: z.ZodNumber;
16
+ width: z.ZodNumber;
17
+ }, z.core.$strip>;
18
+ export type BoardItem = z.infer<typeof BoardItem>;
19
+ export declare const BoardLabel: z.ZodObject<{
20
+ id: z.ZodString;
21
+ text: z.ZodString;
22
+ x: z.ZodNumber;
23
+ y: z.ZodNumber;
24
+ }, z.core.$strip>;
25
+ export type BoardLabel = z.infer<typeof BoardLabel>;
26
+ export declare const BoardSection: z.ZodObject<{
27
+ id: z.ZodString;
28
+ title: z.ZodString;
29
+ rectangle: z.ZodObject<{
30
+ x: z.ZodNumber;
31
+ y: z.ZodNumber;
32
+ width: z.ZodNumber;
33
+ height: z.ZodNumber;
34
+ }, z.core.$strip>;
35
+ items: z.ZodArray<z.ZodString>;
36
+ }, z.core.$strip>;
37
+ export type BoardSection = z.infer<typeof BoardSection>;
38
+ export declare const Board: z.ZodObject<{
39
+ title: z.ZodString;
40
+ direction: z.ZodEnum<{
41
+ ltr: "ltr";
42
+ rtl: "rtl";
43
+ }>;
44
+ items: z.ZodArray<z.ZodObject<{
45
+ id: z.ZodString;
46
+ kind: z.ZodEnum<{
47
+ paper: "paper";
48
+ page: "page";
49
+ book: "book";
50
+ shot: "shot";
51
+ image: "image";
52
+ deck: "deck";
53
+ }>;
54
+ address: z.ZodString;
55
+ x: z.ZodNumber;
56
+ y: z.ZodNumber;
57
+ width: z.ZodNumber;
58
+ }, z.core.$strip>>;
59
+ labels: z.ZodArray<z.ZodObject<{
60
+ id: z.ZodString;
61
+ text: z.ZodString;
62
+ x: z.ZodNumber;
63
+ y: z.ZodNumber;
64
+ }, z.core.$strip>>;
65
+ sections: z.ZodArray<z.ZodObject<{
66
+ id: z.ZodString;
67
+ title: z.ZodString;
68
+ rectangle: z.ZodObject<{
69
+ x: z.ZodNumber;
70
+ y: z.ZodNumber;
71
+ width: z.ZodNumber;
72
+ height: z.ZodNumber;
73
+ }, z.core.$strip>;
74
+ items: z.ZodArray<z.ZodString>;
75
+ }, z.core.$strip>>;
76
+ }, z.core.$strip>;
77
+ export type Board = z.infer<typeof Board>;
78
+ export type BoardInput = z.input<typeof Board>;
79
+ //#endregion
package/dist/board.js ADDED
@@ -0,0 +1,75 @@
1
+ import { TextDirection } from "./direction.js";
2
+ import { Box } from "./deck.js";
3
+ import { z } from "zod";
4
+ //#region src/board.ts
5
+ const BoardKind = z.enum([
6
+ "deck",
7
+ "page",
8
+ "paper",
9
+ "book",
10
+ "image",
11
+ "shot"
12
+ ], { error: "item kind is unknown; use deck, page, paper, book, image or shot" });
13
+ const BoardItem = z.object({
14
+ id: z.string(),
15
+ kind: BoardKind,
16
+ address: z.string().min(1, "item address is empty; provide a non-empty address"),
17
+ x: z.number(),
18
+ y: z.number(),
19
+ width: z.number().positive("item width is not positive; provide a width greater than zero")
20
+ });
21
+ const BoardLabel = z.object({
22
+ id: z.string(),
23
+ text: z.string(),
24
+ x: z.number(),
25
+ y: z.number()
26
+ });
27
+ const BoardSection = z.object({
28
+ id: z.string(),
29
+ title: z.string(),
30
+ rectangle: Box,
31
+ items: z.array(z.string())
32
+ });
33
+ const Board = z.object({
34
+ title: z.string(),
35
+ direction: TextDirection,
36
+ items: z.array(BoardItem),
37
+ labels: z.array(BoardLabel),
38
+ sections: z.array(BoardSection)
39
+ }).superRefine((board, ctx) => {
40
+ const ids = /* @__PURE__ */ new Set();
41
+ const checkIds = (entries, listName) => {
42
+ entries.forEach((entry, index) => {
43
+ if (ids.has(entry.id)) ctx.addIssue({
44
+ code: "custom",
45
+ path: [
46
+ listName,
47
+ index,
48
+ "id"
49
+ ],
50
+ message: `id "${entry.id}" is duplicated across board items, labels and sections; use a unique id`
51
+ });
52
+ ids.add(entry.id);
53
+ });
54
+ };
55
+ checkIds(board.items, "items");
56
+ checkIds(board.labels, "labels");
57
+ checkIds(board.sections, "sections");
58
+ const itemIds = new Set(board.items.map((item) => item.id));
59
+ board.sections.forEach((section, sectionIndex) => {
60
+ section.items.forEach((id, itemIndex) => {
61
+ if (!itemIds.has(id)) ctx.addIssue({
62
+ code: "custom",
63
+ path: [
64
+ "sections",
65
+ sectionIndex,
66
+ "items",
67
+ itemIndex
68
+ ],
69
+ message: `section member "${id}" is not a board item id; use the id of an existing item`
70
+ });
71
+ });
72
+ });
73
+ });
74
+ //#endregion
75
+ export { Board, BoardItem, BoardLabel, BoardSection };
package/dist/book.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Direction } from "./direction.js";
2
+ import { Scripts } from "./scripts.js";
2
3
  import { NoteMarker, NumberSystem } from "./numbering.js";
3
4
  import { Paper, sheetMm } from "./paper.js";
4
- import { Scripts } from "./scripts.js";
5
5
  import { z } from "zod";
6
6
  //#region src/book.ts
7
7
  const BookMode = z.enum(["continuous", "paginated"]);
package/dist/deck.d.ts CHANGED
@@ -16,6 +16,7 @@ export declare const Point: z.ZodObject<{
16
16
  x: z.ZodNumber;
17
17
  y: z.ZodNumber;
18
18
  }, z.core.$strip>;
19
+ export type Point = z.infer<typeof Point>;
19
20
  export declare const ImageFit: z.ZodEnum<{
20
21
  width: "width";
21
22
  contain: "contain";
@@ -5,7 +5,11 @@ export declare const Direction: z.ZodEnum<{
5
5
  rtl: "rtl";
6
6
  auto: "auto";
7
7
  }>;
8
- export type TextDirection = 'ltr' | 'rtl';
8
+ export declare const TextDirection: z.ZodEnum<{
9
+ ltr: "ltr";
10
+ rtl: "rtl";
11
+ }>;
12
+ export type TextDirection = z.infer<typeof TextDirection>;
9
13
  export declare function firstStrongDirection(text: string): TextDirection | null;
10
14
  export declare function languageDirection(lang: string | undefined): TextDirection | null;
11
15
  export declare function resolveDirection(dir: 'ltr' | 'rtl' | 'auto' | undefined, lang: string | undefined, sample: string): TextDirection;
package/dist/direction.js CHANGED
@@ -5,6 +5,7 @@ const Direction = z.enum([
5
5
  "rtl",
6
6
  "auto"
7
7
  ]);
8
+ const TextDirection = z.enum(["ltr", "rtl"]);
8
9
  const RTL_LETTER = /[\p{Script=Hebrew}\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Samaritan}\p{Script=Mandaic}\p{Script=Adlam}\p{Script=Hanifi_Rohingya}\p{Script=Mende_Kikakui}\p{Script=Old_Hungarian}\p{Script=Imperial_Aramaic}\p{Script=Phoenician}]/u;
9
10
  const LETTER = /\p{L}/u;
10
11
  const RTL_LANGUAGES = /* @__PURE__ */ new Set([
@@ -42,4 +43,4 @@ function resolveDirection(dir, lang, sample) {
42
43
  return languageDirection(lang) ?? firstStrongDirection(sample) ?? "ltr";
43
44
  }
44
45
  //#endregion
45
- export { Direction, firstStrongDirection, languageDirection, resolveDirection };
46
+ export { Direction, TextDirection, firstStrongDirection, languageDirection, resolveDirection };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
- import { Book, BookContents, BookFrontMatterEntry, BookInput, BookMode, BookPage, BookSection, BookView, BookViewInput, Chapter, isBookContents, isHebrew, noteMarkerIssues } from "./book.js";
1
+ import { Board, BoardInput, BoardItem, BoardLabel, BoardSection } from "./board.js";
2
2
  import { Annotation, Box, Cue, DECK_SIZE, Deck, DeckInput, DeckLimits, ImageFit, Manifest, Narration, Point, PublishedShot, SHOT_KEY, Shot, Size, Slide, SlideContent, Word, annotationCueIssues, exceedsLimits } from "./deck.js";
3
+ import { ArrangeOptions, BoardShapes, BoardView, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, ZoomBounds, arrange, boardBounds, boardToScreen, itemAt, itemHeight, revealView, screenToBoard, visibleItems, zoomAt, zoomToFit } from "./board-geometry.js";
4
+ import { BoardListingGroup, boardListing, boardListingIsEmpty, foldForSearch, nameMatches } from "./board-listing.js";
5
+ import { Book, BookContents, BookFrontMatterEntry, BookInput, BookMode, BookPage, BookSection, BookView, BookViewInput, Chapter, isBookContents, isHebrew, noteMarkerIssues } from "./book.js";
3
6
  import { DeckFromSlidesOptions, SlideRow, deckFromSlides } from "./deck-from-slides.js";
4
7
  import { Direction, TextDirection, firstStrongDirection, languageDirection, resolveDirection } from "./direction.js";
5
8
  import { MARK_GAP_MM, MARK_LENGTH_MM, MM_PER_PT, NAMED_PAPERS, PAPER_MM, PX_PER_MM, Paper, PaperBox, printBoxes, printPadding, printProperties, roundMillimeters, sheetMm, toMillimeters } from "./paper.js";
@@ -676,6 +679,45 @@ export declare function jsonSchemas(): {
676
679
  meta: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
677
680
  }, z.core.$strip>;
678
681
  }, z.core.$strip>>;
682
+ board: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
683
+ title: z.ZodString;
684
+ direction: z.ZodEnum<{
685
+ ltr: "ltr";
686
+ rtl: "rtl";
687
+ }>;
688
+ items: z.ZodArray<z.ZodObject<{
689
+ id: z.ZodString;
690
+ kind: z.ZodEnum<{
691
+ paper: "paper";
692
+ page: "page";
693
+ book: "book";
694
+ shot: "shot";
695
+ image: "image";
696
+ deck: "deck";
697
+ }>;
698
+ address: z.ZodString;
699
+ x: z.ZodNumber;
700
+ y: z.ZodNumber;
701
+ width: z.ZodNumber;
702
+ }, z.core.$strip>>;
703
+ labels: z.ZodArray<z.ZodObject<{
704
+ id: z.ZodString;
705
+ text: z.ZodString;
706
+ x: z.ZodNumber;
707
+ y: z.ZodNumber;
708
+ }, z.core.$strip>>;
709
+ sections: z.ZodArray<z.ZodObject<{
710
+ id: z.ZodString;
711
+ title: z.ZodString;
712
+ rectangle: z.ZodObject<{
713
+ x: z.ZodNumber;
714
+ y: z.ZodNumber;
715
+ width: z.ZodNumber;
716
+ height: z.ZodNumber;
717
+ }, z.core.$strip>;
718
+ items: z.ZodArray<z.ZodString>;
719
+ }, z.core.$strip>>;
720
+ }, z.core.$strip>>;
679
721
  };
680
722
  //#endregion
681
- export { Annotation, Book, BookContents, BookFrontMatterEntry, type BookInput, BookMode, BookPage, BookSection, BookView, type BookViewInput, Box, Chapter, Cue, DECK_SIZE, DEFAULT_TRANSITION_DURATION_MS, Deck, type DeckFromSlidesOptions, type DeckInput, type DeckLimits, Direction, ImageFit, type Imposed, Lexicon, MARK_GAP_MM, MARK_LENGTH_MM, MAX_SLIDE_TIMING_MS, MAX_TRANSITION_DURATION_MS, MIN_TRANSITION_DURATION_MS, MM_PER_PT, Manifest, type MillimeterEdges, NAMED_PAPERS, Narration, NoteMarker, NumberSystem, PAPER_MM, PX_PER_MM, type PageFit, type PagePlacementKind, type PagePlacementLayout, Paper, type PaperBox, type Placement, Point, PronunciationEntry, PublishedShot, SHOT_KEY, Scripts, Shot, type ShotUse, Size, Slide, SlideContent, type SlideRow, type TextDirection, Transition, TransitionInput, Word, annotationCueIssues, deckFromSlides, exceedsLimits, firstStrongDirection, fitPage, formatNumber, impose, isBookContents, isHebrew, languageDirection, lexiconVersion, mirrorPlacement, noteMarker, noteMarkerIssues, pagePlacementLayout, printBoxes, printPadding, printProperties, resolveDirection, roundMillimeters, sheetMm, shotsUsed, toMillimeters };
723
+ export { Annotation, type ArrangeOptions, Board, type BoardInput, BoardItem, BoardLabel, type BoardListingGroup, BoardSection, type BoardShapes, type BoardView, Book, BookContents, BookFrontMatterEntry, type BookInput, BookMode, BookPage, BookSection, BookView, type BookViewInput, Box, Chapter, Cue, DECK_SIZE, DEFAULT_TRANSITION_DURATION_MS, Deck, type DeckFromSlidesOptions, type DeckInput, type DeckLimits, Direction, ImageFit, type Imposed, Lexicon, MARK_GAP_MM, MARK_LENGTH_MM, MAX_BOARD_ZOOM, MAX_SLIDE_TIMING_MS, MAX_TRANSITION_DURATION_MS, MIN_BOARD_ZOOM, MIN_TRANSITION_DURATION_MS, MM_PER_PT, Manifest, type MillimeterEdges, NAMED_PAPERS, Narration, NoteMarker, NumberSystem, PAPER_MM, PX_PER_MM, type PageFit, type PagePlacementKind, type PagePlacementLayout, Paper, type PaperBox, type Placement, Point, PronunciationEntry, PublishedShot, SHOT_KEY, Scripts, Shot, type ShotUse, Size, Slide, SlideContent, type SlideRow, TextDirection, Transition, TransitionInput, Word, type ZoomBounds, annotationCueIssues, arrange, boardBounds, boardListing, boardListingIsEmpty, boardToScreen, deckFromSlides, exceedsLimits, firstStrongDirection, fitPage, foldForSearch, formatNumber, impose, isBookContents, isHebrew, itemAt, itemHeight, languageDirection, lexiconVersion, mirrorPlacement, nameMatches, noteMarker, noteMarkerIssues, pagePlacementLayout, printBoxes, printPadding, printProperties, resolveDirection, revealView, roundMillimeters, screenToBoard, sheetMm, shotsUsed, toMillimeters, visibleItems, zoomAt, zoomToFit };
package/dist/index.js CHANGED
@@ -1,12 +1,15 @@
1
- import { Direction, firstStrongDirection, languageDirection, resolveDirection } from "./direction.js";
2
- import { NoteMarker, NumberSystem, formatNumber, noteMarker } from "./numbering.js";
3
- import { MARK_GAP_MM, MARK_LENGTH_MM, MM_PER_PT, NAMED_PAPERS, PAPER_MM, PX_PER_MM, Paper, printBoxes, printPadding, printProperties, roundMillimeters, sheetMm, toMillimeters } from "./paper.js";
1
+ import { Direction, TextDirection, firstStrongDirection, languageDirection, resolveDirection } from "./direction.js";
4
2
  import { Scripts } from "./scripts.js";
5
- import { Book, BookContents, BookFrontMatterEntry, BookMode, BookPage, BookSection, BookShape, BookView, Chapter, isBookContents, isHebrew, noteMarkerIssues } from "./book.js";
6
3
  import { MAX_SLIDE_TIMING_MS } from "./timing.js";
7
4
  import { DEFAULT_TRANSITION_DURATION_MS, MAX_TRANSITION_DURATION_MS, MIN_TRANSITION_DURATION_MS, Transition } from "./transition.js";
8
5
  import { Annotation, Box, Cue, DECK_SIZE, Deck, DeckShape, ImageFit, Manifest, Narration, Point, PublishedShot, SHOT_KEY, Shot, Size, Slide, SlideContent, Word, annotationCueIssues, exceedsLimits } from "./deck.js";
6
+ import { Board, BoardItem, BoardLabel, BoardSection } from "./board.js";
7
+ import { NoteMarker, NumberSystem, formatNumber, noteMarker } from "./numbering.js";
8
+ import { MARK_GAP_MM, MARK_LENGTH_MM, MM_PER_PT, NAMED_PAPERS, PAPER_MM, PX_PER_MM, Paper, printBoxes, printPadding, printProperties, roundMillimeters, sheetMm, toMillimeters } from "./paper.js";
9
+ import { Book, BookContents, BookFrontMatterEntry, BookMode, BookPage, BookSection, BookShape, BookView, Chapter, isBookContents, isHebrew, noteMarkerIssues } from "./book.js";
9
10
  import { Lexicon, PronunciationEntry, lexiconVersion } from "./lexicon.js";
11
+ import { MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, arrange, boardBounds, boardToScreen, itemAt, itemHeight, revealView, screenToBoard, visibleItems, zoomAt, zoomToFit } from "./board-geometry.js";
12
+ import { boardListing, boardListingIsEmpty, foldForSearch, nameMatches } from "./board-listing.js";
10
13
  import { deckFromSlides } from "./deck-from-slides.js";
11
14
  import { fitPage, impose, mirrorPlacement, pagePlacementLayout } from "./imposition.js";
12
15
  import { shotsUsed } from "./shots-used.js";
@@ -147,8 +150,9 @@ function jsonSchemas() {
147
150
  imposition: z.toJSONSchema(Imposition, { io: "input" }),
148
151
  deck: z.toJSONSchema(DeckShape, { io: "input" }),
149
152
  manifest: z.toJSONSchema(Manifest, { io: "input" }),
150
- publishedShot: z.toJSONSchema(PublishedShot, { io: "input" })
153
+ publishedShot: z.toJSONSchema(PublishedShot, { io: "input" }),
154
+ board: z.toJSONSchema(Board, { io: "input" })
151
155
  };
152
156
  }
153
157
  //#endregion
154
- export { Annotation, Book, BookContents, BookFrontMatterEntry, BookMode, BookPage, BookSection, BookView, Box, Chapter, Cue, DECK_SIZE, DEFAULT_TRANSITION_DURATION_MS, Deck, Direction, ImageFit, Imposition, Lexicon, MARK_GAP_MM, MARK_LENGTH_MM, MAX_IMPOSITION_CELLS, MAX_SLIDE_TIMING_MS, MAX_TRANSITION_DURATION_MS, MIN_TRANSITION_DURATION_MS, MM_PER_PT, Manifest, Margin, NAMED_PAPERS, Narration, NoteMarker, NumberSystem, PAPER_MM, PX_PER_MM, Page, PageSize, Paper, Point, Print, PronunciationEntry, PublishedShot, SHOT_KEY, Scripts, Shot, Size, Slide, SlideContent, Transition, Word, annotationCueIssues, deckFromSlides, exceedsLimits, firstStrongDirection, fitPage, formatNumber, impose, isBookContents, isHebrew, jsonSchemas, languageDirection, lexiconVersion, mirrorPlacement, noteMarker, noteMarkerIssues, pagePlacementLayout, printBoxes, printPadding, printProperties, resolveDirection, roundMillimeters, sheetMm, shotsUsed, toMillimeters };
158
+ export { Annotation, Board, BoardItem, BoardLabel, BoardSection, Book, BookContents, BookFrontMatterEntry, BookMode, BookPage, BookSection, BookView, Box, Chapter, Cue, DECK_SIZE, DEFAULT_TRANSITION_DURATION_MS, Deck, Direction, ImageFit, Imposition, Lexicon, MARK_GAP_MM, MARK_LENGTH_MM, MAX_BOARD_ZOOM, MAX_IMPOSITION_CELLS, MAX_SLIDE_TIMING_MS, MAX_TRANSITION_DURATION_MS, MIN_BOARD_ZOOM, MIN_TRANSITION_DURATION_MS, MM_PER_PT, Manifest, Margin, NAMED_PAPERS, Narration, NoteMarker, NumberSystem, PAPER_MM, PX_PER_MM, Page, PageSize, Paper, Point, Print, PronunciationEntry, PublishedShot, SHOT_KEY, Scripts, Shot, Size, Slide, SlideContent, TextDirection, Transition, Word, annotationCueIssues, arrange, boardBounds, boardListing, boardListingIsEmpty, boardToScreen, deckFromSlides, exceedsLimits, firstStrongDirection, fitPage, foldForSearch, formatNumber, impose, isBookContents, isHebrew, itemAt, itemHeight, jsonSchemas, languageDirection, lexiconVersion, mirrorPlacement, nameMatches, noteMarker, noteMarkerIssues, pagePlacementLayout, printBoxes, printPadding, printProperties, resolveDirection, revealView, roundMillimeters, screenToBoard, sheetMm, shotsUsed, toMillimeters, visibleItems, zoomAt, zoomToFit };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segnavia/format",
3
- "version": "0.9.1",
3
+ "version": "0.11.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {