@bendyline/squisq 2.11.9 → 2.11.10

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 (31) hide show
  1. package/dist/{Doc-DmElSKmg.d.ts → Doc-BWtfp7dT.d.ts} +207 -3
  2. package/dist/{ImageEditDoc-Dm_BETxC.d.ts → ImageEditDoc-CYRQK8so.d.ts} +1 -1
  3. package/dist/{chunk-YNO6JV36.js → chunk-2SRF5III.js} +4 -4
  4. package/dist/{chunk-DTM4FG7S.js → chunk-7WN7DDMI.js} +1 -1
  5. package/dist/{chunk-QDA7NXDO.js → chunk-BVQZCKXN.js} +2 -2
  6. package/dist/{chunk-VRTXPGP7.js → chunk-CPQCZUBW.js} +98 -4
  7. package/dist/{chunk-B5STNW6C.js → chunk-HVJ6VFDX.js} +2 -2
  8. package/dist/{chunk-PCCQLD3G.js → chunk-PFH3WV6J.js} +143 -3
  9. package/dist/{chunk-2PGC4JDT.js → chunk-PWCIJHZH.js} +1 -1
  10. package/dist/{chunk-CCRBHFNO.js → chunk-RV5OOBSV.js} +2 -2
  11. package/dist/{chunk-QOVINAB2.js → chunk-TYW5VMNP.js} +366 -111
  12. package/dist/doc/index.d.ts +103 -6
  13. package/dist/doc/index.js +31 -5
  14. package/dist/fence/index.d.ts +1 -1
  15. package/dist/generate/index.d.ts +1 -1
  16. package/dist/imageEdit/index.d.ts +3 -3
  17. package/dist/index.d.ts +5 -5
  18. package/dist/index.js +47 -9
  19. package/dist/jsonForm/index.d.ts +1 -1
  20. package/dist/jsonForm/index.js +4 -4
  21. package/dist/{materializePageSection-BfttC9Zj.d.ts → materializePageSection-Db7pABI0.d.ts} +1 -1
  22. package/dist/mediaEdit/index.d.ts +2 -2
  23. package/dist/narration/index.d.ts +1 -1
  24. package/dist/narration/index.js +4 -4
  25. package/dist/schemas/index.d.ts +4 -4
  26. package/dist/schemas/index.js +15 -3
  27. package/dist/{themeLibrary-ChnTImby.d.ts → themeLibrary-Bphz1CRp.d.ts} +1 -1
  28. package/dist/timing/index.d.ts +1 -1
  29. package/dist/transform/index.d.ts +2 -2
  30. package/dist/transform/index.js +3 -3
  31. package/package.json +1 -1
@@ -2,6 +2,97 @@ import {
2
2
  isTransitionType
3
3
  } from "./chunk-4VOD55SX.js";
4
4
 
5
+ // src/schemas/Motion.ts
6
+ var MOTION_PROFILE_NAMES = ["calm", "documentary", "vibrant"];
7
+ var FRONTMATTER_MOTION_KEY = "squisq-motion";
8
+ var OVERSHOOT_EASING = "cubic-bezier(0.34, 1.4, 0.64, 1)";
9
+ var SETTLE_EASING = "cubic-bezier(0.22, 1, 0.36, 1)";
10
+ var MOTION_PROFILES = Object.freeze({
11
+ calm: Object.freeze({
12
+ name: "calm",
13
+ textEntrance: Object.freeze({ type: "fadeIn", duration: 1, delayScale: 1 }),
14
+ chartGrowth: false,
15
+ chartGrowthDuration: 1,
16
+ countUp: false,
17
+ countUpDuration: 1.5,
18
+ diagramBuild: false,
19
+ photoGridStagger: 0,
20
+ coverWordReveal: false
21
+ }),
22
+ documentary: Object.freeze({
23
+ name: "documentary",
24
+ textEntrance: Object.freeze({
25
+ type: "fadeInUp",
26
+ duration: 0.8,
27
+ easing: SETTLE_EASING,
28
+ delayScale: 1
29
+ }),
30
+ chartGrowth: true,
31
+ chartGrowthDuration: 1.1,
32
+ countUp: true,
33
+ countUpDuration: 1.6,
34
+ diagramBuild: true,
35
+ photoGridStagger: 0.22,
36
+ coverWordReveal: false
37
+ }),
38
+ vibrant: Object.freeze({
39
+ name: "vibrant",
40
+ textEntrance: Object.freeze({
41
+ type: "fadeInUp",
42
+ duration: 0.55,
43
+ easing: OVERSHOOT_EASING,
44
+ delayScale: 0.8
45
+ }),
46
+ chartGrowth: true,
47
+ chartGrowthDuration: 0.9,
48
+ countUp: true,
49
+ countUpDuration: 1.2,
50
+ diagramBuild: true,
51
+ photoGridStagger: 0.16,
52
+ coverWordReveal: false
53
+ })
54
+ });
55
+ function isMotionProfileName(value) {
56
+ return typeof value === "string" && MOTION_PROFILE_NAMES.includes(value);
57
+ }
58
+ function resolveMotionProfile(spec, fallback = "calm") {
59
+ if (spec == null) return MOTION_PROFILES[fallback];
60
+ if (typeof spec === "string") {
61
+ return MOTION_PROFILES[isMotionProfileName(spec) ? spec : fallback];
62
+ }
63
+ if (typeof spec !== "object") return MOTION_PROFILES[fallback];
64
+ const named = spec;
65
+ const baseName = isMotionProfileName(named.profile) ? named.profile : isMotionProfileName(named.name) ? named.name : fallback;
66
+ const base = MOTION_PROFILES[baseName];
67
+ const { profile: _profile, name: _name, ...overrides } = spec;
68
+ const merged = { ...base };
69
+ for (const [key, value] of Object.entries(overrides)) {
70
+ if (value === void 0) continue;
71
+ if (key === "textEntrance" && typeof value === "object" && value !== null) {
72
+ merged.textEntrance = { ...base.textEntrance, ...value };
73
+ } else if (key in base && typeof value === typeof base[key]) {
74
+ merged[key] = value;
75
+ }
76
+ }
77
+ return merged;
78
+ }
79
+ function readFrontmatterMotion(frontmatter) {
80
+ if (!frontmatter) return void 0;
81
+ const raw = frontmatter[FRONTMATTER_MOTION_KEY] ?? frontmatter.motion;
82
+ if (typeof raw === "string") {
83
+ const trimmed = raw.trim();
84
+ return isMotionProfileName(trimmed) ? trimmed : void 0;
85
+ }
86
+ if (raw && typeof raw === "object" && !Array.isArray(raw)) return raw;
87
+ return void 0;
88
+ }
89
+ function resolveMotionForDoc(doc, theme, explicit) {
90
+ const themeName = theme?.renderStyle.motionProfile;
91
+ const themeDefault = isMotionProfileName(themeName) ? themeName : "calm";
92
+ const spec = explicit ?? doc?.motion ?? readFrontmatterMotion(doc?.frontmatter);
93
+ return resolveMotionProfile(spec, themeDefault);
94
+ }
95
+
5
96
  // src/schemas/Viewport.ts
6
97
  var VIEWPORT_PRESETS = {
7
98
  /** 16:9 landscape (default, 1080p) */
@@ -130,7 +221,7 @@ var DEFAULT_TITLE_FONT = 'Georgia, "Times New Roman", serif';
130
221
  function isTemplateBlock(block) {
131
222
  return "template" in block && typeof block.template === "string";
132
223
  }
133
- function createTemplateContext(theme, blockIndex, totalBlocks, viewport = VIEWPORT_PRESETS.landscape) {
224
+ function createTemplateContext(theme, blockIndex, totalBlocks, viewport = VIEWPORT_PRESETS.landscape, options = {}) {
134
225
  const orientation = getViewportOrientation(viewport);
135
226
  const overrides = theme.renderStyle.layoutOverrides;
136
227
  const baseLayout = getLayoutHints(orientation);
@@ -141,7 +232,8 @@ function createTemplateContext(theme, blockIndex, totalBlocks, viewport = VIEWPO
141
232
  viewport,
142
233
  fontScale: calculateFontScale(viewport),
143
234
  orientation,
144
- layout: overrides ? { ...baseLayout, ...overrides } : baseLayout
235
+ layout: overrides ? { ...baseLayout, ...overrides } : baseLayout,
236
+ motion: resolveMotionForDoc(null, theme, options.motion)
145
237
  };
146
238
  }
147
239
  function scaledFontSize2(basePx, context, isTitle = false) {
@@ -172,8 +264,18 @@ var ANIMATION_TYPES = /* @__PURE__ */ new Set([
172
264
  "zoomOut",
173
265
  "panLeft",
174
266
  "panRight",
175
- "typewriter"
267
+ "typewriter",
268
+ "fadeInUp",
269
+ "slideIn",
270
+ "wordReveal",
271
+ "countUp",
272
+ "drawOn",
273
+ "grow",
274
+ "reveal",
275
+ "drift",
276
+ "tween"
176
277
  ]);
278
+ var MOTION_ORIGINS = ["center", "left", "right", "top", "bottom"];
177
279
  var TemplateValidator = class {
178
280
  constructor() {
179
281
  this.errors = [];
@@ -256,6 +358,30 @@ function validateAnimation(v, value, path) {
256
358
  optionalString(v, value, "easing", path);
257
359
  optionalEnum(v, value, "direction", path, ["in", "out"]);
258
360
  optionalEnum(v, value, "panDirection", path, ["left", "right", "up", "down"]);
361
+ optionalEnum(v, value, "origin", path, MOTION_ORIGINS);
362
+ optionalEnum(v, value, "shape", path, ["wipe", "iris"]);
363
+ optionalNumber(v, value, "stagger", path);
364
+ if (value.wordTimes !== void 0) {
365
+ if (!Array.isArray(value.wordTimes) || value.wordTimes.some((t) => typeof t !== "number")) {
366
+ v.error(`${path}.wordTimes`, "expected array of numbers");
367
+ }
368
+ }
369
+ const count = value.count;
370
+ if (count !== void 0 && v.object(count, `${path}.count`)) {
371
+ if (typeof count.to !== "number") v.error(`${path}.count.to`, "expected number");
372
+ optionalNumber(v, count, "from", `${path}.count`);
373
+ optionalNumber(v, count, "decimals", `${path}.count`);
374
+ optionalString(v, count, "prefix", `${path}.count`);
375
+ optionalString(v, count, "suffix", `${path}.count`);
376
+ }
377
+ for (const key of ["fromState", "toState"]) {
378
+ const state = value[key];
379
+ if (state !== void 0 && v.object(state, `${path}.${key}`)) {
380
+ for (const field of ["scale", "x", "y", "opacity", "rotate"]) {
381
+ optionalNumber(v, state, field, `${path}.${key}`);
382
+ }
383
+ }
384
+ }
259
385
  }
260
386
  function validateRepeat(v, value, path) {
261
387
  if (!v.object(value, path)) return;
@@ -993,6 +1119,9 @@ var V = class {
993
1119
  if (v.ambientMotion !== void 0 && !this.isBoolean(v.ambientMotion)) {
994
1120
  this.err(`${path}.ambientMotion`, "expected boolean");
995
1121
  }
1122
+ if (v.motionProfile !== void 0 && !isMotionProfileName(v.motionProfile)) {
1123
+ this.err(`${path}.motionProfile`, "expected calm | documentary | vibrant");
1124
+ }
996
1125
  for (const k of ["defaultTextAnimation", "defaultImageAnimation"]) {
997
1126
  if (v[k] !== void 0 && !this.isString(v[k])) {
998
1127
  this.err(`${path}.${k}`, "expected animation type string");
@@ -1704,6 +1833,7 @@ var documentary_default = {
1704
1833
  defaultTextAnimation: "fadeIn",
1705
1834
  defaultImageAnimation: "slowZoom",
1706
1835
  ambientMotion: true,
1836
+ motionProfile: "documentary",
1707
1837
  defaultTransition: {
1708
1838
  type: "fade",
1709
1839
  duration: 0.8
@@ -1902,6 +2032,7 @@ var bold_default = {
1902
2032
  defaultTextAnimation: "zoomIn",
1903
2033
  defaultImageAnimation: "slowZoom",
1904
2034
  ambientMotion: true,
2035
+ motionProfile: "vibrant",
1905
2036
  defaultTransition: { type: "dissolve", duration: 0.5 },
1906
2037
  templateHints: {
1907
2038
  statHighlight: { entrance: "dramatic" },
@@ -2111,6 +2242,7 @@ var tech_dark_default = {
2111
2242
  defaultTextAnimation: "typewriter",
2112
2243
  defaultImageAnimation: "slowZoom",
2113
2244
  ambientMotion: true,
2245
+ motionProfile: "vibrant",
2114
2246
  defaultTransition: {
2115
2247
  type: "dissolve",
2116
2248
  duration: 0.4
@@ -2380,6 +2512,7 @@ var cinematic_default = {
2380
2512
  defaultTextAnimation: "fadeIn",
2381
2513
  defaultImageAnimation: "slowZoom",
2382
2514
  ambientMotion: true,
2515
+ motionProfile: "documentary",
2383
2516
  defaultTransition: {
2384
2517
  type: "dissolve",
2385
2518
  duration: 1.2
@@ -2516,6 +2649,7 @@ var warm_earth_default = {
2516
2649
  defaultTextAnimation: "fadeIn",
2517
2650
  defaultImageAnimation: "panLeft",
2518
2651
  ambientMotion: true,
2652
+ motionProfile: "documentary",
2519
2653
  defaultTransition: { type: "fade", duration: 0.9 }
2520
2654
  },
2521
2655
  colorSchemes: {
@@ -2965,6 +3099,12 @@ function matchFontFamily(name) {
2965
3099
  }
2966
3100
 
2967
3101
  export {
3102
+ FRONTMATTER_MOTION_KEY,
3103
+ MOTION_PROFILES,
3104
+ isMotionProfileName,
3105
+ resolveMotionProfile,
3106
+ readFrontmatterMotion,
3107
+ resolveMotionForDoc,
2968
3108
  VIEWPORT_PRESETS,
2969
3109
  getViewport,
2970
3110
  calculateFontScale,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  flattenRenderableBlocks,
3
3
  getBlockBodyText
4
- } from "./chunk-QOVINAB2.js";
4
+ } from "./chunk-TYW5VMNP.js";
5
5
  import {
6
6
  estimateSpokenWordCount
7
7
  } from "./chunk-GHOPHGOK.js";
@@ -5,11 +5,11 @@ import {
5
5
  } from "./chunk-SVN7T6BK.js";
6
6
  import {
7
7
  markdownToDoc
8
- } from "./chunk-QOVINAB2.js";
8
+ } from "./chunk-TYW5VMNP.js";
9
9
  import {
10
10
  cloneAndFreezeData,
11
11
  isTemplateBlock
12
- } from "./chunk-PCCQLD3G.js";
12
+ } from "./chunk-PFH3WV6J.js";
13
13
  import {
14
14
  parseMarkdown
15
15
  } from "./chunk-HUXK7EOT.js";