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

Set up Codex #746

Merged
merged 1 commit into from
Sep 19, 2024
Merged

Set up Codex #746

merged 1 commit into from
Sep 19, 2024

Conversation

lucaswerkmeister
Copy link
Member

@lucaswerkmeister lucaswerkmeister commented Sep 10, 2024

This sets up Codex components and design tokens so we can start using them. No actual components are migrated to Codex yet.

Components from Wikit can be used directly in our own components. The build is set up so that, when Special:NewLexeme is used within MediaWiki, Codex will be imported from there; this means that our build should get substantially smaller once we don’t need Wikit anymore. In the dev entry point, Codex comes from node_modules/ as expected. (Notice that the styles are only imported in index.html, so they won’t be included in our build output either. As far as I could tell, Vite doesn’t have a CSS equivalent of external JS packages in vite.config.ts yet.) When MediaWiki upgrades to a new Codex version, Special:NewLexeme will use the new versions of the Codex components (and their styles) immediately.

For the design tokens from Codex, we will start by directly importing them into each component that uses them, where they will end up being included (inlined) in the build. This means that design tokens used in our own components will be outdated after a MediaWiki upgrade to a new Codex version until we update this repository and push a new build to WikibaseLexeme. We will continue to investigate whether we can use them in some way that will automatically update them instead. (The solution will almost certainly involve using the tokens via CSS variables, but currently only a subset of the design tokens is available as CSS variables, and even then this depends on the skin. We might be able to get more variables added by MediaWiki, or we might add the variables in WikibaseLexeme ourselves.)

Bug: T369505

Copy link
Contributor

@codders codders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@itamargiv
Copy link
Member

Combined, this means that when MediaWiki upgrades to a new Codex version, Special:NewLexeme will use the new versions of the Codex components (and their styles) immediately, but the design tokens used in our own components will stay outdated until this repository is updated and a new build is pushed in WikibaseLexeme.git.

This sounds a bit precarious to me. While in the non MW based projects like QB or MSMF we have to rely only on codex updates through npm, this version mismatch you describe here has a potential of creating UI disruptions if we neglect to update our dependencies on time. Which of the tokens we need are not exposed as CSS variables? How about filing an issue and patching codex-design-tokens/.style-dictionary/matchers.js#35 to expose the needed tokens?

This sets up Codex components and design tokens so we can start using
them. No actual components are migrated to Codex yet.

Components from Wikit can be used directly in our own components. The
build is set up so that, when Special:NewLexeme is used within
MediaWiki, Codex will be imported from there; this means that our build
should get substantially smaller once we don’t need Wikit anymore. In
the dev entry point, Codex comes from node_modules/ as expected. (Notice
that the styles are only imported in index.html, so they won’t be
included in our build output either. As far as I could tell, Vite
doesn’t have a CSS equivalent of `external` JS packages in
vite.config.ts yet.) When MediaWiki upgrades to a new Codex version,
Special:NewLexeme will use the new versions of the Codex components (and
their styles) immediately.

For the design tokens from Codex, we will start by directly importing
them into each component that uses them, where they will end up being
included (inlined) in the build. This means that design tokens used in
our own components will be outdated after a MediaWiki upgrade to a new
Codex version until we update this repository and push a new build to
WikibaseLexeme. We will continue to investigate whether we can use them
in some way that will automatically update them instead. (The solution
will almost certainly involve using the tokens via CSS variables, but
currently only a subset of the design tokens is available as CSS
variables, and even then this depends on the skin. We might be able to
get more variables added by MediaWiki, or we might add the variables in
WikibaseLexeme ourselves.)

Bug: T369505
@lucaswerkmeister
Copy link
Member Author

Combined, this means that when MediaWiki upgrades to a new Codex version, Special:NewLexeme will use the new versions of the Codex components (and their styles) immediately, but the design tokens used in our own components will stay outdated until this repository is updated and a new build is pushed in WikibaseLexeme.git.

This sounds a bit precarious to me. While in the non MW based projects like QB or MSMF we have to rely only on codex updates through npm, this version mismatch you describe here has a potential of creating UI disruptions if we neglect to update our dependencies on time. Which of the tokens we need are not exposed as CSS variables? How about filing an issue and patching codex-design-tokens/.style-dictionary/matchers.js#35 to expose the needed tokens?

I updated the commit message to reflect the discussion we had; with that I think this is okay to merge.

@lucaswerkmeister lucaswerkmeister merged commit 0a92937 into main Sep 19, 2024
2 checks passed
wmfgerrit pushed a commit to wikimedia/mediawiki-extensions that referenced this pull request Sep 20, 2024
* Update WikibaseLexeme from branch 'master'
  to 49689438edf3c4f614c33b6142c984afee040053
  - Set up Codex in special-new-lexeme
    
    Start using the ResourceLoader module, so that Special:NewLexeme can use
    Codex components in subsequent changes.
    
    Requires <wmde/new-lexeme-special-page#746>.
    
    Bug: T369505
    Change-Id: If9ad15d9479a6e95ecdcd71b1c6388ab96f3a8bd
wmfgerrit pushed a commit to wikimedia/mediawiki-extensions-WikibaseLexeme that referenced this pull request Sep 20, 2024
Start using the ResourceLoader module, so that Special:NewLexeme can use
Codex components in subsequent changes.

Requires <wmde/new-lexeme-special-page#746>.

Bug: T369505
Change-Id: If9ad15d9479a6e95ecdcd71b1c6388ab96f3a8bd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants