@motionscript/layout-grid 0.0.0-stage → 0.1.0-alpha.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 (132) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/LICENSE +201 -0
  3. package/dist/browser/chunks/chunk-PB3E5HQV.js +2 -0
  4. package/dist/browser/chunks/chunk-PB3E5HQV.js.map +7 -0
  5. package/dist/browser/index.js +2 -0
  6. package/dist/browser/index.js.map +7 -0
  7. package/dist/browser/kit.js +2 -0
  8. package/dist/browser/kit.js.map +7 -0
  9. package/dist/browser/manifest.json +12 -0
  10. package/dist/engine.d.ts +13 -0
  11. package/dist/engine.d.ts.map +1 -0
  12. package/dist/engine.js +13 -0
  13. package/dist/engine.js.map +1 -0
  14. package/dist/index.d.ts +7 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +7 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/kit/index.d.ts +7 -0
  19. package/dist/kit/index.d.ts.map +1 -0
  20. package/dist/kit/index.js +7 -0
  21. package/dist/kit/index.js.map +1 -0
  22. package/dist/kit/item-effects.d.ts +37 -0
  23. package/dist/kit/item-effects.d.ts.map +1 -0
  24. package/dist/kit/item-effects.js +76 -0
  25. package/dist/kit/item-effects.js.map +1 -0
  26. package/dist/kit/layout-grid.d.ts +243 -0
  27. package/dist/kit/layout-grid.d.ts.map +1 -0
  28. package/dist/kit/layout-grid.js +542 -0
  29. package/dist/kit/layout-grid.js.map +1 -0
  30. package/dist/kit/order.d.ts +13 -0
  31. package/dist/kit/order.d.ts.map +1 -0
  32. package/dist/kit/order.js +43 -0
  33. package/dist/kit/order.js.map +1 -0
  34. package/dist/kit/random.d.ts +7 -0
  35. package/dist/kit/random.d.ts.map +1 -0
  36. package/dist/kit/random.js +29 -0
  37. package/dist/kit/random.js.map +1 -0
  38. package/dist/kit/slots/index.d.ts +22 -0
  39. package/dist/kit/slots/index.d.ts.map +1 -0
  40. package/dist/kit/slots/index.js +28 -0
  41. package/dist/kit/slots/index.js.map +1 -0
  42. package/dist/kit/slots/path-templates.d.ts +15 -0
  43. package/dist/kit/slots/path-templates.d.ts.map +1 -0
  44. package/dist/kit/slots/path-templates.js +113 -0
  45. package/dist/kit/slots/path-templates.js.map +1 -0
  46. package/dist/kit/slots/path.d.ts +45 -0
  47. package/dist/kit/slots/path.d.ts.map +1 -0
  48. package/dist/kit/slots/path.js +87 -0
  49. package/dist/kit/slots/path.js.map +1 -0
  50. package/dist/kit/slots/radial.d.ts +30 -0
  51. package/dist/kit/slots/radial.d.ts.map +1 -0
  52. package/dist/kit/slots/radial.js +45 -0
  53. package/dist/kit/slots/radial.js.map +1 -0
  54. package/dist/kit/slots/rectangular.d.ts +42 -0
  55. package/dist/kit/slots/rectangular.d.ts.map +1 -0
  56. package/dist/kit/slots/rectangular.js +79 -0
  57. package/dist/kit/slots/rectangular.js.map +1 -0
  58. package/dist/kit/slots/slot.d.ts +62 -0
  59. package/dist/kit/slots/slot.d.ts.map +1 -0
  60. package/dist/kit/slots/slot.js +41 -0
  61. package/dist/kit/slots/slot.js.map +1 -0
  62. package/dist/kit/slots/sphere.d.ts +36 -0
  63. package/dist/kit/slots/sphere.d.ts.map +1 -0
  64. package/dist/kit/slots/sphere.js +68 -0
  65. package/dist/kit/slots/sphere.js.map +1 -0
  66. package/dist/kit/stagger.d.ts +24 -0
  67. package/dist/kit/stagger.d.ts.map +1 -0
  68. package/dist/kit/stagger.js +90 -0
  69. package/dist/kit/stagger.js.map +1 -0
  70. package/dist/nodes.d.ts +15 -0
  71. package/dist/nodes.d.ts.map +1 -0
  72. package/dist/nodes.js +15 -0
  73. package/dist/nodes.js.map +1 -0
  74. package/dist/path-grid/index.d.ts +2 -0
  75. package/dist/path-grid/index.d.ts.map +1 -0
  76. package/dist/path-grid/index.js +2 -0
  77. package/dist/path-grid/index.js.map +1 -0
  78. package/dist/path-grid/path-grid.d.ts +82 -0
  79. package/dist/path-grid/path-grid.d.ts.map +1 -0
  80. package/dist/path-grid/path-grid.js +192 -0
  81. package/dist/path-grid/path-grid.js.map +1 -0
  82. package/dist/radial-grid/index.d.ts +2 -0
  83. package/dist/radial-grid/index.d.ts.map +1 -0
  84. package/dist/radial-grid/index.js +2 -0
  85. package/dist/radial-grid/index.js.map +1 -0
  86. package/dist/radial-grid/radial-grid.d.ts +51 -0
  87. package/dist/radial-grid/radial-grid.d.ts.map +1 -0
  88. package/dist/radial-grid/radial-grid.js +95 -0
  89. package/dist/radial-grid/radial-grid.js.map +1 -0
  90. package/dist/rectangular-grid/index.d.ts +2 -0
  91. package/dist/rectangular-grid/index.d.ts.map +1 -0
  92. package/dist/rectangular-grid/index.js +2 -0
  93. package/dist/rectangular-grid/index.js.map +1 -0
  94. package/dist/rectangular-grid/rectangular-grid.d.ts +79 -0
  95. package/dist/rectangular-grid/rectangular-grid.d.ts.map +1 -0
  96. package/dist/rectangular-grid/rectangular-grid.js +156 -0
  97. package/dist/rectangular-grid/rectangular-grid.js.map +1 -0
  98. package/dist/sphere-grid/index.d.ts +2 -0
  99. package/dist/sphere-grid/index.d.ts.map +1 -0
  100. package/dist/sphere-grid/index.js +2 -0
  101. package/dist/sphere-grid/index.js.map +1 -0
  102. package/dist/sphere-grid/sphere-grid.d.ts +68 -0
  103. package/dist/sphere-grid/sphere-grid.d.ts.map +1 -0
  104. package/dist/sphere-grid/sphere-grid.js +149 -0
  105. package/dist/sphere-grid/sphere-grid.js.map +1 -0
  106. package/package.json +69 -3
  107. package/registry.json +32 -0
  108. package/src/engine.ts +12 -0
  109. package/src/index.ts +6 -0
  110. package/src/kit/index.ts +6 -0
  111. package/src/kit/item-effects.ts +114 -0
  112. package/src/kit/layout-grid.ts +605 -0
  113. package/src/kit/order.ts +41 -0
  114. package/src/kit/random.ts +29 -0
  115. package/src/kit/slots/index.ts +39 -0
  116. package/src/kit/slots/path-templates.ts +120 -0
  117. package/src/kit/slots/path.ts +120 -0
  118. package/src/kit/slots/radial.ts +62 -0
  119. package/src/kit/slots/rectangular.ts +108 -0
  120. package/src/kit/slots/slot.ts +82 -0
  121. package/src/kit/slots/sphere.ts +94 -0
  122. package/src/kit/stagger.ts +96 -0
  123. package/src/nodes.ts +15 -0
  124. package/src/path-grid/index.ts +1 -0
  125. package/src/path-grid/path-grid.ts +213 -0
  126. package/src/radial-grid/index.ts +1 -0
  127. package/src/radial-grid/radial-grid.ts +90 -0
  128. package/src/rectangular-grid/index.ts +1 -0
  129. package/src/rectangular-grid/rectangular-grid.ts +160 -0
  130. package/src/sphere-grid/index.ts +1 -0
  131. package/src/sphere-grid/sphere-grid.ts +143 -0
  132. package/README.md +0 -4
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/rectangular-grid/rectangular-grid.ts", "../../src/radial-grid/radial-grid.ts", "../../src/path-grid/path-grid.ts", "../../src/sphere-grid/sphere-grid.ts", "../../src/nodes.ts"],
4
+ "sourcesContent": ["import {\n command,\n easeInOut,\n node,\n property,\n type Command,\n type CommandArgs,\n type NodeConfig,\n type Size2D,\n} from \"@motionscript/core\"\n\nimport {\n CELL_MODES,\n contentBoxOf,\n FILL_DIRECTIONS,\n LINE_ALIGNS,\n LayoutGrid,\n rectangularCell,\n staggerArgs,\n TRANSITION_STAGGER,\n type CellMode,\n type FillDirection,\n type LayoutGridProps,\n type LineAlign,\n type RectangularArrangement,\n type StaggerArgs,\n} from \"../kit\"\n\nexport interface RectangularGridProps extends LayoutGridProps {\n columns: number\n fillDirection: FillDirection\n cellMode: CellMode\n cellWidth: number\n cellHeight: number\n columnGap: number\n rowGap: number\n lastLineAlign: LineAlign\n rowOffset: number\n columnOffset: number\n}\n\n/**\n * Children in rows and columns — the grid the other three are variations on.\n *\n * Cells are as big as the largest child (`fit`), a size of their own\n * (`fixed`), or an equal share of the node's box (`fill`), which is also the\n * room a child set to fill grows into. Shift every other row by half a cell\n * for a brick bond or a hex pack.\n */\n@node({\n key: \"rectangularGrid\",\n parentKey: \"node\",\n forkable: true,\n layout: {\n children: \"grid\",\n acceptsChildren: true,\n defaultWidthMode: \"hug\",\n defaultHeightMode: \"hug\",\n },\n})\nexport class RectangularGrid extends LayoutGrid<RectangularGridProps> {\n @property({ default: 3, min: 1, step: 1 }) declare columns: number\n @property({ default: \"row\", kind: \"enum\", options: FILL_DIRECTIONS }) declare fillDirection: FillDirection\n @property({ default: \"fit\", kind: \"enum\", options: CELL_MODES }) declare cellMode: CellMode\n @property({ default: 120, min: 0, step: 1 }) declare cellWidth: number\n @property({ default: 120, min: 0, step: 1 }) declare cellHeight: number\n @property({ default: 24, step: 1 }) declare columnGap: number\n @property({ default: 24, step: 1 }) declare rowGap: number\n @property({ default: \"start\", kind: \"enum\", options: LINE_ALIGNS }) declare lastLineAlign: LineAlign\n @property({ default: 0, min: -1, max: 1, step: 0.05 }) declare rowOffset: number\n @property({ default: 0, min: -1, max: 1, step: 0.05 }) declare columnOffset: number\n\n constructor(props?: NodeConfig<RectangularGrid, RectangularGridProps>) {\n super(props)\n }\n\n /** Re-flow the items into `columns` columns, each moving to its new cell. */\n @command({ args: [{ key: \"columns\", min: 1, step: 1, default: 4 }, ...staggerArgs(TRANSITION_STAGGER)] })\n columnsTo(args: CommandArgs<{ columns: number } & StaggerArgs> & { duration: number }): Command<RectangularGridProps> {\n const columns = Math.max(1, Math.round(args.data?.columns ?? this.columns))\n return this._transitionTo({ columns }, args)\n }\n\n /** Animate the spacing between columns and rows. */\n @command({ args: [{ key: \"columnGap\", default: 48 }, { key: \"rowGap\", default: 48 }] })\n gapTo(args: CommandArgs<{ columnGap?: number; rowGap?: number }> & { duration: number }): Command<RectangularGridProps> {\n const data: Partial<RectangularGridProps> = {}\n if (args.data?.columnGap !== undefined) data.columnGap = args.data.columnGap\n if (args.data?.rowGap !== undefined) data.rowGap = args.data.rowGap\n return this.to({ data, duration: args.duration, easing: args.easing })\n }\n\n /**\n * Animate the cell size, from whatever the cells measure now. The grid\n * switches to `fixed` cells as it starts, since a size of its own is what\n * `fixed` means.\n */\n @command({ args: [{ key: \"cellWidth\", min: 0, default: 160 }, { key: \"cellHeight\", min: 0, default: 160 }] })\n cellSizeTo(args: CommandArgs<{ cellWidth?: number; cellHeight?: number }> & { duration: number }): Command<RectangularGridProps> {\n const sizes = this._itemSizes()\n const from = rectangularCell(this.arrangementFor(), sizes.length, sizes, contentBoxOf(this))\n const width = args.data?.cellWidth ?? from.width\n const height = args.data?.cellHeight ?? from.height\n return this.command<RectangularGridProps>((t) => ({\n cellMode: \"fixed\",\n cellWidth: from.width + (width - from.width) * t,\n cellHeight: from.height + (height - from.height) * t,\n }), args.duration, args.easing ?? easeInOut(\"cubic\"))\n }\n\n /** Bring one row (from 0 at the top) forward and push the rest back. */\n @command({\n args: [\n { key: \"row\", min: 0, step: 1, default: 0 },\n { key: \"dim\", min: 0, max: 1, step: 0.05, default: 0.7 },\n { key: \"grow\", min: 0, max: 1, step: 0.05, default: 0.1 },\n ],\n })\n focusRow(args: CommandArgs<{ row?: number; dim?: number; grow?: number }> & { duration: number }): Command<LayoutGridProps> {\n const slots = this._itemSlots()\n const row = Math.round(args.data?.row ?? 0)\n return this._focusOn((i) => slots[i]?.meta.kind === \"rectangular\" && slots[i].meta.row === row, slots.length, args)\n }\n\n /** Bring one column (from 0 at the left) forward and push the rest back. */\n @command({\n args: [\n { key: \"column\", min: 0, step: 1, default: 0 },\n { key: \"dim\", min: 0, max: 1, step: 0.05, default: 0.7 },\n { key: \"grow\", min: 0, max: 1, step: 0.05, default: 0.1 },\n ],\n })\n focusColumn(args: CommandArgs<{ column?: number; dim?: number; grow?: number }> & { duration: number }): Command<LayoutGridProps> {\n const slots = this._itemSlots()\n const column = Math.round(args.data?.column ?? 0)\n return this._focusOn((i) => slots[i]?.meta.kind === \"rectangular\" && slots[i].meta.column === column, slots.length, args)\n }\n\n protected override arrangementFor(): RectangularArrangement {\n return {\n kind: \"rectangular\",\n columns: this.columns,\n fillDirection: this.fillDirection,\n cellMode: this.cellMode,\n cellWidth: this.cellWidth,\n cellHeight: this.cellHeight,\n columnGap: this.columnGap,\n rowGap: this.rowGap,\n lastLineAlign: this.lastLineAlign,\n rowOffset: this.rowOffset,\n columnOffset: this.columnOffset,\n }\n }\n\n /** A child set to fill takes its cell, where the cell is not simply the largest child. */\n protected override itemSpace(count: number, space: Size2D): Size2D {\n if (this.cellMode === \"fit\") return space\n return rectangularCell(this.arrangementFor(), count, [], space)\n }\n}\n", "import { command, node, property, type Command, type CommandArgs, type NodeConfig } from \"@motionscript/core\"\n\nimport {\n LayoutGrid,\n normalizeOrder,\n RADIAL_DIRECTIONS,\n radialTurnToTop,\n type LayoutGridProps,\n type RadialArrangement,\n type RadialDirection,\n} from \"../kit\"\n\nexport interface RadialGridProps extends LayoutGridProps {\n radius: number\n startAngle: number\n sweep: number\n direction: RadialDirection\n rotateItems: boolean\n spinSpeed: number\n}\n\n/**\n * Children round a circle, or along an arc of one.\n *\n * A full circle spaces the items evenly with none on top of another; an arc\n * puts one at each end. Angles run clockwise from twelve o'clock, so\n * {@link turnTo} can bring any item to the top like a dial.\n */\n@node({\n key: \"radialGrid\",\n parentKey: \"node\",\n forkable: true,\n layout: {\n children: \"flow\",\n acceptsChildren: true,\n defaultWidthMode: \"hug\",\n defaultHeightMode: \"hug\",\n },\n})\nexport class RadialGrid extends LayoutGrid<RadialGridProps> {\n @property({ default: 200, min: 0, step: 1 }) declare radius: number\n @property({ default: 0, step: 1, unit: \"°\" }) declare startAngle: number\n @property({ default: 360, min: -360, max: 360, step: 1, unit: \"°\" }) declare sweep: number\n @property({ default: \"clockwise\", kind: \"enum\", options: RADIAL_DIRECTIONS }) declare direction: RadialDirection\n @property({ default: false }) declare rotateItems: boolean\n @property({ default: 0, step: 1, unit: \"°/s\" }) declare spinSpeed: number\n\n constructor(props?: NodeConfig<RadialGrid, RadialGridProps>) {\n super(props)\n }\n\n /** Orbit the items round the centre by `degrees` — `360` is one full turn. */\n @command({ args: [{ key: \"degrees\", step: 15, unit: \"°\", default: 360 }] })\n spin(args: CommandArgs<{ degrees?: number }> & { duration: number }): Command<RadialGridProps> {\n const degrees = args.data?.degrees ?? 360\n return this.to({ data: { startAngle: this.startAngle + degrees }, duration: args.duration, easing: args.easing })\n }\n\n /** Turn the ring the shorter way round until an item (by its place in the layers) sits at the top. */\n @command({ args: [{ key: \"item\", min: 0, step: 1, default: 0 }] })\n turnTo(args: CommandArgs<{ item?: number }> & { duration: number }): Command<RadialGridProps> {\n const count = this._itemCount()\n const slot = normalizeOrder(this.order, count).indexOf(Math.round(args.data?.item ?? 0))\n const turn = slot < 0 ? 0 : radialTurnToTop(this.arrangementFor(), count, slot)\n return this.to({ data: { startAngle: this.startAngle + turn }, duration: args.duration, easing: args.easing })\n }\n\n @command({ args: [{ key: \"radius\", min: 0, default: 280 }] })\n radiusTo(args: CommandArgs<{ radius: number }> & { duration: number }): Command<RadialGridProps> {\n return this.to({ data: { radius: args.data?.radius ?? this.radius }, duration: args.duration, easing: args.easing })\n }\n\n /** Open or close the arc like a fan — from `0` to `360` is a reveal of its own. */\n @command({ args: [{ key: \"sweep\", min: -360, max: 360, unit: \"°\", default: 360 }] })\n sweepTo(args: CommandArgs<{ sweep: number }> & { duration: number }): Command<RadialGridProps> {\n return this.to({ data: { sweep: args.data?.sweep ?? this.sweep }, duration: args.duration, easing: args.easing })\n }\n\n protected override arrangementFor(): RadialArrangement {\n return {\n kind: \"radial\",\n radius: this.radius,\n startAngle: this.startAngle,\n sweep: this.sweep,\n direction: this.direction,\n rotateItems: this.rotateItems,\n spinSpeed: this.spinSpeed,\n }\n }\n}\n", "import {\n command,\n node,\n Path,\n pathOps,\n PathShape,\n pathProperty,\n property,\n type Command,\n type CommandArgs,\n type NodeConfig,\n type PathData,\n type Size2D,\n} from \"@motionscript/core\"\n\nimport {\n findNode2D,\n frameIn,\n LayoutGrid,\n PATH_SPACINGS,\n PATH_TEMPLATES,\n staggerArgs,\n TRANSITION_STAGGER,\n templatePath,\n type LayoutGridProps,\n type PathArrangement,\n type PathPlacement,\n type PathSpacing,\n type PathTemplate,\n type StaggerArgs,\n} from \"../kit\"\n\n/** A template, or `custom` for the grid's own {@link PathGrid.path}. */\nexport const PATH_GRID_SHAPES = [...PATH_TEMPLATES, \"custom\"] as const\nexport type PathGridShape = (typeof PATH_GRID_SHAPES)[number]\n\nexport interface PathGridProps extends LayoutGridProps {\n shape: PathGridShape\n path: PathData\n pathNode: string\n spacing: PathSpacing\n spacingDistance: number\n offset: number\n flowSpeed: number\n trimStart: number\n trimEnd: number\n alignToPath: boolean\n}\n\nconst AT_ORIGIN: PathPlacement = { originX: 0, originY: 0, x: 0, y: 0, rotation: 0, scale: 1 }\n\n/** The size a path grid is placed at when nothing says otherwise, since a template is drawn to fill it. */\nconst DEFAULT_SIZE = { width: 640, height: 400 }\n\n/**\n * Children along a path: one of the templates drawn to fill the node's box,\n * a path of the grid's own, or a `Path` node elsewhere in the scene, followed\n * wherever it is.\n *\n * Items are spaced by distance along the curve, so they sit evenly on a tight\n * bend and a straight alike. Animating {@link offset} moves them along it — on\n * a closed path they come round again, which is a conveyor belt for free.\n */\n@node({\n key: \"pathGrid\",\n parentKey: \"node\",\n forkable: true,\n layout: {\n children: \"flow\",\n acceptsChildren: true,\n defaultWidthMode: \"fixed\",\n defaultHeightMode: \"fixed\",\n defaultWidth: DEFAULT_SIZE.width,\n defaultHeight: DEFAULT_SIZE.height,\n },\n seed: { ...DEFAULT_SIZE },\n})\nexport class PathGrid extends LayoutGrid<PathGridProps> {\n @property({ default: \"circle\", kind: \"enum\", options: PATH_GRID_SHAPES }) declare shape: PathGridShape\n /** Used when {@link shape} is `custom`: an SVG path, y-down as SVG writes one, centred on its own bounds. */\n @pathProperty() declare path: PathData\n /** A path node to follow instead, by id — the items track it wherever it goes. */\n @property({ default: \"\", kind: \"nodeRef\", nodeTypes: [\"path\"], animatable: false }) declare pathNode: string\n @property({ default: \"distribute\", kind: \"enum\", options: PATH_SPACINGS }) declare spacing: PathSpacing\n @property({ default: 80, min: 0, step: 1 }) declare spacingDistance: number\n /** Share of the path the items are moved along — `1` is once round. */\n @property({ default: 0, step: 0.01 }) declare offset: number\n /** Share of the path per second the items travel on their own. */\n @property({ default: 0, step: 0.01, unit: \"/s\" }) declare flowSpeed: number\n @property({ default: 0, min: 0, max: 1, step: 0.01 }) declare trimStart: number\n @property({ default: 1, min: 0, max: 1, step: 0.01 }) declare trimEnd: number\n @property({ default: true }) declare alignToPath: boolean\n\n constructor(props?: NodeConfig<PathGrid, PathGridProps>) {\n super(props)\n }\n\n /** Move the items along the path by `loops` — `1` is once round, and they keep their spacing. */\n @command({ args: [{ key: \"loops\", step: 0.25, default: 1 }] })\n flow(args: CommandArgs<{ loops?: number }> & { duration: number }): Command<PathGridProps> {\n const loops = args.data?.loops ?? 1\n return this.to({ data: { offset: this.offset + loops }, duration: args.duration, easing: args.easing })\n }\n\n /** Squeeze the items into part of the path, between two shares of its length. */\n @command({\n args: [\n { key: \"trimStart\", min: 0, max: 1, step: 0.01, default: 0.25 },\n { key: \"trimEnd\", min: 0, max: 1, step: 0.01, default: 0.75 },\n ],\n })\n trimTo(args: CommandArgs<{ trimStart?: number; trimEnd?: number }> & { duration: number }): Command<PathGridProps> {\n return this.to({\n data: { trimStart: args.data?.trimStart ?? this.trimStart, trimEnd: args.data?.trimEnd ?? this.trimEnd },\n duration: args.duration,\n easing: args.easing,\n })\n }\n\n /**\n * Move the items onto another path — a template, or a `Path` node in the\n * scene. Each item travels from its place on the old path to its place on the\n * new one; the path itself is not morphed.\n */\n @command({\n args: [\n { key: \"shape\", kind: \"enum\", options: PATH_GRID_SHAPES, default: \"heart\" },\n { key: \"pathNode\", kind: \"nodeRef\", nodeTypes: [\"path\"] },\n ...staggerArgs(TRANSITION_STAGGER),\n ],\n })\n setPath(args: CommandArgs<{ shape?: PathGridShape; pathNode?: string } & StaggerArgs> & { duration: number }): Command<PathGridProps> {\n const pathNode = args.data?.pathNode ?? \"\"\n const changes: Partial<PathGridProps> = pathNode ? { pathNode } : { shape: args.data?.shape ?? this.shape, pathNode: \"\" }\n return this._transitionTo(changes, args)\n }\n\n protected override arrangementFor(box: Size2D): PathArrangement {\n const { path, placement } = this._pathIn(box)\n return {\n kind: \"path\",\n path,\n placement,\n spacing: this.spacing,\n spacingDistance: this.spacingDistance,\n offset: this.offset,\n flowSpeed: this.flowSpeed,\n trimStart: this.trimStart,\n trimEnd: this.trimEnd,\n alignToPath: this.alignToPath,\n }\n }\n\n // A template is drawn to fill the box, so a path grid needs one of its own\n // rather than hugging items whose places depend on it.\n protected override applyDefaultSize(props?: { readonly width?: unknown; readonly height?: unknown }): void {\n if (!props || props.width === undefined) this.applyProp(\"width\", DEFAULT_SIZE.width)\n if (!props || props.height === undefined) this.applyProp(\"height\", DEFAULT_SIZE.height)\n }\n\n private _linked: { data: PathData; width: number; height: number; path: PathData } | null = null\n\n /** The path the items follow, and where its coordinates land in this grid's frame. */\n private _pathIn(box: Size2D): { path: PathData; placement: PathPlacement } {\n const linked = this.pathNode ? findNode2D(this, this.pathNode) : null\n if (linked instanceof PathShape) {\n return { path: this._unitPath(linked), placement: { ...AT_ORIGIN, ...frameIn(this, linked) } }\n }\n if (linked instanceof Path && pathOps.bounds(linked.data)) {\n // A `Path` draws its data centred on the data's own bounds, at its own position.\n const bounds = pathOps.bounds(linked.data)!\n const frame = frameIn(this, linked)\n return {\n path: linked.data,\n placement: {\n originX: (bounds.minX + bounds.maxX) / 2,\n originY: (bounds.minY + bounds.maxY) / 2,\n ...frame,\n },\n }\n }\n if (this.shape === \"custom\") {\n const bounds = pathOps.bounds(this.path)\n if (bounds) {\n return {\n path: this.path,\n placement: {\n ...AT_ORIGIN,\n originX: (bounds.minX + bounds.maxX) / 2,\n originY: (bounds.minY + bounds.maxY) / 2,\n flipY: true,\n },\n }\n }\n }\n const template: PathTemplate = this.shape === \"custom\" ? \"circle\" : this.shape\n return { path: templatePath(template, box), placement: AT_ORIGIN }\n }\n\n /**\n * A path node's geometry as it draws it: stored in its unit box, y-down, and\n * scaled to its laid-out size — kept while neither changes, so the path's\n * measurement is kept with it.\n */\n private _unitPath(shape: PathShape): PathData {\n const { width, height } = shape.layoutBounds\n const cached = this._linked\n if (cached && cached.data === shape.data && cached.width === width && cached.height === height) return cached.path\n const path = pathOps.anchorCommands(pathOps.anchors(shape.data), (p) => ({ x: p.x * width, y: -p.y * height }))\n this._linked = { data: shape.data, width, height, path }\n return path\n }\n}\n", "import { command, node, property, type Command, type CommandArgs, type NodeConfig } from \"@motionscript/core\"\n\nimport {\n LayoutGrid,\n normalizeOrder,\n SPHERE_AXES,\n SPHERE_FACINGS,\n sphereFaceForward,\n wrapDegrees,\n type LayoutGridProps,\n type SphereArrangement,\n type SphereAxis,\n type SphereFacing,\n} from \"../kit\"\n\nexport interface SphereGridProps extends LayoutGridProps {\n radius: number\n yaw: number\n pitch: number\n roll: number\n facing: SphereFacing\n focalLength: number\n depthFade: number\n cullBackfaces: boolean\n spinSpeed: number\n}\n\nconst AXIS_PROP: Record<SphereAxis, \"yaw\" | \"pitch\" | \"roll\"> = { x: \"pitch\", y: \"yaw\", z: \"roll\" }\n\n/**\n * Children spread over a sphere — a Fibonacci lattice, as even as any number\n * of points gets — and seen through a camera of the grid's own, so the far\n * side is smaller, drawn first, and hidden where a face turns away.\n *\n * `outward` lays each item flat on the surface; `billboard` keeps each one\n * facing the viewer, like labels on a globe. {@link turnTo} brings any item\n * round to the front.\n */\n@node({\n key: \"sphereGrid\",\n parentKey: \"node\",\n forkable: true,\n layout: {\n children: \"flow\",\n acceptsChildren: true,\n defaultWidthMode: \"hug\",\n defaultHeightMode: \"hug\",\n },\n})\nexport class SphereGrid extends LayoutGrid<SphereGridProps> {\n @property({ default: 220, min: 0, step: 1 }) declare radius: number\n @property({ default: 0, step: 1, unit: \"°\" }) declare yaw: number\n @property({ default: 0, step: 1, unit: \"°\" }) declare pitch: number\n @property({ default: 0, step: 1, unit: \"°\" }) declare roll: number\n @property({ default: \"outward\", kind: \"enum\", options: SPHERE_FACINGS }) declare facing: SphereFacing\n @property({ default: 900, min: 100, step: 10 }) declare focalLength: number\n @property({ default: 0.5, min: 0, max: 1, step: 0.05 }) declare depthFade: number\n @property({ default: false }) declare cullBackfaces: boolean\n @property({ default: 0, step: 1, unit: \"°/s\" }) declare spinSpeed: number\n\n constructor(props?: NodeConfig<SphereGrid, SphereGridProps>) {\n super(props)\n }\n\n /** Turn the sphere about an axis by `degrees` — `y` spins it like a globe. */\n @command({\n args: [\n { key: \"axis\", kind: \"enum\", options: SPHERE_AXES, default: \"y\" },\n { key: \"degrees\", step: 15, unit: \"°\", default: 360 },\n ],\n })\n spin(args: CommandArgs<{ axis?: SphereAxis; degrees?: number }> & { duration: number }): Command<SphereGridProps> {\n const key = AXIS_PROP[args.data?.axis ?? \"y\"] ?? \"yaw\"\n const degrees = args.data?.degrees ?? 360\n return this.to({ data: { [key]: this[key] + degrees }, duration: args.duration, easing: args.easing })\n }\n\n /** Turn the sphere to a set orientation. */\n @command({\n args: [\n { key: \"yaw\", unit: \"°\", default: 45 },\n { key: \"pitch\", unit: \"°\", default: 20 },\n { key: \"roll\", unit: \"°\", default: 0 },\n ],\n })\n orientTo(args: CommandArgs<{ yaw?: number; pitch?: number; roll?: number }> & { duration: number }): Command<SphereGridProps> {\n return this.to({\n data: { yaw: args.data?.yaw ?? this.yaw, pitch: args.data?.pitch ?? this.pitch, roll: args.data?.roll ?? this.roll },\n duration: args.duration,\n easing: args.easing,\n })\n }\n\n /** Turn the sphere the shorter way until an item (by its place in the layers) faces the viewer. */\n @command({ args: [{ key: \"item\", min: 0, step: 1, default: 0 }] })\n turnTo(args: CommandArgs<{ item?: number }> & { duration: number }): Command<SphereGridProps> {\n const count = this._itemCount()\n const slot = normalizeOrder(this.order, count).indexOf(Math.round(args.data?.item ?? 0))\n if (slot < 0) return this.to({ data: {}, duration: args.duration })\n const facing = sphereFaceForward(count, slot)\n // The yaw the clock has added is part of where the item is now.\n const spun = this.spinSpeed * this.time.total\n return this.to({\n data: {\n yaw: this.yaw + wrapDegrees(facing.yaw - (this.yaw + spun)),\n pitch: this.pitch + wrapDegrees(facing.pitch - this.pitch),\n roll: 0,\n },\n duration: args.duration,\n easing: args.easing,\n })\n }\n\n @command({ args: [{ key: \"radius\", min: 0, default: 300 }] })\n radiusTo(args: CommandArgs<{ radius: number }> & { duration: number }): Command<SphereGridProps> {\n return this.to({ data: { radius: args.data?.radius ?? this.radius }, duration: args.duration, easing: args.easing })\n }\n\n /** Dolly the camera: a shorter focal length exaggerates the depth, a longer one flattens it. */\n @command({ args: [{ key: \"focalLength\", min: 100, default: 600 }] })\n focalLengthTo(args: CommandArgs<{ focalLength: number }> & { duration: number }): Command<SphereGridProps> {\n return this.to({\n data: { focalLength: args.data?.focalLength ?? this.focalLength },\n duration: args.duration,\n easing: args.easing,\n })\n }\n\n protected override arrangementFor(): SphereArrangement {\n return {\n kind: \"sphere\",\n radius: this.radius,\n yaw: this.yaw,\n pitch: this.pitch,\n roll: this.roll,\n facing: this.facing,\n focalLength: this.focalLength,\n depthFade: this.depthFade,\n cullBackfaces: this.cullBackfaces,\n spinSpeed: this.spinSpeed,\n }\n }\n}\n", "import { PathGrid } from \"./path-grid\"\nimport { RadialGrid } from \"./radial-grid\"\nimport { RectangularGrid } from \"./rectangular-grid\"\nimport { SphereGrid } from \"./sphere-grid\"\n\n/**\n * Every node type this package publishes.\n *\n * A host registers these by handing the array to an engine —\n * `new Engine(platform, { nodes: NODES })` — which reads each class's `@node()`\n * key. Listing class **values** is also what survives bundling: this package\n * declares `sideEffects: false`, and a document names a node type by string, so\n * an import kept only for its side effect is exactly what gets shaken out.\n */\nexport const NODES = [RectangularGrid, RadialGrid, PathGrid, SphereGrid]\n"],
5
+ "mappings": "+XAAA,OACE,WAAAA,EACA,aAAAC,EACA,QAAAC,EACA,YAAAC,MAKK,+VAmDMC,EAAN,cAA8BC,CAAgC,CAYnE,YAAYC,EAAyD,CACnE,MAAMA,CAAK,CACb,CAIA,UAAUC,EAA2E,CACnF,IAAMC,EA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AE,IAAK,OAAQ,KAAM,OAAQ,QAASC,EAAa,QAAS,GAAG,EAC/D,CAAE,IAAK,UAAW,KAAM,GAAI,KAAM,OAAK,QAAS,GAAG,GAEtD,4BAeDJ,EAAA,CAPCG,EAAQ,CACP,KAAM,CACJ,CAAE,IAAK,MAAO,KAAM,OAAK,QAAS,EAAE,EACpC,CAAE,IAAK,QAAS,KAAM,OAAK,QAAS,EAAE,EACtC,CAAE,IAAK,OAAQ,KAAM,OAAK,QAAS,CAAC,GAEvC,gCAWDH,EAAA,CADCG,EAAQ,CAAE,KAAM,CAAC,CAAE,IAAK,OAAQ,IAAK,EAAG,KAAM,EAAG,QAAS,CAAC,CAAE,CAAC,CAAE,8BAoBjEH,EAAA,CADCG,EAAQ,CAAE,KAAM,CAAC,CAAE,IAAK,SAAU,IAAK,EAAG,QAAS,GAAG,CAAE,CAAC,CAAE,gCAO5DH,EAAA,CADCG,EAAQ,CAAE,KAAM,CAAC,CAAE,IAAK,cAAe,IAAK,IAAK,QAAS,GAAG,CAAE,CAAC,CAAE,qCAtExDhB,EAAUa,EAAA,CAXtBK,GAAK,CACJ,IAAK,aACL,UAAW,OACX,SAAU,GACV,OAAQ,CACN,SAAU,OACV,gBAAiB,GACjB,iBAAkB,MAClB,kBAAmB,OAEtB,GACYlB,CAAU,ECnChB,IAAMmB,GAAQ,CAACC,EAAiBC,EAAYC,EAAUC,CAAU",
6
+ "names": ["command", "easeInOut", "node", "property", "RectangularGrid", "LayoutGrid", "props", "args", "columns", "data", "sizes", "from", "rectangularCell", "contentBoxOf", "width", "height", "t", "easeInOut", "slots", "row", "i", "column", "count", "space", "__decorate", "property", "FILL_DIRECTIONS", "CELL_MODES", "LINE_ALIGNS", "command", "staggerArgs", "TRANSITION_STAGGER", "node", "command", "node", "property", "RadialGrid", "LayoutGrid", "props", "args", "degrees", "count", "slot", "normalizeOrder", "turn", "radialTurnToTop", "__decorate", "property", "RADIAL_DIRECTIONS", "command", "node", "command", "node", "Path", "pathOps", "PathShape", "pathProperty", "property", "PATH_GRID_SHAPES", "PATH_TEMPLATES", "AT_ORIGIN", "DEFAULT_SIZE", "PathGrid", "LayoutGrid", "props", "args", "loops", "pathNode", "changes", "box", "path", "placement", "linked", "findNode2D", "PathShape", "frameIn", "Path", "pathOps", "bounds", "frame", "template", "templatePath", "shape", "width", "height", "cached", "p", "__decorate", "property", "pathProperty", "PATH_SPACINGS", "command", "staggerArgs", "TRANSITION_STAGGER", "node", "command", "node", "property", "AXIS_PROP", "SphereGrid", "LayoutGrid", "props", "args", "key", "degrees", "count", "slot", "normalizeOrder", "facing", "sphereFaceForward", "spun", "wrapDegrees", "__decorate", "property", "SPHERE_FACINGS", "command", "SPHERE_AXES", "node", "NODES", "RectangularGrid", "RadialGrid", "PathGrid", "SphereGrid"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunks/chunk-PB3E5HQV.js";export{m as CELL_MODES,l as FILL_DIRECTIONS,O as LAYOUT_GRID_TYPES,n as LINE_ALIGNS,Q as LayoutGrid,e as PATH_SPACINGS,x as PATH_TEMPLATES,g as RADIAL_DIRECTIONS,H as REVEAL_STYLES,s as SPHERE_AXES,r as SPHERE_FACINGS,E as STAGGER_ORDERS,P as TRANSITION_STAGGER,I as WAVE_STYLES,J as applyItemEffects,b as blendSlot,R as contentBoxOf,t as fibonacciPoint,S as findNode2D,A as focalLengthOf,T as frameIn,D as hashSeed,d as largest,K as normalizeOrder,u as orient,M as parseOrder,f as pathSlots,h as radialAngles,i as radialSlots,j as radialTurnToTop,p as rectangularCell,o as rectangularShape,q as rectangularSlots,B as seededRandom,C as shuffled,a as slot,L as slotOfItem,z as slotsOf,w as sphereFaceForward,v as sphereSlots,c as spreadSlot,N as staggerArgs,G as staggerProgress,F as staggerRanks,y as templatePath,k as wrapDegrees};
2
+ //# sourceMappingURL=kit.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@motionscript/layout-grid",
3
+ "version": "0.1.0-alpha.0",
4
+ "exports": {
5
+ ".": "dist/browser/index.js",
6
+ "./kit": "dist/browser/kit.js"
7
+ },
8
+ "peers": [
9
+ "@motionscript/core"
10
+ ],
11
+ "assets": {}
12
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The layout grid **kit**: what the four grids share, and what a copied one does
3
+ * not copy.
4
+ *
5
+ * `ms add` writes a grid's own files into your project and rewrites its reach for
6
+ * these to `@motionscript/layout-grid`, so the shared parts stay a real
7
+ * dependency. That is not a size decision. The engine keys prop machinery to
8
+ * class identity — `@property` installs against the class it was applied with —
9
+ * so a second copy of `LayoutGrid` is a second class answering to one name, and
10
+ * a morph from one grid to another only finds grids of the class it knows.
11
+ */
12
+ export * from "./kit/index.js";
13
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,cAAc,OAAO,CAAA"}
package/dist/engine.js ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The layout grid **kit**: what the four grids share, and what a copied one does
3
+ * not copy.
4
+ *
5
+ * `ms add` writes a grid's own files into your project and rewrites its reach for
6
+ * these to `@motionscript/layout-grid`, so the shared parts stay a real
7
+ * dependency. That is not a size decision. The engine keys prop machinery to
8
+ * class identity — `@property` installs against the class it was applied with —
9
+ * so a second copy of `LayoutGrid` is a second class answering to one name, and
10
+ * a morph from one grid to another only finds grids of the class it knows.
11
+ */
12
+ export * from "./kit/index.js";
13
+ //# sourceMappingURL=engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,cAAc,OAAO,CAAA","sourcesContent":["/**\n * The layout grid **kit**: what the four grids share, and what a copied one does\n * not copy.\n *\n * `ms add` writes a grid's own files into your project and rewrites its reach for\n * these to `@motionscript/layout-grid`, so the shared parts stay a real\n * dependency. That is not a size decision. The engine keys prop machinery to\n * class identity — `@property` installs against the class it was applied with —\n * so a second copy of `LayoutGrid` is a second class answering to one name, and\n * a morph from one grid to another only finds grids of the class it knows.\n */\nexport * from \"./kit\"\n"]}
@@ -0,0 +1,7 @@
1
+ export * from "./rectangular-grid/index.js";
2
+ export * from "./radial-grid/index.js";
3
+ export * from "./path-grid/index.js";
4
+ export * from "./sphere-grid/index.js";
5
+ export * from "./engine.js";
6
+ export { NODES } from "./nodes.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export * from "./rectangular-grid/index.js";
2
+ export * from "./radial-grid/index.js";
3
+ export * from "./path-grid/index.js";
4
+ export * from "./sphere-grid/index.js";
5
+ export * from "./engine.js";
6
+ export { NODES } from "./nodes.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA","sourcesContent":["export * from \"./rectangular-grid\"\nexport * from \"./radial-grid\"\nexport * from \"./path-grid\"\nexport * from \"./sphere-grid\"\nexport * from \"./engine\"\nexport { NODES } from \"./nodes\"\n"]}
@@ -0,0 +1,7 @@
1
+ export * from "./slots/index.js";
2
+ export * from "./stagger.js";
3
+ export * from "./item-effects.js";
4
+ export * from "./order.js";
5
+ export * from "./random.js";
6
+ export * from "./layout-grid.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/kit/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA"}
@@ -0,0 +1,7 @@
1
+ export * from "./slots/index.js";
2
+ export * from "./stagger.js";
3
+ export * from "./item-effects.js";
4
+ export * from "./order.js";
5
+ export * from "./random.js";
6
+ export * from "./layout-grid.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/kit/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA","sourcesContent":["export * from \"./slots\"\nexport * from \"./stagger\"\nexport * from \"./item-effects\"\nexport * from \"./order\"\nexport * from \"./random\"\nexport * from \"./layout-grid\"\n"]}
@@ -0,0 +1,37 @@
1
+ import type { Size2D } from "@motionscript/core";
2
+ import type { Slot } from "./slots/index.js";
3
+ /**
4
+ * What an item does on its way in (or out): grow from nothing, fade, fly out of
5
+ * the grid's centre, rise into place, flip up, or spin in.
6
+ */
7
+ export declare const REVEAL_STYLES: readonly ["scale", "fade", "center", "rise", "flip", "spin"];
8
+ export type RevealStyle = (typeof REVEAL_STYLES)[number];
9
+ /** What a wave does to each item as it passes. */
10
+ export declare const WAVE_STYLES: readonly ["scale", "lift", "fade", "spin"];
11
+ export type WaveStyle = (typeof WAVE_STYLES)[number];
12
+ /**
13
+ * How far into view each item is, `1` shown and `0` gone — past `1` on the
14
+ * way to it under an overshooting ease. Absent means every item is shown.
15
+ */
16
+ export interface RevealState {
17
+ style: RevealStyle;
18
+ values: readonly number[];
19
+ }
20
+ /** Each item's share of the wave passing through it, `0` at rest and `1` at the crest. */
21
+ export interface WaveState {
22
+ style: WaveStyle;
23
+ /** How big the crest is — a share of the item's size, opacity or a turn, by style. */
24
+ amount: number;
25
+ values: readonly number[];
26
+ }
27
+ /** Each item's emphasis: `1` the focus, `-1` pushed back, `0` untouched. */
28
+ export interface FocusState {
29
+ /** How far the others fade, `0..1`. */
30
+ dim: number;
31
+ /** How much the focus grows, as a share of its size; the others shrink by half that. */
32
+ grow: number;
33
+ values: readonly number[];
34
+ }
35
+ /** Layer item `i`'s reveal, wave and focus onto its slot, in place. */
36
+ export declare function applyItemEffects(s: Slot, i: number, size: Size2D, reveal: RevealState | null | undefined, wave: WaveState | null | undefined, focus: FocusState | null | undefined): void;
37
+ //# sourceMappingURL=item-effects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"item-effects.d.ts","sourceRoot":"","sources":["../../src/kit/item-effects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAEnC;;;GAGG;AACH,eAAO,MAAM,aAAa,8DAA+D,CAAA;AACzF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAA;AAExD,kDAAkD;AAClD,eAAO,MAAM,WAAW,4CAA6C,CAAA;AACrE,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,WAAW,CAAA;IAClB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAC1B;AAED,0FAA0F;AAC1F,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,SAAS,CAAA;IAChB,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAC1B;AAED,4EAA4E;AAC5E,MAAM,WAAW,UAAU;IACzB,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAA;IACX,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAC1B;AAED,uEAAuE;AACvE,wBAAgB,gBAAgB,CAC9B,CAAC,EAAE,IAAI,EACP,CAAC,EAAE,MAAM,EACT,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,EACtC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,EAClC,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,CAIN"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * What an item does on its way in (or out): grow from nothing, fade, fly out of
3
+ * the grid's centre, rise into place, flip up, or spin in.
4
+ */
5
+ export const REVEAL_STYLES = ["scale", "fade", "center", "rise", "flip", "spin"];
6
+ /** What a wave does to each item as it passes. */
7
+ export const WAVE_STYLES = ["scale", "lift", "fade", "spin"];
8
+ /** Layer item `i`'s reveal, wave and focus onto its slot, in place. */
9
+ export function applyItemEffects(s, i, size, reveal, wave, focus) {
10
+ if (reveal)
11
+ applyReveal(s, reveal.style, reveal.values[i] ?? 1, size);
12
+ if (wave)
13
+ applyWave(s, wave, wave.values[i] ?? 0, size);
14
+ if (focus)
15
+ applyFocus(s, focus, focus.values[i] ?? 0);
16
+ }
17
+ function applyReveal(s, style, v, size) {
18
+ if (v === 1)
19
+ return;
20
+ const shown = clamp01(v);
21
+ switch (style) {
22
+ case "fade":
23
+ s.opacity *= shown;
24
+ break;
25
+ case "center":
26
+ s.x *= v;
27
+ s.y *= v;
28
+ s.depth *= v;
29
+ s.opacity *= clamp01(v * 4);
30
+ break;
31
+ case "rise":
32
+ s.y -= (1 - v) * Math.max(40, size.height);
33
+ s.opacity *= shown;
34
+ break;
35
+ case "flip":
36
+ s.rotationX += (1 - v) * 90;
37
+ break;
38
+ case "spin":
39
+ s.rotation -= (1 - v) * 180;
40
+ s.scale *= Math.max(0, v);
41
+ break;
42
+ default:
43
+ s.scale *= Math.max(0, v);
44
+ }
45
+ }
46
+ function applyWave(s, wave, w, size) {
47
+ if (w === 0)
48
+ return;
49
+ switch (wave.style) {
50
+ case "lift":
51
+ s.y += wave.amount * w * Math.max(40, size.height);
52
+ break;
53
+ case "fade":
54
+ s.opacity *= clamp01(1 - wave.amount * w);
55
+ break;
56
+ case "spin":
57
+ s.rotation += wave.amount * w * 360;
58
+ break;
59
+ default:
60
+ s.scale *= 1 + wave.amount * w;
61
+ }
62
+ }
63
+ function applyFocus(s, focus, f) {
64
+ if (f === 0)
65
+ return;
66
+ if (f > 0) {
67
+ s.scale *= 1 + focus.grow * f;
68
+ return;
69
+ }
70
+ s.opacity *= clamp01(1 - focus.dim * -f);
71
+ s.scale *= Math.max(0, 1 + focus.grow * 0.5 * f);
72
+ }
73
+ function clamp01(v) {
74
+ return v < 0 ? 0 : v > 1 ? 1 : v;
75
+ }
76
+ //# sourceMappingURL=item-effects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"item-effects.js","sourceRoot":"","sources":["../../src/kit/item-effects.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAU,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CAAC,KAAK,CAAC;QAAE,OAAM;IACnB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACV,CAAC,CAAC,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC,CAAA;QAC7B,OAAM;IACR,CAAC;IACD,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;IACxC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,CAAA;AAClD,CAAC;AAED,SAAS,OAAO,CAAC,CAAS;IACxB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAClC,CAAC","sourcesContent":["import type { Size2D } from \"@motionscript/core\"\n\nimport type { Slot } from \"./slots\"\n\n/**\n * What an item does on its way in (or out): grow from nothing, fade, fly out of\n * the grid's centre, rise into place, flip up, or spin in.\n */\nexport const REVEAL_STYLES = [\"scale\", \"fade\", \"center\", \"rise\", \"flip\", \"spin\"] as const\nexport type RevealStyle = (typeof REVEAL_STYLES)[number]\n\n/** What a wave does to each item as it passes. */\nexport const WAVE_STYLES = [\"scale\", \"lift\", \"fade\", \"spin\"] as const\nexport type WaveStyle = (typeof WAVE_STYLES)[number]\n\n/**\n * How far into view each item is, `1` shown and `0` gone — past `1` on the\n * way to it under an overshooting ease. Absent means every item is shown.\n */\nexport interface RevealState {\n style: RevealStyle\n values: readonly number[]\n}\n\n/** Each item's share of the wave passing through it, `0` at rest and `1` at the crest. */\nexport interface WaveState {\n style: WaveStyle\n /** How big the crest is — a share of the item's size, opacity or a turn, by style. */\n amount: number\n values: readonly number[]\n}\n\n/** Each item's emphasis: `1` the focus, `-1` pushed back, `0` untouched. */\nexport interface FocusState {\n /** How far the others fade, `0..1`. */\n dim: number\n /** How much the focus grows, as a share of its size; the others shrink by half that. */\n grow: number\n values: readonly number[]\n}\n\n/** Layer item `i`'s reveal, wave and focus onto its slot, in place. */\nexport function applyItemEffects(\n s: Slot,\n i: number,\n size: Size2D,\n reveal: RevealState | null | undefined,\n wave: WaveState | null | undefined,\n focus: FocusState | null | undefined,\n): void {\n if (reveal) applyReveal(s, reveal.style, reveal.values[i] ?? 1, size)\n if (wave) applyWave(s, wave, wave.values[i] ?? 0, size)\n if (focus) applyFocus(s, focus, focus.values[i] ?? 0)\n}\n\nfunction applyReveal(s: Slot, style: RevealStyle, v: number, size: Size2D): void {\n if (v === 1) return\n const shown = clamp01(v)\n switch (style) {\n case \"fade\":\n s.opacity *= shown\n break\n case \"center\":\n s.x *= v\n s.y *= v\n s.depth *= v\n s.opacity *= clamp01(v * 4)\n break\n case \"rise\":\n s.y -= (1 - v) * Math.max(40, size.height)\n s.opacity *= shown\n break\n case \"flip\":\n s.rotationX += (1 - v) * 90\n break\n case \"spin\":\n s.rotation -= (1 - v) * 180\n s.scale *= Math.max(0, v)\n break\n default:\n s.scale *= Math.max(0, v)\n }\n}\n\nfunction applyWave(s: Slot, wave: WaveState, w: number, size: Size2D): void {\n if (w === 0) return\n switch (wave.style) {\n case \"lift\":\n s.y += wave.amount * w * Math.max(40, size.height)\n break\n case \"fade\":\n s.opacity *= clamp01(1 - wave.amount * w)\n break\n case \"spin\":\n s.rotation += wave.amount * w * 360\n break\n default:\n s.scale *= 1 + wave.amount * w\n }\n}\n\nfunction applyFocus(s: Slot, focus: FocusState, f: number): void {\n if (f === 0) return\n if (f > 0) {\n s.scale *= 1 + focus.grow * f\n return\n }\n s.opacity *= clamp01(1 - focus.dim * -f)\n s.scale *= Math.max(0, 1 + focus.grow * 0.5 * f)\n}\n\nfunction clamp01(v: number): number {\n return v < 0 ? 0 : v > 1 ? 1 : v\n}\n"]}
@@ -0,0 +1,243 @@
1
+ import { Node2D, type BoxBounds, type ChildPlacement, type Command, type CommandArgs, type MeasureContext2D, type EasingFunction, type Node2DProps, type Size2D, type SizeConstraints, type SpaceCamera } from "@motionscript/core";
2
+ import { type FocusState, type RevealState, type RevealStyle, type WaveState, type WaveStyle } from "./item-effects.js";
3
+ import { type Arrangement, type Slot } from "./slots/index.js";
4
+ import { type StaggerOrder } from "./stagger.js";
5
+ /** An arrangement a grid is leaving, kept as data so its slots can be worked out afresh every frame. */
6
+ export interface GridSnapshot {
7
+ arrangement: Arrangement;
8
+ /** The grid the arrangement was borrowed from, or `""` for the grid's own. */
9
+ source: string;
10
+ order: readonly number[];
11
+ spread: number;
12
+ }
13
+ /** A change of arrangement under way: where the items are coming from, and how far each has come. */
14
+ export interface GridTransition {
15
+ from: GridSnapshot;
16
+ /** Each item's eased, staggered progress, `0..1`. */
17
+ mix: readonly number[];
18
+ }
19
+ export interface LayoutGridProps extends Node2DProps {
20
+ /** Items in slot order: slot `k` holds child `order[k]`. Empty is the children's own order. */
21
+ order: number[];
22
+ /** `0` gathers every item at the centre, `1` is the arrangement, past `1` pushes them apart. */
23
+ spread: number;
24
+ /** Another grid whose arrangement this one takes on — what {@link LayoutGrid.morphInto} animates. */
25
+ arrangeLike: string;
26
+ revealState: RevealState | null;
27
+ waveState: WaveState | null;
28
+ focusState: FocusState | null;
29
+ transition: GridTransition | null;
30
+ }
31
+ /** What a command that moves the items to new slots is built from. */
32
+ export interface TransitionArgs {
33
+ data?: StaggerArgs;
34
+ duration: number;
35
+ easing?: EasingFunction;
36
+ }
37
+ /** The stagger options every per-item command takes. */
38
+ export interface StaggerArgs {
39
+ staggerOrder?: StaggerOrder;
40
+ /** `0..0.95`: how much of the command's length the items' offsets take up. */
41
+ stagger?: number;
42
+ }
43
+ /** `@command` descriptors for {@link StaggerArgs}, `stagger` defaulting to `fallback`. */
44
+ export declare function staggerArgs(fallback: number): readonly [{
45
+ readonly key: "staggerOrder";
46
+ readonly kind: "enum";
47
+ readonly options: readonly ["index", "reverse", "random", "centerOut", "edgesIn", "row", "column", "angle", "path", "depth"];
48
+ readonly default: "index";
49
+ }, {
50
+ readonly key: "stagger";
51
+ readonly min: 0;
52
+ readonly max: 0.95;
53
+ readonly step: 0.05;
54
+ readonly default: number;
55
+ }];
56
+ /**
57
+ * Every grid's document key — what a reference to "another grid" may name. A
58
+ * `nodeRef` descriptor carries it as `nodeTypes`, for a host's picker to offer
59
+ * only those.
60
+ */
61
+ export declare const LAYOUT_GRID_TYPES: readonly ["rectangularGrid", "radialGrid", "pathGrid", "sphereGrid"];
62
+ /** The stagger a move to new slots takes when its command states none. */
63
+ export declare const TRANSITION_STAGGER = 0.3;
64
+ /**
65
+ * The base of every grid: a container that places each of its children in a
66
+ * slot of an arrangement — a rectangular grid, a ring, a path, a sphere.
67
+ *
68
+ * ## Children only
69
+ *
70
+ * The items are the children, in layer order. A child's slot is a parent
71
+ * transform on it, so its own `x`/`y`/`rotation`/`scale` — and any command on
72
+ * them — still work, relative to the slot. A group is one item; a grid of
73
+ * grids is a grid of items that happen to be grids.
74
+ *
75
+ * ## One pass
76
+ *
77
+ * Every frame: measure the children, ask the arrangement for its slots (a pure
78
+ * function of the props, the sizes and the clock), blend them from where a
79
+ * transition is leaving, and layer on the per-item effects — reveal, wave,
80
+ * focus. What is left is each child's box and {@link ChildPlacement}, which the
81
+ * renderer, picking and `global` all read, so a selection outline lands on
82
+ * the pixels even on a sphere.
83
+ *
84
+ * ## Commands
85
+ *
86
+ * Every command is a pure function of time, like the rest of the library. The
87
+ * per-item ones stagger *inside* their duration — a one-second reveal takes one
88
+ * second for four children or four hundred — and write their per-item state
89
+ * into props ({@link revealState} and its siblings), which is what keeps them
90
+ * seekable. The ones that change the arrangement itself (a reorder, a morph, a
91
+ * column count) keep the arrangement they are leaving as data and blend each
92
+ * item from its old slot to its new one.
93
+ */
94
+ export declare abstract class LayoutGrid<P extends LayoutGridProps = LayoutGridProps> extends Node2D<P> {
95
+ order: number[];
96
+ spread: number;
97
+ arrangeLike: string;
98
+ revealState: RevealState | null | undefined;
99
+ waveState: WaveState | null | undefined;
100
+ focusState: FocusState | null | undefined;
101
+ transition: GridTransition | null | undefined;
102
+ /**
103
+ * Bring the items in, one after another. Every item starts hidden, so place
104
+ * it where the grid enters — or after a {@link conceal}.
105
+ */
106
+ reveal(args: CommandArgs<{
107
+ style?: RevealStyle;
108
+ } & StaggerArgs> & {
109
+ duration: number;
110
+ }): Command<LayoutGridProps>;
111
+ /** Take the items out, one after another — {@link reveal} in reverse. They stay hidden after. */
112
+ conceal(args: CommandArgs<{
113
+ style?: RevealStyle;
114
+ } & StaggerArgs> & {
115
+ duration: number;
116
+ }): Command<LayoutGridProps>;
117
+ /** Send a ripple through the items that swells each in turn and settles back. */
118
+ wave(args: CommandArgs<{
119
+ style?: WaveStyle;
120
+ amount?: number;
121
+ } & StaggerArgs> & {
122
+ duration: number;
123
+ }): Command<LayoutGridProps>;
124
+ /** Bring one item (by its place in the layers, from 0) forward and push the rest back. */
125
+ focus(args: CommandArgs<{
126
+ item?: number;
127
+ dim?: number;
128
+ grow?: number;
129
+ }> & {
130
+ duration: number;
131
+ }): Command<LayoutGridProps>;
132
+ /** Bring every item back to even. */
133
+ unfocus(args: CommandArgs<Record<string, never>> & {
134
+ duration: number;
135
+ }): Command<LayoutGridProps>;
136
+ /** Gather the items toward the centre (`0`), back to the arrangement (`1`), or push them apart. */
137
+ spreadTo(args: CommandArgs<{
138
+ spread: number;
139
+ }> & {
140
+ duration: number;
141
+ }): Command<P>;
142
+ /** Send every item to a random slot. The same `seed` always deals the same way. */
143
+ shuffle(args: CommandArgs<{
144
+ seed?: number;
145
+ } & StaggerArgs> & {
146
+ duration: number;
147
+ }): Command<P>;
148
+ /** Two items trade places, by their place in the layers. */
149
+ swap(args: CommandArgs<{
150
+ first?: number;
151
+ second?: number;
152
+ } & StaggerArgs> & {
153
+ duration: number;
154
+ }): Command<P>;
155
+ /** Move the items into a new order — a list of layer indices, first slot first, like `"2, 0, 1"`. */
156
+ reorder(args: CommandArgs<{
157
+ order?: string | number[];
158
+ } & StaggerArgs> & {
159
+ duration: number;
160
+ }): Command<P>;
161
+ /**
162
+ * Move every item into another grid's arrangement — a grid into a ring, a ring
163
+ * onto a sphere — and keep following it. An empty `target` morphs back to
164
+ * this grid's own.
165
+ */
166
+ morphInto(args: CommandArgs<{
167
+ target?: string;
168
+ } & StaggerArgs> & {
169
+ duration: number;
170
+ }): Command<P>;
171
+ /** This grid's own arrangement, for a content box of `box`. */
172
+ protected abstract arrangementFor(box: Size2D): Arrangement;
173
+ protected applyDefaultSize(props?: {
174
+ readonly width?: unknown;
175
+ readonly height?: unknown;
176
+ }): void;
177
+ /** The room each item is measured in — the whole content box, unless an arrangement has cells. */
178
+ protected itemSpace(_count: number, space: Size2D, _sizes?: readonly Size2D[]): Size2D;
179
+ measure(constraints: SizeConstraints, scope: MeasureContext2D): Partial<Size2D>;
180
+ protected layoutChildren(rect: BoxBounds, scope: MeasureContext2D): void;
181
+ _placementOf(child: Node2D): ChildPlacement | null;
182
+ /**
183
+ * A grid whose arrangement has depth is seen through a camera of its own,
184
+ * which paints its items far to near — unless it already sits in a space (an
185
+ * orbit camera, a 3D stage), where its items join that one and its camera.
186
+ */
187
+ _spaceCamera(): SpaceCamera | null;
188
+ private readonly _placements;
189
+ /** What {@link measure} found, for {@link layoutChildren} to reuse in the same pass. */
190
+ private _measured;
191
+ /** Each item's slot from the last layout — what a command ranks its stagger by. */
192
+ private _slots;
193
+ /** Each item's size from the last layout. */
194
+ private _sizes;
195
+ /** The last layout's camera distance, `0` while flat. */
196
+ private _focal;
197
+ private _borrowCache;
198
+ /** How many items a command built now will act on. */
199
+ protected _itemCount(): number;
200
+ /** Each item's slot as it stands, for a command being built — the last layout's where it still fits. */
201
+ protected _itemSlots(): Slot[];
202
+ /** The item sizes the last layout found. */
203
+ protected _itemSizes(): readonly Size2D[];
204
+ /** Each item's start in a stagger. A random order is seeded by the node's id, so it never changes between builds. */
205
+ protected _ranks(order: StaggerOrder | undefined): number[];
206
+ /**
207
+ * Write `changes` to the arrangement and move each item from its slot in the
208
+ * one being left to its slot in the new one, staggered.
209
+ */
210
+ protected _transitionTo(changes: Partial<P>, args: TransitionArgs, stagger?: number): Command<P>;
211
+ /** Emphasise the items `isFocus` picks and push the rest back. */
212
+ protected _focusOn(isFocus: (item: number) => boolean, count: number, args: CommandArgs<{
213
+ dim?: number;
214
+ grow?: number;
215
+ }> & {
216
+ duration: number;
217
+ }): Command<LayoutGridProps>;
218
+ private _snapshot;
219
+ private _measureItems;
220
+ /** Where each item sits in the arrangement it is heading for, before any transition or effect. */
221
+ private _targetSlots;
222
+ /** Each item's final slot this frame: the target, blended from any transition, with its effects on. */
223
+ private _resolve;
224
+ /** Whether an ancestor places this grid in a space, as `spaceFrameOf` walks it. */
225
+ private _inSpace;
226
+ /** The grid {@link arrangeLike} names, when it names another grid in this tree. */
227
+ private _borrowed;
228
+ private _gridById;
229
+ /** `slots`, laid out in `source`'s frame, moved into this grid's. */
230
+ private _fromGrid;
231
+ }
232
+ /** A node's content box: its laid-out size inside its padding. */
233
+ export declare function contentBoxOf(grid: Node2D): Size2D;
234
+ /** The 2D node `id` names in the tree `from` is in, or `null`. */
235
+ export declare function findNode2D(from: Node2D, id: string): Node2D | null;
236
+ /** Where `node`'s frame sits in `grid`'s: offset, turn and scale, y-up. */
237
+ export declare function frameIn(grid: Node2D, node: Node2D): {
238
+ x: number;
239
+ y: number;
240
+ rotation: number;
241
+ scale: number;
242
+ };
243
+ //# sourceMappingURL=layout-grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout-grid.d.ts","sourceRoot":"","sources":["../../src/kit/layout-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,MAAM,EAGN,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,MAA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