├── README.md ├── Scaffold.png ├── code.js ├── code.ts ├── figma.d.ts ├── manifest.json ├── scaf.png └── tsconfig.json /README.md: -------------------------------------------------------------------------------- 1 | # plugin to generate a scaffold for your project. 2 | here is a link to the figma page - https://www.figma.com/c/plugin/747372158567878238/Project-Scaffold 3 | -------------------------------------------------------------------------------- /Scaffold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tushar7d/Project-Scaffold-Figma-Plugin/5248b8c12027e5c907e09b5a96f3a68d194083a2/Scaffold.png -------------------------------------------------------------------------------- /code.js: -------------------------------------------------------------------------------- 1 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 2 | return new (P || (P = Promise))(function (resolve, reject) { 3 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 4 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 5 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } 6 | step((generator = generator.apply(thisArg, _arguments || [])).next()); 7 | }); 8 | }; 9 | let Refferences = figma.createPage(); 10 | let UXApproaches = figma.createPage(); 11 | let ContentApproaches = figma.createPage(); 12 | let UIApproaches = figma.createPage(); 13 | let FinalUI = figma.createPage(); 14 | let Prototype = figma.createPage(); 15 | let Showcase = figma.createPage(); 16 | let Cover = figma.currentPage; 17 | let CoverFrame = figma.createFrame(); 18 | let CoverHead = figma.createText(); 19 | let CoverDesc = figma.createText(); 20 | figma.currentPage.name = "⬜️ Cover"; 21 | Refferences.name = "🔭 References"; 22 | UXApproaches.name = "📋 UX Approaches"; 23 | ContentApproaches.name = "✍🏼 Content Approaches"; 24 | UIApproaches.name = "👁 UI Approaches"; 25 | FinalUI.name = "👍 Final UI"; 26 | Prototype.name = "📱 Prototype"; 27 | Showcase.name = "🖥 Showcase"; 28 | CoverFrame.name = "Cover"; 29 | Cover.appendChild(CoverFrame); 30 | CoverFrame.appendChild(CoverHead); 31 | CoverFrame.appendChild(CoverDesc); 32 | CoverFrame.resize(1240, 640); 33 | let setPosition = (node, spacex, spacey) => { node.relativeTransform = [[1, 0, spacex], [0, 1, spacey]]; }; 34 | let xCalculator = (container, element) => { return ((container.width / 2) - (element.width / 2)); }; 35 | let yCalculator = (container, element) => { return ((container.height / 2) - (element.height / 2)); }; 36 | let loadFontHead = (name) => __awaiter(this, void 0, void 0, function* () { 37 | yield figma.loadFontAsync({ family: "Roboto", style: "Bold" }); 38 | CoverHead.fontName = { family: "Roboto", style: "Bold" }; 39 | CoverHead.characters = name; 40 | CoverHead.fontSize = 74; 41 | CoverHead.textAlignHorizontal = "CENTER"; 42 | }); 43 | let loadFontDesc = (text) => __awaiter(this, void 0, void 0, function* () { 44 | yield figma.loadFontAsync({ family: "Roboto", style: "Regular" }); 45 | CoverDesc.fontSize = 36; 46 | CoverDesc.characters = text; 47 | CoverDesc.textAlignHorizontal = "CENTER"; 48 | layoutText(); 49 | }); 50 | let layoutText = () => { 51 | let descX = xCalculator(CoverFrame, CoverDesc); 52 | let headX = xCalculator(CoverFrame, CoverHead); 53 | let headY = (yCalculator(CoverFrame, CoverHead) - 30); 54 | let descY = headY + CoverHead.height + 20; 55 | setPosition(CoverHead, headX, headY); 56 | setPosition(CoverDesc, descX, descY); 57 | }; 58 | let run = () => __awaiter(this, void 0, void 0, function* () { 59 | yield loadFontHead("Add Heading"); 60 | yield loadFontDesc("Add Description"); 61 | figma.notify("Project Scafolding Done 👍"); 62 | figma.closePlugin(); 63 | }); 64 | run(); 65 | -------------------------------------------------------------------------------- /code.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | let Refferences = figma.createPage(); 4 | let UXApproaches = figma.createPage(); 5 | let ContentApproaches = figma.createPage(); 6 | let UIApproaches = figma.createPage(); 7 | let FinalUI = figma.createPage(); 8 | let Prototype = figma.createPage(); 9 | let Showcase = figma.createPage(); 10 | let Cover = figma.currentPage; 11 | let CoverFrame = figma.createFrame(); 12 | let CoverHead = figma.createText(); 13 | let CoverDesc = figma.createText(); 14 | 15 | figma.currentPage.name = "⬜️ Cover"; 16 | Refferences.name = "🔭 References"; 17 | UXApproaches.name = "📋 UX Approaches"; 18 | ContentApproaches.name = "✍🏼 Content Approaches" 19 | UIApproaches.name = "👁 UI Approaches"; 20 | FinalUI.name = "👍 Final UI"; 21 | Prototype.name = "📱 Prototype"; 22 | Showcase.name = "🖥 Showcase"; 23 | CoverFrame.name = "Cover"; 24 | 25 | 26 | 27 | Cover.appendChild(CoverFrame); 28 | CoverFrame.appendChild(CoverHead); 29 | CoverFrame.appendChild(CoverDesc); 30 | CoverFrame.resize(1240, 640); 31 | 32 | let setPosition = (node, spacex, spacey) => { node.relativeTransform = [[1, 0, spacex], [0, 1, spacey]] }; 33 | 34 | let xCalculator = (container: FrameNode, element: TextNode) => { return ((container.width / 2) - (element.width / 2)); } 35 | 36 | let yCalculator = (container: FrameNode, element: TextNode) => { return ((container.height / 2) - (element.height / 2)); } 37 | 38 | let loadFontHead = async (name: string) => { 39 | await figma.loadFontAsync({ family: "Roboto", style: "Bold" }); 40 | CoverHead.fontName = { family: "Roboto", style: "Bold" }; 41 | CoverHead.characters = name; 42 | CoverHead.fontSize = 74; 43 | CoverHead.textAlignHorizontal = "CENTER"; 44 | 45 | } 46 | 47 | let loadFontDesc = async (text) => { 48 | 49 | await figma.loadFontAsync({ family: "Roboto", style: "Regular" }); 50 | CoverDesc.fontSize = 36; 51 | CoverDesc.characters = text; 52 | CoverDesc.textAlignHorizontal = "CENTER"; 53 | layoutText(); 54 | } 55 | let layoutText = () => { 56 | let descX = xCalculator(CoverFrame, CoverDesc); 57 | let headX = xCalculator(CoverFrame, CoverHead); 58 | let headY = (yCalculator(CoverFrame, CoverHead) - 30); 59 | let descY = headY + CoverHead.height + 20; 60 | 61 | setPosition(CoverHead, headX, headY); 62 | setPosition(CoverDesc, descX, descY); 63 | } 64 | let run = async ()=>{ 65 | await loadFontHead("Add Heading"); 66 | await loadFontDesc("Add Description"); 67 | figma.notify("Project Scafolding Done 👍") 68 | figma.closePlugin(); 69 | } 70 | 71 | run(); -------------------------------------------------------------------------------- /figma.d.ts: -------------------------------------------------------------------------------- 1 | // Figma Plugin API version 1, update 1 2 | 3 | // Global variable with Figma's plugin API. 4 | declare const figma: PluginAPI 5 | declare const __html__: string 6 | 7 | interface PluginAPI { 8 | readonly apiVersion: "1.0.0" 9 | readonly command: string 10 | readonly viewport: ViewportAPI 11 | closePlugin(message?: string): void 12 | 13 | notify(message: string, options?: NotificationOptions): NotificationHandler 14 | 15 | showUI(html: string, options?: ShowUIOptions): void 16 | readonly ui: UIAPI 17 | 18 | readonly clientStorage: ClientStorageAPI 19 | 20 | getNodeById(id: string): BaseNode | null 21 | getStyleById(id: string): BaseStyle | null 22 | 23 | readonly root: DocumentNode 24 | currentPage: PageNode 25 | 26 | readonly mixed: symbol 27 | 28 | createRectangle(): RectangleNode 29 | createLine(): LineNode 30 | createEllipse(): EllipseNode 31 | createPolygon(): PolygonNode 32 | createStar(): StarNode 33 | createVector(): VectorNode 34 | createText(): TextNode 35 | createFrame(): FrameNode 36 | createComponent(): ComponentNode 37 | createPage(): PageNode 38 | createSlice(): SliceNode 39 | /** 40 | * [DEPRECATED]: This API often fails to create a valid boolean operation. Use figma.union, figma.subtract, figma.intersect and figma.exclude instead. 41 | */ 42 | createBooleanOperation(): BooleanOperationNode 43 | 44 | createPaintStyle(): PaintStyle 45 | createTextStyle(): TextStyle 46 | createEffectStyle(): EffectStyle 47 | createGridStyle(): GridStyle 48 | 49 | // The styles are returned in the same order as displayed in the UI. Only 50 | // local styles are returned. Never styles from team library. 51 | getLocalPaintStyles(): PaintStyle[] 52 | getLocalTextStyles(): TextStyle[] 53 | getLocalEffectStyles(): EffectStyle[] 54 | getLocalGridStyles(): GridStyle[] 55 | 56 | importComponentByKeyAsync(key: string): Promise 57 | importStyleByKeyAsync(key: string): Promise 58 | 59 | listAvailableFontsAsync(): Promise 60 | loadFontAsync(fontName: FontName): Promise 61 | readonly hasMissingFont: boolean 62 | 63 | createNodeFromSvg(svg: string): FrameNode 64 | 65 | createImage(data: Uint8Array): Image 66 | getImageByHash(hash: string): Image 67 | 68 | group(nodes: ReadonlyArray, parent: BaseNode & ChildrenMixin, index?: number): FrameNode 69 | flatten(nodes: ReadonlyArray, parent?: BaseNode & ChildrenMixin, index?: number): VectorNode 70 | 71 | union(nodes: ReadonlyArray, parent: BaseNode & ChildrenMixin, index?: number): BooleanOperationNode 72 | subtract(nodes: ReadonlyArray, parent: BaseNode & ChildrenMixin, index?: number): BooleanOperationNode 73 | intersect(nodes: ReadonlyArray, parent: BaseNode & ChildrenMixin, index?: number): BooleanOperationNode 74 | exclude(nodes: ReadonlyArray, parent: BaseNode & ChildrenMixin, index?: number): BooleanOperationNode 75 | } 76 | 77 | interface ClientStorageAPI { 78 | getAsync(key: string): Promise 79 | setAsync(key: string, value: any): Promise 80 | } 81 | 82 | interface NotificationOptions { 83 | timeout?: number, 84 | } 85 | 86 | interface NotificationHandler { 87 | cancel: () => void, 88 | } 89 | 90 | interface ShowUIOptions { 91 | visible?: boolean, 92 | width?: number, 93 | height?: number, 94 | } 95 | 96 | interface UIPostMessageOptions { 97 | origin?: string, 98 | } 99 | 100 | interface OnMessageProperties { 101 | origin: string, 102 | } 103 | 104 | interface UIAPI { 105 | show(): void 106 | hide(): void 107 | resize(width: number, height: number): void 108 | close(): void 109 | 110 | postMessage(pluginMessage: any, options?: UIPostMessageOptions): void 111 | onmessage: ((pluginMessage: any, props: OnMessageProperties) => void) | undefined 112 | } 113 | 114 | interface ViewportAPI { 115 | center: { x: number, y: number } 116 | zoom: number 117 | scrollAndZoomIntoView(nodes: ReadonlyArray) 118 | } 119 | 120 | //////////////////////////////////////////////////////////////////////////////// 121 | // Datatypes 122 | 123 | type Transform = [ 124 | [number, number, number], 125 | [number, number, number] 126 | ] 127 | 128 | interface Vector { 129 | readonly x: number 130 | readonly y: number 131 | } 132 | 133 | interface RGB { 134 | readonly r: number 135 | readonly g: number 136 | readonly b: number 137 | } 138 | 139 | interface RGBA { 140 | readonly r: number 141 | readonly g: number 142 | readonly b: number 143 | readonly a: number 144 | } 145 | 146 | interface FontName { 147 | readonly family: string 148 | readonly style: string 149 | } 150 | 151 | type TextCase = "ORIGINAL" | "UPPER" | "LOWER" | "TITLE" 152 | 153 | type TextDecoration = "NONE" | "UNDERLINE" | "STRIKETHROUGH" 154 | 155 | interface ArcData { 156 | readonly startingAngle: number 157 | readonly endingAngle: number 158 | readonly innerRadius: number 159 | } 160 | 161 | interface ShadowEffect { 162 | readonly type: "DROP_SHADOW" | "INNER_SHADOW" 163 | readonly color: RGBA 164 | readonly offset: Vector 165 | readonly radius: number 166 | readonly visible: boolean 167 | readonly blendMode: BlendMode 168 | } 169 | 170 | interface BlurEffect { 171 | readonly type: "LAYER_BLUR" | "BACKGROUND_BLUR" 172 | readonly radius: number 173 | readonly visible: boolean 174 | } 175 | 176 | type Effect = ShadowEffect | BlurEffect 177 | 178 | type ConstraintType = "MIN" | "CENTER" | "MAX" | "STRETCH" | "SCALE" 179 | 180 | interface Constraints { 181 | readonly horizontal: ConstraintType 182 | readonly vertical: ConstraintType 183 | } 184 | 185 | interface ColorStop { 186 | readonly position: number 187 | readonly color: RGBA 188 | } 189 | 190 | interface ImageFilters { 191 | readonly exposure?: number 192 | readonly contrast?: number 193 | readonly saturation?: number 194 | readonly temperature?: number 195 | readonly tint?: number 196 | readonly highlights?: number 197 | readonly shadows?: number 198 | } 199 | 200 | interface SolidPaint { 201 | readonly type: "SOLID" 202 | readonly color: RGB 203 | 204 | readonly visible?: boolean 205 | readonly opacity?: number 206 | readonly blendMode?: BlendMode 207 | } 208 | 209 | interface GradientPaint { 210 | readonly type: "GRADIENT_LINEAR" | "GRADIENT_RADIAL" | "GRADIENT_ANGULAR" | "GRADIENT_DIAMOND" 211 | readonly gradientTransform: Transform 212 | readonly gradientStops: ReadonlyArray 213 | 214 | readonly visible?: boolean 215 | readonly opacity?: number 216 | readonly blendMode?: BlendMode 217 | } 218 | 219 | interface ImagePaint { 220 | readonly type: "IMAGE" 221 | readonly scaleMode: "FILL" | "FIT" | "CROP" | "TILE" 222 | readonly imageHash: string | null 223 | readonly imageTransform?: Transform // setting for "CROP" 224 | readonly scalingFactor?: number // setting for "TILE" 225 | readonly filters?: ImageFilters 226 | 227 | readonly visible?: boolean 228 | readonly opacity?: number 229 | readonly blendMode?: BlendMode 230 | } 231 | 232 | type Paint = SolidPaint | GradientPaint | ImagePaint 233 | 234 | interface Guide { 235 | readonly axis: "X" | "Y" 236 | readonly offset: number 237 | } 238 | 239 | interface RowsColsLayoutGrid { 240 | readonly pattern: "ROWS" | "COLUMNS" 241 | readonly alignment: "MIN" | "MAX" | "STRETCH" | "CENTER" 242 | readonly gutterSize: number 243 | 244 | readonly count: number // Infinity when "Auto" is set in the UI 245 | readonly sectionSize?: number // Not set for alignment: "STRETCH" 246 | readonly offset?: number // Not set for alignment: "CENTER" 247 | 248 | readonly visible?: boolean 249 | readonly color?: RGBA 250 | } 251 | 252 | interface GridLayoutGrid { 253 | readonly pattern: "GRID" 254 | readonly sectionSize: number 255 | 256 | readonly visible?: boolean 257 | readonly color?: RGBA 258 | } 259 | 260 | type LayoutGrid = RowsColsLayoutGrid | GridLayoutGrid 261 | 262 | interface ExportSettingsConstraints { 263 | type: "SCALE" | "WIDTH" | "HEIGHT" 264 | value: number 265 | } 266 | 267 | interface ExportSettingsImage { 268 | format: "JPG" | "PNG" 269 | contentsOnly?: boolean // defaults to true 270 | suffix?: string 271 | constraint?: ExportSettingsConstraints 272 | } 273 | 274 | interface ExportSettingsSVG { 275 | format: "SVG" 276 | contentsOnly?: boolean // defaults to true 277 | suffix?: string 278 | svgOutlineText?: boolean // defaults to true 279 | svgIdAttribute?: boolean // defaults to false 280 | svgSimplifyStroke?: boolean // defaults to true 281 | } 282 | 283 | interface ExportSettingsPDF { 284 | format: "PDF" 285 | contentsOnly?: boolean // defaults to true 286 | suffix?: string 287 | } 288 | 289 | type ExportSettings = ExportSettingsImage | ExportSettingsSVG | ExportSettingsPDF 290 | 291 | type WindingRule = "NONZERO" | "EVENODD" 292 | 293 | interface VectorVertex { 294 | readonly x: number 295 | readonly y: number 296 | readonly strokeCap?: StrokeCap 297 | readonly strokeJoin?: StrokeJoin 298 | readonly cornerRadius?: number 299 | readonly handleMirroring?: HandleMirroring 300 | } 301 | 302 | interface VectorSegment { 303 | readonly start: number 304 | readonly end: number 305 | readonly tangentStart?: Vector // Defaults to { x: 0, y: 0 } 306 | readonly tangentEnd?: Vector // Defaults to { x: 0, y: 0 } 307 | } 308 | 309 | interface VectorRegion { 310 | readonly windingRule: WindingRule 311 | readonly loops: ReadonlyArray> 312 | } 313 | 314 | interface VectorNetwork { 315 | readonly vertices: ReadonlyArray 316 | readonly segments: ReadonlyArray 317 | readonly regions?: ReadonlyArray // Defaults to [] 318 | } 319 | 320 | interface VectorPath { 321 | readonly windingRule: WindingRule | "NONE" 322 | readonly data: string 323 | } 324 | 325 | type VectorPaths = ReadonlyArray 326 | 327 | interface LetterSpacing { 328 | readonly value: number 329 | readonly unit: "PIXELS" | "PERCENT" 330 | } 331 | 332 | type LineHeight = { 333 | readonly value: number 334 | readonly unit: "PIXELS" | "PERCENT" 335 | } | { 336 | readonly unit: "AUTO" 337 | } 338 | 339 | type BlendMode = 340 | "PASS_THROUGH" | 341 | "NORMAL" | 342 | "DARKEN" | 343 | "MULTIPLY" | 344 | "LINEAR_BURN" | 345 | "COLOR_BURN" | 346 | "LIGHTEN" | 347 | "SCREEN" | 348 | "LINEAR_DODGE" | 349 | "COLOR_DODGE" | 350 | "OVERLAY" | 351 | "SOFT_LIGHT" | 352 | "HARD_LIGHT" | 353 | "DIFFERENCE" | 354 | "EXCLUSION" | 355 | "HUE" | 356 | "SATURATION" | 357 | "COLOR" | 358 | "LUMINOSITY" 359 | 360 | interface Font { 361 | fontName: FontName 362 | } 363 | 364 | //////////////////////////////////////////////////////////////////////////////// 365 | // Mixins 366 | 367 | interface BaseNodeMixin { 368 | readonly id: string 369 | readonly parent: (BaseNode & ChildrenMixin) | null 370 | name: string // Note: setting this also sets `autoRename` to false on TextNodes 371 | readonly removed: boolean 372 | toString(): string 373 | remove(): void 374 | 375 | getPluginData(key: string): string 376 | setPluginData(key: string, value: string): void 377 | 378 | // Namespace is a string that must be at least 3 alphanumeric characters, and should 379 | // be a name related to your plugin. Other plugins will be able to read this data. 380 | getSharedPluginData(namespace: string, key: string): string 381 | setSharedPluginData(namespace: string, key: string, value: string): void 382 | } 383 | 384 | interface SceneNodeMixin { 385 | visible: boolean 386 | locked: boolean 387 | } 388 | 389 | interface ChildrenMixin { 390 | readonly children: ReadonlyArray 391 | 392 | appendChild(child: SceneNode): void 393 | insertChild(index: number, child: SceneNode): void 394 | 395 | findAll(callback?: (node: SceneNode) => boolean): SceneNode[] 396 | findOne(callback: (node: SceneNode) => boolean): SceneNode | null 397 | } 398 | 399 | interface ConstraintMixin { 400 | constraints: Constraints 401 | } 402 | 403 | interface LayoutMixin { 404 | readonly absoluteTransform: Transform 405 | relativeTransform: Transform 406 | x: number 407 | y: number 408 | rotation: number // In degrees 409 | 410 | readonly width: number 411 | readonly height: number 412 | 413 | resize(width: number, height: number): void 414 | resizeWithoutConstraints(width: number, height: number): void 415 | } 416 | 417 | interface BlendMixin { 418 | opacity: number 419 | blendMode: BlendMode 420 | isMask: boolean 421 | effects: ReadonlyArray 422 | effectStyleId: string 423 | } 424 | 425 | interface FrameMixin { 426 | backgrounds: ReadonlyArray 427 | layoutGrids: ReadonlyArray 428 | clipsContent: boolean 429 | guides: ReadonlyArray 430 | gridStyleId: string 431 | backgroundStyleId: string 432 | } 433 | 434 | type StrokeCap = "NONE" | "ROUND" | "SQUARE" | "ARROW_LINES" | "ARROW_EQUILATERAL" 435 | type StrokeJoin = "MITER" | "BEVEL" | "ROUND" 436 | type HandleMirroring = "NONE" | "ANGLE" | "ANGLE_AND_LENGTH" 437 | 438 | interface GeometryMixin { 439 | fills: ReadonlyArray | symbol 440 | strokes: ReadonlyArray 441 | strokeWeight: number 442 | strokeAlign: "CENTER" | "INSIDE" | "OUTSIDE" 443 | strokeCap: StrokeCap | symbol 444 | strokeJoin: StrokeJoin | symbol 445 | dashPattern: ReadonlyArray 446 | fillStyleId: string | symbol 447 | strokeStyleId: string 448 | } 449 | 450 | interface CornerMixin { 451 | cornerRadius: number | symbol 452 | cornerSmoothing: number 453 | } 454 | 455 | interface ExportMixin { 456 | exportSettings: ReadonlyArray 457 | exportAsync(settings?: ExportSettings): Promise // Defaults to PNG format 458 | } 459 | 460 | interface DefaultShapeMixin extends 461 | BaseNodeMixin, SceneNodeMixin, 462 | BlendMixin, GeometryMixin, LayoutMixin, ExportMixin { 463 | } 464 | 465 | interface DefaultContainerMixin extends 466 | BaseNodeMixin, SceneNodeMixin, 467 | ChildrenMixin, FrameMixin, 468 | BlendMixin, ConstraintMixin, LayoutMixin, ExportMixin { 469 | } 470 | 471 | //////////////////////////////////////////////////////////////////////////////// 472 | // Nodes 473 | 474 | interface DocumentNode extends BaseNodeMixin { 475 | readonly type: "DOCUMENT" 476 | 477 | readonly children: ReadonlyArray 478 | 479 | appendChild(child: PageNode): void 480 | insertChild(index: number, child: PageNode): void 481 | 482 | findAll(callback?: (node: (PageNode | SceneNode)) => boolean): Array 483 | findOne(callback: (node: (PageNode | SceneNode)) => boolean): PageNode | SceneNode | null 484 | } 485 | 486 | interface PageNode extends BaseNodeMixin, ChildrenMixin, ExportMixin { 487 | readonly type: "PAGE" 488 | clone(): PageNode 489 | 490 | guides: ReadonlyArray 491 | selection: ReadonlyArray 492 | 493 | backgrounds: ReadonlyArray 494 | } 495 | 496 | interface FrameNode extends DefaultContainerMixin { 497 | readonly type: "FRAME" | "GROUP" 498 | clone(): FrameNode 499 | } 500 | 501 | interface SliceNode extends BaseNodeMixin, SceneNodeMixin, LayoutMixin, ExportMixin { 502 | readonly type: "SLICE" 503 | clone(): SliceNode 504 | } 505 | 506 | interface RectangleNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin { 507 | readonly type: "RECTANGLE" 508 | clone(): RectangleNode 509 | topLeftRadius: number 510 | topRightRadius: number 511 | bottomLeftRadius: number 512 | bottomRightRadius: number 513 | } 514 | 515 | interface LineNode extends DefaultShapeMixin, ConstraintMixin { 516 | readonly type: "LINE" 517 | clone(): LineNode 518 | } 519 | 520 | interface EllipseNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin { 521 | readonly type: "ELLIPSE" 522 | clone(): EllipseNode 523 | arcData: ArcData 524 | } 525 | 526 | interface PolygonNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin { 527 | readonly type: "POLYGON" 528 | clone(): PolygonNode 529 | pointCount: number 530 | } 531 | 532 | interface StarNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin { 533 | readonly type: "STAR" 534 | clone(): StarNode 535 | pointCount: number 536 | innerRadius: number 537 | } 538 | 539 | interface VectorNode extends DefaultShapeMixin, ConstraintMixin, CornerMixin { 540 | readonly type: "VECTOR" 541 | clone(): VectorNode 542 | vectorNetwork: VectorNetwork 543 | vectorPaths: VectorPaths 544 | handleMirroring: HandleMirroring | symbol 545 | } 546 | 547 | interface TextNode extends DefaultShapeMixin, ConstraintMixin { 548 | readonly type: "TEXT" 549 | clone(): TextNode 550 | characters: string 551 | readonly hasMissingFont: boolean 552 | textAlignHorizontal: "LEFT" | "CENTER" | "RIGHT" | "JUSTIFIED" 553 | textAlignVertical: "TOP" | "CENTER" | "BOTTOM" 554 | textAutoResize: "NONE" | "WIDTH_AND_HEIGHT" | "HEIGHT" 555 | paragraphIndent: number 556 | paragraphSpacing: number 557 | autoRename: boolean 558 | 559 | textStyleId: string | symbol 560 | fontSize: number | symbol 561 | fontName: FontName | symbol 562 | textCase: TextCase | symbol 563 | textDecoration: TextDecoration | symbol 564 | letterSpacing: LetterSpacing | symbol 565 | lineHeight: LineHeight | symbol 566 | 567 | getRangeFontSize(start: number, end: number): number | symbol 568 | setRangeFontSize(start: number, end: number, value: number): void 569 | getRangeFontName(start: number, end: number): FontName | symbol 570 | setRangeFontName(start: number, end: number, value: FontName): void 571 | getRangeTextCase(start: number, end: number): TextCase | symbol 572 | setRangeTextCase(start: number, end: number, value: TextCase): void 573 | getRangeTextDecoration(start: number, end: number): TextDecoration | symbol 574 | setRangeTextDecoration(start: number, end: number, value: TextDecoration): void 575 | getRangeLetterSpacing(start: number, end: number): LetterSpacing | symbol 576 | setRangeLetterSpacing(start: number, end: number, value: LetterSpacing): void 577 | getRangeLineHeight(start: number, end: number): LineHeight | symbol 578 | setRangeLineHeight(start: number, end: number, value: LineHeight): void 579 | getRangeFills(start: number, end: number): Paint[] | symbol 580 | setRangeFills(start: number, end: number, value: Paint[]): void 581 | getRangeTextStyleId(start: number, end: number): string | symbol 582 | setRangeTextStyleId(start: number, end: number, value: string): void 583 | getRangeFillStyleId(start: number, end: number): string | symbol 584 | setRangeFillStyleId(start: number, end: number, value: string): void 585 | } 586 | 587 | interface ComponentNode extends DefaultContainerMixin { 588 | readonly type: "COMPONENT" 589 | clone(): ComponentNode 590 | 591 | createInstance(): InstanceNode 592 | description: string 593 | readonly remote: boolean 594 | readonly key: string // The key to use with "importComponentByKeyAsync" 595 | } 596 | 597 | interface InstanceNode extends DefaultContainerMixin { 598 | readonly type: "INSTANCE" 599 | clone(): InstanceNode 600 | masterComponent: ComponentNode 601 | } 602 | 603 | interface BooleanOperationNode extends DefaultShapeMixin, ChildrenMixin, CornerMixin { 604 | readonly type: "BOOLEAN_OPERATION" 605 | clone(): BooleanOperationNode 606 | booleanOperation: "UNION" | "INTERSECT" | "SUBTRACT" | "EXCLUDE" 607 | } 608 | 609 | type BaseNode = 610 | DocumentNode | 611 | PageNode | 612 | SceneNode 613 | 614 | type SceneNode = 615 | SliceNode | 616 | FrameNode | 617 | ComponentNode | 618 | InstanceNode | 619 | BooleanOperationNode | 620 | VectorNode | 621 | StarNode | 622 | LineNode | 623 | EllipseNode | 624 | PolygonNode | 625 | RectangleNode | 626 | TextNode 627 | 628 | type NodeType = 629 | "DOCUMENT" | 630 | "PAGE" | 631 | "SLICE" | 632 | "FRAME" | 633 | "GROUP" | 634 | "COMPONENT" | 635 | "INSTANCE" | 636 | "BOOLEAN_OPERATION" | 637 | "VECTOR" | 638 | "STAR" | 639 | "LINE" | 640 | "ELLIPSE" | 641 | "POLYGON" | 642 | "RECTANGLE" | 643 | "TEXT" 644 | 645 | //////////////////////////////////////////////////////////////////////////////// 646 | // Styles 647 | type StyleType = "PAINT" | "TEXT" | "EFFECT" | "GRID" 648 | 649 | interface BaseStyle { 650 | readonly id: string 651 | readonly type: StyleType 652 | name: string 653 | description: string 654 | remote: boolean 655 | readonly key: string // The key to use with "importStyleByKeyAsync" 656 | remove(): void 657 | } 658 | 659 | interface PaintStyle extends BaseStyle { 660 | type: "PAINT" 661 | paints: ReadonlyArray 662 | } 663 | 664 | interface TextStyle extends BaseStyle { 665 | type: "TEXT" 666 | fontSize: number 667 | textDecoration: TextDecoration 668 | fontName: FontName 669 | letterSpacing: LetterSpacing 670 | lineHeight: LineHeight 671 | paragraphIndent: number 672 | paragraphSpacing: number 673 | textCase: TextCase 674 | } 675 | 676 | interface EffectStyle extends BaseStyle { 677 | type: "EFFECT" 678 | effects: ReadonlyArray 679 | } 680 | 681 | interface GridStyle extends BaseStyle { 682 | type: "GRID" 683 | layoutGrids: ReadonlyArray 684 | } 685 | 686 | //////////////////////////////////////////////////////////////////////////////// 687 | // Other 688 | 689 | interface Image { 690 | readonly hash: string 691 | getBytesAsync(): Promise 692 | } 693 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Project Scaffold", 3 | "id": "747372158567878238", 4 | "api": "1.0.0", 5 | "main": "code.js" 6 | } -------------------------------------------------------------------------------- /scaf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tushar7d/Project-Scaffold-Figma-Plugin/5248b8c12027e5c907e09b5a96f3a68d194083a2/scaf.png -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6" 4 | } 5 | } 6 | --------------------------------------------------------------------------------