You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-14Lines changed: 15 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ import type {
70
70
71
71
## Basic usage
72
72
73
-
Example of simple CSS classes conditioning – [\__tests__/readme.spec.tsx:9](./__tests__/readme.spec.tsx#L9-L31)
73
+
Example of simple CSS classes conditioning – [./\__tests__/readme.spec.tsx:9](./__tests__/readme.spec.tsx#L9-L31)
74
74
75
75
```tsx
76
76
importclassNamingfrom"react-classnaming"
@@ -114,19 +114,19 @@ You can find demonstration with all main points in folder [./\__examples__/](./_
114
114
115
115
### Condition is strictly `boolean`
116
116
117
-
Conditions with falsy values may lead to hardly caught bugs due to not obvious behavior for humans. In addition, as a possible `true` shortcut, the value can be not empty string as `class-hash` from CSS-module, and <u>`undefined`</u> for global CSS-class or modules simulation. Thus, to not keep in mind that `undefined` appears to be a truthy condition, it is prohibited on TypeScript level to mix in value type `boolean` with `ClassHash = string | undefined` and not allowed to use any other types like 0, null. [\__tests__/readme.spec.tsx:43](./__tests__/readme.spec.tsx#L43-L49)
117
+
Conditions with falsy values may lead to hardly caught bugs due to not obvious behavior for humans. In addition, as a possible `true` shortcut, the value can be not empty string as `class-hash` from CSS-module, and <u>`undefined`</u> for global CSS-class or modules simulation. Thus, to not keep in mind that `undefined` appears to be a truthy condition, it is prohibited on TypeScript level to mix in value type `boolean` with `ClassHash = string | undefined` and not allowed to use any other types like 0, null. [./\__tests__/readme.spec.tsx:43](./__tests__/readme.spec.tsx#L43-L49)
118
118
119
119

120
120
121
121
### Single source of truth
122
122
123
-
There can be only ONE condition for each class in call pipe. Already conditioned classes are propagated to next call type notation so you can see currently stacked with according *modality*: `true`, `false` or `boolean`. [\__tests__/readme.spec.tsx:55](./__tests__/readme.spec.tsx#L55-L63)
123
+
There can be only ONE condition for each class in call pipe. Already conditioned classes are propagated to next call type notation so you can see currently stacked with according *modality*: `true`, `false` or `boolean`. [./\__tests__/readme.spec.tsx:55](./__tests__/readme.spec.tsx#L55-L63)
Only declared CSS classes will be allowed as keys with IDE hint on possibilities – [\__tests__/readme.spec.tsx:71](./__tests__/readme.spec.tsx#L71-L102)
129
+
Only declared CSS classes will be allowed as keys with IDE hint on possibilities – [./\__tests__/readme.spec.tsx:71](./__tests__/readme.spec.tsx#L71-L102)
130
130
131
131
```diff
132
132
+ import type { ClassHash, ClassNamesProperty } from "react-classnaming"
@@ -145,7 +145,7 @@ Only declared CSS classes will be allowed as keys with IDE hint on possibilities
145
145
146
146
### BEM
147
147
148
-
It is possible to use BEM as condition query. With explicitly declared CSS classes (i.e. via [`postcss-plugin-d-ts`](https://www.npmjs.com/package/postcss-plugin-d-ts)) TS and IDE will check and hint on available blocks, elements, modifiers and values. [\__tests__/readme.spec.tsx:165](./__tests__/readme.spec.tsx#L165-L176)
148
+
It is possible to use BEM as condition query. With explicitly declared CSS classes (i.e. via [`postcss-plugin-d-ts`](https://www.npmjs.com/package/postcss-plugin-d-ts)) TS and IDE will check and hint on available blocks, elements, modifiers and values. [./\__tests__/readme.spec.tsx:165](./__tests__/readme.spec.tsx#L165-L176)
149
149
150
150
```diff
151
151
import {
@@ -215,21 +215,22 @@ On `const` hovering will be tooltip with already conditioned classes under this
215
215
216
216
### function `classBeming`
217
217
218
-
Sets context to returned function for using BEM conditioned CSS classes queries. In general, argument's shape is
218
+
Sets context to returned function for using BEM conditioned CSS classes queries. General argument's shape is
Featured example: [\./\__tests__/readme.spec.tsx:191](./__tests__/readme.spec.tsx#L191-L221)
233
234
234
235
---
235
236
@@ -238,7 +239,7 @@ Table of output logic:
238
239
Default options BEM naming:
239
240
240
241
- Modifier's and value's separator is a double hyphen `"--"`
241
-
- [#30](https://github.com/askirmas/react-classnaming/issues/30) ~~Element's separator is a double underscore `"__"`~~
242
+
- Element's separator is a double underscore `"__"`
242
243
243
244
It is required to change this options twice, both on JS (`setOpts(...)`) and TS `namespaceReactClassNaming { interfaceBemOptions {...} }`) levels
244
245
@@ -349,7 +350,7 @@ import css_module from "./some.css"; // With class `.never-used {...}`
349
350
350
351
#### Using CSS-modules or simulation
351
352
352
-
It is possible to use CSS modules or simulation without "context" by supplying class-hash value with variable [\__tests__/readme.spec.tsx:114](./__tests__/readme.spec.tsx#L114-L153)
353
+
It is possible to use CSS modules or simulation without "context" by supplying class-hash value with variable [./\__tests__/readme.spec.tsx:114](./__tests__/readme.spec.tsx#L114-L153)
353
354
354
355
```diff
355
356
// CSS-module, assuming "button" will be replaced with "BTN"
0 commit comments