cleo_design_tokens 0.1.4 → 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: 2bf8406899ea47dbbef0c4a0110eb3b995796cb4e13ea660c720deae3aa98da0
4
- data.tar.gz: ff162bd5c5543c81973894100d71c636baa9a9a515a035efc5367acdc8c66eb2
3
+ metadata.gz: 7abb9671d84913b6c88d46130486c08520ed672196e05d8ad9ce85b0dfe1f1c9
4
+ data.tar.gz: 3db80dbc885bbea88bd2f253e7a12fa098e16602af7b1eb3f03b86a7af21aafc
5
5
  SHA512:
6
- metadata.gz: 7ce45df54d80e57003987f91fbd1e7965af5bfe6b91d496fb0c9dcc39ae3e0de727b31b842135c39705ff3f366f21964e53e8ed664281f99adc3b3b635818dea
7
- data.tar.gz: 36c131e5eda05c02cd4eb2c530450e6b3dd8cd5d54b52bc3e0fcb0e156c78f1cdb112d7da03422509ac22ecdf87725d1b523426d491a61c9bc7af7d00e86c98d
6
+ metadata.gz: a9519fa9d05c897d745806756fb1354d77614e2c0fde50799eeab987fec3d918a202d524287d2595d0b204434f5d2d703818fc85ab24f443a7316a6c215f415d
7
+ data.tar.gz: 464f1ae23b11cd7fc3c888f9a9652aff9b7a34fc9ec9c71ae62415378390241a68ab76c4081e5c9ff3b1bb6238ffdb4fd5042c9dffc32de459e1c5b9be37f9f2
@@ -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.4",
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",
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cleo_design_tokens
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cleo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-26 00:00:00.000000000 Z
11
+ date: 2026-09-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Flattens Cleo's colour design tokens (packages/tokens/tokens/color) into
14
14
  frozen colors.primitives / colors.semantic lookups, with the theme passed alongside
15
- the key.
15
+ the key, plus a code-owned base-unit spacing API.
16
16
  email:
17
17
  executables: []
18
18
  extensions: []
@@ -55,5 +55,5 @@ requirements: []
55
55
  rubygems_version: 3.4.1
56
56
  signing_key:
57
57
  specification_version: 4
58
- summary: Ruby reader for Cleo's canonical colour design tokens
58
+ summary: Ruby reader for Cleo's canonical design tokens
59
59
  test_files: []