@popcraft/kit 0.3.0 → 0.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popcraft/kit",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "The PopCraft design kit: the library PopCraft templates and design scripts are written with — brand roles, text styles, layout, components, motion and music — with its helpers, design checks, a sandboxed script runner and .popcraft output.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://popcraft.app/docs/api/design-reference",
@@ -0,0 +1,14 @@
1
+ import type { Template } from './types.js';
2
+ export interface TemplateUpload {
3
+ meta: Record<string, unknown> & {
4
+ localId: string;
5
+ name: string;
6
+ kind: string;
7
+ category: string;
8
+ };
9
+ payload: Template['payload'];
10
+ }
11
+ /** `t` as the body that saves it; `meta.localId` (its id) is what makes a second save update the first. */
12
+ export declare function templateUploadBody(t: Template, opts?: {
13
+ workspaceId?: string;
14
+ }): TemplateUpload;
@@ -1,5 +1,6 @@
1
1
  import type { Document } from '../../../lib/document/types.js';
2
2
  import { type DesignIssue } from '../../../lib/agent/design-script/check.js';
3
+ import { type TemplateUpload } from '../../../lib/templates/upload.js';
3
4
  export { Kit, hex, preset } from '../../../templates/src/kit.js';
4
5
  export type * from '../../../templates/src/kit.js';
5
6
  export { ease } from '../../../lib/motion/author.js';
@@ -23,6 +24,7 @@ export * as effects from '../../../templates/src/effects/shared.js';
23
24
  export { loadKitModules, HELPER_NAMES } from '../../../lib/agent/design-script/kit-modules.js';
24
25
  export { checkDesign, MAX_FRAME_PX, type DesignIssue } from '../../../lib/agent/design-script/check.js';
25
26
  export type { Document } from '../../../lib/document/types.js';
27
+ export type { TemplateUpload } from '../../../lib/templates/upload.js';
26
28
  /** Every shipped music track's tempo, as plain numbers (the `TRACKS` a design script sees). */
27
29
  export declare function tracks(): Promise<Record<string, {
28
30
  bpm: number;
@@ -57,3 +59,19 @@ export declare function runDesign(source: string, options?: {
57
59
  export declare const toPopcraft: (document: Document) => string;
58
60
  /** Read the text of a .popcraft file; null when it is not one. */
59
61
  export declare const fromPopcraft: (text: string) => Document | null;
62
+ /**
63
+ * A built design as a template for an account: what `template.json` holds, which `popcraft publish <folder>` uploads
64
+ * (POST /templates; private until you list it) and the editor's Save as template sends. Every frame is a size of the
65
+ * template. `id` is yours and stays the same: publishing again with it updates the template instead of adding one.
66
+ */
67
+ export declare function toTemplate(document: Document, meta: {
68
+ id: string;
69
+ name: string;
70
+ description?: string;
71
+ category?: string;
72
+ tags?: string[];
73
+ thumbnail?: string;
74
+ }, options?: {
75
+ breakpoints?: boolean;
76
+ sequence?: boolean;
77
+ }): TemplateUpload;