@ohos-ports/slides-grab 1.5.0-beta.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 (115) hide show
  1. package/LICENSE +21 -0
  2. package/README-ko.md +292 -0
  3. package/README.md +301 -0
  4. package/bin/ohos-postinstall.cjs +118 -0
  5. package/bin/ppt-agent.js +620 -0
  6. package/convert.cjs +20 -0
  7. package/native/@img/sharp-libvips-openharmony-arm64/lib/glib-2.0/include/glibconfig.h +220 -0
  8. package/native/@img/sharp-libvips-openharmony-arm64/lib/index.js +1 -0
  9. package/native/@img/sharp-libvips-openharmony-arm64/lib/libexpat.so +0 -0
  10. package/native/@img/sharp-libvips-openharmony-arm64/lib/libffi.so +0 -0
  11. package/native/@img/sharp-libvips-openharmony-arm64/lib/libjpeg.so +0 -0
  12. package/native/@img/sharp-libvips-openharmony-arm64/lib/libpcre2-8.so.0 +0 -0
  13. package/native/@img/sharp-libvips-openharmony-arm64/lib/libvips-cpp.so.42.20.3 +0 -0
  14. package/native/@img/sharp-libvips-openharmony-arm64/lib/libvips.so.42.20.3 +0 -0
  15. package/native/@img/sharp-libvips-openharmony-arm64/package.json +13 -0
  16. package/native/@img/sharp-openharmony-arm64/lib/sharp-openharmony-arm64.node +0 -0
  17. package/native/@img/sharp-openharmony-arm64/package.json +16 -0
  18. package/package.json +95 -0
  19. package/runtimes/claude-code/agents/design-critic-agent.md +23 -0
  20. package/runtimes/codex/agents/slides-grab-design-critic.md +22 -0
  21. package/scripts/build-viewer.js +444 -0
  22. package/scripts/design-gate.js +258 -0
  23. package/scripts/download-video.js +213 -0
  24. package/scripts/editor-server.js +1167 -0
  25. package/scripts/figma-export.js +169 -0
  26. package/scripts/generate-image.js +116 -0
  27. package/scripts/generate-images.js +164 -0
  28. package/scripts/html2pdf.js +822 -0
  29. package/scripts/html2png.js +246 -0
  30. package/scripts/html2pptx.js +162 -0
  31. package/scripts/import-template.js +86 -0
  32. package/scripts/install-runtime.js +216 -0
  33. package/scripts/render-tldraw.js +44 -0
  34. package/scripts/validate-slides.js +221 -0
  35. package/skills/slides-grab/SKILL.md +65 -0
  36. package/skills/slides-grab/references/presentation-workflow-reference.md +61 -0
  37. package/skills/slides-grab-card-news/SKILL.md +35 -0
  38. package/skills/slides-grab-design/SKILL.md +88 -0
  39. package/skills/slides-grab-design/references/beautiful-slide-defaults.md +88 -0
  40. package/skills/slides-grab-design/references/design-gate.md +349 -0
  41. package/skills/slides-grab-design/references/design-rules.md +76 -0
  42. package/skills/slides-grab-design/references/design-system-full.md +568 -0
  43. package/skills/slides-grab-design/references/detailed-design-rules.md +70 -0
  44. package/skills/slides-grab-export/SKILL.md +55 -0
  45. package/skills/slides-grab-export/references/export-rules.md +27 -0
  46. package/skills/slides-grab-export/references/html2pptx.md +627 -0
  47. package/skills/slides-grab-export/references/ooxml.md +427 -0
  48. package/skills/slides-grab-export/references/pptx-skill-reference.md +189 -0
  49. package/skills/slides-grab-html/SKILL.md +67 -0
  50. package/skills/slides-grab-image/SKILL.md +82 -0
  51. package/skills/slides-grab-plan/SKILL.md +68 -0
  52. package/skills/slides-grab-plan/references/design-md-to-slides-conversion.md +135 -0
  53. package/skills/slides-grab-plan/references/outline-format.md +47 -0
  54. package/skills/slides-grab-plan/references/plan-workflow-reference.md +140 -0
  55. package/src/codex-imagen.js +182 -0
  56. package/src/design-diversity-data.js +6932 -0
  57. package/src/design-gate-report.js +244 -0
  58. package/src/design-gate-state.js +329 -0
  59. package/src/design-import.js +164 -0
  60. package/src/design-md-parser.js +415 -0
  61. package/src/design-styles-data.js +1928 -0
  62. package/src/design-styles.js +209 -0
  63. package/src/editor/codex-edit.js +584 -0
  64. package/src/editor/edit-subprocess.js +170 -0
  65. package/src/editor/editor-codex-prompt.md +50 -0
  66. package/src/editor/editor.html +1785 -0
  67. package/src/editor/js/editor-bbox.js +332 -0
  68. package/src/editor/js/editor-chat.js +56 -0
  69. package/src/editor/js/editor-direct-edit.js +238 -0
  70. package/src/editor/js/editor-dom.js +59 -0
  71. package/src/editor/js/editor-init.js +405 -0
  72. package/src/editor/js/editor-navigation.js +54 -0
  73. package/src/editor/js/editor-select.js +558 -0
  74. package/src/editor/js/editor-send.js +175 -0
  75. package/src/editor/js/editor-sse.js +163 -0
  76. package/src/editor/js/editor-state.js +41 -0
  77. package/src/editor/js/editor-type.js +71 -0
  78. package/src/editor/js/editor-utils.js +167 -0
  79. package/src/editor/js/model-registry.js +37 -0
  80. package/src/editor/screenshot.js +82 -0
  81. package/src/export-resolution.cjs +68 -0
  82. package/src/figma.js +71 -0
  83. package/src/html2pptx-scale.cjs +120 -0
  84. package/src/html2pptx.cjs +1262 -0
  85. package/src/image-contract.js +329 -0
  86. package/src/image-native.js +468 -0
  87. package/src/nano-banana.js +841 -0
  88. package/src/ohos-browser-bridge.cjs +272 -0
  89. package/src/pptx-raster-export.cjs +299 -0
  90. package/src/resolve.js +110 -0
  91. package/src/slide-mode.cjs +72 -0
  92. package/src/template-fidelity.js +267 -0
  93. package/src/template-import.js +505 -0
  94. package/src/template-layout.js +261 -0
  95. package/src/template-pack.js +255 -0
  96. package/src/tldraw/render.js +473 -0
  97. package/src/validation/cli.js +120 -0
  98. package/src/validation/core.js +1023 -0
  99. package/templates/chart.html +121 -0
  100. package/templates/closing.html +54 -0
  101. package/templates/content.html +50 -0
  102. package/templates/contents.html +60 -0
  103. package/templates/cover.html +64 -0
  104. package/templates/custom/.gitkeep +0 -0
  105. package/templates/custom/README.md +7 -0
  106. package/templates/design-styles/README.md +20 -0
  107. package/templates/design-styles/preview.html +4438 -0
  108. package/templates/diagram-tldraw.html +56 -0
  109. package/templates/diagram.html +98 -0
  110. package/templates/quote.html +31 -0
  111. package/templates/section-divider.html +43 -0
  112. package/templates/split-layout.html +43 -0
  113. package/templates/statistics.html +55 -0
  114. package/templates/team.html +49 -0
  115. package/templates/timeline.html +59 -0
@@ -0,0 +1,209 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { basename, dirname, isAbsolute, resolve } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ import { DESIGN_DIVERSITY_SOURCE, RAW_DESIGN_DIVERSITY_STYLES } from './design-diversity-data.js';
6
+ import { RAW_DESIGN_STYLES } from './design-styles-data.js';
7
+ import { parseDesignMarkdownFile } from './design-md-parser.js';
8
+
9
+ const __dirname = dirname(fileURLToPath(import.meta.url));
10
+
11
+ export const DESIGN_STYLES_SOURCE = Object.freeze({
12
+ name: 'PPT Design Collections',
13
+ repo: 'corazzon/pptx-design-styles',
14
+ url: 'https://github.com/corazzon/pptx-design-styles',
15
+ previewUrl: 'https://corazzon.github.io/pptx-design-styles/preview/modern-pptx-designs-30.html',
16
+ references: [
17
+ 'README.md',
18
+ 'preview/modern-pptx-designs-30.html',
19
+ 'references/styles.md',
20
+ ],
21
+ license: 'MIT',
22
+ citation: 'Design collections derived from corazzon/pptx-design-styles. Styles 31–35 are slides-grab originals.',
23
+ });
24
+
25
+ export const SLIDES_GRAB_ORIGINAL_STYLES_SOURCE = Object.freeze({
26
+ name: 'slides-grab original styles',
27
+ repo: 'NomaDamas/slides-grab',
28
+ url: 'https://github.com/NomaDamas/slides-grab',
29
+ license: 'MIT',
30
+ citation: 'slides-grab original bundled styles 31–35.',
31
+ });
32
+
33
+ function getStyleSource(style) {
34
+ if (style.source) return style.source;
35
+ if (style.collection === 'design-diversity') return DESIGN_DIVERSITY_SOURCE;
36
+ const styleNumber = Number(style.number);
37
+ if (styleNumber >= 31 && styleNumber <= 35) return SLIDES_GRAB_ORIGINAL_STYLES_SOURCE;
38
+ return DESIGN_STYLES_SOURCE;
39
+ }
40
+
41
+ const DESIGN_DIVERSITY_ALIAS_MAP = {
42
+ 'ppt-glassmorphism': 'glassmorphism',
43
+ 'ppt-neo-brutalism': 'neo-brutalism',
44
+ 'ppt-editorial-magazine': 'editorial-magazine',
45
+ };
46
+
47
+ const DESIGN_DIVERSITY_RELATED_MAP = {
48
+ 'ppt-consulting-precision-grid': ['swiss-international-style', 'executive-minimal', 'corporate-blue'],
49
+ 'ppt-mckinsey-ghost-deck': ['swiss-international-style', 'executive-minimal'],
50
+ 'ppt-bcg-exhibit-deck': ['swiss-international-style', 'corporate-blue'],
51
+ 'ppt-bain-results-deck': ['executive-minimal', 'corporate-blue'],
52
+ 'ppt-memphis-retro-90s': ['memphis-pop-pattern', 'retro-y2k'],
53
+ 'ppt-botanical-organic': ['hand-crafted-organic', 'dark-forest-nature', 'nordic-minimalism'],
54
+ 'ppt-print-first-newspaper': ['brutalist-newspaper', 'risograph-print', 'editorial-magazine'],
55
+ 'ppt-keynote-minimal-fullbleed': ['monochrome-minimal', 'executive-minimal'],
56
+ 'ppt-minimal-mono-note': ['monochrome-minimal'],
57
+ 'ppt-monochrome-risk': ['monochrome-minimal', 'executive-minimal'],
58
+ 'ppt-monochrome-infrastructure-deck': ['monochrome-minimal', 'executive-minimal'],
59
+ 'ppt-dark-tech': ['modern-dark', 'cyberpunk-outline'],
60
+ 'ppt-engineered-dark-deck': ['modern-dark'],
61
+ 'ppt-prismatic-dark-deck': ['modern-dark', 'scifi-holographic-data'],
62
+ 'ppt-dark-luxury-keynote': ['modern-dark', 'dark-neon-miami'],
63
+ 'ppt-vivid-gradient-future': ['gradient-mesh', 'aurora-neon-glow'],
64
+ 'ppt-vivid-gradient-infographic-deck': ['gradient-mesh', 'aurora-neon-glow'],
65
+ 'ppt-expressive-soundwave-deck': ['dark-neon-miami', 'typographic-bold'],
66
+ 'ppt-cinematic-keynote-deck': ['modern-dark', 'art-deco-luxe'],
67
+ };
68
+
69
+ // reverse map: builtin id -> [dd slug] for enrichment
70
+ const BUILTIN_ALIAS_SLUGS = Object.entries(DESIGN_DIVERSITY_ALIAS_MAP).reduce((acc, [slug, builtinId]) => {
71
+ (acc[builtinId] = acc[builtinId] || []).push(slug);
72
+ return acc;
73
+ }, {});
74
+
75
+ function classifyStyle(style) {
76
+ if (style.collection === 'design-diversity') {
77
+ const slug = style.id;
78
+ if (DESIGN_DIVERSITY_ALIAS_MAP[slug]) {
79
+ return {
80
+ classification: 'source-alias',
81
+ sourceSlug: slug,
82
+ aliasOf: DESIGN_DIVERSITY_ALIAS_MAP[slug],
83
+ relatedStyleIds: [],
84
+ };
85
+ }
86
+ if (DESIGN_DIVERSITY_RELATED_MAP[slug]) {
87
+ return {
88
+ classification: 'source-variant',
89
+ sourceSlug: slug,
90
+ relatedStyleIds: [...DESIGN_DIVERSITY_RELATED_MAP[slug]],
91
+ };
92
+ }
93
+ return {
94
+ classification: 'source-new',
95
+ sourceSlug: slug,
96
+ relatedStyleIds: [],
97
+ };
98
+ }
99
+ const extra = { classification: 'builtin', relatedStyleIds: [] };
100
+ if (BUILTIN_ALIAS_SLUGS[style.id]) extra.aliases = [...BUILTIN_ALIAS_SLUGS[style.id]];
101
+ return extra;
102
+ }
103
+
104
+ const DESIGN_STYLES = [...RAW_DESIGN_STYLES, ...RAW_DESIGN_DIVERSITY_STYLES].map((style) => Object.freeze({
105
+ ...style,
106
+ source: getStyleSource(style),
107
+ ...classifyStyle(style),
108
+ }));
109
+
110
+ const DESIGN_STYLES_BY_ID = new Map(DESIGN_STYLES.map((style) => [style.id, style]));
111
+
112
+ export function listDesignStyles() {
113
+ return DESIGN_STYLES;
114
+ }
115
+
116
+ export function listSelectableDesignStyles() {
117
+ return DESIGN_STYLES.filter((style) => style.classification !== 'source-alias');
118
+ }
119
+
120
+ export function getDesignStyle(styleId) {
121
+ if (!styleId) {
122
+ return null;
123
+ }
124
+ const style = DESIGN_STYLES_BY_ID.get(styleId);
125
+ if (style?.classification === 'source-alias') {
126
+ return DESIGN_STYLES_BY_ID.get(style.aliasOf) ?? style;
127
+ }
128
+ return style ?? null;
129
+ }
130
+
131
+ export function requireDesignStyle(styleId) {
132
+ const style = getDesignStyle(styleId);
133
+ if (!style) {
134
+ throw new Error(`Unknown style "${styleId}". Run "slides-grab list-styles" to inspect the bundled collection.`);
135
+ }
136
+ return style;
137
+ }
138
+
139
+ export function getPreviewHtmlPath() {
140
+ return resolve(__dirname, '..', 'templates', 'design-styles', 'preview.html');
141
+ }
142
+
143
+ export function buildStylePreviewHtml() {
144
+ return readFileSync(getPreviewHtmlPath(), 'utf-8');
145
+ }
146
+
147
+ export const SLIDE_DESIGN_FILENAME = 'DESIGN.slides.md';
148
+ export const WEB_DESIGN_FILENAME = 'DESIGN.md';
149
+
150
+ export function isDesignMarkdownRef(styleRef) {
151
+ if (typeof styleRef !== 'string') return false;
152
+ const trimmed = styleRef.trim();
153
+ if (trimmed === '') return false;
154
+ if (trimmed.toLowerCase().endsWith('.md')) return true;
155
+ if (trimmed.startsWith('./') || trimmed.startsWith('../')) return true;
156
+ if (isAbsolute(trimmed)) return true;
157
+ return false;
158
+ }
159
+
160
+ export function resolveDesignMarkdownPath(styleRef, { baseDir = process.cwd() } = {}) {
161
+ if (!isDesignMarkdownRef(styleRef)) return null;
162
+ const candidate = isAbsolute(styleRef) ? styleRef : resolve(baseDir, styleRef);
163
+ if (!existsSync(candidate)) {
164
+ throw new Error(`DESIGN.md reference not found at ${candidate}`);
165
+ }
166
+ if (basename(candidate) === WEB_DESIGN_FILENAME) {
167
+ const siblingSlideDesign = resolve(dirname(candidate), SLIDE_DESIGN_FILENAME);
168
+ if (existsSync(siblingSlideDesign)) return siblingSlideDesign;
169
+ }
170
+ return candidate;
171
+ }
172
+
173
+ export function loadDesignStyleRef(styleRef, options = {}) {
174
+ if (!styleRef) return null;
175
+ if (isDesignMarkdownRef(styleRef)) {
176
+ const path = resolveDesignMarkdownPath(styleRef, options);
177
+ return parseDesignMarkdownFile(path);
178
+ }
179
+ return requireDesignStyle(styleRef);
180
+ }
181
+
182
+ export function findLocalDesignMarkdown({ baseDir = process.cwd() } = {}) {
183
+ const detection = detectLocalDesignMarkdown({ baseDir });
184
+ return detection.path;
185
+ }
186
+
187
+ export function detectLocalDesignMarkdown({ baseDir = process.cwd() } = {}) {
188
+ const slideCandidate = resolve(baseDir, SLIDE_DESIGN_FILENAME);
189
+ const webCandidate = resolve(baseDir, WEB_DESIGN_FILENAME);
190
+ const slideExists = existsSync(slideCandidate);
191
+ const webExists = existsSync(webCandidate);
192
+ if (slideExists) {
193
+ return {
194
+ path: slideCandidate,
195
+ kind: 'slides',
196
+ slidePath: slideCandidate,
197
+ webPath: webExists ? webCandidate : null,
198
+ };
199
+ }
200
+ if (webExists) {
201
+ return {
202
+ path: webCandidate,
203
+ kind: 'web',
204
+ slidePath: null,
205
+ webPath: webCandidate,
206
+ };
207
+ }
208
+ return { path: null, kind: null, slidePath: null, webPath: null };
209
+ }