@croquiscom/pds 14.2.2 → 14.2.3

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ /// <reference types="@figma/plugin-typings/plugin-api" />
2
+ export declare const TABLE_HEAD_COMPONENT_NAME = "Table Head/Normal";
3
+ export declare const TABLE_HEAD_LABEL_PROPERTY_NAME = "Label";
4
+ export declare const TABLE_HEAD_COMPONENT_KEY = "c35b8807ff62f8a35e4688e6cc4a11327a1e9ece";
5
+ interface TableHeadResult {
6
+ nodes: SceneNode[];
7
+ properties: Record<string, ComponentProperties>[];
8
+ }
9
+ export declare const getMainComponentsAndValidate: (nodes: SceneNode[]) => Promise<boolean>;
10
+ export declare const findAllTableHeadNodes: (node: SceneNode) => TableHeadResult;
11
+ export declare const findAllTableHeadLabelNodes: (allThNodes: SceneNode[]) => TextNode[];
12
+ export declare const getErrorMessage: (code: string) => CodegenResult[];
13
+ export declare const getTooltipValue: (obj: Record<string, ComponentProperties>) => {
14
+ type: ComponentPropertyType;
15
+ value: string | boolean;
16
+ preferredValues?: InstanceSwapPreferredValue[];
17
+ readonly boundVariables?: {
18
+ value?: VariableAlias;
19
+ };
20
+ };
21
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@croquiscom/pds",
3
- "version": "14.2.2",
3
+ "version": "14.2.3",
4
4
  "description": "Design system for Zigzag's Partner Center",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.es.js",
@@ -22,6 +22,7 @@
22
22
  "test:type": "tsc --skipLibCheck",
23
23
  "test": "vitest",
24
24
  "build": "npm run build-rollup && npm run test:type",
25
+ "watch": "rollup -c --watch",
25
26
  "lint": "eslint 'src/**/*.{js,ts,tsx}' --quiet --fix",
26
27
  "changeset": "changeset",
27
28
  "svgr": "yarn svgr:icons && yarn svgr:images && node ./scripts/figma-import-icons.js",
@@ -88,6 +89,7 @@
88
89
  "react-number-format": "^5.0.1",
89
90
  "rollup": "^2.52.7",
90
91
  "rollup-plugin-copy": "^3.4.0",
92
+ "rollup-plugin-json": "^4.0.0",
91
93
  "rollup-plugin-peer-deps-external": "^2.2.4",
92
94
  "rollup-plugin-terser": "^7.0.2",
93
95
  "rollup-plugin-typescript2": "^0.30.0",
@@ -3,8 +3,8 @@
3
3
  "api": "1.0.0",
4
4
  "id": "1399991915237680587",
5
5
  "editorType": ["figma"],
6
- "main": "./plugin/plugin.js",
7
- "ui": "./plugin/ui.html",
6
+ "main": "plugin.js",
7
+ "ui": "ui.html",
8
8
  "enablePrivatePluginApi": true,
9
9
  "documentAccess": "dynamic-page",
10
10
  "networkAccess": {
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "Generate Table Code from Figma",
3
+ "api": "1.0.0",
4
+ "id": "1473511516859183851",
5
+ "editorType": ["dev"],
6
+ "capabilities": ["codegen", "vscode"],
7
+ "codegenLanguages": [{ "label": "Typescript", "value": "typescript" }],
8
+ "codegenPreferences": [
9
+ {
10
+ "itemType": "select",
11
+ "propertyName": "columnWidth",
12
+ "label": "컬럼 너비 출력 여부",
13
+ "options": [
14
+ { "label": "예", "value": "true", "isDefault": true },
15
+ { "label": "아니오", "value": "false" }
16
+ ],
17
+ "includedLanguages": ["typescript"]
18
+ },
19
+ {
20
+ "itemType": "action",
21
+ "propertyName": "refresh",
22
+ "label": "재실행",
23
+ "includedLanguages": ["typescript"]
24
+ }
25
+ ],
26
+ "main": "plugin.js",
27
+ "enablePrivatePluginApi": true,
28
+ "documentAccess": "dynamic-page",
29
+ "networkAccess": {
30
+ "allowedDomains": ["none"]
31
+ }
32
+ }
@@ -0,0 +1 @@
1
+ "use strict";function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime(){_regeneratorRuntime=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function define(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{define({},"")}catch(e){define=function(e,t,r){return e[t]=r}}function wrap(e,t,r,n){var a=t&&t.prototype instanceof Generator?t:Generator,i=Object.create(a.prototype),c=new Context(n||[]);return o(i,"_invoke",{value:makeInvokeMethod(e,r,c)}),i}function tryCatch(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=wrap;var l="suspendedStart",s="suspendedYield",f="executing",p="completed",h={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var y={};define(y,i,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,i)&&(y=v);var m=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(y);function defineIteratorMethods(e){["next","throw","return"].forEach((function(t){define(e,t,(function(e){return this._invoke(t,e)}))}))}function AsyncIterator(e,t){function invoke(r,o,a,i){var c=tryCatch(e[r],e,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){invoke("next",e,a,i)}),(function(e){invoke("throw",e,a,i)})):t.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return invoke("throw",e,a,i)}))}i(c.arg)}var r;o(this,"_invoke",{value:function(e,n){function callInvokeWithMethodAndArg(){return new t((function(t,r){invoke(e,n,t,r)}))}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(t,r,n){var o=l;return function(a,i){if(o===f)throw Error("Generator is already running");if(o===p){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===h)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===l)throw o=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var y=tryCatch(t,r,n);if("normal"===y.type){if(o=n.done?p:s,y.arg===h)continue;return{value:y.arg,done:n.done}}"throw"===y.type&&(o=p,n.method="throw",n.arg=y.arg)}}}function maybeInvokeDelegate(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,maybeInvokeDelegate(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var a=tryCatch(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,h;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,h):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function pushTryEntry(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function resetTryEntry(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function Context(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(pushTryEntry,this),this.reset(!0)}function values(t){if(t||""===t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function next(){for(;++o<t.length;)if(n.call(t,o))return next.value=t[o],next.done=!1,next;return next.value=e,next.done=!0,next};return a.next=a}}throw new TypeError(typeof t+" is not iterable")}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(m,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===GeneratorFunction||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,define(e,u,"GeneratorFunction")),e.prototype=Object.create(m),e},t.awrap=function(e){return{__await:e}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,(function(){return this})),t.AsyncIterator=AsyncIterator,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new AsyncIterator(wrap(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},defineIteratorMethods(m),define(m,u,"Generator"),define(m,i,(function(){return this})),define(m,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function next(){for(;r.length;){var e=r.pop();if(e in t)return next.value=e,next.done=!1,next}return next.done=!0,next}},t.values=values,Context.prototype={constructor:Context,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(resetTryEntry),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function handle(n,o){return i.type="throw",i.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return handle("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return handle(a.catchLoc,!0);if(this.prev<a.finallyLoc)return handle(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return handle(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return handle(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:values(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),h}},t}function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function asyncGeneratorStep(e,t,r,n,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function _next(e){asyncGeneratorStep(a,n,o,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(a,n,o,_next,_throw,"throw",e)}_next(void 0)}))}}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,F=function(){};return{s:F,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,i=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){i=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(i)throw o}}}}var e="Label",t=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(e){var t,r,n,o;return _regeneratorRuntime().wrap((function _callee$(a){for(;;)switch(a.prev=a.next){case 0:t=_createForOfIteratorHelper(e),a.prev=1,t.s();case 3:if((r=t.n()).done){a.next=18;break}return n=r.value,a.prev=5,a.next=8,n.parent.getMainComponentAsync();case 8:if("c35b8807ff62f8a35e4688e6cc4a11327a1e9ece"===(null==(o=a.sent)?void 0:o.key)){a.next=11;break}return a.abrupt("return",!1);case 11:a.next=16;break;case 13:return a.prev=13,a.t0=a.catch(5),a.abrupt("return",!1);case 16:a.next=3;break;case 18:a.next=23;break;case 20:a.prev=20,a.t1=a.catch(1),t.e(a.t1);case 23:return a.prev=23,t.f(),a.finish(23);case 26:return a.abrupt("return",!0);case 27:case"end":return a.stop()}}),_callee,null,[[1,20,23,26],[5,13]])})));return function getMainComponentsAndValidate(t){return e.apply(this,arguments)}}(),r=function findAllTableHeadNodes(t){var r,n={nodes:[],properties:[]};"Table Head/Normal"===t.parent.name&&t.name===e&&t.visible&&(n.nodes.push(t),n.properties.push("INSTANCE"===(null===(r=t.parent)||void 0===r?void 0:r.type)?_objectSpread2(_objectSpread2({},t.parent.componentProperties),{},{width:{value:t.parent.width}}):{}));return"children"in t?t.children.reduce((function(e,t){var r=findAllTableHeadNodes(t);return{nodes:[].concat(_toConsumableArray(e.nodes),_toConsumableArray(r.nodes)),properties:[].concat(_toConsumableArray(e.properties),_toConsumableArray(r.properties))}}),n):n},n=function findAllTableHeadLabelNodes(t){return t.reduce((function(t,r){if(!("children"in r))return t;var n=r.children.reduce((function(t,r){var n;if((null===(n=r.parent)||void 0===n?void 0:n.name)===e&&r.name===e&&"children"in r){var o=r.children.filter((function(e){return"TEXT"===e.type}));return[].concat(_toConsumableArray(t),_toConsumableArray(o))}return t}),[]);return[].concat(_toConsumableArray(t),_toConsumableArray(n))}),[])},o=function getErrorMessage(e){return[{title:"DataTable Columns",language:"PLAINTEXT",code:e}]};"dev"===figma.editorType&&"codegen"===figma.mode?(figma.codegen.on("generate",function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(e){var a,i,c,u,l,s;return _regeneratorRuntime().wrap((function _callee$(f){for(;;)switch(f.prev=f.next){case 0:if(a=e.node,i=r(a),c=i.properties,0!==(u=i.nodes).length){f.next=5;break}return f.abrupt("return",o("PDS 테이블 컴포넌트를 찾을 수 없습니다. 테이블 전체 Frame 또는 Instance 단위를 선택하세요."));case 5:return f.next=7,t(u);case 7:if(f.sent){f.next=10;break}return f.abrupt("return",o("PDS 테이블 헤더 컴포넌트를 찾을 수 없습니다. 마스터 컴포넌트와 연결되어 있는지 확인하세요."));case 10:if(l=n(u).map((function(e){var t;return null!==(t=e.characters)&&void 0!==t?t:""})),l.length===c.length){f.next=13;break}return f.abrupt("return",o("정확한 컬럼 라벨명 정보를 찾을 수 없습니다."));case 13:return s=c.map((function(e,t){var r="string"==typeof e["Text Align"].value?e["Text Align"].value.toLowerCase():"left",n="left"===r,o="true"===figma.codegen.preferences.customSettings.columnWidth;return _objectSpread2(_objectSpread2({id:t,text:l[t]},e.width.value&&o&&{width:Math.round(Number(e.width.value))}),!n&&{align:r})})),f.abrupt("return",[{title:"DataTable Columns",language:"TYPESCRIPT",code:JSON.stringify(s,null,2)}]);case 15:case"end":return f.stop()}}),_callee)})));return function(t){return e.apply(this,arguments)}}()),figma.codegen.on("preferenceschange",function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function _callee2(e){return _regeneratorRuntime().wrap((function _callee2$(t){for(;;)switch(t.prev=t.next){case 0:"refresh"===e.propertyName&&figma.codegen.refresh();case 1:case"end":return t.stop()}}),_callee2)})));return function(t){return e.apply(this,arguments)}}())):(figma.notify("PDS 테이블 컬럼 자동 코드 생성 플러그인을 사용하려면 Dev모드를 활성해야합니다."),figma.closePlugin());
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-var-requires */
2
2
 
3
- const figma_rest_api = require('@figma/code-connect/dist/connect/figma_rest_api');
4
- const helpers = require('@figma/code-connect/dist/connect/helpers');
3
+ const figma_rest_api = require('../node_modules/@figma/code-connect/dist/connect/figma_rest_api');
4
+ const helpers = require('../node_modules/@figma/code-connect/dist/connect/helpers');
5
5
  require('dotenv').config();
6
6
  /**
7
7
  * Fetch components from a figma file. If the `node-id` query parameter is used,
File without changes
File without changes
File without changes
File without changes