@sproutsocial/seeds-theme 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.
- package/README.md +259 -0
- package/dist/css-tokens.json +134 -0
- package/dist/legacy-dark.css +437 -0
- package/dist/legacy-light.css +437 -0
- package/dist/legacy.css +659 -0
- package/dist/schema.json +11798 -0
- package/dist/shadcn-dark.css +2 -0
- package/dist/shadcn-light.css +2 -0
- package/dist/shadcn.css +2 -0
- package/dist/shadcn.registry.json +77 -0
- package/dist/source/shadcn-dark.tokens.json +169 -0
- package/dist/source/shadcn-light.tokens.json +169 -0
- package/dist/source/theme-dark.tokens.json +1945 -0
- package/dist/source/theme-light.tokens.json +1945 -0
- package/dist/styled-components/index.cjs +1648 -0
- package/dist/styled-components/index.d.ts +3654 -0
- package/dist/styled-components/index.js +1641 -0
- package/dist/styled-components/index.ts +5285 -0
- package/dist/tailwind.css +40 -0
- package/dist/theme-dark.css +388 -0
- package/dist/theme-dark.d.ts +420 -0
- package/dist/theme-dark.js +401 -0
- package/dist/theme-dark.json +712 -0
- package/dist/theme-light.css +388 -0
- package/dist/theme-light.d.ts +420 -0
- package/dist/theme-light.js +400 -0
- package/dist/theme-light.json +712 -0
- package/dist/theme.css +611 -0
- package/mode-authoring.md +54 -0
- package/package.json +96 -0
- package/src/cli.js +42 -0
- package/src/compiler.d.ts +9 -0
- package/src/compiler.js +533 -0
- package/src/config.d.ts +39 -0
- package/src/config.js +280 -0
- package/src/contract.js +351 -0
- package/src/extension-schema.js +88 -0
- package/src/extension.d.ts +18 -0
- package/src/extension.js +81 -0
- package/src/index.d.ts +90 -0
- package/src/index.js +9 -0
- package/src/primitives.js +98 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Later exploration: light and dark in one file
|
|
2
|
+
|
|
3
|
+
Keep separate light/dark files for this phase. First establish the recognizable
|
|
4
|
+
Seeds paths, default Sprout values, compatibility exports, and consumer extension
|
|
5
|
+
API. A later authoring format should compile into the same two token graphs.
|
|
6
|
+
|
|
7
|
+
Three options are worth comparing:
|
|
8
|
+
|
|
9
|
+
| Option | What the author sees | Tradeoff |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| Separate mode files (current) | The same familiar tree in light and dark JSON | Simple native merges; compare files side by side |
|
|
12
|
+
| One file with `light` and `dark` sections | Both complete override trees in one document | Easy preprocessing, but still repeats paths |
|
|
13
|
+
| Per-token mode values | Each token shows its light and dark values together | Best local comparison; requires a documented convention and preprocessing |
|
|
14
|
+
|
|
15
|
+
For example, a **proposed, unsupported** authoring shorthand could be:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"colors": {
|
|
20
|
+
"container": {
|
|
21
|
+
"background": {
|
|
22
|
+
"base": {
|
|
23
|
+
"$type": "color",
|
|
24
|
+
"$value": "#fff",
|
|
25
|
+
"$extensions": {
|
|
26
|
+
"com.sproutsocial.modes": { "dark": "#222" }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The custom extension above is not built-in Style Dictionary mode syntax. A
|
|
36
|
+
preprocessor would select each mode before inheritance, reference validation,
|
|
37
|
+
and output generation. Style Dictionary supports this kind of
|
|
38
|
+
[preprocessing](https://styledictionary.com/reference/hooks/preprocessors/).
|
|
39
|
+
We would also need to extend JSON Schema completion and prove that partial dark
|
|
40
|
+
overrides, references, and compatibility output remain identical.
|
|
41
|
+
|
|
42
|
+
The published [DTCG Resolver 2025.10](https://www.designtokens.org/TR/2025.10/resolver/)
|
|
43
|
+
defines contexts such as light and dark, supports inline token sources, and can
|
|
44
|
+
bundle sources into one document. It is the standards-based option to investigate,
|
|
45
|
+
but it does not prescribe a `dark` value beside every token's `$value`. Resolver
|
|
46
|
+
support in our pinned Style Dictionary version and tooling needs a separate
|
|
47
|
+
implementation spike before adoption.
|
|
48
|
+
|
|
49
|
+
My recommendation for that later spike: compare the per-token shorthand with a
|
|
50
|
+
resolver document using a small set of real Seeds overrides. Keep the public
|
|
51
|
+
extension build API unchanged if either format wins. Today, the documented
|
|
52
|
+
[native `.extend()` API](https://styledictionary.com/reference/api/#extend)
|
|
53
|
+
handles inheritance of the selected light/dark graphs; file organization is a
|
|
54
|
+
separate authoring choice.
|
package/package.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sproutsocial/seeds-theme",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Framework-neutral DTCG replacement for the Seeds theme",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.js",
|
|
7
|
+
"types": "src/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"seeds-theme": "./src/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"src",
|
|
14
|
+
"README.md",
|
|
15
|
+
"mode-authoring.md"
|
|
16
|
+
],
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./src/index.d.ts",
|
|
20
|
+
"import": "./src/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./compiler": {
|
|
23
|
+
"types": "./src/compiler.d.ts",
|
|
24
|
+
"import": "./src/compiler.js"
|
|
25
|
+
},
|
|
26
|
+
"./config": {
|
|
27
|
+
"types": "./src/config.d.ts",
|
|
28
|
+
"import": "./src/config.js"
|
|
29
|
+
},
|
|
30
|
+
"./styled-components": {
|
|
31
|
+
"types": "./dist/styled-components/index.d.ts",
|
|
32
|
+
"import": "./dist/styled-components/index.js",
|
|
33
|
+
"require": "./dist/styled-components/index.cjs"
|
|
34
|
+
},
|
|
35
|
+
"./light": {
|
|
36
|
+
"types": "./dist/theme-light.d.ts",
|
|
37
|
+
"import": "./dist/theme-light.js"
|
|
38
|
+
},
|
|
39
|
+
"./dark": {
|
|
40
|
+
"types": "./dist/theme-dark.d.ts",
|
|
41
|
+
"import": "./dist/theme-dark.js"
|
|
42
|
+
},
|
|
43
|
+
"./css/theme": "./dist/theme.css",
|
|
44
|
+
"./css/theme-light": "./dist/theme-light.css",
|
|
45
|
+
"./css/theme-dark": "./dist/theme-dark.css",
|
|
46
|
+
"./css/legacy": "./dist/legacy.css",
|
|
47
|
+
"./css/legacy-light": "./dist/legacy-light.css",
|
|
48
|
+
"./css/legacy-dark": "./dist/legacy-dark.css",
|
|
49
|
+
"./css/shadcn": "./dist/shadcn.css",
|
|
50
|
+
"./css/shadcn-light": "./dist/shadcn-light.css",
|
|
51
|
+
"./css/shadcn-dark": "./dist/shadcn-dark.css",
|
|
52
|
+
"./css/tailwind": "./dist/tailwind.css",
|
|
53
|
+
"./shadcn/registry": "./dist/shadcn.registry.json",
|
|
54
|
+
"./json/light": "./dist/theme-light.json",
|
|
55
|
+
"./json/dark": "./dist/theme-dark.json",
|
|
56
|
+
"./tokens/light": "./dist/source/theme-light.tokens.json",
|
|
57
|
+
"./tokens/dark": "./dist/source/theme-dark.tokens.json",
|
|
58
|
+
"./tokens/shadcn/light": "./dist/source/shadcn-light.tokens.json",
|
|
59
|
+
"./tokens/shadcn/dark": "./dist/source/shadcn-dark.tokens.json",
|
|
60
|
+
"./extension": {
|
|
61
|
+
"types": "./src/extension.d.ts",
|
|
62
|
+
"import": "./src/extension.js"
|
|
63
|
+
},
|
|
64
|
+
"./schema": "./dist/schema.json",
|
|
65
|
+
"./css-tokens": "./dist/css-tokens.json",
|
|
66
|
+
"./styled-components/source": "./dist/styled-components/index.ts"
|
|
67
|
+
},
|
|
68
|
+
"scripts": {
|
|
69
|
+
"build": "node build.js && tsx migration/seeds-react-theme/check-css.ts",
|
|
70
|
+
"clean": "rm -rf .turbo dist",
|
|
71
|
+
"clean:modules": "rm -rf node_modules",
|
|
72
|
+
"test": "node build.js && node --test 'test/**/*.test.js'"
|
|
73
|
+
},
|
|
74
|
+
"dependencies": {
|
|
75
|
+
"@sproutsocial/seeds-color": "^2.3.0",
|
|
76
|
+
"style-dictionary": "5.5.2",
|
|
77
|
+
"@sproutsocial/seeds-space": "^0.8.1",
|
|
78
|
+
"@sproutsocial/seeds-border": "^1.7.1",
|
|
79
|
+
"@sproutsocial/seeds-typography": "^3.8.0",
|
|
80
|
+
"@sproutsocial/seeds-depth": "^3.6.0",
|
|
81
|
+
"@sproutsocial/seeds-motion": "^1.8.2",
|
|
82
|
+
"@sproutsocial/seeds-networkcolor": "^2.22.0"
|
|
83
|
+
},
|
|
84
|
+
"devDependencies": {
|
|
85
|
+
"tsx": "^4.0.0"
|
|
86
|
+
},
|
|
87
|
+
"engines": {
|
|
88
|
+
"node": ">=22"
|
|
89
|
+
},
|
|
90
|
+
"repository": {
|
|
91
|
+
"type": "git",
|
|
92
|
+
"url": "git+ssh://git@github.com/sproutsocial/seeds-packets.git"
|
|
93
|
+
},
|
|
94
|
+
"author": "Sprout Social, Inc.",
|
|
95
|
+
"license": "MIT"
|
|
96
|
+
}
|
package/src/cli.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
|
+
import { buildProductTheme } from "./config.js";
|
|
6
|
+
|
|
7
|
+
const usage = `Usage: seeds-theme build [config]
|
|
8
|
+
|
|
9
|
+
Build a product-owned Seeds theme. The config defaults to
|
|
10
|
+
seeds-theme.config.mjs in the current directory.`;
|
|
11
|
+
|
|
12
|
+
async function main() {
|
|
13
|
+
const [command, configArgument] = process.argv.slice(2);
|
|
14
|
+
if (command === "--help" || command === "-h") {
|
|
15
|
+
process.stdout.write(`${usage}\n`);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (command !== "build") {
|
|
19
|
+
throw new Error(usage);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const configPath = path.resolve(
|
|
23
|
+
process.cwd(),
|
|
24
|
+
configArgument ?? "seeds-theme.config.mjs"
|
|
25
|
+
);
|
|
26
|
+
const configModule = await import(pathToFileURL(configPath).href);
|
|
27
|
+
if (!configModule.default) {
|
|
28
|
+
throw new Error(`${configPath} must have a default export.`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const outputDirectory = await buildProductTheme(configModule.default, {
|
|
32
|
+
configDirectory: path.dirname(configPath),
|
|
33
|
+
});
|
|
34
|
+
process.stdout.write(
|
|
35
|
+
`Built ${configModule.default.name} theme in ${outputDirectory}\n`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
main().catch((error) => {
|
|
40
|
+
process.stderr.write(`${error.message}\n`);
|
|
41
|
+
process.exitCode = 1;
|
|
42
|
+
});
|