Skip to content

Commit

Permalink
add export
Browse files Browse the repository at this point in the history
add DSP basic export
  • Loading branch information
carlosbollero committed Nov 28, 2022
1 parent a041e13 commit 459250e
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<pre v-if="selectedOption === 0"><code v-highlight class="json" v-html="JSON.stringify(transformW3C(),null,2)"></code></pre>
<pre v-if="selectedOption === 1"><code v-highlight class="css" v-html="transformCSSvars('CSS')"></code></pre>
<pre v-if="selectedOption === 2"><code v-highlight class="scss" v-html="transformCSSvars('SASS')"></code></pre>
<pre v-if="selectedOption === 3"><code v-highlight class="css" v-html="transformDSP()"></code></pre>
<pre v-if="selectedOption === 3"><code v-highlight class="json" v-html="transformDSP()"></code></pre>
<pre v-if="selectedOption === 4">
<div class="theo-specs-radio">
<div>
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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: {} };
Expand Down

0 comments on commit 459250e

Please sign in to comment.