konpeki 0.1.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 (121) hide show
  1. package/.agents/skills/authoring-visuals/SKILL.md +82 -0
  2. package/AGENTS.md +33 -0
  3. package/AUTHORING.md +233 -0
  4. package/LICENSE +201 -0
  5. package/README.md +70 -0
  6. package/SETUP.md +86 -0
  7. package/composition/README.md +166 -0
  8. package/composition/compile.ts +227 -0
  9. package/composition/document.ts +709 -0
  10. package/composition/schema.json +2992 -0
  11. package/composition/schema.ts +435 -0
  12. package/composition/theme-tokens.ts +16 -0
  13. package/composition/types.ts +286 -0
  14. package/composition/validate.ts +684 -0
  15. package/composition/vector.ts +143 -0
  16. package/composition/visualizations.ts +335 -0
  17. package/design/README.md +17 -0
  18. package/design/palettes/README.md +14 -0
  19. package/design/palettes/base.ts +14 -0
  20. package/design/palettes/candidates.ts +19 -0
  21. package/design/palettes/index.ts +78 -0
  22. package/design/review/color-theme.md +44 -0
  23. package/design/review/layout.md +16 -0
  24. package/design/review/text.md +18 -0
  25. package/design/review/typography.md +15 -0
  26. package/design/review/visuals.md +31 -0
  27. package/design/semantic-patterns.md +43 -0
  28. package/design/themes/README.md +22 -0
  29. package/design/themes/index.ts +13 -0
  30. package/design/visual-languages/technical-product.md +17 -0
  31. package/design/visual-review.md +88 -0
  32. package/docs/development.md +140 -0
  33. package/docs/workflow.md +61 -0
  34. package/index.html +17 -0
  35. package/lib/assets.d.ts +8 -0
  36. package/lib/charts.ts +18 -0
  37. package/lib/contrast.ts +16 -0
  38. package/lib/layouts.ts +50 -0
  39. package/lib/slide.tsx +42 -0
  40. package/lib/taste.ts +17 -0
  41. package/lib/text.tsx +89 -0
  42. package/lib/typeface.ts +44 -0
  43. package/package.json +85 -0
  44. package/runtime/konpeki.mjs +1685 -0
  45. package/scripts/migrate-react-page.ts +120 -0
  46. package/slides/README.md +153 -0
  47. package/slides/architecture/PROMPT.md +31 -0
  48. package/slides/architecture/index.tsx +102 -0
  49. package/slides/article-brief/PROMPT.md +35 -0
  50. package/slides/article-brief/index.tsx +71 -0
  51. package/slides/bar-chart/PROMPT.md +39 -0
  52. package/slides/bar-chart/index.tsx +97 -0
  53. package/slides/comparison/PROMPT.md +29 -0
  54. package/slides/comparison/index.tsx +95 -0
  55. package/slides/decision-memo/PROMPT.md +34 -0
  56. package/slides/decision-memo/index.tsx +85 -0
  57. package/slides/delivery-plan/PROMPT.md +45 -0
  58. package/slides/delivery-plan/index.tsx +105 -0
  59. package/slides/experiment/PROMPT.md +44 -0
  60. package/slides/experiment/index.tsx +127 -0
  61. package/slides/incident-workflow/PROMPT.md +57 -0
  62. package/slides/incident-workflow/index.tsx +78 -0
  63. package/slides/introducing-konpeki/PROMPT.md +19 -0
  64. package/slides/introducing-konpeki/README.md +54 -0
  65. package/slides/introducing-konpeki/SOURCE.md +20 -0
  66. package/slides/introducing-konpeki/author.ts +163 -0
  67. package/slides/introducing-konpeki/composition.json +3265 -0
  68. package/slides/line-chart/PROMPT.md +40 -0
  69. package/slides/line-chart/index.tsx +72 -0
  70. package/slides/migration/PROMPT.md +38 -0
  71. package/slides/migration/index.tsx +89 -0
  72. package/slides/og-images/PROMPT.md +21 -0
  73. package/slides/og-images/index.tsx +76 -0
  74. package/slides/product-introduction/PROMPT.md +24 -0
  75. package/slides/product-introduction/index.tsx +105 -0
  76. package/slides/research-brief/PROMPT.md +40 -0
  77. package/slides/research-brief/index.tsx +104 -0
  78. package/slides/results-explanation/PROMPT.md +32 -0
  79. package/slides/results-explanation/index.tsx +96 -0
  80. package/slides/retrospective/PROMPT.md +43 -0
  81. package/slides/retrospective/index.tsx +105 -0
  82. package/slides/sankey/PROMPT.md +11 -0
  83. package/slides/sankey/index.tsx +93 -0
  84. package/slides/teaching/PROMPT.md +45 -0
  85. package/slides/teaching/index.tsx +124 -0
  86. package/slides/vertical-bar-charts/PROMPT.md +13 -0
  87. package/slides/vertical-bar-charts/index.tsx +97 -0
  88. package/src/app/App.tsx +694 -0
  89. package/src/assets/konpeki-mark.png +0 -0
  90. package/src/components/Canvas.tsx +1168 -0
  91. package/src/components/DiagramTypeIcon.tsx +78 -0
  92. package/src/components/InspectorPanel.tsx +687 -0
  93. package/src/components/LeftPanel.tsx +107 -0
  94. package/src/components/PageSizePicker.tsx +30 -0
  95. package/src/components/Presentation.tsx +105 -0
  96. package/src/components/RightPanel.tsx +201 -0
  97. package/src/components/VectorOverflowWarning.tsx +46 -0
  98. package/src/components/WorkspaceChrome.tsx +199 -0
  99. package/src/components/ui.tsx +53 -0
  100. package/src/lib/examples/react-page-migration.json +1295 -0
  101. package/src/lib/examples.ts +42 -0
  102. package/src/lib/export-png.ts +101 -0
  103. package/src/lib/file-session.ts +74 -0
  104. package/src/lib/history.ts +53 -0
  105. package/src/lib/model.ts +188 -0
  106. package/src/lib/page-size.ts +24 -0
  107. package/src/lib/presentation.ts +17 -0
  108. package/src/lib/storage.ts +43 -0
  109. package/src/lib/theme.ts +25 -0
  110. package/src/lib/use-file-session.ts +162 -0
  111. package/src/main.tsx +26 -0
  112. package/src/styles/base.css +105 -0
  113. package/src/styles/canvas.css +268 -0
  114. package/src/styles/chrome.css +214 -0
  115. package/src/styles/component-previews.css +386 -0
  116. package/src/styles/feedback.css +71 -0
  117. package/src/styles/left-panel.css +125 -0
  118. package/src/styles/presentation.css +72 -0
  119. package/src/styles/right-panel.css +1172 -0
  120. package/src/styles/shell.css +247 -0
  121. package/vite.config.ts +6 -0
@@ -0,0 +1,286 @@
1
+ import type { ChartTemplate, DiagramType } from "./visualizations.ts";
2
+ export type { ChartTemplate, DiagramType } from "./visualizations.ts";
3
+
4
+ export const compositionSchema = "konpeki-composition/v18" as const;
5
+ export const legacyCompositionSchemas = [
6
+ "konpeki-composition/v1",
7
+ "konpeki-composition/v2",
8
+ "konpeki-composition/v3",
9
+ "konpeki-composition/v4",
10
+ "konpeki-composition/v5",
11
+ "konpeki-composition/v6",
12
+ "konpeki-composition/v7",
13
+ "konpeki-composition/v8",
14
+ "konpeki-composition/v9",
15
+ "konpeki-composition/v10",
16
+ "konpeki-composition/v11",
17
+ "konpeki-composition/v12",
18
+ "konpeki-composition/v13",
19
+ "konpeki-composition/v14",
20
+ "konpeki-composition/v15",
21
+ "konpeki-composition/v16",
22
+ "konpeki-composition/v17",
23
+ ] as const;
24
+ export type CanvasSize = { width: number; height: number };
25
+ export const canvasSize = { width: 1920, height: 1080 } as const;
26
+ export const canvasPadding = {
27
+ top: 72,
28
+ right: 112,
29
+ bottom: 0,
30
+ left: 112,
31
+ } as const;
32
+ export const authoringModes = ["default", "dynamic"] as const;
33
+ export type AuthoringMode = (typeof authoringModes)[number];
34
+ export const themeIds = [
35
+ "plex",
36
+ "precision",
37
+ "editorial",
38
+ "blue-cyan",
39
+ "orange-coral",
40
+ "yellow",
41
+ "green",
42
+ "graphite",
43
+ ] as const;
44
+ export type ThemeId = (typeof themeIds)[number];
45
+ export const themeModes = ["paper", "night"] as const;
46
+ export type ThemeMode = (typeof themeModes)[number];
47
+ export type Rect = { x: number; y: number; width: number; height: number };
48
+ export type Alignment = "start" | "center" | "end";
49
+ export type TitleStyle = "plain" | "prominent";
50
+ export type BorderTreatment = "none" | "outline" | "filled";
51
+ export type TextColor = "ink" | "muted" | "accent";
52
+ export type TextLayout =
53
+ | "single"
54
+ | "two-column"
55
+ | "three-column"
56
+ | "two-plus-two"
57
+ | "four-column"
58
+ | "one-plus-three"
59
+ | "three-plus-one";
60
+ export type TextPurpose = "narrative" | "comparison" | "emphasis";
61
+ export type TextTreatment = "plain" | "subtle" | "strong";
62
+ export type TextLogicalOrder =
63
+ | "none"
64
+ | "parallel"
65
+ | "progressive"
66
+ | "cyclical"
67
+ | "general-to-specific"
68
+ | "hierarchical";
69
+ export type TextRole = "title" | "subtitle" | "body" | "caption" | "footnote";
70
+ export type ColorScheme =
71
+ | "monochrome"
72
+ | "accent-with-muted-context"
73
+ | "categorical"
74
+ | "sequential"
75
+ | "status";
76
+ export type Density = "sparse" | "standard";
77
+ export type Emphasis = "none" | "primary" | "latest-series" | "exception";
78
+ export const vectorElementKinds = [
79
+ "g",
80
+ "rect",
81
+ "circle",
82
+ "ellipse",
83
+ "line",
84
+ "polyline",
85
+ "polygon",
86
+ "path",
87
+ "text",
88
+ "tspan",
89
+ ] as const;
90
+ export type VectorElementKind = (typeof vectorElementKinds)[number];
91
+ export type VectorElement = {
92
+ id: string;
93
+ kind: VectorElementKind;
94
+ parentId?: string;
95
+ attributes: Record<string, string | number>;
96
+ text?: string;
97
+ };
98
+ type VisualBase = {
99
+ viewBox: { x: number; y: number; width: number; height: number };
100
+ description: string;
101
+ fit?: "contain" | "cover" | "stretch";
102
+ };
103
+ export type CustomVisual = VisualBase & (
104
+ | { format: "vector"; elements: VectorElement[] }
105
+ | { format: "svg"; source: string }
106
+ );
107
+ type ComponentBase = {
108
+ id: string;
109
+ preferredRect: Rect;
110
+ slotIds: string[];
111
+ intent?: string;
112
+ customVisual?: CustomVisual;
113
+ };
114
+ export type TextBlockComponent = ComponentBase & {
115
+ kind: "text-block";
116
+ content?: string;
117
+ textStyle?: {
118
+ size?: number;
119
+ weight?: 400 | 500 | 600;
120
+ lineHeight?: number;
121
+ color?: "ink" | "muted" | "accent";
122
+ font?: "heading" | "body";
123
+ };
124
+ appearance: {
125
+ role: TextRole;
126
+ alignment?: Alignment;
127
+ border?: BorderTreatment;
128
+ layout?: TextLayout;
129
+ orientation?: "horizontal" | "vertical";
130
+ purpose?: TextPurpose;
131
+ treatment?: TextTreatment;
132
+ logicalOrder?: TextLogicalOrder;
133
+ titleStyle?: TitleStyle;
134
+ rule?: "none" | "top" | "bottom";
135
+ };
136
+ };
137
+ type ChartAppearance = {
138
+ selection?: "auto" | "explicit";
139
+ border?: BorderTreatment;
140
+ colorScheme?: ColorScheme;
141
+ orientation?: "horizontal" | "vertical";
142
+ emphasis?: Emphasis;
143
+ density?: Density;
144
+ legend?: "none" | "top" | "right" | "bottom";
145
+ };
146
+ export type ChartComponent = ComponentBase & ({
147
+ kind: "chart";
148
+ appearance: ChartAppearance & { template: "sankey" };
149
+ topology?: ExplicitTopology;
150
+ } | {
151
+ kind: "chart";
152
+ appearance: ChartAppearance & {
153
+ template: Exclude<ChartTemplate, "sankey">;
154
+ };
155
+ topology?: never;
156
+ });
157
+ export type ExplicitTopology = {
158
+ kind: "explicit";
159
+ nodes: {
160
+ id: string;
161
+ slotId: string;
162
+ visible?: boolean;
163
+ preferredRect?: Rect;
164
+ primitive?:
165
+ | {
166
+ kind: "shape";
167
+ shape: "rectangle" | "rounded-rectangle" | "circle" | "line";
168
+ color?: TextColor;
169
+ fill?: "none" | "solid" | "wash";
170
+ }
171
+ | {
172
+ kind: "icon";
173
+ name?: string;
174
+ style?: "outline" | "filled";
175
+ color?: TextColor;
176
+ };
177
+ }[];
178
+ edges: { from: string; to: string; label?: string }[];
179
+ };
180
+ export type DiagramComponent = ComponentBase & {
181
+ kind: "diagram";
182
+ appearance: {
183
+ type: DiagramType;
184
+ selection?: "auto" | "explicit";
185
+ border?: BorderTreatment;
186
+ colorScheme?: ColorScheme;
187
+ emphasis?: Emphasis;
188
+ density?: Density;
189
+ };
190
+ topology?: ExplicitTopology;
191
+ };
192
+ export type ImageComponent = ComponentBase & {
193
+ kind: "image";
194
+ appearance?: {
195
+ border?: BorderTreatment;
196
+ fit?: "cover" | "contain";
197
+ };
198
+ };
199
+ export type TableComponent = ComponentBase & {
200
+ kind: "table";
201
+ appearance?: {
202
+ header?: "none" | "row" | "column" | "both";
203
+ grid?: "none" | "rows" | "all";
204
+ border?: BorderTreatment;
205
+ colorScheme?: ColorScheme;
206
+ density?: Density;
207
+ };
208
+ };
209
+ export type CompositionComponent =
210
+ | TextBlockComponent
211
+ | ChartComponent
212
+ | DiagramComponent
213
+ | ImageComponent
214
+ | TableComponent;
215
+ export const componentKinds = [
216
+ "text-block",
217
+ "chart",
218
+ "diagram",
219
+ "image",
220
+ "table",
221
+ ] as const satisfies readonly CompositionComponent["kind"][];
222
+ export type ContentSlotRole =
223
+ | "takeaway"
224
+ | "body"
225
+ | "evidence"
226
+ | "comparison-item"
227
+ | "process-step"
228
+ | "entity"
229
+ | "qualification"
230
+ | "source"
231
+ | "image"
232
+ | "table";
233
+ type ContentSlotBase = {
234
+ id: string;
235
+ label: string;
236
+ required: boolean;
237
+ instruction: string;
238
+ };
239
+ export type ContentSlot =
240
+ | (ContentSlotBase & {
241
+ role: Exclude<ContentSlotRole, "qualification" | "source">;
242
+ })
243
+ | (ContentSlotBase & { role: "qualification" | "source"; targets: string[] });
244
+ export type ManipulationGroup = {
245
+ id: string;
246
+ label?: string;
247
+ childIds: string[];
248
+ };
249
+ export type ReadingOrderEntry =
250
+ { kind: "component"; id: string } | { kind: "group"; id: string };
251
+ export type RelationshipEndpoint = { nodeId: string; slotId?: string };
252
+ export type SemanticRelationship = {
253
+ id: string;
254
+ kind:
255
+ "flows-to" | "qualifies" | "compares-with" | "depends-on" | "connects-to";
256
+ direction: "forward" | "bidirectional" | "undirected";
257
+ from: RelationshipEndpoint;
258
+ to: RelationshipEndpoint;
259
+ label?: string;
260
+ };
261
+ export type CompositionSlide = {
262
+ id: string;
263
+ name: string;
264
+ canvas: CanvasSize;
265
+ innerPadding?: { top: number; right: number; bottom: number; left: number };
266
+ pageNumber?: {
267
+ style: "none" | "01" | "01/02";
268
+ color: TextColor;
269
+ };
270
+ audience: string;
271
+ question: string;
272
+ intendedViewingSize: "presentation" | "social" | "article" | "custom";
273
+ contentSlots: ContentSlot[];
274
+ components: CompositionComponent[];
275
+ groups: ManipulationGroup[];
276
+ readingOrder: ReadingOrderEntry[];
277
+ paintOrder: string[];
278
+ relationships: SemanticRelationship[];
279
+ };
280
+ export type CompositionDocument = {
281
+ schema: typeof compositionSchema;
282
+ title: string;
283
+ authoringMode?: AuthoringMode;
284
+ theme?: { id: ThemeId; mode: ThemeMode };
285
+ slides: CompositionSlide[];
286
+ };