@hirokisakabe/pom 0.1.11 → 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.
- package/README.md +28 -580
- package/dist/calcYogaLayout/calcYogaLayout.js +12 -0
- package/dist/inputSchema.d.ts +274 -2
- package/dist/inputSchema.d.ts.map +1 -1
- package/dist/inputSchema.js +54 -1
- package/dist/renderPptx/renderPptx.d.ts.map +1 -1
- package/dist/renderPptx/renderPptx.js +795 -2
- package/dist/toPositioned/toPositioned.d.ts.map +1 -1
- package/dist/toPositioned/toPositioned.js +45 -0
- package/dist/types.d.ts +405 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +135 -0
- package/package.json +11 -2
package/dist/types.js
CHANGED
|
@@ -267,6 +267,7 @@ const basePOMNodeSchema = z.object({
|
|
|
267
267
|
padding: paddingSchema.optional(),
|
|
268
268
|
backgroundColor: z.string().optional(),
|
|
269
269
|
border: borderStyleSchema.optional(),
|
|
270
|
+
borderRadius: z.number().optional(),
|
|
270
271
|
});
|
|
271
272
|
// ===== Non-recursive Node Types =====
|
|
272
273
|
export const textNodeSchema = basePOMNodeSchema.extend({
|
|
@@ -342,6 +343,130 @@ export const chartNodeSchema = basePOMNodeSchema.extend({
|
|
|
342
343
|
// radar専用オプション
|
|
343
344
|
radarStyle: radarStyleSchema.optional(),
|
|
344
345
|
});
|
|
346
|
+
// ===== Timeline Node =====
|
|
347
|
+
export const timelineDirectionSchema = z.enum(["horizontal", "vertical"]);
|
|
348
|
+
export const timelineItemSchema = z.object({
|
|
349
|
+
date: z.string(),
|
|
350
|
+
title: z.string(),
|
|
351
|
+
description: z.string().optional(),
|
|
352
|
+
color: z.string().optional(),
|
|
353
|
+
});
|
|
354
|
+
export const timelineNodeSchema = basePOMNodeSchema.extend({
|
|
355
|
+
type: z.literal("timeline"),
|
|
356
|
+
direction: timelineDirectionSchema.optional(),
|
|
357
|
+
items: z.array(timelineItemSchema),
|
|
358
|
+
});
|
|
359
|
+
// ===== Matrix Node =====
|
|
360
|
+
export const matrixAxisSchema = z.object({
|
|
361
|
+
x: z.string(),
|
|
362
|
+
y: z.string(),
|
|
363
|
+
});
|
|
364
|
+
export const matrixQuadrantsSchema = z.object({
|
|
365
|
+
topLeft: z.string(),
|
|
366
|
+
topRight: z.string(),
|
|
367
|
+
bottomLeft: z.string(),
|
|
368
|
+
bottomRight: z.string(),
|
|
369
|
+
});
|
|
370
|
+
export const matrixItemSchema = z.object({
|
|
371
|
+
label: z.string(),
|
|
372
|
+
x: z.number().min(0).max(1),
|
|
373
|
+
y: z.number().min(0).max(1),
|
|
374
|
+
color: z.string().optional(),
|
|
375
|
+
});
|
|
376
|
+
export const matrixNodeSchema = basePOMNodeSchema.extend({
|
|
377
|
+
type: z.literal("matrix"),
|
|
378
|
+
axes: matrixAxisSchema,
|
|
379
|
+
quadrants: matrixQuadrantsSchema.optional(),
|
|
380
|
+
items: z.array(matrixItemSchema),
|
|
381
|
+
});
|
|
382
|
+
// ===== Tree Node =====
|
|
383
|
+
export const treeLayoutSchema = z.enum(["vertical", "horizontal"]);
|
|
384
|
+
export const treeNodeShapeSchema = z.enum(["rect", "roundRect", "ellipse"]);
|
|
385
|
+
export const treeConnectorStyleSchema = z.object({
|
|
386
|
+
color: z.string().optional(),
|
|
387
|
+
width: z.number().optional(),
|
|
388
|
+
});
|
|
389
|
+
export const treeDataItemSchema = z.lazy(() => z.object({
|
|
390
|
+
label: z.string(),
|
|
391
|
+
color: z.string().optional(),
|
|
392
|
+
children: z.array(treeDataItemSchema).optional(),
|
|
393
|
+
}));
|
|
394
|
+
export const treeNodeSchema = basePOMNodeSchema.extend({
|
|
395
|
+
type: z.literal("tree"),
|
|
396
|
+
layout: treeLayoutSchema.optional(),
|
|
397
|
+
nodeShape: treeNodeShapeSchema.optional(),
|
|
398
|
+
data: treeDataItemSchema,
|
|
399
|
+
connectorStyle: treeConnectorStyleSchema.optional(),
|
|
400
|
+
nodeWidth: z.number().optional(),
|
|
401
|
+
nodeHeight: z.number().optional(),
|
|
402
|
+
levelGap: z.number().optional(),
|
|
403
|
+
siblingGap: z.number().optional(),
|
|
404
|
+
});
|
|
405
|
+
// ===== ProcessArrow Node =====
|
|
406
|
+
export const processArrowDirectionSchema = z.enum(["horizontal", "vertical"]);
|
|
407
|
+
export const processArrowStepSchema = z.object({
|
|
408
|
+
label: z.string(),
|
|
409
|
+
color: z.string().optional(),
|
|
410
|
+
textColor: z.string().optional(),
|
|
411
|
+
});
|
|
412
|
+
export const processArrowNodeSchema = basePOMNodeSchema.extend({
|
|
413
|
+
type: z.literal("processArrow"),
|
|
414
|
+
direction: processArrowDirectionSchema.optional(),
|
|
415
|
+
steps: z.array(processArrowStepSchema),
|
|
416
|
+
itemWidth: z.number().optional(),
|
|
417
|
+
itemHeight: z.number().optional(),
|
|
418
|
+
gap: z.number().optional(),
|
|
419
|
+
fontPx: z.number().optional(),
|
|
420
|
+
bold: z.boolean().optional(),
|
|
421
|
+
});
|
|
422
|
+
// ===== Flow Node =====
|
|
423
|
+
export const flowDirectionSchema = z.enum(["horizontal", "vertical"]);
|
|
424
|
+
export const flowNodeShapeSchema = z.enum([
|
|
425
|
+
"flowChartTerminator",
|
|
426
|
+
"flowChartProcess",
|
|
427
|
+
"flowChartDecision",
|
|
428
|
+
"flowChartInputOutput",
|
|
429
|
+
"flowChartDocument",
|
|
430
|
+
"flowChartPredefinedProcess",
|
|
431
|
+
"flowChartConnector",
|
|
432
|
+
"flowChartPreparation",
|
|
433
|
+
"flowChartManualInput",
|
|
434
|
+
"flowChartManualOperation",
|
|
435
|
+
"flowChartDelay",
|
|
436
|
+
"flowChartMagneticDisk",
|
|
437
|
+
]);
|
|
438
|
+
export const flowNodeItemSchema = z.object({
|
|
439
|
+
id: z.string(),
|
|
440
|
+
shape: flowNodeShapeSchema,
|
|
441
|
+
text: z.string(),
|
|
442
|
+
color: z.string().optional(),
|
|
443
|
+
textColor: z.string().optional(),
|
|
444
|
+
width: z.number().optional(),
|
|
445
|
+
height: z.number().optional(),
|
|
446
|
+
});
|
|
447
|
+
export const flowConnectionSchema = z.object({
|
|
448
|
+
from: z.string(),
|
|
449
|
+
to: z.string(),
|
|
450
|
+
label: z.string().optional(),
|
|
451
|
+
color: z.string().optional(),
|
|
452
|
+
});
|
|
453
|
+
export const flowConnectorStyleSchema = z.object({
|
|
454
|
+
color: z.string().optional(),
|
|
455
|
+
width: z.number().optional(),
|
|
456
|
+
arrowType: z
|
|
457
|
+
.enum(["none", "arrow", "diamond", "oval", "stealth", "triangle"])
|
|
458
|
+
.optional(),
|
|
459
|
+
});
|
|
460
|
+
export const flowNodeSchema = basePOMNodeSchema.extend({
|
|
461
|
+
type: z.literal("flow"),
|
|
462
|
+
direction: flowDirectionSchema.optional(),
|
|
463
|
+
nodes: z.array(flowNodeItemSchema),
|
|
464
|
+
connections: z.array(flowConnectionSchema),
|
|
465
|
+
connectorStyle: flowConnectorStyleSchema.optional(),
|
|
466
|
+
nodeWidth: z.number().optional(),
|
|
467
|
+
nodeHeight: z.number().optional(),
|
|
468
|
+
nodeGap: z.number().optional(),
|
|
469
|
+
});
|
|
345
470
|
// Define schemas using passthrough to maintain type safety
|
|
346
471
|
const boxNodeSchemaBase = basePOMNodeSchema.extend({
|
|
347
472
|
type: z.literal("box"),
|
|
@@ -374,6 +499,11 @@ export const pomNodeSchema = z.lazy(() => z.discriminatedUnion("type", [
|
|
|
374
499
|
hStackNodeSchemaBase,
|
|
375
500
|
shapeNodeSchema,
|
|
376
501
|
chartNodeSchema,
|
|
502
|
+
timelineNodeSchema,
|
|
503
|
+
matrixNodeSchema,
|
|
504
|
+
treeNodeSchema,
|
|
505
|
+
flowNodeSchema,
|
|
506
|
+
processArrowNodeSchema,
|
|
377
507
|
]));
|
|
378
508
|
// ===== Positioned Node Types =====
|
|
379
509
|
const positionedBaseSchema = z.object({
|
|
@@ -399,6 +529,11 @@ export const positionedNodeSchema = z.lazy(() => z.union([
|
|
|
399
529
|
}),
|
|
400
530
|
shapeNodeSchema.merge(positionedBaseSchema),
|
|
401
531
|
chartNodeSchema.merge(positionedBaseSchema),
|
|
532
|
+
timelineNodeSchema.merge(positionedBaseSchema),
|
|
533
|
+
matrixNodeSchema.merge(positionedBaseSchema),
|
|
534
|
+
treeNodeSchema.merge(positionedBaseSchema),
|
|
535
|
+
flowNodeSchema.merge(positionedBaseSchema),
|
|
536
|
+
processArrowNodeSchema.merge(positionedBaseSchema),
|
|
402
537
|
]));
|
|
403
538
|
// ===== Master Slide Options =====
|
|
404
539
|
export const pageNumberPositionSchema = z.enum(["left", "center", "right"]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hirokisakabe/pom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "PowerPoint Object Model - A declarative TypeScript library for creating PowerPoint presentations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -59,9 +59,18 @@
|
|
|
59
59
|
"vrt:docker": "docker compose build vrt && docker compose run --rm vrt",
|
|
60
60
|
"vrt:docker:update": "docker compose build vrt-update && docker compose run --rm vrt-update",
|
|
61
61
|
"preview": "tsx preview/lib/previewPptx.ts",
|
|
62
|
-
"preview:docker": "docker compose build preview && docker compose run --rm preview"
|
|
62
|
+
"preview:docker": "docker compose build preview && docker compose run --rm preview",
|
|
63
|
+
"docs:images": "tsx docs/lib/generateNodeImages.ts",
|
|
64
|
+
"docs:images:docker": "docker compose run --rm docs-images",
|
|
65
|
+
"docs:images:docker:update": "docker compose build docs-images && docker compose run --rm docs-images",
|
|
66
|
+
"release": "changeset publish"
|
|
67
|
+
},
|
|
68
|
+
"publishConfig": {
|
|
69
|
+
"access": "public"
|
|
63
70
|
},
|
|
64
71
|
"devDependencies": {
|
|
72
|
+
"@changesets/changelog-github": "^0.5.2",
|
|
73
|
+
"@changesets/cli": "^2.29.8",
|
|
65
74
|
"@eslint/js": "^9.39.1",
|
|
66
75
|
"@types/image-size": "0.7.0",
|
|
67
76
|
"@types/pngjs": "6.0.5",
|