Skip to content

Conversation

@kyledurand
Copy link
Member

@kyledurand kyledurand commented May 19, 2023

WHY are these changes introduced?

WHAT is this pull request doing?

Adds a bit of experimental coloring

How to 🎩

🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines

Copy-paste this code in playground/Playground.tsx:
import React from 'react';
import {Page} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
    </Page>
  );
}

🎩 checklist

@kyledurand kyledurand marked this pull request as draft May 19, 2023 19:46
@kyledurand kyledurand changed the base branch from main to v11.x.x May 19, 2023 19:50
@kyledurand kyledurand force-pushed the add-experimental-colors branch from 8bb7a5a to dd5cb14 Compare May 19, 2023 19:50
@github-actions
Copy link
Contributor

github-actions bot commented May 19, 2023

size-limit report 📦

Path Size
polaris-react-cjs 243.08 KB (+0.04% 🔺)
polaris-react-esm 157.34 KB (+0.04% 🔺)
polaris-react-esnext 219.88 KB (+0.06% 🔺)
polaris-react-css 47.53 KB (+0.07% 🔺)

@kyledurand kyledurand force-pushed the add-experimental-colors branch from dd5cb14 to 5788197 Compare May 19, 2023 20:27
@aaronccasanova
Copy link
Member

aaronccasanova commented May 22, 2023

Discussed offline and brainstormed a consolidated strategy for rolling out experimental tokens: 0869b42

  • New tokens that map to an existing alias are assigned to valueExperimental
    • These will apply as overrides when the beta flag is enabled (without code changes)
    • Stylelint will continue to validate SCSS files as expected
    • TypeScript will continue to validate TSX files as expected (e.g. in Layout component props)
    • TODO: Establish a pattern to conditionally apply value or valueExperimental when tokens object is imported directly (we don't encourage this pattern and thus I expect this to be very rare).
  • New tokens that do NOT map to an existing alias are assigned to value
    • These will be generated as top level custom properties with a color-experimental prefix since they will be accessible regardless of the beta flag status (which should simplify the TypeScript implementation and intuitiveness). Note: The new token to existing token mappings are currently being worked out and we expect these experimental tokens to be minimal
    • Stylelint will continue to validate SCSS files as expected (without code changes) and breaking changes should be fine by using the color-experimental prefix
    • TypeScript will continue to validate TSX files as expected (e.g. in Layout component props) and breaking changes should be fine by using the color-experimental prefix
    • Direct access to the tokens object will work as expected (since values are accessible via tokenGroup[tokenName].value) and breaking changes should be fine by using the color-experimental prefix
    • Reduces the overall size of the generated stylesheet as the class with overrides will only contain experimental tokens (avoiding the need to generate two stylesheets that are dynamically loaded)

Note: The above pattern is applicable to all token groups (not just color):

Example of new tokens that do NOT map to an existing alias:
image

Example of new tokens that map to an existing alias (overridden via beta flag)
image

@kyledurand kyledurand marked this pull request as ready for review May 23, 2023 13:27
@kyledurand
Copy link
Member Author

/snapit

@github-actions
Copy link
Contributor

🫰✨ Thanks @kyledurand! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

yarn add @shopify/polaris-cli@0.0.0-snapshot-release-20230523201101
yarn add @shopify/polaris-codemods@0.0.0-snapshot-release-20230523201101
yarn add @shopify/polaris-icons@0.0.0-snapshot-release-20230523201101
yarn add @shopify/polaris-migrator@0.0.0-snapshot-release-20230523201101
yarn add @shopify/polaris@0.0.0-snapshot-release-20230523201101
yarn add @shopify/polaris-tokens@0.0.0-snapshot-release-20230523201101
yarn add @shopify/stylelint-polaris@0.0.0-snapshot-release-20230523201101

@kyledurand kyledurand merged commit 93e2d42 into v11.x.x May 24, 2023
@kyledurand kyledurand deleted the add-experimental-colors branch May 24, 2023 19:00
@gwyneplaine gwyneplaine mentioned this pull request May 25, 2023
@gwyneplaine gwyneplaine restored the add-experimental-colors branch May 25, 2023 00:04
gwyneplaine pushed a commit that referenced this pull request May 25, 2023
### WHY are these changes introduced?

### WHAT is this pull request doing?

Adds a bit of experimental coloring

<!-- ℹ️ Delete the following for small / trivial changes -->

### How to 🎩

🖥 [Local development
instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development)
🗒 [General tophatting
guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md)
📄 [Changelog
guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog)

<!--
  Give as much information as needed to experiment with the component
  in the playground.
-->

<details>
<summary>Copy-paste this code in
<code>playground/Playground.tsx</code>:</summary>

```jsx
import React from 'react';
import {Page} from '../src';

export function Playground() {
  return (
    <Page title="Playground">
      {/* Add the code you want to test in here */}
    </Page>
  );
}
```

</details>

### 🎩 checklist

- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [ ] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [ ] Updated the component's `README.md` with documentation changes
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide

---------

Co-authored-by: Aaron Casanova <32409546+aaronccasanova@users.noreply.github.com>
gwyneplaine added a commit that referenced this pull request May 25, 2023
Remerging #9241  into v11.x.x to fix bad rebase

---------

Co-authored-by: Kyle Durand <kyledurand@users.noreply.github.com>
Co-authored-by: Lo Kim <lo.kim@shopify.com>
Co-authored-by: kyledurand <kyle.durand@shopify.com>
Co-authored-by: Aaron Casanova <32409546+aaronccasanova@users.noreply.github.com>
sam-b-rose pushed a commit that referenced this pull request May 26, 2023
Remerging #9241  into v11.x.x to fix bad rebase

---------

Co-authored-by: Kyle Durand <kyledurand@users.noreply.github.com>
Co-authored-by: Lo Kim <lo.kim@shopify.com>
Co-authored-by: kyledurand <kyle.durand@shopify.com>
Co-authored-by: Aaron Casanova <32409546+aaronccasanova@users.noreply.github.com>
sophschneider pushed a commit that referenced this pull request Jun 1, 2023
Remerging #9241  into v11.x.x to fix bad rebase

---------

Co-authored-by: Kyle Durand <kyledurand@users.noreply.github.com>
Co-authored-by: Lo Kim <lo.kim@shopify.com>
Co-authored-by: kyledurand <kyle.durand@shopify.com>
Co-authored-by: Aaron Casanova <32409546+aaronccasanova@users.noreply.github.com>
sophschneider pushed a commit that referenced this pull request Jun 1, 2023
Remerging #9241  into v11.x.x to fix bad rebase

---------

Co-authored-by: Kyle Durand <kyledurand@users.noreply.github.com>
Co-authored-by: Lo Kim <lo.kim@shopify.com>
Co-authored-by: kyledurand <kyle.durand@shopify.com>
Co-authored-by: Aaron Casanova <32409546+aaronccasanova@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants