style-dictionary 5.1.1 → 5.1.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.
- package/README.md +2 -2
- package/examples/README.md +25 -25
- package/examples/advanced/assets-base64-embed/package.json +1 -1
- package/examples/advanced/create-react-app/package.json +1 -1
- package/examples/advanced/create-react-native-app/package.json +1 -1
- package/examples/advanced/custom-parser/package.json +1 -1
- package/examples/advanced/custom-transforms/package.json +1 -1
- package/examples/advanced/font-face-rules/package.json +1 -1
- package/examples/advanced/format-helpers/package.json +1 -1
- package/examples/advanced/matching-build-files/package.json +1 -1
- package/examples/advanced/multi-brand-multi-platform/package.json +1 -1
- package/examples/advanced/node-modules-as-config-and-properties/package.json +2 -2
- package/examples/advanced/npm-module/package.json +1 -1
- package/examples/advanced/referencing_aliasing/package.json +1 -1
- package/examples/advanced/s3/package.json +1 -1
- package/examples/advanced/tailwind-preset/package.json +1 -1
- package/examples/advanced/tokens-deprecation/package.json +1 -1
- package/examples/advanced/transitive-transforms/package.json +1 -1
- package/examples/advanced/variables-in-outputs/package.json +1 -1
- package/examples/advanced/yaml-tokens/package.json +1 -1
- package/examples/complete/StyleDictionary.podspec +1 -1
- package/examples/complete/android/demo/build.gradle +1 -1
- package/examples/complete/android/demo/src/androidTest/java/com/amazon/styledictionaryexample/ApplicationTest.java +1 -1
- package/examples/complete/android/demo/src/main/AndroidManifest.xml +1 -1
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/BaseActivity.kt +1 -1
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/MainActivity.kt +5 -5
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/color/BackgroundColorActivity.kt +5 -5
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/color/BaseColorActivity.kt +7 -7
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/color/BaseColorListItem.kt +2 -2
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/color/ColorDetailFragment.kt +6 -6
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/color/ColorsActivity.kt +3 -3
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/color/FontColorActivity.kt +5 -5
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/icon/IconDetailActivity.kt +3 -3
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/icon/IconDetailFragment.kt +5 -5
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/icon/IconListActivity.kt +6 -6
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/models/Property.kt +1 -1
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/models/StyleDictionaryNode.kt +1 -1
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/property/PropertiesActivity.kt +6 -6
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/property/PropertyDetailActivity.kt +5 -5
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/property/PropertyFragment.kt +5 -5
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/property/PropertyRecyclerViewAdapter.kt +4 -4
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/util/StringHelper.kt +1 -1
- package/examples/complete/android/demo/src/main/java/com/amazon/styledictionaryexample/util/StyleDictionaryHelper.kt +3 -3
- package/examples/complete/android/demo/src/main/res/layout/activity_background_color.xml +1 -1
- package/examples/complete/android/demo/src/main/res/layout/activity_base_color.xml +1 -1
- package/examples/complete/android/demo/src/main/res/layout/activity_colors.xml +1 -1
- package/examples/complete/android/demo/src/main/res/layout/activity_font_color.xml +1 -1
- package/examples/complete/android/demo/src/main/res/layout/activity_icon_detail.xml +1 -1
- package/examples/complete/android/demo/src/main/res/layout/activity_icon_list.xml +2 -2
- package/examples/complete/android/demo/src/main/res/layout/activity_main.xml +1 -1
- package/examples/complete/android/demo/src/main/res/layout/activity_properties.xml +2 -2
- package/examples/complete/android/demo/src/main/res/layout/activity_property_detail.xml +1 -1
- package/examples/complete/android/demo/src/main/res/layout/fragment_color_detail.xml +1 -1
- package/examples/complete/android/demo/src/main/res/layout/fragment_property_list.xml +2 -2
- package/examples/complete/android/demo/src/main/res/layout/icon_detail.xml +1 -1
- package/examples/complete/android/demo/src/test/java/com/amazon/styledictionaryexample/ExampleUnitTest.java +1 -1
- package/examples/complete/ios/Demo/Pods/Local Podspecs/StyleDictionary.podspec.json +3 -8
- package/examples/complete/ios/Demo/Pods/Target Support Files/Pods-StyleDictionary_Demo/Pods-StyleDictionary_Demo-acknowledgements.markdown +1 -1
- package/examples/complete/ios/Demo/Pods/Target Support Files/Pods-StyleDictionary_Demo/Pods-StyleDictionary_Demo-acknowledgements.plist +1 -1
- package/lib/StyleDictionary.js +1 -1
- package/lib/common/transforms.js +7 -3
- package/package.json +6 -7
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://badge.fury.io/js/style-dictionary)
|
|
8
8
|
[](https://github.com/style-dictionary/style-dictionary/blob/main/LICENSE)
|
|
9
|
-
[](https://github.com/
|
|
9
|
+
[](https://github.com/style-dictionary/style-dictionary/blob/main/CONTRIBUTING.md#submitting-pull-requests)
|
|
10
10
|
[](https://github.com/style-dictionary/style-dictionary/actions)
|
|
11
11
|
[](https://www.npmjs.com/package/style-dictionary)
|
|
12
12
|
|
|
@@ -316,7 +316,7 @@ For more information on creating your own transforms and formats, take a look at
|
|
|
316
316
|
|
|
317
317
|
## Mascot
|
|
318
318
|
|
|
319
|
-
The mascot for Style Dictionary is ["Pascal"](https://github.com/
|
|
319
|
+
The mascot for Style Dictionary is ["Pascal"](https://github.com/style-dictionary/style-dictionary/issues/97) the chameleon (seen below). You can also find them blending in as the logo throughout the documentation.
|
|
320
320
|
|
|
321
321
|
<img src="docs/src/assets/logo.png" alt="Style Dictionary logo and mascot" title=""Pascal"" width="240" />
|
|
322
322
|
|
package/examples/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<img src="https://github.com/
|
|
1
|
+
<img src="https://github.com/style-dictionary/style-dictionary/raw/main/docs/assets/logo.png" alt="Style Dictionary logo" title="StyleDictionary" width="100" align="right" />
|
|
2
2
|
|
|
3
3
|
# Examples
|
|
4
4
|
|
|
5
|
-
To get you started, there are some example packages included that you can use. You can [take a look at the code on Github](https://github.com/
|
|
5
|
+
To get you started, there are some example packages included that you can use. You can [take a look at the code on Github](https://github.com/style-dictionary/style-dictionary/tree/main/examples/) or you can use the CLI included to generate a new package using some of these examples. Here is how you can do that:
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
$ mkdir MyFolder
|
|
@@ -14,41 +14,41 @@ Where `[example]` is one of: `basic`, `complete`.
|
|
|
14
14
|
|
|
15
15
|
## Basic
|
|
16
16
|
|
|
17
|
-
[View on Github](https://github.com/
|
|
17
|
+
[View on Github](https://github.com/style-dictionary/style-dictionary/tree/main/examples/basic)
|
|
18
18
|
|
|
19
19
|
This example code is bare-bones to show you what this framework can do. Use this if you want to play around with what the Style Dictionary can do.
|
|
20
20
|
|
|
21
21
|
## Complete
|
|
22
22
|
|
|
23
|
-
[View on Github](https://github.com/
|
|
23
|
+
[View on Github](https://github.com/style-dictionary/style-dictionary/tree/main/examples/complete)
|
|
24
24
|
|
|
25
25
|
This is a more complete package and should have everything you need to get started. This package can be consumed as a Cocoapod on iOS, as a node module for web, and as a local library for Android.
|
|
26
26
|
|
|
27
27
|
## Advanced
|
|
28
28
|
|
|
29
|
-
[View the folder](https://github.com/
|
|
30
|
-
|
|
31
|
-
If you want to look at more advanced examples of possible applications and customizations of Style Dictionary, the [`examples/advanced`](https://github.com/
|
|
32
|
-
|
|
33
|
-
- [**assets-base64-embed**](https://github.com/
|
|
34
|
-
- [**create-react-app**](https://github.com/
|
|
35
|
-
- [**create-react-native-app**](https://github.com/
|
|
36
|
-
- [**custom-parser**](https://github.com/
|
|
37
|
-
- [**custom-transforms**](https://github.com/
|
|
38
|
-
- [**flutter**](https://github.com/
|
|
39
|
-
- [**matching-build-files**](https://github.com/
|
|
40
|
-
- [**multi-brand-multi-platform**](https://github.com/
|
|
41
|
-
- [**node-modules-as-config-and-properties**](https://github.com/
|
|
42
|
-
- [**npm-module**](https://github.com/
|
|
43
|
-
- [**referencing_aliasing**](https://github.com/
|
|
44
|
-
- [**s3**](https://github.com/
|
|
45
|
-
- [**tokens-deprecation**](https://github.com/
|
|
46
|
-
- [**transitive-transforms**](https://github.com/
|
|
47
|
-
- [**variables-in-outputs**](https://github.com/
|
|
48
|
-
- [**yaml-tokens**](https://github.com/
|
|
29
|
+
[View the folder](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced)
|
|
30
|
+
|
|
31
|
+
If you want to look at more advanced examples of possible applications and customizations of Style Dictionary, the [`examples/advanced`](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/) folder on GitHub contains these extra folders:
|
|
32
|
+
|
|
33
|
+
- [**assets-base64-embed**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/assets-base64-embed) shows how it's possible to embed and distribute assets – like images, icons and fonts – directly as design tokens.
|
|
34
|
+
- [**create-react-app**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/create-react-app) shows how to integrate Style Dictionary into a React application.
|
|
35
|
+
- [**create-react-native-app**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/create-react-native-app) shows how to integrate Style Dictionary into a React Native application.
|
|
36
|
+
- [**custom-parser**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/custom-parser) shows how to use custom parsers for token files.
|
|
37
|
+
- [**custom-transforms**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/custom-transforms) shows how to use custom transforms (and transformGroups) to apply custom "transformations" to the design tokens.
|
|
38
|
+
- [**flutter**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/flutter) shows how to integrate with Flutter applications.
|
|
39
|
+
- [**matching-build-files**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/matching-build-files) shows how to output files 1-to-1 with source files.
|
|
40
|
+
- [**multi-brand-multi-platform**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/multi-brand-multi-platform) shows how to set up Style Dictionary to support a multi-brand (for brand theming) and multi-platform (web, iOS, Android) solution, with token values depending on brand and platforms.
|
|
41
|
+
- [**node-modules-as-config-and-properties**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/node-modules-as-config-and-properties) shows how to use Javascript rather than JSON for configuration and token files.
|
|
42
|
+
- [**npm-module**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/npm-module) shows how to set up a style dictionary as an npm module, either to publish to a local npm service or to publish externally.
|
|
43
|
+
- [**referencing_aliasing**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/referencing_aliasing) shows how to use referencing (or "aliasing") to reference a value -or an attribute– of a token and assign it to the value –or attribute– of another token.
|
|
44
|
+
- [**s3**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/s3) shows how to set up a style dictionary to build files for different platforms (web, iOS, Android) and upload those build artifacts, together with a group of assets, to an S3 bucket.
|
|
45
|
+
- [**tokens-deprecation**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/tokens-deprecation) shows one way to deprecate tokens by adding metadata to tokens and using custom formats to output comments in the generated files.
|
|
46
|
+
- [**transitive-transforms**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/transitive-transforms) shows how to use transitive transforms to transform references
|
|
47
|
+
- [**variables-in-outputs**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/variables-in-outputs) shows you how to use the `outputReferences` option to generate files variable references in them.
|
|
48
|
+
- [**yaml-tokens**](https://github.com/style-dictionary/style-dictionary/tree/main/examples/advanced/yaml-tokens) shows how to use a custom parser to define your source files in YAML rather than JSON.
|
|
49
49
|
|
|
50
50
|
---
|
|
51
51
|
|
|
52
52
|
#### Do you think an example is missing?<br/>Do you want to see another example added to the project?<br/>Do you have a working example that we can add to the list?
|
|
53
53
|
|
|
54
|
-
Fantastic! Let us know by [filing an issue](https://github.com/
|
|
54
|
+
Fantastic! Let us know by [filing an issue](https://github.com/style-dictionary/style-dictionary/issues).
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "git://github.com/
|
|
14
|
+
"url": "git://github.com/style-dictionary/style-dictionary.git"
|
|
15
15
|
},
|
|
16
16
|
"author": "",
|
|
17
17
|
"license": "Apache-2.0",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://github.com/dbanksdesign/style-dictionary-node#readme",
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"style-dictionary": "^5.1.
|
|
23
|
+
"style-dictionary": "^5.1.3",
|
|
24
24
|
"tinycolor2": "^1.4.1"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -8,7 +8,7 @@ An example StyleDictionary cocoapod and example app.
|
|
|
8
8
|
DESC
|
|
9
9
|
s.homepage = 'homepage'
|
|
10
10
|
s.license = { :type => 'Apache-2.0', :file => 'LICENSE' }
|
|
11
|
-
s.author = { 'Danny Banks' => '
|
|
11
|
+
s.author = { 'Danny Banks' => 'dbanks.design@gmail.com' }
|
|
12
12
|
s.source = { :git => '', :tag => s.version.to_s }
|
|
13
13
|
s.platform = :ios
|
|
14
14
|
s.source_files = 'ios/Classes/**/*.{h,m}'
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.styledictionaryexample
|
|
2
2
|
|
|
3
3
|
import android.content.Intent
|
|
4
4
|
import android.graphics.Typeface
|
|
5
5
|
import android.os.Bundle
|
|
6
6
|
import android.view.View
|
|
7
7
|
import android.widget.Button
|
|
8
|
-
import com.
|
|
9
|
-
import com.
|
|
10
|
-
import com.
|
|
11
|
-
import com.
|
|
8
|
+
import com.styledictionaryexample.color.ColorsActivity
|
|
9
|
+
import com.styledictionaryexample.icon.IconListActivity
|
|
10
|
+
import com.styledictionaryexample.property.PropertiesActivity
|
|
11
|
+
import com.styledictionaryexample.util.StyleDictionaryHelper
|
|
12
12
|
|
|
13
13
|
@Suppress("UNUSED_PARAMETER")
|
|
14
14
|
class MainActivity : BaseActivity() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.styledictionaryexample.color
|
|
2
2
|
|
|
3
3
|
import android.os.Bundle
|
|
4
4
|
import android.view.LayoutInflater
|
|
@@ -6,10 +6,10 @@ import android.view.View
|
|
|
6
6
|
import android.view.ViewGroup
|
|
7
7
|
import android.widget.TextView
|
|
8
8
|
import androidx.recyclerview.widget.RecyclerView
|
|
9
|
-
import com.
|
|
10
|
-
import com.
|
|
11
|
-
import com.
|
|
12
|
-
import com.
|
|
9
|
+
import com.styledictionaryexample.BaseActivity
|
|
10
|
+
import com.styledictionaryexample.R
|
|
11
|
+
import com.styledictionaryexample.models.Property
|
|
12
|
+
import com.styledictionaryexample.util.StyleDictionaryHelper
|
|
13
13
|
import java.util.*
|
|
14
14
|
|
|
15
15
|
class BackgroundColorActivity : BaseActivity() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.styledictionaryexample.color
|
|
2
2
|
|
|
3
3
|
import android.os.Bundle
|
|
4
4
|
import android.view.LayoutInflater
|
|
@@ -6,12 +6,12 @@ import android.view.View
|
|
|
6
6
|
import android.view.ViewGroup
|
|
7
7
|
import android.widget.TextView
|
|
8
8
|
import androidx.recyclerview.widget.RecyclerView
|
|
9
|
-
import com.
|
|
10
|
-
import com.
|
|
11
|
-
import com.
|
|
12
|
-
import com.
|
|
13
|
-
import com.
|
|
14
|
-
import com.
|
|
9
|
+
import com.styledictionaryexample.BaseActivity
|
|
10
|
+
import com.styledictionaryexample.R
|
|
11
|
+
import com.styledictionaryexample.color.BaseColorListItem.BaseColorHeaderItem
|
|
12
|
+
import com.styledictionaryexample.color.BaseColorListItem.BaseColorItem
|
|
13
|
+
import com.styledictionaryexample.models.StyleDictionaryNode
|
|
14
|
+
import com.styledictionaryexample.util.StyleDictionaryHelper
|
|
15
15
|
import java.util.*
|
|
16
16
|
|
|
17
17
|
class BaseColorActivity : BaseActivity() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.styledictionaryexample.color
|
|
2
2
|
|
|
3
3
|
import android.annotation.SuppressLint
|
|
4
4
|
import android.os.Bundle
|
|
@@ -7,11 +7,11 @@ import android.view.View
|
|
|
7
7
|
import android.view.ViewGroup
|
|
8
8
|
import android.widget.TextView
|
|
9
9
|
import androidx.fragment.app.Fragment
|
|
10
|
-
import com.
|
|
11
|
-
import com.
|
|
12
|
-
import com.
|
|
13
|
-
import com.
|
|
14
|
-
import com.
|
|
10
|
+
import com.styledictionaryexample.R
|
|
11
|
+
import com.styledictionaryexample.models.Property
|
|
12
|
+
import com.styledictionaryexample.property.PropertyDetailActivity
|
|
13
|
+
import com.styledictionaryexample.util.StringHelper
|
|
14
|
+
import com.styledictionaryexample.util.StyleDictionaryHelper
|
|
15
15
|
|
|
16
16
|
class ColorDetailFragment : Fragment() {
|
|
17
17
|
private var property: Property? = null
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
@file:Suppress("UNUSED_PARAMETER")
|
|
2
2
|
|
|
3
|
-
package com.
|
|
3
|
+
package com.styledictionaryexample.color
|
|
4
4
|
|
|
5
5
|
import android.content.Intent
|
|
6
6
|
import android.os.Bundle
|
|
7
7
|
import android.view.View
|
|
8
8
|
import android.widget.Button
|
|
9
|
-
import com.
|
|
10
|
-
import com.
|
|
9
|
+
import com.styledictionaryexample.BaseActivity
|
|
10
|
+
import com.styledictionaryexample.R
|
|
11
11
|
|
|
12
12
|
class ColorsActivity : BaseActivity() {
|
|
13
13
|
private var baseButton: Button? = null
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.styledictionaryexample.color
|
|
2
2
|
|
|
3
3
|
import android.os.Bundle
|
|
4
4
|
import android.view.LayoutInflater
|
|
@@ -6,10 +6,10 @@ import android.view.View
|
|
|
6
6
|
import android.view.ViewGroup
|
|
7
7
|
import android.widget.TextView
|
|
8
8
|
import androidx.recyclerview.widget.RecyclerView
|
|
9
|
-
import com.
|
|
10
|
-
import com.
|
|
11
|
-
import com.
|
|
12
|
-
import com.
|
|
9
|
+
import com.styledictionaryexample.BaseActivity
|
|
10
|
+
import com.styledictionaryexample.R
|
|
11
|
+
import com.styledictionaryexample.models.Property
|
|
12
|
+
import com.styledictionaryexample.util.StyleDictionaryHelper
|
|
13
13
|
import java.util.*
|
|
14
14
|
|
|
15
15
|
class FontColorActivity : BaseActivity() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.styledictionaryexample.icon
|
|
2
2
|
|
|
3
3
|
import android.os.Bundle
|
|
4
|
-
import com.
|
|
5
|
-
import com.
|
|
4
|
+
import com.styledictionaryexample.BaseActivity
|
|
5
|
+
import com.styledictionaryexample.R
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* An activity representing a single Icon detail screen. This
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.styledictionaryexample.icon
|
|
2
2
|
|
|
3
3
|
import android.annotation.SuppressLint
|
|
4
4
|
import android.graphics.Typeface
|
|
@@ -8,10 +8,10 @@ import android.view.View
|
|
|
8
8
|
import android.view.ViewGroup
|
|
9
9
|
import android.widget.TextView
|
|
10
10
|
import androidx.fragment.app.Fragment
|
|
11
|
-
import com.
|
|
12
|
-
import com.
|
|
13
|
-
import com.
|
|
14
|
-
import com.
|
|
11
|
+
import com.styledictionaryexample.R
|
|
12
|
+
import com.styledictionaryexample.models.Property
|
|
13
|
+
import com.styledictionaryexample.util.StringHelper
|
|
14
|
+
import com.styledictionaryexample.util.StyleDictionaryHelper
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* A fragment representing a single Icon detail screen.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.styledictionaryexample.icon
|
|
2
2
|
|
|
3
3
|
import android.content.Intent
|
|
4
4
|
import android.graphics.Typeface
|
|
@@ -8,11 +8,11 @@ import android.view.View
|
|
|
8
8
|
import android.view.ViewGroup
|
|
9
9
|
import android.widget.TextView
|
|
10
10
|
import androidx.recyclerview.widget.RecyclerView
|
|
11
|
-
import com.
|
|
12
|
-
import com.
|
|
13
|
-
import com.
|
|
14
|
-
import com.
|
|
15
|
-
import com.
|
|
11
|
+
import com.styledictionaryexample.BaseActivity
|
|
12
|
+
import com.styledictionaryexample.R
|
|
13
|
+
import com.styledictionaryexample.models.Property
|
|
14
|
+
import com.styledictionaryexample.util.StringHelper
|
|
15
|
+
import com.styledictionaryexample.util.StyleDictionaryHelper
|
|
16
16
|
import java.util.*
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.styledictionaryexample.property
|
|
2
2
|
|
|
3
3
|
import android.content.Intent
|
|
4
4
|
import android.os.Bundle
|
|
5
5
|
import android.transition.Slide
|
|
6
6
|
import android.view.Gravity
|
|
7
7
|
import androidx.fragment.app.Fragment
|
|
8
|
-
import com.
|
|
9
|
-
import com.
|
|
10
|
-
import com.
|
|
11
|
-
import com.
|
|
12
|
-
import com.
|
|
8
|
+
import com.styledictionaryexample.BaseActivity
|
|
9
|
+
import com.styledictionaryexample.R
|
|
10
|
+
import com.styledictionaryexample.models.StyleDictionaryNode
|
|
11
|
+
import com.styledictionaryexample.property.PropertyFragment.OnListFragmentInteractionListener
|
|
12
|
+
import com.styledictionaryexample.util.StyleDictionaryHelper
|
|
13
13
|
import java.util.*
|
|
14
14
|
|
|
15
15
|
class PropertiesActivity : BaseActivity(), OnListFragmentInteractionListener {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.styledictionaryexample.property
|
|
2
2
|
|
|
3
3
|
import android.os.Bundle
|
|
4
4
|
import androidx.fragment.app.Fragment
|
|
5
|
-
import com.
|
|
6
|
-
import com.
|
|
7
|
-
import com.
|
|
8
|
-
import com.
|
|
5
|
+
import com.styledictionaryexample.BaseActivity
|
|
6
|
+
import com.styledictionaryexample.R
|
|
7
|
+
import com.styledictionaryexample.color.ColorDetailFragment
|
|
8
|
+
import com.styledictionaryexample.icon.IconDetailFragment
|
|
9
9
|
|
|
10
10
|
class PropertyDetailActivity : BaseActivity() {
|
|
11
11
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.styledictionaryexample.property
|
|
2
2
|
|
|
3
3
|
import android.content.Context
|
|
4
4
|
import android.os.Bundle
|
|
@@ -7,10 +7,10 @@ import android.view.View
|
|
|
7
7
|
import android.view.ViewGroup
|
|
8
8
|
import androidx.fragment.app.Fragment
|
|
9
9
|
import androidx.recyclerview.widget.RecyclerView
|
|
10
|
-
import com.
|
|
11
|
-
import com.
|
|
12
|
-
import com.
|
|
13
|
-
import com.
|
|
10
|
+
import com.styledictionaryexample.R
|
|
11
|
+
import com.styledictionaryexample.models.StyleDictionaryNode
|
|
12
|
+
import com.styledictionaryexample.property.PropertyFragment.OnListFragmentInteractionListener
|
|
13
|
+
import com.styledictionaryexample.util.StyleDictionaryHelper
|
|
14
14
|
import java.util.*
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.styledictionaryexample.property
|
|
2
2
|
|
|
3
3
|
import android.view.LayoutInflater
|
|
4
4
|
import android.view.View
|
|
5
5
|
import android.view.ViewGroup
|
|
6
6
|
import android.widget.TextView
|
|
7
7
|
import androidx.recyclerview.widget.RecyclerView
|
|
8
|
-
import com.
|
|
9
|
-
import com.
|
|
10
|
-
import com.
|
|
8
|
+
import com.styledictionaryexample.R
|
|
9
|
+
import com.styledictionaryexample.models.StyleDictionaryNode
|
|
10
|
+
import com.styledictionaryexample.property.PropertyFragment.OnListFragmentInteractionListener
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* [RecyclerView.Adapter] that can display a [StyleDictionaryNode] and makes a call to the
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
package com.
|
|
1
|
+
package com.styledictionaryexample.util
|
|
2
2
|
|
|
3
3
|
import android.content.Context
|
|
4
|
-
import com.
|
|
5
|
-
import com.
|
|
4
|
+
import com.styledictionaryexample.models.Property
|
|
5
|
+
import com.styledictionaryexample.models.StyleDictionaryNode
|
|
6
6
|
import com.fasterxml.jackson.databind.ObjectMapper
|
|
7
7
|
import com.fasterxml.jackson.datatype.jsonorg.JsonOrgModule
|
|
8
8
|
import org.json.JSONException
|
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
android:layout_width="match_parent"
|
|
8
8
|
android:layout_height="match_parent"
|
|
9
9
|
app:layoutManager="LinearLayoutManager"
|
|
10
|
-
tools:context="com.
|
|
10
|
+
tools:context="com.styledictionaryexample.color.BackgroundColorActivity"
|
|
11
11
|
tools:listitem="@layout/icon_list_content" />
|
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
android:paddingTop="0dp"
|
|
12
12
|
android:paddingBottom="@dimen/size_padding_medium"
|
|
13
13
|
app:layoutManager="LinearLayoutManager"
|
|
14
|
-
tools:context="com.
|
|
14
|
+
tools:context="com.styledictionaryexample.color.BaseColorActivity"
|
|
15
15
|
tools:listitem="@layout/base_color_list_content" />
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
9
9
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
10
10
|
android:paddingTop="@dimen/activity_vertical_margin"
|
|
11
|
-
tools:context="com.
|
|
11
|
+
tools:context="com.styledictionaryexample.color.ColorsActivity">
|
|
12
12
|
|
|
13
13
|
<LinearLayout
|
|
14
14
|
android:orientation="vertical"
|
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
android:layout_width="match_parent"
|
|
8
8
|
android:layout_height="match_parent"
|
|
9
9
|
app:layoutManager="LinearLayoutManager"
|
|
10
|
-
tools:context="com.
|
|
10
|
+
tools:context="com.styledictionaryexample.color.FontColorActivity"
|
|
11
11
|
tools:listitem="@layout/icon_list_content" />
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
android:id="@+id/icon_detail_container"
|
|
4
4
|
android:layout_width="match_parent"
|
|
5
5
|
android:layout_height="match_parent"
|
|
6
|
-
tools:context="com.
|
|
6
|
+
tools:context="com.styledictionaryexample.icon.IconDetailActivity"
|
|
7
7
|
tools:ignore="MergeRootFrame" />
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
4
4
|
xmlns:tools="http://schemas.android.com/tools"
|
|
5
5
|
android:id="@+id/icon_list"
|
|
6
|
-
android:name="com.
|
|
6
|
+
android:name="com.styledictionaryexample.IconListFragment"
|
|
7
7
|
android:layout_width="match_parent"
|
|
8
8
|
android:layout_height="match_parent"
|
|
9
9
|
app:layoutManager="LinearLayoutManager"
|
|
10
|
-
tools:context="com.
|
|
10
|
+
tools:context="com.styledictionaryexample.icon.IconListActivity"
|
|
11
11
|
tools:listitem="@layout/icon_list_content" />
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
android:paddingRight="@dimen/size_padding_medium"
|
|
9
9
|
android:paddingTop="@dimen/size_padding_medium"
|
|
10
10
|
android:paddingBottom="@dimen/size_padding_medium"
|
|
11
|
-
tools:context="com.
|
|
11
|
+
tools:context="com.styledictionaryexample.MainActivity">
|
|
12
12
|
|
|
13
13
|
<LinearLayout
|
|
14
14
|
android:orientation="vertical"
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
android:layout_width="match_parent"
|
|
6
6
|
android:layout_height="match_parent"
|
|
7
7
|
android:background="@color/color_background_base"
|
|
8
|
-
tools:context="com.
|
|
8
|
+
tools:context="com.styledictionaryexample.property.PropertiesActivity">
|
|
9
9
|
<fragment
|
|
10
10
|
android:layout_width="match_parent"
|
|
11
11
|
android:layout_height="match_parent"
|
|
12
12
|
android:id="@+id/activity_properties_list_fragment"
|
|
13
|
-
android:name="com.
|
|
13
|
+
android:name="com.styledictionaryexample.property.PropertyFragment" />
|
|
14
14
|
</RelativeLayout>
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
android:id="@+id/property_detail_container"
|
|
5
5
|
android:layout_width="match_parent"
|
|
6
6
|
android:layout_height="match_parent"
|
|
7
|
-
tools:context="com.
|
|
7
|
+
tools:context="com.styledictionaryexample.property.PropertyDetailActivity"
|
|
8
8
|
tools:ignore="MergeRootFrame" />
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
android:layout_width="match_parent"
|
|
4
4
|
android:layout_height="match_parent"
|
|
5
5
|
android:orientation="vertical"
|
|
6
|
-
tools:context="com.
|
|
6
|
+
tools:context="com.styledictionaryexample.color.ColorDetailFragment">
|
|
7
7
|
|
|
8
8
|
<View
|
|
9
9
|
android:layout_width="match_parent"
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
4
4
|
xmlns:tools="http://schemas.android.com/tools"
|
|
5
5
|
android:id="@+id/list"
|
|
6
|
-
android:name="com.
|
|
6
|
+
android:name="com.styledictionaryexample.PropertyFragment"
|
|
7
7
|
android:layout_width="match_parent"
|
|
8
8
|
android:layout_height="match_parent"
|
|
9
9
|
android:background="@color/color_background_base"
|
|
10
10
|
app:layoutManager="LinearLayoutManager"
|
|
11
|
-
tools:context="com.
|
|
11
|
+
tools:context="com.styledictionaryexample.property.PropertyFragment"
|
|
12
12
|
tools:listitem="@layout/fragment_property_list_item"
|
|
13
13
|
android:scrollbars="vertical" />
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<LinearLayout
|
|
2
2
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
3
|
xmlns:tools="http://schemas.android.com/tools"
|
|
4
|
-
tools:context="com.
|
|
4
|
+
tools:context="com.styledictionaryexample.icon.IconDetailFragment"
|
|
5
5
|
android:layout_width="match_parent"
|
|
6
6
|
android:layout_height="wrap_content"
|
|
7
7
|
android:background="@color/color_background_base"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"file": "LICENSE"
|
|
10
10
|
},
|
|
11
11
|
"authors": {
|
|
12
|
-
"Danny Banks": "
|
|
12
|
+
"Danny Banks": "dbanks.design@gmail.com"
|
|
13
13
|
},
|
|
14
14
|
"source": {
|
|
15
15
|
"git": "",
|
|
@@ -21,12 +21,7 @@
|
|
|
21
21
|
"source_files": "ios/Classes/**/*.{h,m}",
|
|
22
22
|
"public_header_files": "ios/Classes/**/*.h",
|
|
23
23
|
"resource_bundles": {
|
|
24
|
-
"StyleDictionary": [
|
|
25
|
-
"assets/**/*"
|
|
26
|
-
]
|
|
24
|
+
"StyleDictionary": ["assets/**/*"]
|
|
27
25
|
},
|
|
28
|
-
"frameworks": [
|
|
29
|
-
"UIKit",
|
|
30
|
-
"QuartzCore"
|
|
31
|
-
]
|
|
26
|
+
"frameworks": ["UIKit", "QuartzCore"]
|
|
32
27
|
}
|
|
@@ -3,7 +3,7 @@ This application makes use of the following third party libraries:
|
|
|
3
3
|
|
|
4
4
|
## StyleDictionary
|
|
5
5
|
|
|
6
|
-
Copyright (c) 2017 Danny Banks <
|
|
6
|
+
Copyright (c) 2017 Danny Banks <dbanks.design@gmail.com>
|
|
7
7
|
|
|
8
8
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
9
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
</dict>
|
|
15
15
|
<dict>
|
|
16
16
|
<key>FooterText</key>
|
|
17
|
-
<string>Copyright (c) 2017 Danny Banks <
|
|
17
|
+
<string>Copyright (c) 2017 Danny Banks <dbanks.design@gmail.com>
|
|
18
18
|
|
|
19
19
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
20
|
of this software and associated documentation files (the "Software"), to deal
|
package/lib/StyleDictionary.js
CHANGED
|
@@ -67,7 +67,7 @@ export default class StyleDictionary extends Register {
|
|
|
67
67
|
// Placeholder is transformed on prepublish -> see scripts/inject-version.js
|
|
68
68
|
// Another option might be import pkg from './package.json' with { "type": "json" } which would work in both browser and node, but support is not there yet.
|
|
69
69
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#browser_compatibility
|
|
70
|
-
static VERSION = '5.1.
|
|
70
|
+
static VERSION = '5.1.3';
|
|
71
71
|
|
|
72
72
|
/** @returns {Config} */
|
|
73
73
|
get options() {
|
package/lib/common/transforms.js
CHANGED
|
@@ -828,13 +828,17 @@ export default {
|
|
|
828
828
|
filter: (token, options) => isDimension(token, options) || isFontSize(token, options),
|
|
829
829
|
transform: function (token, _, options) {
|
|
830
830
|
const nonParsed = options.usesDtcg ? token.$value : token.value;
|
|
831
|
-
|
|
831
|
+
const parsedVal = parseFloat(nonParsed);
|
|
832
|
+
|
|
833
|
+
if (isNaN(parsedVal)) throwSizeError(token.name, nonParsed, 'rem');
|
|
834
|
+
|
|
835
|
+
// if the dimension already has a unit (non-digit / . period character or any arbitrary character)
|
|
832
836
|
if (`${nonParsed}`.match(/[^0-9.-]+$/)) {
|
|
833
837
|
return nonParsed;
|
|
834
838
|
}
|
|
835
|
-
|
|
836
|
-
if (isNaN(parsedVal)) throwSizeError(token.name, nonParsed, 'rem');
|
|
839
|
+
|
|
837
840
|
if (parsedVal === 0) return Number.isInteger(nonParsed) ? 0 : '0';
|
|
841
|
+
|
|
838
842
|
return parsedVal + 'rem';
|
|
839
843
|
},
|
|
840
844
|
},
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "style-dictionary",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.3",
|
|
4
4
|
"description": "Style once, use everywhere. A build system for creating cross-platform styles.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"style dictionary",
|
|
7
7
|
"style",
|
|
8
8
|
"dictionary",
|
|
9
|
-
"amazon",
|
|
10
9
|
"css",
|
|
11
10
|
"design",
|
|
12
11
|
"tokens",
|
|
@@ -97,27 +96,27 @@
|
|
|
97
96
|
},
|
|
98
97
|
"repository": {
|
|
99
98
|
"type": "git",
|
|
100
|
-
"url": "git://github.com/
|
|
99
|
+
"url": "git://github.com/style-dictionary/style-dictionary.git"
|
|
101
100
|
},
|
|
102
101
|
"author": "Style Dictionary",
|
|
103
102
|
"license": "Apache-2.0",
|
|
104
103
|
"bugs": {
|
|
105
|
-
"url": "https://github.com/
|
|
104
|
+
"url": "https://github.com/style-dictionary/style-dictionary/issues"
|
|
106
105
|
},
|
|
107
106
|
"contributors": [
|
|
108
107
|
"Yuliya Baran <baranyu@amazon.com>",
|
|
109
108
|
"Charles Dorner <dornerc@amazon.com>",
|
|
110
109
|
"Dustin Boudreau <boudrd@amazon.com>",
|
|
111
|
-
"Danny Banks <
|
|
110
|
+
"Danny Banks <dbanks.design@gmail.com>",
|
|
112
111
|
"Joren Broekema <joren.broekema@gmail.com>"
|
|
113
112
|
],
|
|
114
|
-
"homepage": "https://
|
|
113
|
+
"homepage": "https://styledictionary.com",
|
|
115
114
|
"overrides": {
|
|
116
115
|
"tmp": "0.2.5"
|
|
117
116
|
},
|
|
118
117
|
"dependencies": {
|
|
119
118
|
"@bundled-es-modules/deepmerge": "^4.3.1",
|
|
120
|
-
"@bundled-es-modules/glob": "^11.0
|
|
119
|
+
"@bundled-es-modules/glob": "^11.1.0",
|
|
121
120
|
"@bundled-es-modules/memfs": "^4.9.4",
|
|
122
121
|
"@zip.js/zip.js": "^2.7.44",
|
|
123
122
|
"chalk": "^5.3.0",
|