Skip to content

Commit 8712c86

Browse files
v1.1.0
1 parent b7d1e40 commit 8712c86

File tree

9 files changed

+1554
-1095
lines changed

9 files changed

+1554
-1095
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"engines": {
77
"node": ">=20"
88
},
9-
"packageManager": "pnpm@9.15.1",
9+
"packageManager": "pnpm@10.17.1",
1010
"scripts": {
1111
"preinstall": "npx only-allow pnpm",
1212
"dev": "turbo dev",
@@ -26,9 +26,9 @@
2626
"release": "pnpm build:release && changeset version && changeset publish"
2727
},
2828
"devDependencies": {
29-
"@changesets/cli": "^2.28.1",
30-
"prettier": "^3.5.2",
31-
"turbo": "^2.4.2",
32-
"typescript": "^5.7.3"
29+
"@changesets/cli": "^2.29.7",
30+
"prettier": "^3.6.2",
31+
"turbo": "^2.5.8",
32+
"typescript": "^5.9.2"
3333
}
3434
}

packages/internal-eslint-config/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
"tsc:print": "npx tsc --showConfig"
1212
},
1313
"devDependencies": {
14-
"@eslint/js": "^9.21.0",
15-
"eslint": "^9.21.0",
16-
"eslint-import-resolver-typescript": "^3.8.3",
17-
"eslint-plugin-import": "^2.31.0",
18-
"eslint-plugin-perfectionist": "^4.9.0",
19-
"eslint-plugin-react": "^7.37.4",
20-
"eslint-plugin-react-hooks": "5.1.0",
21-
"eslint-plugin-unused-imports": "^4.1.4",
22-
"globals": "^16.0.0",
23-
"typescript": "^5.7.3",
24-
"typescript-eslint": "^8.24.1"
14+
"@eslint/js": "^9.36.0",
15+
"eslint": "^9.36.0",
16+
"eslint-import-resolver-typescript": "^4.4.4",
17+
"eslint-plugin-import": "^2.32.0",
18+
"eslint-plugin-perfectionist": "^4.15.0",
19+
"eslint-plugin-react": "^7.37.5",
20+
"eslint-plugin-react-hooks": "5.2.0",
21+
"eslint-plugin-unused-imports": "^4.2.0",
22+
"globals": "^16.4.0",
23+
"typescript": "^5.9.2",
24+
"typescript-eslint": "^8.44.1"
2525
}
2626
}

packages/minimal-shared/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# minimal-shared
22

3+
## 1.1.0
4+
5+
_Sep 27, 2025_
6+
7+
- Add `src/utils/right-to-left`.
8+
9+
---
10+
311
## 1.0.15
412

513
_Jun 20, 2025_

packages/minimal-shared/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "minimal-shared",
33
"author": "Minimals",
4-
"version": "1.0.15",
4+
"version": "1.1.0",
55
"description": "Shared hooks and utils used by Minimal UI and Zone UI.",
66
"keywords": [
77
"typescript",
@@ -66,20 +66,20 @@
6666
"tsc:print": "npx tsc --showConfig"
6767
},
6868
"dependencies": {
69-
"es-toolkit": "^1.32.0"
69+
"es-toolkit": "^1.39.10"
7070
},
7171
"devDependencies": {
72-
"@testing-library/jest-dom": "^6.6.3",
73-
"@testing-library/react": "^16.2.0",
74-
"@types/node": "^22.13.5",
75-
"@types/react": "19.0.10",
72+
"@testing-library/jest-dom": "^6.8.0",
73+
"@testing-library/react": "^16.3.0",
74+
"@types/node": "^24.5.2",
75+
"@types/react": "19.1.14",
7676
"internal-eslint-config": "workspace:*",
7777
"internal-ts-config": "workspace:*",
78-
"jsdom": "^26.0.0",
78+
"jsdom": "^27.0.0",
7979
"react": "^19.0.0",
80-
"tsup": "^8.3.6",
81-
"typescript": "^5.7.3",
82-
"vitest": "^3.0.6"
80+
"tsup": "^8.5.0",
81+
"typescript": "^5.9.2",
82+
"vitest": "^3.2.4"
8383
},
8484
"peerDependencies": {
8585
"react": "^18.0.0 || ^19.0.0"

packages/minimal-shared/src/utils/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ export * from './cookies';
99
export * from './active-link';
1010
export * from './local-storage';
1111
export * from './css-variables';
12+
export * from './right-to-left';
1213
export * from './transform-number';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './right-to-left';
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { noRtlFlip } from './right-to-left';
2+
3+
// ----------------------------------------------------------------------
4+
5+
describe('noRtlFlip()', () => {
6+
it('1. Should append /* @noflip */ to a normal CSS value', () => {
7+
expect(noRtlFlip('margin-left: 10px;')).toBe('margin-left: 10px; /* @noflip */');
8+
});
9+
10+
it('2. Should trim whitespace before appending', () => {
11+
expect(noRtlFlip(' padding-right: 20px; ')).toBe('padding-right: 20px; /* @noflip */');
12+
});
13+
14+
it('3. Should not duplicate the @noflip marker if already present', () => {
15+
expect(noRtlFlip('color: red; /* @noflip */')).toBe('color: red; /* @noflip */');
16+
});
17+
18+
it('4. Should return empty string and warn if non-string value is provided', () => {
19+
const spy = vi.spyOn(console, 'warn').mockImplementation(() => {});
20+
expect(noRtlFlip(null)).toBe('');
21+
expect(spy).toHaveBeenCalledWith('Invalid CSS value provided');
22+
spy.mockRestore();
23+
});
24+
25+
it('5. Should return empty string and warn if string is empty', () => {
26+
const spy = vi.spyOn(console, 'warn').mockImplementation(() => {});
27+
expect(noRtlFlip(' ')).toBe('');
28+
expect(spy).toHaveBeenCalledWith('Empty CSS value provided');
29+
spy.mockRestore();
30+
});
31+
32+
it('6. Should handle CSS with line breaks', () => {
33+
expect(noRtlFlip('font-size: 14px;\n')).toBe('font-size: 14px; /* @noflip */');
34+
});
35+
});
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Prevents automatic RTL (right-to-left) flipping of a CSS declaration
3+
* by appending the `/* @noflip *\/` comment.
4+
*
5+
* @param {string} cssValue - A CSS declaration string (e.g., "margin-left: 10px;").
6+
* @returns {string} The same declaration string with the `/* @noflip *\/` comment appended.
7+
*
8+
* @example
9+
* noRtlFlip('margin-left: 10px;') // 'margin-left: 10px; /* @noflip *\/'
10+
*/
11+
export function noRtlFlip(cssValue: unknown): string {
12+
if (typeof cssValue !== 'string') {
13+
console.warn('Invalid CSS value provided');
14+
return '';
15+
}
16+
17+
const trimmed = cssValue.trim();
18+
19+
if (!trimmed) {
20+
console.warn('Empty CSS value provided');
21+
return '';
22+
}
23+
24+
if (trimmed.includes('/* @noflip */')) {
25+
return trimmed;
26+
}
27+
28+
return `${trimmed} /* @noflip */`;
29+
}

0 commit comments

Comments
 (0)