Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,39 @@ let package = Package(
name: "NucleusIcons",
targets: ["NucleusIcons"]
),
.library(
name: "NucleusTokens",
targets: ["NucleusTokens"]
),
],
targets: [
// Zero-dependency protocol target. Each primitive conforms in its own module so consumers
// only link what they import — no target that depends on every module.
.target(
name: "NucleusTokens",
path: "ios/Sources/NucleusTokens"
),
.target(
name: "NucleusColors",
dependencies: ["NucleusTokens"],
path: "ios/Sources/NucleusColors"
),
.target(
name: "NucleusFonts",
dependencies: ["NucleusTokens"],
path: "ios/Sources/NucleusFonts",
resources: [
.process("Resources/Fonts"),
]
),
.target(
name: "NucleusButtons",
dependencies: ["NucleusColors", "NucleusFonts"],
dependencies: ["NucleusTokens", "NucleusColors", "NucleusFonts"],
path: "ios/Sources/NucleusButtons"
),
.target(
name: "NucleusIcons",
dependencies: ["NucleusTokens"],
path: "ios/Sources/NucleusIcons",
resources: [
.process("Resources/Icons.xcassets"),
Expand Down

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions ios/Sources/NucleusButtons/NucleusButton+TokenResolvable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// AUTOGENERATED by tokens/build — do not edit by hand.

import NucleusTokens

private let buttonTokens: [String: NucleusButton] = [
"disabled.32": .disabled32,
"disabled.40": .disabled40,
"disabled.48": .disabled48,
"ghost.32": .ghost32,
"ghost.40": .ghost40,
"ghost.48": .ghost48,
"inverse.32": .inverse32,
"inverse.40": .inverse40,
"inverse.48": .inverse48,
"primary.32": .primary32,
"primary.40": .primary40,
"primary.48": .primary48,
"secondary.32": .secondary32,
"secondary.40": .secondary40,
"secondary.48": .secondary48,
"tertiary.32": .tertiary32,
"tertiary.40": .tertiary40,
"tertiary.48": .tertiary48,
]

extension NucleusButton: TokenResolvable {
/// Resolves a type-scoped button style token, e.g. `inverse.32`.
public static func resolve(token: String) -> NucleusButton? {
guard let value = buttonTokens[token] else {
assertionFailure("unknown NucleusButton token: \(token)")
return nil
}
return value
}
}
118 changes: 118 additions & 0 deletions ios/Sources/NucleusColors/NucleusColor+TokenResolvable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
// AUTOGENERATED by tokens/build — do not edit by hand.

import NucleusTokens

private let colorTokens: [String: NucleusColor] = [
"accent.content": .accentContent,
"accent.primary": .accentPrimary,
"action.destructive": .actionDestructive,
"action.destructiveContent": .actionDestructiveContent,
"action.disabled": .actionDisabled,
"action.disabledContent": .actionDisabledContent,
"action.ghost": .actionGhost,
"action.ghostContent": .actionGhostContent,
"action.primary": .actionPrimary,
"action.primaryContent": .actionPrimaryContent,
"action.secondary": .actionSecondary,
"action.secondaryContent": .actionSecondaryContent,
"action.tertiary": .actionTertiary,
"action.tertiaryContent": .actionTertiaryContent,
"black": .black,
"border.default": .borderDefault,
"border.divider": .borderDivider,
"border.focus": .borderFocus,
"border.strong": .borderStrong,
"border.subtle": .borderSubtle,
"border.translucent": .borderTranslucent,
"error.100": .error100,
"error.200": .error200,
"error.300": .error300,
"error.400": .error400,
"error.500": .error500,
"error.600": .error600,
"error.700": .error700,
"error.800": .error800,
"error.900": .error900,
"error.950": .error950,
"grey.100": .grey100,
"grey.200": .grey200,
"grey.300": .grey300,
"grey.400": .grey400,
"grey.500": .grey500,
"grey.600": .grey600,
"grey.700": .grey700,
"grey.800": .grey800,
"grey.900": .grey900,
"grey.950": .grey950,
"icon.disabled": .iconDisabled,
"icon.inverse": .iconInverse,
"icon.primary": .iconPrimary,
"icon.secondary": .iconSecondary,
"icon.tertiary": .iconTertiary,
"info.100": .info100,
"info.200": .info200,
"info.300": .info300,
"info.400": .info400,
"info.500": .info500,
"info.600": .info600,
"info.700": .info700,
"info.800": .info800,
"info.900": .info900,
"info.950": .info950,
"input.background": .inputBackground,
"input.backgroundFocus": .inputBackgroundFocus,
"input.divider": .inputDivider,
"input.error": .inputError,
"input.placeholder": .inputPlaceholder,
"input.text": .inputText,
"status.error": .statusError,
"status.errorBackground": .statusErrorBackground,
"status.info": .statusInfo,
"status.infoBackground": .statusInfoBackground,
"status.success": .statusSuccess,
"status.successBackground": .statusSuccessBackground,
"status.warning": .statusWarning,
"status.warningBackground": .statusWarningBackground,
"success.100": .success100,
"success.200": .success200,
"success.300": .success300,
"success.400": .success400,
"success.500": .success500,
"success.600": .success600,
"success.700": .success700,
"success.800": .success800,
"success.900": .success900,
"success.950": .success950,
"surface.elevated": .surfaceElevated,
"surface.overlay": .surfaceOverlay,
"surface.primary": .surfacePrimary,
"surface.secondary": .surfaceSecondary,
"surface.tertiary": .surfaceTertiary,
"text.disabled": .textDisabled,
"text.inverse": .textInverse,
"text.primary": .textPrimary,
"text.secondary": .textSecondary,
"text.tertiary": .textTertiary,
"warning.100": .warning100,
"warning.200": .warning200,
"warning.300": .warning300,
"warning.400": .warning400,
"warning.500": .warning500,
"warning.600": .warning600,
"warning.700": .warning700,
"warning.800": .warning800,
"warning.900": .warning900,
"warning.950": .warning950,
"white": .white,
]

extension NucleusColor: TokenResolvable {
/// Resolves a type-scoped color token, e.g. `text.primary` or `grey.900`.
public static func resolve(token: String) -> NucleusColor? {
guard let value = colorTokens[token] else {
assertionFailure("unknown NucleusColor token: \(token)")
return nil
}
return value
}
}
38 changes: 38 additions & 0 deletions ios/Sources/NucleusFonts/NucleusFont+TokenResolvable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// AUTOGENERATED by tokens/build — do not edit by hand.

import NucleusTokens

private let fontTokens: [String: NucleusFont] = [
"b1": .b1,
"b2": .b2,
"b3": .b3,
"b4": .b4,
"d1": .d1,
"h1": .h1,
"h2": .h2,
"h3": .h3,
"h4": .h4,
"l1": .l1,
"l2": .l2,
"l3": .l3,
"n1": .n1,
"n2": .n2,
"n3": .n3,
"n4": .n4,
"n5": .n5,
"s1": .s1,
"s2": .s2,
"s3": .s3,
"s4": .s4,
]

extension NucleusFont: TokenResolvable {
/// Resolves a type-scoped typography token (bare id), e.g. `s3`.
public static func resolve(token: String) -> NucleusFont? {
guard let value = fontTokens[token] else {
assertionFailure("unknown NucleusFont token: \(token)")
return nil
}
return value
}
}
Loading
Loading