Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: move utils directory to make it accessible #3027

Closed
wants to merge 183 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
d471390
feat: alpha release of design tokens (#1770)
viktorrusakov Nov 18, 2022
c302938
build: add alpha/beta to release CI workflow
adamstankiewicz Nov 18, 2022
577b297
feat: design tokens with style-dictionary
adamstankiewicz Nov 18, 2022
fe5818f
[BD-46] resolve bootstrap conflicts with design tokens (#1800)
viktorrusakov Nov 28, 2022
7c14c6e
feat: add ability to generate CSS utility classes through design tokens
viktorrusakov Dec 1, 2022
c226353
docs: added background-color for color HEX values on CSS utility clas…
PKulkoRaccoonGang Dec 5, 2022
e292ff1
fix: add missed border utilities
viktorrusakov Dec 5, 2022
abfead4
docs: add ability to view CSS variables on CSS Utility Classes page
viktorrusakov Dec 5, 2022
d931b2b
chore: remove unused import
viktorrusakov Dec 7, 2022
7ab5cd3
feat: remove deprecated components
viktorrusakov Dec 7, 2022
273c0ca
chore: update tokens for Modal components
viktorrusakov Dec 8, 2022
746882b
docs: display computed CSS variables on components' pages
viktorrusakov Dec 8, 2022
79e3896
refactor: update design tokens structure
PKulkoRaccoonGang Dec 15, 2022
eb1d19c
feat: add CLI interface for design tokens (#1846)
viktorrusakov Dec 15, 2022
0b809c0
fix: install dependencies in tokens module after installing Paragon
viktorrusakov Dec 19, 2022
2598825
fix: remove package.json files from tokens module
viktorrusakov Dec 20, 2022
c824182
refactor: update design tokens structure
PKulkoRaccoonGang Dec 20, 2022
d5f15df
refactor: replace old tables with `DataTable` on documentation site (…
PKulkoRaccoonGang Jan 6, 2023
a8043e4
[BD-46] refactor: improve design tokens architecture (#1874)
PKulkoRaccoonGang Jan 6, 2023
5715923
build: add workflow_dispatch to alpha branch to trigger release
adamstankiewicz Jan 7, 2023
e2e4d18
fix: trigger release
adamstankiewicz Jan 7, 2023
df2f764
fix: added custom title for CSS output files (#1985)
PKulkoRaccoonGang Feb 1, 2023
222d4e5
feat: deleted value in reference design tokens (#1989)
PKulkoRaccoonGang Feb 8, 2023
aedb5b6
fix: ensure design tokens have a valid type attribute (#1992)
PKulkoRaccoonGang Feb 15, 2023
9a08684
fix: add missing tokens for Button component (#1924)
PKulkoRaccoonGang Feb 15, 2023
9184d80
feat: add new tokens and cleanup after rebase
viktorrusakov Feb 16, 2023
5ea28ea
fix: trigger alpha release
adamstankiewicz Feb 21, 2023
5d6378a
Merge pull request #2072 from openedx/master
adamstankiewicz Feb 22, 2023
9fd32b8
Merge pull request #2079 from openedx/master
edx-requirements-bot Feb 22, 2023
a357889
Merge pull request #2081 from openedx/master
edx-requirements-bot Feb 23, 2023
4bbb0df
Merge pull request #2083 from openedx/master
edx-requirements-bot Feb 23, 2023
4882da0
Merge pull request #2087 from openedx/master
edx-requirements-bot Feb 24, 2023
5159195
docs: add pseudo-docs for intended usage, and details on working with…
adamstankiewicz Feb 24, 2023
577ac74
feat: added CSS custom media query transformer (#2068)
PKulkoRaccoonGang Feb 24, 2023
b5e1083
Merge pull request #2093 from openedx/master
edx-requirements-bot Feb 24, 2023
a42ea75
[BD-46] feat: refactoring design tokens folders structure (#2069)
PKulkoRaccoonGang Feb 24, 2023
e76f8b2
Merge pull request #2095 from openedx/master
edx-requirements-bot Feb 25, 2023
6d096dd
Merge pull request #2097 from openedx/master
edx-requirements-bot Feb 26, 2023
3cccdeb
fix: use min-width in custom-media breakpoint definitions (#2098)
adamstankiewicz Feb 26, 2023
d535348
Merge pull request #2101 from openedx/master
edx-requirements-bot Feb 27, 2023
aee70b1
Merge pull request #2104 from openedx/master
edx-requirements-bot Feb 28, 2023
b69b5de
Merge pull request #2106 from openedx/master
edx-requirements-bot Mar 1, 2023
dde1937
Merge pull request #2109 from openedx/master
edx-requirements-bot Mar 2, 2023
cbf48a2
Merge pull request #2114 from openedx/master
edx-requirements-bot Mar 3, 2023
b45f1d2
Merge pull request #2116 from openedx/master
edx-requirements-bot Mar 4, 2023
9fd9fb0
Merge pull request #2118 from openedx/master
edx-requirements-bot Mar 5, 2023
d04688d
Merge pull request #2120 from openedx/master
edx-requirements-bot Mar 6, 2023
503514e
Merge pull request #2122 from openedx/master
edx-requirements-bot Mar 7, 2023
c8f88f8
Merge pull request #2124 from openedx/master
edx-requirements-bot Mar 9, 2023
f007326
Merge pull request #2126 from openedx/master
edx-requirements-bot Mar 10, 2023
229d171
Merge pull request #2129 from openedx/master
edx-requirements-bot Mar 11, 2023
2f70912
Merge pull request #2131 from openedx/master
edx-requirements-bot Mar 12, 2023
000db3d
Merge pull request #2133 from openedx/master
edx-requirements-bot Mar 13, 2023
cee1c7c
Merge pull request #2135 from openedx/master
edx-requirements-bot Mar 14, 2023
40eaf0f
Merge pull request #2153 from openedx/master
edx-requirements-bot Mar 22, 2023
7942446
Merge pull request #2155 from openedx/master
edx-requirements-bot Mar 22, 2023
7f30806
Merge pull request #2157 from openedx/master
edx-requirements-bot Mar 23, 2023
54f7e14
Merge pull request #2158 from openedx/master
edx-requirements-bot Mar 24, 2023
d85c00e
chore: update @edx/frontend-build to latest in Paragon example app (#…
PKulkoRaccoonGang Mar 24, 2023
2ca3b68
fix: add description for tokens (#2112)
monteri Mar 24, 2023
6d6fa91
Merge pull request #2161 from openedx/master
edx-requirements-bot Mar 24, 2023
4fbe4ac
feat: [BD-46] Paragon theme CSS is built and published independently …
PKulkoRaccoonGang Apr 7, 2023
0a9ddde
Merge branch 'master' into alpha
viktorrusakov Apr 21, 2023
8ed7630
feat: add new tokens for Form, ColorPicker, and Icon components
viktorrusakov Apr 21, 2023
2252eb5
Merge pull request #2204 from openedx/rusakov/sync-alpha-with-master
viktorrusakov Apr 21, 2023
f4b919b
Merge pull request #2205 from openedx/master
edx-requirements-bot Apr 21, 2023
a9c1ec5
Merge pull request #2206 from openedx/master
edx-requirements-bot Apr 21, 2023
ec79b3b
Merge pull request #2207 from openedx/master
edx-requirements-bot Apr 21, 2023
387e3c4
Merge pull request #2208 from openedx/master
edx-requirements-bot Apr 21, 2023
f5f4921
feat: add custom variables to utility classes (#2022)
andrey-canon Apr 26, 2023
b373a94
Merge branch 'master' into alpha
viktorrusakov Apr 27, 2023
8570521
feat: add new css variable to `DataTable`
viktorrusakov Apr 27, 2023
100ee5c
sync: master to alpha
viktorrusakov Apr 27, 2023
27af4e3
feat: remove SCSS variable usages in components (#2137)
PKulkoRaccoonGang May 5, 2023
1fe1d52
Merge branch 'master' into alpha
viktorrusakov May 12, 2023
a9a27d1
feat: add tokens for `SelectMenu` component and cleanup after sync wi…
viktorrusakov May 12, 2023
bb00db7
Merge pull request #2293 from openedx/vrusakov/merge-master-into-alpha
viktorrusakov May 15, 2023
8fa043e
Merge pull request #2210 from openedx/master
edx-requirements-bot May 15, 2023
1384daa
Merge pull request #2301 from openedx/master
edx-requirements-bot May 15, 2023
880a92f
Merge pull request #2303 from openedx/master
edx-requirements-bot May 15, 2023
177c219
Merge pull request #2305 from openedx/master
edx-requirements-bot May 16, 2023
9163ff5
Merge pull request #2306 from openedx/master
edx-requirements-bot May 16, 2023
0a6025b
Merge pull request #2308 from openedx/master
edx-requirements-bot May 16, 2023
c13dfb1
Merge pull request #2312 from openedx/master
edx-requirements-bot May 17, 2023
9a94ac5
feat: completely deprecate FontAwesome (#2327)
PKulkoRaccoonGang May 26, 2023
a2ac304
feat: generate paragon-theme.json during npm run build with themeUrls…
adamstankiewicz May 29, 2023
faf7dac
fix: updates the paragon-theme.json output (#2334)
adamstankiewicz May 29, 2023
60dccb7
Merge branch 'master' into vrusakov/sync-alpha
viktorrusakov Jun 1, 2023
9533544
feat: add tokens for `Tab` and `Nav` components
viktorrusakov Jun 1, 2023
02b576e
feat: make color-yiq function a11y-friendly
viktorrusakov Jun 1, 2023
9fa8190
Merge pull request #2337 from openedx/vrusakov/sync-alpha
viktorrusakov Jun 2, 2023
f2171fc
Merge pull request #2339 from openedx/master
edx-requirements-bot Jun 2, 2023
101fe25
fix: avoid infinite while loop with `colorYiq` (#2349)
adamstankiewicz Jun 3, 2023
2d23b45
fix: remove unnecessary parentheses from coloryiq warning (#2350)
adamstankiewicz Jun 3, 2023
a8069b0
feat: update `build-tokens.js` to include `--source-tokens-only` arg …
adamstankiewicz Jun 4, 2023
a7ff171
fix: ensure sourceMappingUrl is correct (#2352)
adamstankiewicz Jun 4, 2023
73335b9
fix: add missing css util classes for border-radius (#2355)
adamstankiewicz Jun 5, 2023
13c53d0
feat: create themes flag to build tokens (#2357)
dcoa Jun 7, 2023
39fe41d
feat: added rounded pill token (#2361)
PKulkoRaccoonGang Jun 8, 2023
86df23e
fix: added missing SCSS variables in design tokens (#2364)
PKulkoRaccoonGang Jun 16, 2023
cc022bb
docs: fixed Input is not defined in TransitionReplace component (#2393)
PKulkoRaccoonGang Jun 23, 2023
f72bd32
feat: add defaults to theme-urls.json output on build (#2468)
adamstankiewicz Jul 23, 2023
8959d73
fix: renamed custom media query (#2495)
PKulkoRaccoonGang Aug 3, 2023
f869dad
Merge branch 'master' into zadorozhnii/sync-alpha-v3
Aug 22, 2023
3288ab4
refactor: refactorng after rebase
PKulkoRaccoonGang Aug 25, 2023
319f309
refactor: added new tokens
PKulkoRaccoonGang Aug 28, 2023
5537250
fix: skeleton.css fix
Aug 31, 2023
ac50be8
chore: sync alpha (#2568)
monteri Sep 1, 2023
f68a0ed
Revert "chore: sync alpha (#2568)" (#2586)
adamstankiewicz Sep 1, 2023
09570d7
Merge pull request #2587 from openedx/ags/sync-alpha-fix
adamstankiewicz Sep 1, 2023
e98894f
fix: remove undefined variables from utility classes (#2615)
PKulkoRaccoonGang Sep 13, 2023
bf05cc3
docs: replaced SCSS variables with CSS variables on the Colors page (…
PKulkoRaccoonGang Sep 15, 2023
948e51e
fix: remove `$enable-shadows` SCSS flag (#2423)
PKulkoRaccoonGang Sep 15, 2023
4450782
docs: fix theme switcher on the Colors page (#2628)
PKulkoRaccoonGang Sep 15, 2023
4d8d89a
fix: add source for grid gutter width token (#2636)
khudym Sep 20, 2023
0957ffe
fix: correctly resolve file pathing when replacing SCSS variables usa…
viktorrusakov Sep 20, 2023
ab1c6e4
Merge remote-tracking branch 'origin/master' into HEAD
PKulkoRaccoonGang Sep 22, 2023
1075c49
chore: sync alpha (#2643)
adamstankiewicz Sep 22, 2023
8acb42a
Merge pull request #2649 from openedx/master
edx-requirements-bot Sep 22, 2023
11c7e63
Merge pull request #2654 from openedx/master
edx-requirements-bot Sep 23, 2023
3845544
Merge pull request #2656 from openedx/master
edx-requirements-bot Sep 24, 2023
b447a60
Merge pull request #2659 from openedx/master
edx-requirements-bot Sep 25, 2023
2eae85c
Merge pull request #2662 from openedx/master
edx-requirements-bot Sep 25, 2023
9422920
Merge pull request #2666 from openedx/master
edx-requirements-bot Sep 28, 2023
d12ee31
Merge pull request #2670 from openedx/master
edx-requirements-bot Sep 29, 2023
3474728
docs: use `DataTable` component on the spacing page (#2677)
khudym Oct 6, 2023
4eb5450
Merge remote-tracking branch 'origin/master' into HEAD
PKulkoRaccoonGang Oct 6, 2023
48e0030
refactor: some refactoring
PKulkoRaccoonGang Oct 6, 2023
9299f4a
chore: sync alpha (#2693)
viktorrusakov Oct 6, 2023
91c5f63
Merge pull request #2696 from openedx/master
edx-requirements-bot Oct 6, 2023
27a5c11
Merge pull request #2698 from openedx/master
edx-requirements-bot Oct 7, 2023
4651bde
Merge pull request #2700 from openedx/master
edx-requirements-bot Oct 8, 2023
9ce4a41
Merge pull request #2704 from openedx/master
edx-requirements-bot Oct 9, 2023
9ad26f7
Merge pull request #2707 from openedx/master
edx-requirements-bot Oct 10, 2023
762fb03
Merge pull request #2708 from openedx/master
edx-requirements-bot Oct 10, 2023
01b1578
Merge pull request #2710 from openedx/master
edx-requirements-bot Oct 10, 2023
f465b40
Merge pull request #2712 from openedx/master
edx-requirements-bot Oct 11, 2023
2f2a295
Merge remote-tracking branch 'origin/master' into Peter_Kulko/alpha-t…
PKulkoRaccoonGang Oct 18, 2023
cead29f
refactor: deleted Modal.test.jsx file and updated SearchField snapshot
PKulkoRaccoonGang Oct 18, 2023
096ffab
chore: sync alpha (#2731)
viktorrusakov Oct 27, 2023
75580fd
feat: move design tokens CLI commands to paragon CLI (#2609)
monteri Oct 30, 2023
56836f0
fix: fixed design token for icon btn active state (#2765)
PKulkoRaccoonGang Oct 30, 2023
9af9a64
feat: added Segment track for CLI scripts (#2617)
PKulkoRaccoonGang Nov 9, 2023
e1c00b2
Merge remote-tracking branch 'origin/master' into HEAD
PKulkoRaccoonGang Nov 10, 2023
6420c19
refactor: refactoring after merge
PKulkoRaccoonGang Nov 10, 2023
4cd5bb7
chore: sync alpha (#2795)
viktorrusakov Nov 15, 2023
042e5b4
Merge pull request #2802 from openedx/master
edx-requirements-bot Nov 15, 2023
2b67057
Merge pull request #2813 from openedx/master
edx-requirements-bot Nov 15, 2023
c53aacb
Merge pull request #2816 from openedx/master
edx-requirements-bot Nov 15, 2023
3b7a980
Merge pull request #2822 from openedx/master
edx-requirements-bot Nov 16, 2023
36c80fe
fix: created missing design tokens (#2811)
PKulkoRaccoonGang Nov 16, 2023
3b57b8d
Merge pull request #2823 from openedx/master
edx-requirements-bot Nov 16, 2023
f6b255e
Merge remote-tracking branch 'origin/master' into HEAD
PKulkoRaccoonGang Nov 23, 2023
469625a
refactor: refactoring after merge
PKulkoRaccoonGang Nov 23, 2023
755740d
chore: sync alpha (#2847)
viktorrusakov Nov 24, 2023
fb6013f
Merge pull request #2854 from openedx/master
edx-requirements-bot Nov 24, 2023
fa882e1
Merge pull request #2857 from openedx/master
edx-requirements-bot Nov 25, 2023
60112a5
Merge pull request #2860 from openedx/master
edx-requirements-bot Nov 26, 2023
f86824f
docs: add loading state to CSS variables table (#2858)
viktorrusakov Nov 27, 2023
fe8d431
Merge remote-tracking branch 'origin/master' into HEAD
PKulkoRaccoonGang Dec 6, 2023
e61658f
refactor: refactoring of tokens in the Dropzone component
PKulkoRaccoonGang Dec 6, 2023
153af6a
chore: sync alpha (#2891)
viktorrusakov Dec 6, 2023
b536c52
Merge pull request #2892 from openedx/master
edx-requirements-bot Dec 6, 2023
6734df7
Merge pull request #2895 from openedx/master
edx-requirements-bot Dec 6, 2023
ebc32e2
Merge pull request #2896 from openedx/master
edx-requirements-bot Dec 6, 2023
2bee391
Merge pull request #2901 from openedx/master
edx-requirements-bot Dec 7, 2023
a9d275e
Merge pull request #2902 from openedx/master
edx-requirements-bot Dec 7, 2023
7b5df84
Merge pull request #2905 from openedx/master
edx-requirements-bot Dec 8, 2023
a6a2ec2
Merge pull request #2906 from openedx/master
edx-requirements-bot Dec 8, 2023
63107e5
Merge pull request #2909 from openedx/master
edx-requirements-bot Dec 8, 2023
c20b213
Merge pull request #2911 from openedx/master
edx-requirements-bot Dec 9, 2023
e87a30e
Merge pull request #2914 from openedx/master
edx-requirements-bot Dec 10, 2023
eb6b293
fix: remove ~ from import of react-loading-skeleton (#2912)
adamstankiewicz Dec 10, 2023
bdcfb17
Merge pull request #2920 from openedx/master
edx-requirements-bot Dec 11, 2023
3309eb4
Merge remote-tracking branch 'origin/master' into HEAD
PKulkoRaccoonGang Dec 15, 2023
5ffe031
Merge remote-tracking branch 'origin/master' into Peter_Kulko/merge-m…
PKulkoRaccoonGang Dec 19, 2023
6a3a66f
chore: sync alpha (#2932)
viktorrusakov Dec 21, 2023
d3b4a67
docs: updated the description on the Installation and usage page (#2835)
PKulkoRaccoonGang Dec 22, 2023
3d835b2
Merge remote-tracking branch 'origin/master' into HEAD
PKulkoRaccoonGang Dec 26, 2023
7c399b1
refactor: fixed button tokens
PKulkoRaccoonGang Dec 26, 2023
2b79e3a
refactor: code refactoring
PKulkoRaccoonGang Dec 26, 2023
ca2154e
chore: sync alpha (#2972)
viktorrusakov Dec 27, 2023
ff2b035
feat: move utils away from root directory
srwang Apr 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ node_modules/
www/
icons/
dependent-usage-analyzer/
build-scss.js
component-generator/
example/
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Release CI

on:
workflow_dispatch:
push:
branches:
- master
- alpha
- beta
jobs:
release:
name: Release
Expand Down
7 changes: 6 additions & 1 deletion .releaserc
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"branches": ["master", "next"],
"branches": [
"master",
"next",
{ "name": "alpha", "prerelease": true },
{ "name": "beta", "prerelease": true }
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
Expand Down
5 changes: 4 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
"ignoreProperties": ["xs", "sm", "md", "lg", "xl", "xxl"]
}],
"alpha-value-notation": "number",
"color-function-notation": "legacy"
"color-function-notation": "legacy",
"value-keyword-case": ["lower", {
"ignoreProperties": ["/font-family/"]
}]
}
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build:
rm -rf dist/**/__snapshots__
rm -rf dist/__mocks__
rm -rf dist/setupTest.js
node build-scss.js
./bin/paragon-scripts.js build-scss

export TRANSIFEX_RESOURCE = paragon
transifex_langs = "ar,ca,es_419,fr,he,id,ko_KR,pl,pt_BR,ru,th,uk,zh_CN,es_AR,es_ES,pt_PT,tr_TR,it_IT"
Expand Down
41 changes: 36 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Usage for Open edX and others:

```
// ... Any custom SCSS variables should be defined here
@import '~@edx/paragon/scss/core/core.scss';
@import '~@edx/paragon/styles/scss/core/core.scss';
```

Usage on with `@edx/brand`:
Expand All @@ -57,7 +57,7 @@ Usage on with `@edx/brand`:
```
@import '~@edx/brand/paragon/fonts.scss';
@import '~@edx/brand/paragon/variables.scss';
@import '~@edx/paragon/scss/core/core.scss';
@import '~@edx/paragon/styles/scss/core/core.scss';
@import '~@edx/brand/paragon/overrides.scss';
```

Expand All @@ -69,7 +69,10 @@ The Paragon CLI (Command Line Interface) is a tool that provides various utility

### Available Commands

- `paragon install-theme [theme]`: Installs the specific @edx/brand package.
- `paragon install-theme [theme]`: Installs the specific [brand package](https://github.com/openedx/brand-openedx).
- `paragon build-tokens`: Build Paragon's design tokens.
- `paragon replace-variables`: Replace SCSS variables usages or definitions to CSS variables and vice versa in `.scss` files.
- `paragon build-scss`: Compile Paragon's core and themes SCSS into CSS.

Use `paragon help` to see more information.

Expand Down Expand Up @@ -148,7 +151,7 @@ module.exports = {
dist: The sub-directory of the source code where it puts its build artifact. Often "dist".
*/
localModules: [
{ moduleName: '@edx/paragon/scss/core', dir: '../src/paragon', dist: 'scss/core' },
{ moduleName: '@edx/paragon/styles/scss/core', dir: '../src/paragon', dist: 'styles/scss/core' },
{ moduleName: '@edx/paragon/icons', dir: '../src/paragon', dist: 'icons' },
// Note that using dist: 'dist' will require you to run 'npm build' in Paragon
// to add local changes to the 'dist' directory, so that they can be picked up by the MFE.
Expand All @@ -158,7 +161,7 @@ module.exports = {
};
```

Then, when importing Paragon's core SCSS in your MFE the import needs to begin with a tilde `~` so that path to your local Paragon repository gets resolved correctly: `@import "~@edx/paragon/scss/core";`
Then, when importing Paragon's core SCSS in your MFE the import needs to begin with a tilde `~` so that path to your local Paragon repository gets resolved correctly: `@import "~@edx/paragon/styles/scss/core";`

#### Internationalization

Expand Down Expand Up @@ -476,3 +479,31 @@ The assigned maintainers for this component and other project details may be fou
Please do not report security issues in public. Please email security@openedx.org.

We tend to prioritize security issues which impact the published `@edx/paragon` NPM library more so than the [documentation website](https://paragon-openedx.netlify.app/) or example React application.

## Design Tokens

Design tokens are all the values needed to build and maintain a design system — spacing, color, typography, object styles, etc. They can represent anything defined by the design: color as an RGB value, opacity as a number, spacing as a REM value. They are used instead of hard-coded values to provide flexibility and uniformity across the application.

By defining style properties as tokens, we can transform the styles into various implementations compatible with different platforms or formats as our use cases expand (e.g., transforming tokens to CSS variables, CSS utility classes, etc.).

### Theming with design tokens

Paragon uses [style-dictionary](https://github.com/amzn/style-dictionary) to build design tokens into CSS variables that are included in the package. Read more in [design tokens README](tokens/README.md).

#### Compiling CSS from design tokens for Paragon contributions (in this repo)
1. **`npm install`.** Install dependencies, including `style-dictionary`.
2. Make changes to design token(s).
3. **`npm run build-scss`.** Transforms the tokens to CSS variables and CSS utility classes, and generates `core.css` and `light.css` output files.
- `light.css`. CSS variable definitions for colors in the light theme variant.
- `core.css`. Contains the majority of Paragon/Bootstrap foundational styles for layout, components, etc. Consumes CSS variables defined by `light.css`.
4. Test changes locally (e.g., running the documentation website, the example MFE app, etc.).
5. Ensure changes to `core.css` and `light.css` are committed & released to NPM (which also "releases" them on versioned public CDNs for NPM packages).
6. Consuming applications would inject the `core.css` and `light.css` theme files into their applications via a mechanism similar to https://github.com/openedx/frontend-platform/pull/440 (ideally pulling from a public CDN for NPM packages, but falling back to locally installed copies, if needed).

#### Compiling CSS from design tokens for `@edx/brand` theme authors (in `@edx/brand` repos)
1. **`npm install`.** Install dependencies, including `@edx/paragon`.
2. Create tokens that will override Paragon's default tokens (matching same JSON schema).
3. **`npm run build-scss`.** This `@edx/brand` repo will have a new NPM script that utilizes a new CLI exported by `@edx/paragon` which exposes the `build-tokens.js` script (or possibly another if we end up needing one for the brand packages to run specifically, TBD) for `@edx/brand` consumers.
- The intent of running this command is to effectively deep merge the tokens defined in Paragon's default tokens with the override tokens defined by `@edx/brand`, generating its own `core.css` and `light.css` output files (exact output files still a TBD) containing CSS variable overrides based on the token overrides.
5. Ensure any changes to the generated `core.css` and `light.css` files are committed & released to NPM (which also "releases" them on versioned public CDNs for NPM packages).
- _Note: It is a bit unclear still in the above linked implementation POC for `@edx/frontend-platform` how it would integrate with `@edx/brand` in this way. Open to suggestions/feedback/ideas here._
137 changes: 128 additions & 9 deletions bin/paragon-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
const chalk = require('chalk');
const themeCommand = require('../lib/install-theme');
const helpCommand = require('../lib/help');
const buildTokensCommand = require('../lib/build-tokens');
const replaceVariablesCommand = require('../lib/replace-variables');
const buildScssCommand = require('../lib/build-scss');
const { sendTrackInfo } = require('../lib/utils');
const versionCommand = require('../lib/version');

const HELP_COMMAND = 'help';
const commandAliases = {
'-v': 'version',
'--version': 'version',
Expand All @@ -30,6 +33,9 @@ const COMMANDS = {
* {
* name: '--optionName',
* description: 'optionDescription',
* choices: 'optionChoices',
* defaultValue: 'optionDefaultValue',
* required: true/false,
* },
* ...
* ],
Expand All @@ -48,8 +54,118 @@ const COMMANDS = {
},
],
},
'build-tokens': {
executor: buildTokensCommand,
description: 'CLI to build Paragon design tokens.',
options: [
{
name: '-s, --source',
description: 'Specify the source directory for design tokens.',
defaultValue: '\'\'',
},
{
name: '-b, --build-dir',
description: 'Specify the build directory for the generated tokens.',
defaultValue: './build/',
},
{
name: '--source-tokens-only',
description: 'Include only source design tokens in the build.',
defaultValue: false,
},
{
name: '-t, --themes',
description: 'Specify themes to include in the token build.',
defaultValue: 'light',
},
],
},
'replace-variables': {
executor: replaceVariablesCommand,
description: 'CLI to replace SCSS variables usages or definitions to CSS variables and vice versa in .scss files.',
parameters: [
{
name: '-p, --filePath',
description: 'Path to the file or directory where to replace variables.',
defaultValue: '\'\'',
},
],
options: [
{
name: '-s, --source',
description: 'Type of replacement: usage or definition. If set to "definition" the command will only update SCSS variables definitions with CSS variables, if set to "usage" - all occurrences of SCSS variables will we replaced',
defaultValue: '\'\'',
},
{
name: '-t, --replacementType',
description: 'Type of replacement: usage or definition. If set to "definition" the command will only update SCSS variables definitions with CSS variables, if set to "usage" - all occurrences of SCSS variables will we replaced',
choices: '[usage|definition]',
defaultValue: 'definition',
},
{
name: '-d, --direction',
description: 'Map direction: css-to-scss or scss-to-css, if replacement type parameter is set to "definition" this has no effect.',
choices: '[scss-to-css|css-to-scss]',
defaultValue: 'scss-to-css',
},
],
},
'build-scss': {
executor: buildScssCommand,
description: 'CLI to compile Paragon\'s core and themes SCSS into CSS.',
options: [
{
name: '--corePath',
description: 'Path to the theme\'s core SCSS file, defaults to Paragon\'s core.scss.',
defaultValue: 'styles/scss/core/core.scss',
},
{
name: '--themesPath',
description: `Path to the directory that contains themes' files. Expects directory to have following structure:
themes/
light/
│ ├─ index.css
│ ├─ other_css_files
dark/
│ ├─ index.css
│ ├─ other_css_files
some_other_custom_theme/
│ ├─ index.css
│ ├─ other_css_files
...

where index.css has imported all other CSS files in the theme's subdirectory. The script will output
light.css, dark.css and some_other_custom_theme.css files (together with maps and minified versions).
You can provide any amount of themes. Default to paragon's themes.
`,
defaultValue: 'styles/css/themes',
},
{
name: '--outDir',
description: 'Specifies directory where to out resulting CSS files.',
defaultValue: './dist',
},
{
name: '--defaultThemeVariants',
description: `Specifies default theme variants. Defaults to a single 'light' theme variant.
You can provide multiple default theme variants by passing multiple values, for
example: \`--defaultThemeVariants light dark\`
`,
defaultValue: 'light',
},
],
},
help: {
executor: helpCommand,
executor: (args) => helpCommand(COMMANDS, args),
parameters: [
{
name: 'command',
description: 'Specifies command name.',
defaultValue: '\'\'',
choices: '[install-theme|build-tokens|replace-variables|build-scss]',
required: false,
},
],
description: 'Displays help for available commands.',
},
version: {
Expand All @@ -58,8 +174,14 @@ const COMMANDS = {
},
};

/**
* Executes a Paragon CLI command based on the provided command-line arguments.
*
* @async
* @function executeParagonCommand
*/
(async () => {
const [command] = process.argv.slice(2);
const [command, ...commandArgs] = process.argv.slice(2);
const resolvedCommand = commandAliases[command] || command;
const executor = COMMANDS[resolvedCommand];

Expand All @@ -69,16 +191,13 @@ const COMMANDS = {
return;
}

if (command === HELP_COMMAND) {
helpCommand(COMMANDS);
return;
}

try {
await executor.executor();
await executor.executor(commandArgs);
sendTrackInfo('openedx.paragon.cli-command.used', { command, status: 'success' });
} catch (error) {
// eslint-disable-next-line no-console
console.error(chalk.red.bold('An error occurred:', error.message));
sendTrackInfo('openedx.paragon.cli-command.used', { command, status: 'error', errorMsg: error.message });
process.exit(1);
}
})();
23 changes: 0 additions & 23 deletions build-scss.js

This file was deleted.

4 changes: 2 additions & 2 deletions component-generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ const path = require('path');
const { COMPONENT_FILES } = require('./constants');
const {
validateComponentName,
sendTrackInfo,
createFile,
addComponentToExports,
addComponentToGit,
} = require('./utils');
const { sendTrackInfo } = require('../lib/utils');

program
.argument('<ComponentName>', 'Component must have a name', validateComponentName)
.action((componentName) => {
// send data to analytics
sendTrackInfo(componentName);
sendTrackInfo('openedx.paragon.functions.track-generate-component.created', { componentName });
const componentDir = path.resolve(__dirname, `../src/${componentName}`);
// create directory for the component files
fs.mkdirSync(componentDir);
Expand Down
21 changes: 0 additions & 21 deletions component-generator/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { InvalidOptionArgumentError } = require('commander');
const fs = require('fs');
const path = require('path');
const axios = require('axios');
const { exec } = require('child_process');
require('dotenv').config();

Expand Down Expand Up @@ -32,25 +31,6 @@ function validateComponentName(value) {
return value;
}

/**
* Sends request to the Netlify function to inform about generate-component usage.
* @param {string} componentName - component name
*/
function sendTrackInfo(componentName) {
const { BASE_URL, TRACK_ANONYMOUS_ANALYTICS } = process.env;
if (TRACK_ANONYMOUS_ANALYTICS) {
const url = `${BASE_URL}/.netlify/functions/trackGenerateComponent`;
axios.post(url, { componentName })
.then(result => {
// eslint-disable-next-line no-console
console.log(`Track info is successfully sent (status ${result.status})`);
}).catch(error => {
// eslint-disable-next-line no-console
console.log(`Track info request failed (${error})`);
});
}
}

/**
* Creates a file for the component based on the template.
* Note that 'componentName' string is a reserved placeholder,
Expand Down Expand Up @@ -97,7 +77,6 @@ function addComponentToGit(componentName) {
}

exports.validateComponentName = validateComponentName;
exports.sendTrackInfo = sendTrackInfo;
exports.createFile = createFile;
exports.addComponentToExports = addComponentToExports;
exports.addComponentToGit = addComponentToGit;
Loading
Loading