cleo_design_tokens 0.1.3 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad9110252ea32cdfcf9ba5d20a7f36ddd1df221a74d39d0e2f17e30866226121
4
- data.tar.gz: fbcaf1f8a39476daf641c3f0d4db3b0f2acd1bc2d793b0595bd178a57605828e
3
+ metadata.gz: 7abb9671d84913b6c88d46130486c08520ed672196e05d8ad9ce85b0dfe1f1c9
4
+ data.tar.gz: 3db80dbc885bbea88bd2f253e7a12fa098e16602af7b1eb3f03b86a7af21aafc
5
5
  SHA512:
6
- metadata.gz: 5666bea3db8b2436a82ab3884fd3075b12092d9809f552892ff8058a4d01b4cd283cd32727a3e095e32855fd6971f02452a3b9674a70aaff63efd8e7898a2c4e
7
- data.tar.gz: 19bc68fc489440538991598ebc48d1dcaa521d8d4dd0ac3fe7c2f8b27b3e39d448b323ae8a42b561dec96c6a4d10324aa3fb4077b145e8e749e36a35c8c70109
6
+ metadata.gz: a9519fa9d05c897d745806756fb1354d77614e2c0fde50799eeab987fec3d918a202d524287d2595d0b204434f5d2d703818fc85ab24f443a7316a6c215f415d
7
+ data.tar.gz: 464f1ae23b11cd7fc3c888f9a9652aff9b7a34fc9ec9c71ae62415378390241a68ab76c4081e5c9ff3b1bb6238ffdb4fd5042c9dffc32de459e1c5b9be37f9f2
@@ -1,9 +1,8 @@
1
1
  require "json"
2
2
 
3
3
  module CleoDesignTokens
4
- # `package.json`'s `version` is the single source of truth — npm requires
5
- # it to be a literal, so it can't defer to us. The gemspec ships
6
- # `package.json` alongside `lib/` (see `spec.files`) specifically so this
7
- # read works from an installed gem too, not just this source checkout.
4
+ # The release workflow writes the computed version into `package.json` before
5
+ # building either artifact. The gemspec ships that file alongside `lib/`
6
+ # (see `spec.files`) so this read works from an installed gem too.
8
7
  VERSION = JSON.parse(File.read(File.expand_path("../../package.json", __dir__))).fetch("version")
9
8
  end
@@ -20,6 +20,8 @@ module CleoDesignTokens
20
20
  TOKENS_DIR = File.expand_path("../tokens/color", __dir__)
21
21
  PRIMITIVES_PATH = File.join(TOKENS_DIR, "primitives.json")
22
22
  SEMANTIC_PATH = File.join(TOKENS_DIR, "semantic.json")
23
+ SPACING_BASE_UNIT_PX = 4
24
+ private_constant :SPACING_BASE_UNIT_PX
23
25
 
24
26
  # Built at load, into constants — not `@lookup ||=`, which would race under
25
27
  # concurrent access. Frozen from the moment the gem loads, so every reader
@@ -42,4 +44,18 @@ module CleoDesignTokens
42
44
  def self.colors
43
45
  COLORS
44
46
  end
47
+
48
+ # Spacing is code-owned, not generated from Figma. It is the package's
49
+ # sole public spacing API, matching the TypeScript reader.
50
+ def self.spacing(multiplier)
51
+ return "auto".freeze if multiplier == "auto"
52
+
53
+ pixels = multiplier * SPACING_BASE_UNIT_PX if multiplier.is_a?(Numeric)
54
+ unless multiplier.is_a?(Numeric) && !multiplier.is_a?(Complex) && multiplier.finite? && multiplier >= 0 && (pixels % 1).zero?
55
+ raise ArgumentError,
56
+ "spacing multiplier must be \"auto\" or a non-negative multiple of 0.25; received #{multiplier.inspect}"
57
+ end
58
+
59
+ "#{pixels.to_i}px".freeze
60
+ end
45
61
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetcleo/design-tokens",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "Canonical source of truth for Cleo's design tokens (DTCG JSON), plus a TypeScript reader.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -14,7 +14,8 @@
14
14
  "url": "https://github.com/meetcleo/cleonardo/issues"
15
15
  },
16
16
  "publishConfig": {
17
- "registry": "https://npm.pkg.github.com"
17
+ "registry": "https://registry.npmjs.org",
18
+ "access": "public"
18
19
  },
19
20
  "engines": {
20
21
  "node": ">=24"
metadata CHANGED
@@ -1,17 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cleo_design_tokens
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cleo
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-09-21 00:00:00.000000000 Z
11
12
  dependencies: []
12
13
  description: Flattens Cleo's colour design tokens (packages/tokens/tokens/color) into
13
14
  frozen colors.primitives / colors.semantic lookups, with the theme passed alongside
14
- the key.
15
+ the key, plus a code-owned base-unit spacing API.
16
+ email:
15
17
  executables: []
16
18
  extensions: []
17
19
  extra_rdoc_files: []
@@ -35,6 +37,7 @@ metadata:
35
37
  changelog_uri: https://github.com/meetcleo/cleonardo/releases
36
38
  github_repo: ssh://github.com/meetcleo/cleonardo
37
39
  allowed_push_host: https://rubygems.org
40
+ post_install_message:
38
41
  rdoc_options: []
39
42
  require_paths:
40
43
  - lib
@@ -49,7 +52,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
52
  - !ruby/object:Gem::Version
50
53
  version: '0'
51
54
  requirements: []
52
- rubygems_version: 3.6.9
55
+ rubygems_version: 3.4.1
56
+ signing_key:
53
57
  specification_version: 4
54
- summary: Ruby reader for Cleo's canonical colour design tokens
58
+ summary: Ruby reader for Cleo's canonical design tokens
55
59
  test_files: []