@loomhq/lens 12.17.1 → 12.18.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 +39 -3
- package/dist/cjs/icons/index.js +224 -204
- package/dist/cjs/icons/index.js.map +4 -4
- package/dist/cjs/icons/playlist.js +52 -0
- package/dist/cjs/icons/playlist.js.map +7 -0
- package/dist/cjs/index.js +979 -879
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/icons/chunk-DNFVTET2.js +23 -0
- package/dist/esm/icons/chunk-DNFVTET2.js.map +7 -0
- package/dist/esm/icons/index.js +33 -29
- package/dist/esm/icons/playlist.js +8 -0
- package/dist/esm/icons/playlist.js.map +7 -0
- package/dist/esm/index.js +905 -805
- package/dist/esm/index.js.map +4 -4
- package/dist/types/app/useTheme.d.ts.map +1 -1
- package/dist/types/icons/index.d.ts +1 -0
- package/dist/types/icons/index.d.ts.map +1 -1
- package/dist/types/icons/playlist.d.ts +3 -0
- package/dist/types/icons/playlist.d.ts.map +1 -0
- package/dist/types/shared-docs/color-box.d.ts +1 -1
- package/dist/types/shared-docs/color-box.d.ts.map +1 -1
- package/dist/types/shared-docs/theme-colors.d.ts.map +1 -1
- package/dist/types/src/colors.d.ts.map +1 -1
- package/dist/types/src/components/icon/available-icons/index.d.ts +1 -0
- package/dist/types/src/components/icon/available-icons/index.d.ts.map +1 -1
- package/dist/types/src/components/icon/available-icons/playlist.d.ts +3 -0
- package/dist/types/src/components/icon/available-icons/playlist.d.ts.map +1 -0
- package/dist/types/src/css-variables/index.d.ts.map +1 -1
- package/dist/types/src/utilities/index.d.ts +1 -0
- package/dist/types/src/utilities/index.d.ts.map +1 -1
- package/dist/types/src/utilities/style-provider.d.ts +92 -0
- package/dist/types/src/utilities/style-provider.d.ts.map +1 -0
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -74,25 +74,28 @@ pnpm --filter @loomhq/lens dev
|
|
|
74
74
|
After running the last `pnpm --filter` in your terminal, a `localhost` address should appear. Follow it to your local lens development website.
|
|
75
75
|
|
|
76
76
|
## Contributing
|
|
77
|
+
|
|
77
78
|
If you are looking to use an ADS (Atlassian Design System) component, [check out this section for implementation guidance](#add-an-icon-to-the-icon-set).
|
|
78
79
|
|
|
79
80
|
If you add any new Lens components, please surface any urgent pull requests in [#loom-design-system-lens](https://atlassian.enterprise.slack.com/archives/CJ52CKB27).
|
|
80
81
|
|
|
81
82
|
### Adding a New Icon to Lens
|
|
83
|
+
|
|
82
84
|
1. Within the `loom` repository, navigate to `projects/libraries/lens/src/components/icon/available-icons`
|
|
83
85
|
2. Create a new file in the `available-icons` folder, and give it a literal name (e.g., bug icon → bug.tsx)
|
|
84
|
-
|
|
86
|
+
- > **If the icon you are trying to add already exists in ADS**, use the same name as what can be found in the [ADS icon explorer](https://atlassian.design/components/icon/icon-explorer)
|
|
85
87
|
3. After creating your new icon, go to `index.ts` (found at `/lens/src/components/icon/available-icons/index.ts`) and add an export statement for your new icon in there.
|
|
86
88
|
4. When you're finished adding your icon into lens library, and run `pnpm build` → this command will automatically register your new icon to Lens and must be ran before you can view or test your new icon locally
|
|
87
89
|
5. [Follow these steps to run Lens locally.](#running-lens-locally)
|
|
88
90
|
6. Once you have finalized your changes and your code is ready for PR, you need to run `pnpm changeset` from the root directory
|
|
89
91
|
7. After running `changeset`, you should be prompted with "what changeset do you need" within your terminal
|
|
90
92
|
8. Select the files that you have changed, and press enter to proceed until you see a `patch bump` prompt. Make sure to select a severity that accurately reflects the scope of your changes.
|
|
91
|
-
|
|
93
|
+
- For example, a change that merely adds a new component or icon would be considered minor, but a change that adds a new component **and** removes support for another component/the previous version of that variant would be considered a **major** change.
|
|
92
94
|
|
|
93
95
|
> **Note:** If there's no `changeset` file included in your PR, your changes won't be available to use in the rest of the repo until a changeset is merged. Think of it like merging without deploying.
|
|
94
96
|
|
|
95
97
|
### Adding a New Illustration to Lens
|
|
98
|
+
|
|
96
99
|
Follow [this guide](https://hello.atlassian.net/wiki/spaces/~712020ed7894b2bdcb46ecacd40aff80a4be0e/pages/6562186947/Adding+a+new+ADS+Illustration+to+Lens) to add a new illustration to Lens. After running the prompt in the guide, verify the following:
|
|
97
100
|
|
|
98
101
|
1. **File location and export** — Your illustration lives in `projects/libraries/lens/src/illustrations/` and is exported from the `index.tsx` file in that folder.
|
|
@@ -101,7 +104,7 @@ Follow [this guide](https://hello.atlassian.net/wiki/spaces/~712020ed7894b2bdcb4
|
|
|
101
104
|
|
|
102
105
|
3. **Color definitions** — Illustration colors are defined in `projects/libraries/lens/src/colors.ts`. The theme-specific colors should have been added to the appropriate dark and light mode entries, and only static colors added to `illustrationColors`.
|
|
103
106
|
|
|
104
|
-
|
|
107
|
+
_Note: For illustrations that aren't from ADS, reach out in [#loom-design-system-lens](https://atlassian.enterprise.slack.com/archives/CJ52CKB27) first._
|
|
105
108
|
|
|
106
109
|
### Use conventional commits
|
|
107
110
|
|
|
@@ -131,6 +134,39 @@ Add your new SVG to `misc/eslint/common.js` and `projects/libraries/lens/src/com
|
|
|
131
134
|
|
|
132
135
|
To see if your icon is in a certain version, refer to [@atlaskit/icon changelog](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/design-system/icon/CHANGELOG.md) or the [@atlaskit/icon-lab changelog](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/design-system/icon-lab/CHANGELOG.md).
|
|
133
136
|
|
|
137
|
+
## Forcing a Theme on a Specific Element
|
|
138
|
+
|
|
139
|
+
To force a specific theme on an element and its children regardless of the page-level color mode, use `data-lens-theme`:
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
{/* Always dark */}
|
|
143
|
+
<div data-lens-theme="dark" />
|
|
144
|
+
|
|
145
|
+
{/* Always light */}
|
|
146
|
+
<div data-lens-theme="light" />
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
If any Lens tokens in the subtree reference ADS tokens (`--ds-*`) under the hood — which most do (see `colors.ts`) — three additional attributes are required so that `--ds-*` tokens are also correctly scoped:
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
{/* Always dark, with ADS tokens */}
|
|
153
|
+
<div data-lens-theme="dark" data-subtree-theme data-color-mode="dark" data-theme="light:dark dark:dark" />
|
|
154
|
+
|
|
155
|
+
{/* Always light, with ADS tokens */}
|
|
156
|
+
<div data-lens-theme="light" data-subtree-theme data-color-mode="light" data-theme="light:light dark:light" />
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
- **`data-subtree-theme`** — required by ADS (`@atlaskit/tokens`) to re-scope `--ds-*` tokens on the element
|
|
160
|
+
- **`data-color-mode`** — causes `--lns-theme{Dark|Light}-color-*` vars to be re-evaluated in a scope where `--ds-*` tokens already have the correct value, rather than inheriting the page-level value from `:root`
|
|
161
|
+
- **`data-theme`** — tells ADS which theme to apply per page color mode; format is `<pageColorMode>:<themeId>`, e.g. `"light:dark dark:dark"` means always use dark regardless of page mode
|
|
162
|
+
|
|
163
|
+
Also ensure `setGlobalTheme` is called with `colorMode: 'auto'` once at app startup so both ADS stylesheets are loaded. If only one is loaded, `--ds-*` tokens will be undefined on forced-theme subtrees:
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
// Call once before React renders, e.g. in renderLoomPage.ts
|
|
167
|
+
setGlobalTheme({ colorMode: 'auto', light: 'light', dark: 'dark' });
|
|
168
|
+
```
|
|
169
|
+
|
|
134
170
|
## Documentation
|
|
135
171
|
|
|
136
172
|
https://lens.loom.dev
|