onecart-ui-tokens 0.1.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.
@@ -0,0 +1,16 @@
1
+ {
2
+ "tokenFormat": "TokensStudio",
3
+ "figmaFileId": "",
4
+ "inputFile": "./tokens-studio.json",
5
+ "outputDir": "./src/styles/tokens",
6
+ "platforms": [
7
+ "css",
8
+ "cssAutocomplete",
9
+ "scss",
10
+ "scssMap",
11
+ "less",
12
+ "js",
13
+ "ts",
14
+ "json"
15
+ ]
16
+ }
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "onecart-ui-tokens",
3
+ "version": "0.1.0",
4
+ "description": "Design tokens for OneCart UI built via Style Dictionary",
5
+ "scripts": {
6
+ "generate-tokens": "npx figma-token-engine",
7
+ "generate-tokens-safe": "node scripts/generate-safe.js",
8
+ "build": "style-dictionary build --config style-dictionary.config.js && node scripts/generate-dts.js"
9
+ },
10
+ "devDependencies": {
11
+ "style-dictionary": "^4.0.0",
12
+ "figma-token-engine": "^0.3.0"
13
+ },
14
+ "exports": {
15
+ "./web": {
16
+ "types": "./build/web/tokens.d.ts",
17
+ "import": "./build/web/tokens.js",
18
+ "default": "./build/web/tokens.js"
19
+ },
20
+ "./mobile": {
21
+ "types": "./build/mobile/tokens.d.ts",
22
+ "default": "./build/mobile/tokens.js"
23
+ },
24
+ "./styles": {
25
+ "types": "./src/styles/tokens/facade.d.ts",
26
+ "import": "./src/styles/tokens/facade.js",
27
+ "default": "./src/styles/tokens/facade.js"
28
+ },
29
+ ".": {
30
+ "types": "./build/web/tokens.d.ts",
31
+ "import": "./build/web/tokens.js",
32
+ "default": "./build/web/tokens.js"
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ /** Enhanced DTS generator including raw styles tokens */
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+
6
+ const targets = [
7
+ {
8
+ js: path.join(__dirname, "..", "build", "web", "tokens.js"),
9
+ dts: path.join(__dirname, "..", "build", "web", "tokens.d.ts"),
10
+ },
11
+ {
12
+ js: path.join(__dirname, "..", "build", "mobile", "tokens.js"),
13
+ dts: path.join(__dirname, "..", "build", "mobile", "tokens.d.ts"),
14
+ },
15
+ {
16
+ js: path.join(__dirname, "..", "src", "styles", "tokens", "tokens.js"),
17
+ dts: path.join(__dirname, "..", "src", "styles", "tokens", "tokens.d.ts"),
18
+ },
19
+ ];
20
+
21
+ function extractExports(jsContent) {
22
+ const regex = /export const (\w+)\s*=\s*/g;
23
+ const names = [];
24
+ let match;
25
+ while ((match = regex.exec(jsContent))) {
26
+ names.push(match[1]);
27
+ }
28
+ return names;
29
+ }
30
+
31
+ for (const t of targets) {
32
+ if (!fs.existsSync(t.js)) continue;
33
+ const content = fs.readFileSync(t.js, "utf8");
34
+ const names = extractExports(content);
35
+ const lines = names.map((n) => `export const ${n}: string | number;`);
36
+ const header = "/** Auto-generated token type declarations */";
37
+ fs.writeFileSync(t.dts, header + "\n" + lines.join("\n") + "\n");
38
+ console.log("Wrote", path.relative(process.cwd(), t.dts));
39
+ }
File without changes
@@ -0,0 +1,32 @@
1
+ // CommonJS wrapper for Jest (which runs in CJS context under ts-jest by default)
2
+ const raw = require("./tokens.cjs");
3
+ module.exports = {
4
+ ACTION_PRIMARY_DEFAULT: raw.ACTION_PRIMARY_DEFAULT,
5
+ ACTION_PRIMARY_HOVER: raw.ACTION_PRIMARY_HOVER,
6
+ ACTION_PRIMARY_ACTIVE: raw.ACTION_PRIMARY_ACTIVE,
7
+ ACTION_PRIMARY_DISABLED: raw.ACTION_PRIMARY_DISABLED,
8
+ ACTION_SECONDARY_DEFAULT: raw.ACTION_SECONDARY_DEFAULT,
9
+ ACTION_SECONDARY_HOVER: raw.ACTION_SECONDARY_HOVER,
10
+ ACTION_SECONDARY_ACTIVE: raw.ACTION_SECONDARY_ACTIVE,
11
+ ACTION_SECONDARY_DISABLED: raw.ACTION_SECONDARY_DISABLED,
12
+ ACTION_TERTIARY_DEFAULT: raw.ACTION_TERTIARY_DEFAULT,
13
+ ACTION_TERTIARY_HOVER: raw.ACTION_TERTIARY_HOVER,
14
+ ACTION_TERTIARY_ACTIVE: raw.ACTION_TERTIARY_ACTIVE,
15
+ ACTION_TERTIARY_DISABLE: raw.ACTION_TERTIARY_DISABLE,
16
+ ACTION_DESTRUCTIVE_DEFAULT: raw.ACTION_DESTRUCTIVE_DEFAULT,
17
+ ACTION_DESTRUCTIVE_HOVER: raw.ACTION_DESTRUCTIVE_HOVER,
18
+ ACTION_DESTRUCTIVE_ACTIVE: raw.ACTION_DESTRUCTIVE_ACTIVE,
19
+ ACTION_DESTRUCTIVE_DISABLE: raw.ACTION_DESTRUCTIVE_DISABLE,
20
+ NEUTRAL_80: raw.NEUTRAL_80,
21
+ BORDER_WIDTH_BUTTON_DEFAULT: raw.BORDER_WIDTH_BUTTON_DEFAULT,
22
+ BORDER_WIDTH_BUTTON_HOVER: raw.BORDER_WIDTH_BUTTON_HOVER,
23
+ BORDER_WIDTH_BUTTON_PRESSED: raw.BORDER_WIDTH_BUTTON_PRESSED,
24
+ SPACE_0: raw.SPACE_0,
25
+ COMPONENT_CARD_SM: raw.COMPONENT_CARD_SM,
26
+ LAYOUT_SPACING_INLINE_MD: raw.LAYOUT_SPACING_INLINE_MD,
27
+ LAYOUT_SPACING_INLINE_XS: raw.LAYOUT_SPACING_INLINE_XS,
28
+ BORDER_RADIUS_BUTTON_FULL: raw.BORDER_RADIUS_BUTTON_FULL,
29
+ FONT_FAMILIES_CAMPTON: raw.FONT_FAMILIES_CAMPTON,
30
+ MEDIUM: raw.MEDIUM,
31
+ raw,
32
+ };
@@ -0,0 +1,29 @@
1
+ // Type declarations for curated button token subset
2
+ export const ACTION_PRIMARY_DEFAULT: string;
3
+ export const ACTION_PRIMARY_HOVER: string;
4
+ export const ACTION_PRIMARY_ACTIVE: string;
5
+ export const ACTION_PRIMARY_DISABLED: string;
6
+ export const ACTION_SECONDARY_DEFAULT: string;
7
+ export const ACTION_SECONDARY_HOVER: string;
8
+ export const ACTION_SECONDARY_ACTIVE: string;
9
+ export const ACTION_SECONDARY_DISABLED: string;
10
+ export const ACTION_TERTIARY_DEFAULT: string;
11
+ export const ACTION_TERTIARY_HOVER: string;
12
+ export const ACTION_TERTIARY_ACTIVE: string;
13
+ export const ACTION_TERTIARY_DISABLE: string;
14
+ export const ACTION_DESTRUCTIVE_DEFAULT: string;
15
+ export const ACTION_DESTRUCTIVE_HOVER: string;
16
+ export const ACTION_DESTRUCTIVE_ACTIVE: string;
17
+ export const ACTION_DESTRUCTIVE_DISABLE: string;
18
+ export const NEUTRAL_80: string;
19
+ export const BORDER_WIDTH_BUTTON_DEFAULT: string;
20
+ export const BORDER_WIDTH_BUTTON_HOVER: string;
21
+ export const BORDER_WIDTH_BUTTON_PRESSED: string;
22
+ export const SPACE_0: string | number;
23
+ export const COMPONENT_CARD_SM: string;
24
+ export const LAYOUT_SPACING_INLINE_MD: string;
25
+ export const LAYOUT_SPACING_INLINE_XS: string;
26
+ export const BORDER_RADIUS_BUTTON_FULL: string;
27
+ export const FONT_FAMILIES_CAMPTON: string;
28
+ export const MEDIUM: string | number;
29
+ export const raw: Record<string, string | number>;
@@ -0,0 +1,33 @@
1
+ // Facade: curated subset of raw Figma tokens for button usage
2
+ // Generated manually; consider automating selection logic later.
3
+ import * as raw from "./tokens.js";
4
+
5
+ export const ACTION_PRIMARY_DEFAULT = raw.ACTION_PRIMARY_DEFAULT;
6
+ export const ACTION_PRIMARY_HOVER = raw.ACTION_PRIMARY_HOVER;
7
+ export const ACTION_PRIMARY_ACTIVE = raw.ACTION_PRIMARY_ACTIVE;
8
+ export const ACTION_PRIMARY_DISABLED = raw.ACTION_PRIMARY_DISABLED;
9
+ export const ACTION_SECONDARY_DEFAULT = raw.ACTION_SECONDARY_DEFAULT;
10
+ export const ACTION_SECONDARY_HOVER = raw.ACTION_SECONDARY_HOVER;
11
+ export const ACTION_SECONDARY_ACTIVE = raw.ACTION_SECONDARY_ACTIVE;
12
+ export const ACTION_SECONDARY_DISABLED = raw.ACTION_SECONDARY_DISABLED;
13
+ export const ACTION_TERTIARY_DEFAULT = raw.ACTION_TERTIARY_DEFAULT;
14
+ export const ACTION_TERTIARY_HOVER = raw.ACTION_TERTIARY_HOVER;
15
+ export const ACTION_TERTIARY_ACTIVE = raw.ACTION_TERTIARY_ACTIVE;
16
+ export const ACTION_TERTIARY_DISABLE = raw.ACTION_TERTIARY_DISABLE;
17
+ export const ACTION_DESTRUCTIVE_DEFAULT = raw.ACTION_DESTRUCTIVE_DEFAULT;
18
+ export const ACTION_DESTRUCTIVE_HOVER = raw.ACTION_DESTRUCTIVE_HOVER;
19
+ export const ACTION_DESTRUCTIVE_ACTIVE = raw.ACTION_DESTRUCTIVE_ACTIVE;
20
+ export const ACTION_DESTRUCTIVE_DISABLE = raw.ACTION_DESTRUCTIVE_DISABLE;
21
+ export const NEUTRAL_80 = raw.NEUTRAL_80;
22
+ export const BORDER_WIDTH_BUTTON_DEFAULT = raw.BORDER_WIDTH_BUTTON_DEFAULT;
23
+ export const BORDER_WIDTH_BUTTON_HOVER = raw.BORDER_WIDTH_BUTTON_HOVER;
24
+ export const BORDER_WIDTH_BUTTON_PRESSED = raw.BORDER_WIDTH_BUTTON_PRESSED;
25
+ export const SPACE_0 = raw.SPACE_0;
26
+ export const COMPONENT_CARD_SM = raw.COMPONENT_CARD_SM;
27
+ export const LAYOUT_SPACING_INLINE_MD = raw.LAYOUT_SPACING_INLINE_MD;
28
+ export const LAYOUT_SPACING_INLINE_XS = raw.LAYOUT_SPACING_INLINE_XS;
29
+ export const BORDER_RADIUS_BUTTON_FULL = raw.BORDER_RADIUS_BUTTON_FULL;
30
+ export const FONT_FAMILIES_CAMPTON = raw.FONT_FAMILIES_CAMPTON;
31
+ export const MEDIUM = raw.MEDIUM;
32
+ // expose raw for rare escape hatches (avoid in production components)
33
+ export { raw };