@streamsai/ui 0.1.8 → 0.1.9

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/dist/index.d.ts CHANGED
@@ -33,7 +33,7 @@ export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants
33
33
  export { Button, buttonVariants } from './components/ui/button.js';
34
34
  export { cn } from './lib/utils.js';
35
35
  export { HOME_TILE_COUNT, homeTileIndex } from './lib/home-tile.js';
36
- export { detectTextDirection, hasStrongCharacter, isNeutralToken, openingDirection, } from './lib/text-direction.js';
36
+ export { detectTextDirection, firstStrongLetterDirection, hasStrongCharacter, isNeutralToken, openingDirection, scriptsIn, } from './lib/text-direction.js';
37
37
  export { Checkbox } from './components/ui/checkbox.js';
38
38
  export { Clickable, clickableVariants, type ClickableProps } from './components/ui/clickable.js';
39
39
  export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from './components/ui/dialog.js';
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants
38
38
  export { Button, buttonVariants } from './components/ui/button.js';
39
39
  export { cn } from './lib/utils.js';
40
40
  export { HOME_TILE_COUNT, homeTileIndex } from './lib/home-tile.js';
41
- export { detectTextDirection, hasStrongCharacter, isNeutralToken, openingDirection, } from './lib/text-direction.js';
41
+ export { detectTextDirection, firstStrongLetterDirection, hasStrongCharacter, isNeutralToken, openingDirection, scriptsIn, } from './lib/text-direction.js';
42
42
  export { Checkbox } from './components/ui/checkbox.js';
43
43
  export { Clickable, clickableVariants } from './components/ui/clickable.js';
44
44
  // prettier-ignore
@@ -31,3 +31,10 @@ export declare const detectTextDirection: (text: string) => TextDirection;
31
31
  * letter (blank, digit-only and punctuation-only openers are skipped), or `null` when no block has one.
32
32
  */
33
33
  export declare const openingDirection: (blockTexts: Iterable<string>) => TextDirection | null;
34
+ /** Which scripts `text` contains letters of, ignoring digits and punctuation. */
35
+ export declare const scriptsIn: (text: string) => {
36
+ rtl: boolean;
37
+ ltr: boolean;
38
+ };
39
+ /** Direction of the first strong letter in `text`, or `null` when it has none (digits and punctuation never count). */
40
+ export declare const firstStrongLetterDirection: (text: string) => TextDirection | null;
@@ -137,3 +137,31 @@ export const openingDirection = (blockTexts) => {
137
137
  }
138
138
  return null;
139
139
  };
140
+ /** Which scripts `text` contains letters of, ignoring digits and punctuation. */
141
+ export const scriptsIn = (text) => {
142
+ let rtl = false;
143
+ let ltr = false;
144
+ for (const character of text) {
145
+ if (!LETTER.test(character))
146
+ continue;
147
+ const strength = strengthOf(character);
148
+ if (strength === 'rtl')
149
+ rtl = true;
150
+ else if (strength === 'ltr')
151
+ ltr = true;
152
+ if (rtl && ltr)
153
+ break;
154
+ }
155
+ return { rtl, ltr };
156
+ };
157
+ /** Direction of the first strong letter in `text`, or `null` when it has none (digits and punctuation never count). */
158
+ export const firstStrongLetterDirection = (text) => {
159
+ for (const character of text) {
160
+ if (!LETTER.test(character))
161
+ continue;
162
+ const strength = strengthOf(character);
163
+ if (strength !== null)
164
+ return strength;
165
+ }
166
+ return null;
167
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamsai/ui",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Streams design system: shadcn/ui components on Base UI, design tokens (Tailwind v4) and a theme provider for React 19.",
5
5
  "license": "MIT",
6
6
  "repository": {