From 459250e8d088a13e5abc714327f99a70464e05ff Mon Sep 17 00:00:00 2001 From: carlos Date: Tue, 15 Nov 2022 10:24:25 -0300 Subject: [PATCH] add export add DSP basic export --- pages/index.vue | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index 34880a2..0fbc5cc 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -135,7 +135,7 @@
-
+
               
@@ -267,7 +267,7 @@ export default { { $name: "easeInSine", "$value": "cubic-bezier(0.12, 0, 0.39, 0)" - }, + }, { $name: "easeOutSine", "$value": "cubic-bezier(0.61, 1, 0.88, 1)500ms" @@ -417,7 +417,33 @@ export default { }, methods: { transformDSP() { - return "{ DSP Support coming soon! }" + const now = (new Date()).toISOString(); + const updatedBy = "Layoutit" // or Design Tokens Generator + var newObj = { + dsp_spec_version: "1.0", + last_updated_by: updatedBy, + last_updated: now, + settings: {}, + entities: [] + }; + var copyObj = JSON.parse(JSON.stringify(this.sets[this.selectedToken])); + for (const group of copyObj.tokens) { + for (const token of group.tokens) { + const { $type } = group; + const type = ($type === "color" || $type === "size") ? $type : "custom"; + const entity = { + class: "token", + type, + id: `${group.$type}_${token.$name}`, + value: token.$value, + last_updated: now, + last_updated_by: updatedBy, + description: token.$description || "", + }; + newObj.entities.push(entity); + } + } + return newObj; }, transformTheo(format) { var newObj = { props: {} };