diff --git a/__integration__/__snapshots__/compose.test.js.snap b/__integration__/__snapshots__/compose.test.js.snap new file mode 100644 index 000000000..eb7f42de0 --- /dev/null +++ b/__integration__/__snapshots__/compose.test.js.snap @@ -0,0 +1,363 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`integration compose compose/object should match snapshot 1`] = ` +" + +// Do not edit directly +// Generated on Sat, 01 Jan 2000 00:00:00 GMT + + + +package com.example.tokens; + + +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.* + +object StyleDictionary { + val colorBackgroundDanger = Color(0xffffeae9) + val colorBackgroundDisabled = Color(0xffdee1e1) + val colorBackgroundInfo = Color(0xffe9f8ff) + val colorBackgroundPrimary = Color(0xffffffff) + val colorBackgroundSecondary = Color(0xfff3f4f4) + val colorBackgroundSuccess = Color(0xffebf9eb) + val colorBackgroundTertiary = Color(0xffdee1e1) + val colorBackgroundWarning = Color(0xffffede3) + val colorBorderPrimary = Color(0xffc8cccc) + val colorBrandPrimary = Color(0xff0b8599) + val colorBrandSecondary = Color(0xff6f5ed3) + val colorCoreAqua0 = Color(0xffd9fcfb) + val colorCoreAqua100 = Color(0xffc5f9f9) + val colorCoreAqua1000 = Color(0xff083d4f) + val colorCoreAqua1100 = Color(0xff002838) + val colorCoreAqua200 = Color(0xffa5f2f2) + val colorCoreAqua300 = Color(0xff76e5e2) + val colorCoreAqua400 = Color(0xff33d6e2) + val colorCoreAqua500 = Color(0xff17b8ce) + val colorCoreAqua600 = Color(0xff0797ae) + val colorCoreAqua700 = Color(0xff0b8599) + val colorCoreAqua800 = Color(0xff0f6e84) + val colorCoreAqua900 = Color(0xff035e73) + val colorCoreBlue0 = Color(0xffe9f8ff) + val colorCoreBlue100 = Color(0xffdcf2ff) + val colorCoreBlue1000 = Color(0xff0a3960) + val colorCoreBlue1100 = Color(0xff002138) + val colorCoreBlue200 = Color(0xffc7e4f9) + val colorCoreBlue300 = Color(0xffa1d2f8) + val colorCoreBlue400 = Color(0xff56adf5) + val colorCoreBlue500 = Color(0xff3896e3) + val colorCoreBlue600 = Color(0xff2b87d3) + val colorCoreBlue700 = Color(0xff2079c3) + val colorCoreBlue800 = Color(0xff116daa) + val colorCoreBlue900 = Color(0xff0c5689) + val colorCoreGreen0 = Color(0xffebf9eb) + val colorCoreGreen100 = Color(0xffd7f4d7) + val colorCoreGreen1000 = Color(0xff08422f) + val colorCoreGreen1100 = Color(0xff002b20) + val colorCoreGreen200 = Color(0xffc2f2bd) + val colorCoreGreen300 = Color(0xff98e58e) + val colorCoreGreen400 = Color(0xff75dd66) + val colorCoreGreen500 = Color(0xff59cb59) + val colorCoreGreen600 = Color(0xff2bb656) + val colorCoreGreen700 = Color(0xff0ca750) + val colorCoreGreen800 = Color(0xff008b46) + val colorCoreGreen900 = Color(0xff006b40) + val colorCoreMagenta0 = Color(0xfffef0ff) + val colorCoreMagenta100 = Color(0xfff9e3fc) + val colorCoreMagenta1000 = Color(0xff451551) + val colorCoreMagenta1100 = Color(0xff29192d) + val colorCoreMagenta200 = Color(0xfff4c4f7) + val colorCoreMagenta300 = Color(0xffedadf2) + val colorCoreMagenta400 = Color(0xfff282f5) + val colorCoreMagenta500 = Color(0xffdb61db) + val colorCoreMagenta600 = Color(0xffc44eb9) + val colorCoreMagenta700 = Color(0xffac44a8) + val colorCoreMagenta800 = Color(0xff8f3896) + val colorCoreMagenta900 = Color(0xff6c2277) + val colorCoreNeutral0 = Color(0xffffffff) + val colorCoreNeutral100 = Color(0xfff3f4f4) + val colorCoreNeutral1000 = Color(0xff162020) + val colorCoreNeutral1100 = Color(0xff040404) + val colorCoreNeutral200 = Color(0xffdee1e1) + val colorCoreNeutral300 = Color(0xffc8cccc) + val colorCoreNeutral400 = Color(0xffb0b6b7) + val colorCoreNeutral500 = Color(0xff929a9b) + val colorCoreNeutral600 = Color(0xff6e797a) + val colorCoreNeutral700 = Color(0xff515e5f) + val colorCoreNeutral800 = Color(0xff364141) + val colorCoreNeutral900 = Color(0xff273333) + val colorCoreOrange0 = Color(0xffffede3) + val colorCoreOrange100 = Color(0xfffcdccc) + val colorCoreOrange1000 = Color(0xff601700) + val colorCoreOrange1100 = Color(0xff2d130e) + val colorCoreOrange200 = Color(0xffffc6a4) + val colorCoreOrange300 = Color(0xffffb180) + val colorCoreOrange400 = Color(0xffff9c5d) + val colorCoreOrange500 = Color(0xfffc8943) + val colorCoreOrange600 = Color(0xfff57d33) + val colorCoreOrange700 = Color(0xffed7024) + val colorCoreOrange800 = Color(0xffce5511) + val colorCoreOrange900 = Color(0xff962c0b) + val colorCorePink0 = Color(0xffffe9f3) + val colorCorePink100 = Color(0xfffcdbeb) + val colorCorePink1000 = Color(0xff561231) + val colorCorePink1100 = Color(0xff2b1721) + val colorCorePink200 = Color(0xffffb5d5) + val colorCorePink300 = Color(0xffff95c1) + val colorCorePink400 = Color(0xffff76ae) + val colorCorePink500 = Color(0xffef588b) + val colorCorePink600 = Color(0xffe0447c) + val colorCorePink700 = Color(0xffce3665) + val colorCorePink800 = Color(0xffb22f5b) + val colorCorePink900 = Color(0xff931847) + val colorCorePurple0 = Color(0xfff2f2f9) + val colorCorePurple100 = Color(0xffeaeaf9) + val colorCorePurple1000 = Color(0xff2d246b) + val colorCorePurple1100 = Color(0xff1d1d38) + val colorCorePurple200 = Color(0xffd8d7f9) + val colorCorePurple300 = Color(0xffc1c1f7) + val colorCorePurple400 = Color(0xffa193f2) + val colorCorePurple500 = Color(0xff9180f4) + val colorCorePurple600 = Color(0xff816fea) + val colorCorePurple700 = Color(0xff6f5ed3) + val colorCorePurple800 = Color(0xff5e4eba) + val colorCorePurple900 = Color(0xff483a9c) + val colorCoreRed0 = Color(0xffffeae9) + val colorCoreRed100 = Color(0xffffd5d2) + val colorCoreRed1000 = Color(0xff6d1313) + val colorCoreRed1100 = Color(0xff2b1111) + val colorCoreRed200 = Color(0xffffb8b1) + val colorCoreRed300 = Color(0xffff9c8f) + val colorCoreRed400 = Color(0xffff7f6e) + val colorCoreRed500 = Color(0xfff76054) + val colorCoreRed600 = Color(0xffed4c42) + val colorCoreRed700 = Color(0xffdb3e3e) + val colorCoreRed800 = Color(0xffc63434) + val colorCoreRed900 = Color(0xff992222) + val colorCoreTeal0 = Color(0xffe5f9f5) + val colorCoreTeal100 = Color(0xffcdf7ef) + val colorCoreTeal1000 = Color(0xff083f3f) + val colorCoreTeal1100 = Color(0xff002528) + val colorCoreTeal200 = Color(0xffb3f2e6) + val colorCoreTeal300 = Color(0xff7dead5) + val colorCoreTeal400 = Color(0xff24e0c5) + val colorCoreTeal500 = Color(0xff08c4b2) + val colorCoreTeal600 = Color(0xff00a99c) + val colorCoreTeal700 = Color(0xff0b968f) + val colorCoreTeal800 = Color(0xff067c7c) + val colorCoreTeal900 = Color(0xff026661) + val colorCoreYellow0 = Color(0xfffff8e2) + val colorCoreYellow100 = Color(0xfffdefcd) + val colorCoreYellow1000 = Color(0xff542a00) + val colorCoreYellow1100 = Color(0xff2d1a05) + val colorCoreYellow200 = Color(0xffffe99a) + val colorCoreYellow300 = Color(0xffffe16e) + val colorCoreYellow400 = Color(0xffffd943) + val colorCoreYellow500 = Color(0xffffcd1c) + val colorCoreYellow600 = Color(0xffffbc00) + val colorCoreYellow700 = Color(0xffdd9903) + val colorCoreYellow800 = Color(0xffba7506) + val colorCoreYellow900 = Color(0xff944c0c) + val colorFontDanger = Color(0xff6d1313) + val colorFontInteractive = Color(0xff0b8599) + val colorFontInteractiveActive = Color(0xff6f5ed3) + val colorFontInteractiveDisabled = Color(0xff364141) + val colorFontInteractiveHover = Color(0xff0b8599) + val colorFontPrimary = Color(0xff040404) + val colorFontSecondary = Color(0xff273333) + val colorFontSuccess = Color(0xff08422f) + val colorFontTertiary = Color(0xff364141) + val colorFontWarning = Color(0xff601700) + val sizeBorderRadiusLarge = 480.00.dp + val sizeFontLarge = 24.00.sp + val sizeFontMedium = 16.00.sp + val sizeFontSmall = 12.00.sp + val sizeFontXl = 36.00.sp + val sizePaddingLarge = 16.00.dp + val sizePaddingMedium = 16.00.dp + val sizePaddingSmall = 8.00.dp + val sizePaddingXl = 16.00.dp +} +" +`; + +exports[`integration compose compose/object with references should match snapshot 1`] = ` +" + +// Do not edit directly +// Generated on Sat, 01 Jan 2000 00:00:00 GMT + + + +package com.example.tokens; + + +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.* + +object StyleDictionary { + val sizePaddingXl = 16.00.dp + val sizePaddingLarge = 16.00.dp + val sizePaddingMedium = 16.00.dp + val sizePaddingSmall = 8.00.dp + val sizeFontXl = 36.00.sp + val sizeFontLarge = 24.00.sp + val sizeFontMedium = 16.00.sp + val sizeFontSmall = 12.00.sp + val sizeBorderRadiusLarge = 480.00.dp + val colorCoreYellow1100 = Color(0xff2d1a05) + val colorCoreYellow1000 = Color(0xff542a00) + val colorCoreYellow900 = Color(0xff944c0c) + val colorCoreYellow800 = Color(0xffba7506) + val colorCoreYellow700 = Color(0xffdd9903) + val colorCoreYellow600 = Color(0xffffbc00) + val colorCoreYellow500 = Color(0xffffcd1c) + val colorCoreYellow400 = Color(0xffffd943) + val colorCoreYellow300 = Color(0xffffe16e) + val colorCoreYellow200 = Color(0xffffe99a) + val colorCoreYellow100 = Color(0xfffdefcd) + val colorCoreYellow0 = Color(0xfffff8e2) + val colorCoreNeutral1100 = Color(0xff040404) + val colorCoreNeutral1000 = Color(0xff162020) + val colorCoreNeutral900 = Color(0xff273333) + val colorCoreNeutral800 = Color(0xff364141) + val colorCoreNeutral700 = Color(0xff515e5f) + val colorCoreNeutral600 = Color(0xff6e797a) + val colorCoreNeutral500 = Color(0xff929a9b) + val colorCoreNeutral400 = Color(0xffb0b6b7) + val colorCoreNeutral300 = Color(0xffc8cccc) + val colorCoreNeutral200 = Color(0xffdee1e1) + val colorCoreNeutral100 = Color(0xfff3f4f4) + val colorCoreNeutral0 = Color(0xffffffff) + val colorCoreOrange1100 = Color(0xff2d130e) + val colorCoreOrange1000 = Color(0xff601700) + val colorCoreOrange900 = Color(0xff962c0b) + val colorCoreOrange800 = Color(0xffce5511) + val colorCoreOrange700 = Color(0xffed7024) + val colorCoreOrange600 = Color(0xfff57d33) + val colorCoreOrange500 = Color(0xfffc8943) + val colorCoreOrange400 = Color(0xffff9c5d) + val colorCoreOrange300 = Color(0xffffb180) + val colorCoreOrange200 = Color(0xffffc6a4) + val colorCoreOrange100 = Color(0xfffcdccc) + val colorCoreOrange0 = Color(0xffffede3) + val colorCoreRed1100 = Color(0xff2b1111) + val colorCoreRed1000 = Color(0xff6d1313) + val colorCoreRed900 = Color(0xff992222) + val colorCoreRed800 = Color(0xffc63434) + val colorCoreRed700 = Color(0xffdb3e3e) + val colorCoreRed600 = Color(0xffed4c42) + val colorCoreRed500 = Color(0xfff76054) + val colorCoreRed400 = Color(0xffff7f6e) + val colorCoreRed300 = Color(0xffff9c8f) + val colorCoreRed200 = Color(0xffffb8b1) + val colorCoreRed100 = Color(0xffffd5d2) + val colorCoreRed0 = Color(0xffffeae9) + val colorCorePink1100 = Color(0xff2b1721) + val colorCorePink1000 = Color(0xff561231) + val colorCorePink900 = Color(0xff931847) + val colorCorePink800 = Color(0xffb22f5b) + val colorCorePink700 = Color(0xffce3665) + val colorCorePink600 = Color(0xffe0447c) + val colorCorePink500 = Color(0xffef588b) + val colorCorePink400 = Color(0xffff76ae) + val colorCorePink300 = Color(0xffff95c1) + val colorCorePink200 = Color(0xffffb5d5) + val colorCorePink100 = Color(0xfffcdbeb) + val colorCorePink0 = Color(0xffffe9f3) + val colorCoreMagenta1100 = Color(0xff29192d) + val colorCoreMagenta1000 = Color(0xff451551) + val colorCoreMagenta900 = Color(0xff6c2277) + val colorCoreMagenta800 = Color(0xff8f3896) + val colorCoreMagenta700 = Color(0xffac44a8) + val colorCoreMagenta600 = Color(0xffc44eb9) + val colorCoreMagenta500 = Color(0xffdb61db) + val colorCoreMagenta400 = Color(0xfff282f5) + val colorCoreMagenta300 = Color(0xffedadf2) + val colorCoreMagenta200 = Color(0xfff4c4f7) + val colorCoreMagenta100 = Color(0xfff9e3fc) + val colorCoreMagenta0 = Color(0xfffef0ff) + val colorCorePurple1100 = Color(0xff1d1d38) + val colorCorePurple1000 = Color(0xff2d246b) + val colorCorePurple900 = Color(0xff483a9c) + val colorCorePurple800 = Color(0xff5e4eba) + val colorCorePurple700 = Color(0xff6f5ed3) + val colorCorePurple600 = Color(0xff816fea) + val colorCorePurple500 = Color(0xff9180f4) + val colorCorePurple400 = Color(0xffa193f2) + val colorCorePurple300 = Color(0xffc1c1f7) + val colorCorePurple200 = Color(0xffd8d7f9) + val colorCorePurple100 = Color(0xffeaeaf9) + val colorCorePurple0 = Color(0xfff2f2f9) + val colorCoreBlue1100 = Color(0xff002138) + val colorCoreBlue1000 = Color(0xff0a3960) + val colorCoreBlue900 = Color(0xff0c5689) + val colorCoreBlue800 = Color(0xff116daa) + val colorCoreBlue700 = Color(0xff2079c3) + val colorCoreBlue600 = Color(0xff2b87d3) + val colorCoreBlue500 = Color(0xff3896e3) + val colorCoreBlue400 = Color(0xff56adf5) + val colorCoreBlue300 = Color(0xffa1d2f8) + val colorCoreBlue200 = Color(0xffc7e4f9) + val colorCoreBlue100 = Color(0xffdcf2ff) + val colorCoreBlue0 = Color(0xffe9f8ff) + val colorCoreAqua1100 = Color(0xff002838) + val colorCoreAqua1000 = Color(0xff083d4f) + val colorCoreAqua900 = Color(0xff035e73) + val colorCoreAqua800 = Color(0xff0f6e84) + val colorCoreAqua700 = Color(0xff0b8599) + val colorCoreAqua600 = Color(0xff0797ae) + val colorCoreAqua500 = Color(0xff17b8ce) + val colorCoreAqua400 = Color(0xff33d6e2) + val colorCoreAqua300 = Color(0xff76e5e2) + val colorCoreAqua200 = Color(0xffa5f2f2) + val colorCoreAqua100 = Color(0xffc5f9f9) + val colorCoreAqua0 = Color(0xffd9fcfb) + val colorCoreTeal1100 = Color(0xff002528) + val colorCoreTeal1000 = Color(0xff083f3f) + val colorCoreTeal900 = Color(0xff026661) + val colorCoreTeal800 = Color(0xff067c7c) + val colorCoreTeal700 = Color(0xff0b968f) + val colorCoreTeal600 = Color(0xff00a99c) + val colorCoreTeal500 = Color(0xff08c4b2) + val colorCoreTeal400 = Color(0xff24e0c5) + val colorCoreTeal300 = Color(0xff7dead5) + val colorCoreTeal200 = Color(0xffb3f2e6) + val colorCoreTeal100 = Color(0xffcdf7ef) + val colorCoreTeal0 = Color(0xffe5f9f5) + val colorCoreGreen1100 = Color(0xff002b20) + val colorCoreGreen1000 = Color(0xff08422f) + val colorCoreGreen900 = Color(0xff006b40) + val colorCoreGreen800 = Color(0xff008b46) + val colorCoreGreen700 = Color(0xff0ca750) + val colorCoreGreen600 = Color(0xff2bb656) + val colorCoreGreen500 = Color(0xff59cb59) + val colorCoreGreen400 = Color(0xff75dd66) + val colorCoreGreen300 = Color(0xff98e58e) + val colorCoreGreen200 = Color(0xffc2f2bd) + val colorCoreGreen100 = Color(0xffd7f4d7) + val colorCoreGreen0 = Color(0xffebf9eb) + val colorFontSuccess = colorCoreGreen1000 + val colorFontWarning = colorCoreOrange1000 + val colorFontDanger = colorCoreRed1000 + val colorFontTertiary = colorCoreNeutral800 + val colorFontSecondary = colorCoreNeutral900 + val colorFontPrimary = colorCoreNeutral1100 + val colorBrandSecondary = colorCorePurple700 + val colorBrandPrimary = colorCoreAqua700 + val colorBorderPrimary = colorCoreNeutral300 + val colorBackgroundInfo = colorCoreBlue0 + val colorBackgroundSuccess = colorCoreGreen0 + val colorBackgroundWarning = colorCoreOrange0 + val colorBackgroundDanger = colorCoreRed0 + val colorBackgroundTertiary = colorCoreNeutral200 + val colorBackgroundSecondary = colorCoreNeutral100 + val colorBackgroundPrimary = colorCoreNeutral0 + val colorFontInteractiveDisabled = colorFontTertiary + val colorFontInteractiveActive = colorBrandSecondary + val colorFontInteractiveHover = colorBrandPrimary + val colorFontInteractive = colorBrandPrimary + val colorBackgroundDisabled = colorBackgroundTertiary +} +" +`; diff --git a/__integration__/compose.test.js b/__integration__/compose.test.js new file mode 100644 index 000000000..6a6b88979 --- /dev/null +++ b/__integration__/compose.test.js @@ -0,0 +1,65 @@ +/* + * Copyright Target Corporation. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with + * the License. A copy of the License is located at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +const fs = require('fs-extra'); +const StyleDictionary = require('../index'); +const {buildPath} = require('./_constants'); + +describe('integration', () => { + describe('compose', () => { + StyleDictionary.extend({ + source: [`__integration__/tokens/**/*.json`], + platforms: { + compose: { + transformGroup: `compose`, + buildPath, + files: [{ + destination: "StyleDictionary.kt", + format: "compose/object", + className: "StyleDictionary", + packageName: "com.example.tokens" + },{ + destination: "StyleDictionaryWithReferences.kt", + format: "compose/object", + className: "StyleDictionary", + packageName: "com.example.tokens", + options: { + outputReferences: true + } + }] + }, + } + }).buildAllPlatforms(); + + describe(`compose/object`, () => { + const output = fs.readFileSync(`${buildPath}StyleDictionary.kt`, {encoding:`UTF-8`}); + + it(`should match snapshot`, () => { + expect(output).toMatchSnapshot(); + }); + + describe(`with references`, () => { + const output = fs.readFileSync(`${buildPath}StyleDictionaryWithReferences.kt`, {encoding:`UTF-8`}); + + it(`should match snapshot`, () => { + expect(output).toMatchSnapshot(); + }); + + }); + }); + }); +}); + +afterAll(() => { + fs.emptyDirSync(buildPath); +}); \ No newline at end of file diff --git a/__tests__/common/transforms.test.js b/__tests__/common/transforms.test.js index 1ed469c2c..3aa097ebe 100644 --- a/__tests__/common/transforms.test.js +++ b/__tests__/common/transforms.test.js @@ -353,6 +353,23 @@ describe('common', () => { }); }); + describe('color/composeColor', () => { + it('should handle color without alpha', () => { + var value = transforms["color/composeColor"].transformer({ + value: "#aaaaaa" + }); + expect(value).toBe("Color(0xffaaaaaa)"); + }); + + it('should handle color with alpha', () => { + var value = transforms["color/composeColor"].transformer({ + value: "#aaaaaaff" + }); + expect(value).toBe("Color(0xffaaaaaa)"); + }); + + }); + describe('color/UIColor', () => { it('should handle normal colors', () => { var value = transforms["color/UIColor"].transformer({ @@ -562,6 +579,50 @@ describe('common', () => { }); }); + describe('size/compose/remToSp', () => { + it('should work', () => { + var value = transforms["size/compose/remToSp"].transformer({ + value: "1" + }); + expect(value).toBe("16.00.sp"); + }); + it('converts rem to sp using custom base font', () => { + var value = transforms["size/compose/remToSp"].transformer({value: "1"}, {basePxFontSize: 14}); + expect(value).toBe("14.00.sp"); + }); + it('should throw an error if prop value is Nan', () => { + expect( () => transforms["size/compose/remToSp"].transformer({value: "a"})).toThrow(); + }); + }); + + describe('size/compose/em', () => { + it('should work', () => { + var value = transforms["size/compose/em"].transformer({ + value: "10" + }); + expect(value).toBe("10.em"); + }); + it('should throw an error if prop value is Nan', () => { + expect( () => transforms["size/compose/em"].transformer({value: "a"})).toThrow(); + }); + }); + + describe('size/compose/remToDp', () => { + it('should work', () => { + var value = transforms["size/compose/remToDp"].transformer({ + value: "1" + }); + expect(value).toBe("16.00.dp"); + }); + it('converts rem to dp using custom base font', () => { + var value = transforms["size/compose/remToDp"].transformer({value: "1"}, {basePxFontSize: 14}); + expect(value).toBe("14.00.dp"); + }); + it('should throw an error if prop value is Nan', () => { + expect( () => transforms["size/compose/remToDp"].transformer({value: "a"})).toThrow(); + }); + }); + describe('size/swift/remToCGFloat', () => { it('should work', () => { var value = transforms["size/swift/remToCGFloat"].transformer({ diff --git a/__tests__/formats/__snapshots__/all.test.js.snap b/__tests__/formats/__snapshots__/all.test.js.snap index c96ac0fa0..8d2cab735 100644 --- a/__tests__/formats/__snapshots__/all.test.js.snap +++ b/__tests__/formats/__snapshots__/all.test.js.snap @@ -80,6 +80,27 @@ exports[`formats all should match android/strings snapshot 1`] = ` " `; +exports[`formats all should match compose/object snapshot 1`] = ` +" + +// Do not edit directly +// Generated on Sat, 01 Jan 2000 00:00:00 GMT + + + +package ; + + +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.* + +object { + /** comment */ + val color_red = #FF0000 +} +" +`; + exports[`formats all should match css/fonts.css snapshot 1`] = ` " " diff --git a/docs/formats.md b/docs/formats.md index 1c7df44fd..f7f257970 100644 --- a/docs/formats.md +++ b/docs/formats.md @@ -138,6 +138,7 @@ Not all formats use the `outputReferences` option because that file format might * [scss/variables](#scssvariables) * [less/variables](#lessvariables) * [android/resources](#androidresources) +* [compose/object](#composeobject) * [ios-swift/class.swift](#ios-swiftclassswift) * [flutter/class.dart](#flutterclassdart) @@ -1144,6 +1145,48 @@ filter: { * * * +### compose/object + + +Creates a Kotlin file for Compose containing an object with a `val` for each property. + +
Param | Type | Default | Description | +
---|---|---|---|
className | String | The name of the generated Kotlin object + |
+ |
packageName | String | The package for the generated Kotlin object + |
+ |
options | Object | + | |
[options.showFileHeader] | Boolean | true | Whether or not to include a comment that has the build date + |
+
[options.outputReferences] | Boolean | false | Whether or not to keep references (a -> b -> c) in the output. + |
+