@appeeky/open-slideshow 0.0.0-stage → 0.2.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.
Files changed (78) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +297 -2
  3. package/dist/bin.d.ts +2 -0
  4. package/dist/bin.js +9 -0
  5. package/dist/brand.d.ts +57 -0
  6. package/dist/brand.js +263 -0
  7. package/dist/brandkit.d.ts +50 -0
  8. package/dist/brandkit.js +212 -0
  9. package/dist/cli.d.ts +1 -0
  10. package/dist/cli.js +355 -0
  11. package/dist/decks.d.ts +44 -0
  12. package/dist/decks.js +100 -0
  13. package/dist/fonts.d.ts +45 -0
  14. package/dist/fonts.js +243 -0
  15. package/dist/gallery.d.ts +35 -0
  16. package/dist/gallery.js +109 -0
  17. package/dist/ideas.d.ts +50 -0
  18. package/dist/ideas.js +146 -0
  19. package/dist/images.d.ts +62 -0
  20. package/dist/images.js +241 -0
  21. package/dist/index.d.ts +21 -0
  22. package/dist/index.js +22 -0
  23. package/dist/lint.d.ts +36 -0
  24. package/dist/lint.js +197 -0
  25. package/dist/mcp.d.ts +3 -0
  26. package/dist/mcp.js +303 -0
  27. package/dist/preview.d.ts +18 -0
  28. package/dist/preview.js +96 -0
  29. package/dist/publish.d.ts +105 -0
  30. package/dist/publish.js +406 -0
  31. package/dist/readability.d.ts +19 -0
  32. package/dist/readability.js +42 -0
  33. package/dist/render.d.ts +92 -0
  34. package/dist/render.js +647 -0
  35. package/dist/results.d.ts +89 -0
  36. package/dist/results.js +252 -0
  37. package/dist/schedule.d.ts +19 -0
  38. package/dist/schedule.js +114 -0
  39. package/dist/schema.d.ts +1159 -0
  40. package/dist/schema.js +211 -0
  41. package/dist/screenshots.d.ts +18 -0
  42. package/dist/screenshots.js +69 -0
  43. package/dist/shape.d.ts +31 -0
  44. package/dist/shape.js +169 -0
  45. package/dist/skill.d.ts +7 -0
  46. package/dist/skill.js +17 -0
  47. package/dist/templates.d.ts +47 -0
  48. package/dist/templates.js +330 -0
  49. package/dist/text.d.ts +40 -0
  50. package/dist/text.js +231 -0
  51. package/dist/themes.d.ts +43 -0
  52. package/dist/themes.js +202 -0
  53. package/dist/variants.d.ts +48 -0
  54. package/dist/variants.js +175 -0
  55. package/dist/version.d.ts +1 -0
  56. package/dist/version.js +1 -0
  57. package/dist/video.d.ts +22 -0
  58. package/dist/video.js +59 -0
  59. package/dist/viral.d.ts +12 -0
  60. package/dist/viral.js +35 -0
  61. package/dist/workspace.d.ts +85 -0
  62. package/dist/workspace.js +322 -0
  63. package/package.json +65 -4
  64. package/skills/open-slideshow/SKILL.md +65 -0
  65. package/skills/open-slideshow/references/brand.md +64 -0
  66. package/skills/open-slideshow/references/channels.md +63 -0
  67. package/skills/open-slideshow/references/ideas.md +23 -0
  68. package/skills/open-slideshow/references/images.md +61 -0
  69. package/skills/open-slideshow/references/languages.md +51 -0
  70. package/skills/open-slideshow/references/publishing.md +70 -0
  71. package/skills/open-slideshow/references/results.md +47 -0
  72. package/skills/open-slideshow/references/review.md +81 -0
  73. package/skills/open-slideshow/references/screenshots.md +26 -0
  74. package/skills/open-slideshow/references/series.md +20 -0
  75. package/skills/open-slideshow/references/templates.md +96 -0
  76. package/skills/open-slideshow/references/troubleshooting.md +92 -0
  77. package/skills/open-slideshow/references/video.md +18 -0
  78. package/skills/open-slideshow/references/writing.md +76 -0
@@ -0,0 +1,42 @@
1
+ import sharp from "sharp";
2
+ import { SIZES } from "./schema.js";
3
+ /**
4
+ * Where TikTok draws its own buttons and text over a photo post, in slide pixels. A 4:5 or 1:1
5
+ * slide is shown full width in the middle of a 9:16 screen, so the screen's zones are moved onto it.
6
+ */
7
+ export function tiktokZones(size) {
8
+ const { width: W, height: H } = SIZES[size];
9
+ const screenH = Math.round((W * 16) / 9);
10
+ const offset = Math.round((screenH - H) / 2);
11
+ const toSlide = (y) => Math.min(H, Math.max(0, Math.round(y * screenH - offset)));
12
+ const zones = [
13
+ { label: "like, comment and share buttons", x0: Math.round(W * 0.87), y0: toSlide(0.42), x1: W, y1: toSlide(0.9) },
14
+ { label: "caption and account name", x0: 0, y0: toSlide(0.8), x1: W, y1: H },
15
+ { label: "top tabs", x0: 0, y0: 0, x1: W, y1: toSlide(0.085) },
16
+ ];
17
+ return zones.filter((z) => z.y1 - z.y0 > 4);
18
+ }
19
+ const overlaps = (r, z) => r.x0 < z.x1 && r.x1 > z.x0 && r.y0 < z.y1 && r.y1 > z.y0;
20
+ /** Lines of text that sit under TikTok's buttons or caption. */
21
+ export function tiktokIssues(lines, size, index) {
22
+ if (!lines?.length)
23
+ return [];
24
+ const out = [];
25
+ for (const z of tiktokZones(size)) {
26
+ const hit = lines.filter((l) => overlaps(l, z));
27
+ if (!hit.length)
28
+ continue;
29
+ const fix = z.label.startsWith("like") ? `shorten the long lines (photo themes can also move the words with text_position)${size === "9:16" ? "" : ", or use 9:16"}` : "move the words toward the middle (text_position on photo themes) or cut words";
30
+ out.push({ slide: index, level: "warning", code: "tiktok-ui", message: `slide ${index + 1}: ${hit.length} line${hit.length === 1 ? "" : "s"} of text ${hit.length === 1 ? "sits" : "sit"} under TikTok's ${z.label}; ${fix}` });
31
+ }
32
+ return out;
33
+ }
34
+ /** The slides with TikTok's zones drawn over them, so a person can see what the app covers. */
35
+ export async function safeZoneSlide(jpg, size) {
36
+ const { width: W, height: H } = SIZES[size];
37
+ const rects = tiktokZones(size)
38
+ .map((z) => `<rect x="${z.x0}" y="${z.y0}" width="${z.x1 - z.x0}" height="${z.y1 - z.y0}" fill="#ff2d55" fill-opacity="0.28" stroke="#ff2d55" stroke-width="4"/>`)
39
+ .join("");
40
+ const svg = Buffer.from(`<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${H}">${rects}</svg>`);
41
+ return sharp(jpg).composite([{ input: svg }]).jpeg({ quality: 85 }).toBuffer();
42
+ }
@@ -0,0 +1,92 @@
1
+ import { type Deck, type Series, type Slide, type SizeId } from "./schema.js";
2
+ import { type Theme } from "./themes.js";
3
+ export declare const RENDERER_VERSION = "1";
4
+ type Style = Record<string, string | number | undefined>;
5
+ export interface El {
6
+ type: string;
7
+ props: {
8
+ style?: Style;
9
+ children?: Child | Child[];
10
+ src?: string;
11
+ width?: number;
12
+ height?: number;
13
+ };
14
+ }
15
+ type Child = El | string;
16
+ export interface RenderBrand {
17
+ name?: string;
18
+ handle?: string;
19
+ /** Absolute path of the app icon, when there is one. */
20
+ icon?: string;
21
+ }
22
+ export interface RenderContext {
23
+ theme: Theme;
24
+ size: SizeId;
25
+ brand: RenderBrand;
26
+ /** Absolute path of a slide image, or null when it cannot be found. */
27
+ resolveImage: (ref: string) => string | null;
28
+ /** The deck's language. */
29
+ locale?: string;
30
+ /** Ready images by absolute path (cropped later per box). */
31
+ images?: Map<string, Buffer>;
32
+ }
33
+ export interface SlideIssue {
34
+ slide: number;
35
+ level: "error" | "warning";
36
+ code: string;
37
+ message: string;
38
+ }
39
+ interface Frame {
40
+ W: number;
41
+ H: number;
42
+ pad: number;
43
+ top: number;
44
+ bottom: number;
45
+ }
46
+ export declare function frameFor(size: SizeId): Frame;
47
+ /** Body text under this size (on a 1080-wide slide) is hard to read on a phone. */
48
+ export declare const SMALL_TEXT = 38;
49
+ /** Where a line of text ends up on the slide, in pixels: for the readability checks. */
50
+ export interface LineRect {
51
+ x0: number;
52
+ y0: number;
53
+ x1: number;
54
+ y1: number;
55
+ }
56
+ export interface Laid {
57
+ tree: El;
58
+ issues: SlideIssue[];
59
+ /** Every line of text, where it is drawn. */
60
+ lines?: LineRect[];
61
+ }
62
+ interface SlideArgs {
63
+ deck: Pick<Deck, "full_cover" | "text_style" | "show_handle"> & {
64
+ series?: Series;
65
+ };
66
+ slide: Slide;
67
+ index: number;
68
+ tipNumber?: number;
69
+ /** Only plan the text (for lint): no images are read. */
70
+ dry?: boolean;
71
+ }
72
+ /** "Part 2", "Part 2/5" or the series' own label, filled in. */
73
+ export declare function seriesLabel(s: Series): string;
74
+ export declare function tipNumbers(slides: Slide[]): (number | undefined)[];
75
+ export declare function laySlide(ctx: RenderContext, a: SlideArgs): Promise<Laid>;
76
+ export declare function rasterize(tree: El, size: SizeId, quality?: number): Promise<Buffer>;
77
+ export declare function themeFor(deck: Pick<Deck, "theme" | "colors">): Theme;
78
+ export interface RenderResult {
79
+ files: string[];
80
+ sheet: string;
81
+ /** The sheet with TikTok's buttons and caption drawn over the slides. */
82
+ safe_sheet: string;
83
+ hash: string;
84
+ issues: SlideIssue[];
85
+ /** Where each slide's lines of text landed, as drawn. */
86
+ lines: (LineRect[] | undefined)[];
87
+ }
88
+ export declare function renderHash(deck: Deck, ctx: RenderContext): string;
89
+ export declare function renderDeck(deck: Deck, ctx: RenderContext, outDir: string): Promise<RenderResult>;
90
+ /** All slides side by side in one image, small, for a quick look. */
91
+ export declare function contactSheet(slides: Buffer[], size: SizeId, columns?: number, labels?: string[]): Promise<Buffer>;
92
+ export {};