@nucleux/direction 0.0.0-stage → 0.7.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nucleux
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,44 @@
1
- # Temporary Holding Version
1
+ # @nucleux/direction
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Text direction (LTR/RTL) provider and hook — Nucleux agentic UI for React.
4
+
5
+ Part of **[Nucleux](https://github.com/intelligaia-open-labs/nucleux)** — agentic UI components for React. Install a single component, or the full kit via [`@nucleux/react`](https://www.npmjs.com/package/@nucleux/react).
6
+
7
+
8
+ ## Exports
9
+
10
+ - **`DirectionProvider`** — sets `dir` (`"ltr"` | `"rtl"`; `direction` is an alias) for components below it
11
+ - **`useDirection(localDir?)`** — returns `localDir`, else the provider's value, else `"ltr"`
12
+ - **`Direction`** — the `"ltr" | "rtl"` type
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ pnpm add @nucleux/direction @nucleux/tokens
18
+ ```
19
+
20
+ `react` / `react-dom` are peer dependencies.
21
+
22
+ ## Usage
23
+
24
+ ```tsx
25
+ import { DirectionProvider, useDirection } from "@nucleux/direction";
26
+
27
+ <html dir="rtl">
28
+ <DirectionProvider dir="rtl">
29
+ <App />
30
+ </DirectionProvider>
31
+ </html>
32
+
33
+ function Arrow() {
34
+ const dir = useDirection();
35
+ return dir === "rtl" ? <ArrowLeft /> : <ArrowRight />;
36
+ }
37
+ ```
38
+
39
+ Requires the theme once in your app: `import "@nucleux/tokens/styles.css";`
40
+ and the Tailwind preset from `@nucleux/tokens/preset`.
41
+
42
+ ## License
43
+
44
+ MIT © Nucleux
package/dist/index.cjs ADDED
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
+
27
+ // src/index.tsx
28
+ var DirectionContext = React__namespace.createContext(void 0);
29
+ function DirectionProvider({ dir, direction, children }) {
30
+ const value = direction ?? dir;
31
+ return /* @__PURE__ */ jsxRuntime.jsx(DirectionContext.Provider, { value, children });
32
+ }
33
+ DirectionProvider.displayName = "DirectionProvider";
34
+ function useDirection(localDir) {
35
+ const globalDir = React__namespace.useContext(DirectionContext);
36
+ return localDir || globalDir || "ltr";
37
+ }
38
+
39
+ exports.DirectionProvider = DirectionProvider;
40
+ exports.useDirection = useDirection;
41
+ //# sourceMappingURL=index.cjs.map
42
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.tsx"],"names":["React","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAM,gBAAA,GAAyBA,+BAAqC,MAAS,CAAA;AAgBtE,SAAS,iBAAA,CAAkB,EAAE,GAAA,EAAK,SAAA,EAAW,UAAS,EAA2B;AACtF,EAAA,MAAM,QAAQ,SAAA,IAAa,GAAA;AAC3B,EAAA,uBAAOC,cAAA,CAAC,gBAAA,CAAiB,QAAA,EAAjB,EAA0B,OAAe,QAAA,EAAS,CAAA;AAC5D;AACA,iBAAA,CAAkB,WAAA,GAAc,mBAAA;AAOzB,SAAS,aAAa,QAAA,EAAiC;AAC5D,EAAA,MAAM,SAAA,GAAkBD,4BAAW,gBAAgB,CAAA;AACnD,EAAA,OAAO,YAAY,SAAA,IAAa,KAAA;AAClC","file":"index.cjs","sourcesContent":["import * as React from \"react\";\n\n/** Reading direction: left-to-right or right-to-left. */\nexport type Direction = \"ltr\" | \"rtl\";\n\nconst DirectionContext = React.createContext<Direction | undefined>(undefined);\n\nexport interface DirectionProviderProps {\n /** Reading direction for everything below this provider. */\n dir?: Direction;\n /** Alias of `dir` (shadcn vocabulary); wins when both are given. */\n direction?: Direction;\n children?: React.ReactNode;\n}\n\n/**\n * Sets the reading direction (\"ltr\" or \"rtl\") for the components below it,\n * read with `useDirection()`. It renders no DOM of its own, so also set\n * `dir` on your `<html>` (or a wrapping element) for the browser's layout\n * and text flow to follow. Accepts `direction` as an alias of `dir`.\n */\nexport function DirectionProvider({ dir, direction, children }: DirectionProviderProps) {\n const value = direction ?? dir;\n return <DirectionContext.Provider value={value}>{children}</DirectionContext.Provider>;\n}\nDirectionProvider.displayName = \"DirectionProvider\";\n\n/**\n * Returns the effective reading direction: `localDir` when given (a\n * component's own `dir` prop), otherwise the nearest DirectionProvider's\n * value, otherwise \"ltr\".\n */\nexport function useDirection(localDir?: Direction): Direction {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || \"ltr\";\n}\n"]}
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+
3
+ /** Reading direction: left-to-right or right-to-left. */
4
+ type Direction = "ltr" | "rtl";
5
+ interface DirectionProviderProps {
6
+ /** Reading direction for everything below this provider. */
7
+ dir?: Direction;
8
+ /** Alias of `dir` (shadcn vocabulary); wins when both are given. */
9
+ direction?: Direction;
10
+ children?: React.ReactNode;
11
+ }
12
+ /**
13
+ * Sets the reading direction ("ltr" or "rtl") for the components below it,
14
+ * read with `useDirection()`. It renders no DOM of its own, so also set
15
+ * `dir` on your `<html>` (or a wrapping element) for the browser's layout
16
+ * and text flow to follow. Accepts `direction` as an alias of `dir`.
17
+ */
18
+ declare function DirectionProvider({ dir, direction, children }: DirectionProviderProps): React.JSX.Element;
19
+ declare namespace DirectionProvider {
20
+ var displayName: string;
21
+ }
22
+ /**
23
+ * Returns the effective reading direction: `localDir` when given (a
24
+ * component's own `dir` prop), otherwise the nearest DirectionProvider's
25
+ * value, otherwise "ltr".
26
+ */
27
+ declare function useDirection(localDir?: Direction): Direction;
28
+
29
+ export { type Direction, DirectionProvider, type DirectionProviderProps, useDirection };
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+
3
+ /** Reading direction: left-to-right or right-to-left. */
4
+ type Direction = "ltr" | "rtl";
5
+ interface DirectionProviderProps {
6
+ /** Reading direction for everything below this provider. */
7
+ dir?: Direction;
8
+ /** Alias of `dir` (shadcn vocabulary); wins when both are given. */
9
+ direction?: Direction;
10
+ children?: React.ReactNode;
11
+ }
12
+ /**
13
+ * Sets the reading direction ("ltr" or "rtl") for the components below it,
14
+ * read with `useDirection()`. It renders no DOM of its own, so also set
15
+ * `dir` on your `<html>` (or a wrapping element) for the browser's layout
16
+ * and text flow to follow. Accepts `direction` as an alias of `dir`.
17
+ */
18
+ declare function DirectionProvider({ dir, direction, children }: DirectionProviderProps): React.JSX.Element;
19
+ declare namespace DirectionProvider {
20
+ var displayName: string;
21
+ }
22
+ /**
23
+ * Returns the effective reading direction: `localDir` when given (a
24
+ * component's own `dir` prop), otherwise the nearest DirectionProvider's
25
+ * value, otherwise "ltr".
26
+ */
27
+ declare function useDirection(localDir?: Direction): Direction;
28
+
29
+ export { type Direction, DirectionProvider, type DirectionProviderProps, useDirection };
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import * as React from 'react';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ // src/index.tsx
6
+ var DirectionContext = React.createContext(void 0);
7
+ function DirectionProvider({ dir, direction, children }) {
8
+ const value = direction ?? dir;
9
+ return /* @__PURE__ */ jsx(DirectionContext.Provider, { value, children });
10
+ }
11
+ DirectionProvider.displayName = "DirectionProvider";
12
+ function useDirection(localDir) {
13
+ const globalDir = React.useContext(DirectionContext);
14
+ return localDir || globalDir || "ltr";
15
+ }
16
+
17
+ export { DirectionProvider, useDirection };
18
+ //# sourceMappingURL=index.js.map
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.tsx"],"names":[],"mappings":";;;;AAKA,IAAM,gBAAA,GAAyB,oBAAqC,MAAS,CAAA;AAgBtE,SAAS,iBAAA,CAAkB,EAAE,GAAA,EAAK,SAAA,EAAW,UAAS,EAA2B;AACtF,EAAA,MAAM,QAAQ,SAAA,IAAa,GAAA;AAC3B,EAAA,uBAAO,GAAA,CAAC,gBAAA,CAAiB,QAAA,EAAjB,EAA0B,OAAe,QAAA,EAAS,CAAA;AAC5D;AACA,iBAAA,CAAkB,WAAA,GAAc,mBAAA;AAOzB,SAAS,aAAa,QAAA,EAAiC;AAC5D,EAAA,MAAM,SAAA,GAAkB,iBAAW,gBAAgB,CAAA;AACnD,EAAA,OAAO,YAAY,SAAA,IAAa,KAAA;AAClC","file":"index.js","sourcesContent":["import * as React from \"react\";\n\n/** Reading direction: left-to-right or right-to-left. */\nexport type Direction = \"ltr\" | \"rtl\";\n\nconst DirectionContext = React.createContext<Direction | undefined>(undefined);\n\nexport interface DirectionProviderProps {\n /** Reading direction for everything below this provider. */\n dir?: Direction;\n /** Alias of `dir` (shadcn vocabulary); wins when both are given. */\n direction?: Direction;\n children?: React.ReactNode;\n}\n\n/**\n * Sets the reading direction (\"ltr\" or \"rtl\") for the components below it,\n * read with `useDirection()`. It renders no DOM of its own, so also set\n * `dir` on your `<html>` (or a wrapping element) for the browser's layout\n * and text flow to follow. Accepts `direction` as an alias of `dir`.\n */\nexport function DirectionProvider({ dir, direction, children }: DirectionProviderProps) {\n const value = direction ?? dir;\n return <DirectionContext.Provider value={value}>{children}</DirectionContext.Provider>;\n}\nDirectionProvider.displayName = \"DirectionProvider\";\n\n/**\n * Returns the effective reading direction: `localDir` when given (a\n * component's own `dir` prop), otherwise the nearest DirectionProvider's\n * value, otherwise \"ltr\".\n */\nexport function useDirection(localDir?: Direction): Direction {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || \"ltr\";\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "@nucleux/direction",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.7.0",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
20
+ "peerDependencies": {
21
+ "react": ">=18",
22
+ "react-dom": ">=18"
23
+ },
24
+ "dependencies": {
25
+ "@nucleux/utils": "0.7.0"
26
+ },
27
+ "devDependencies": {
28
+ "tsup": "^8.3.5",
29
+ "typescript": "^5.7.2",
30
+ "@types/react": "^18.3.18",
31
+ "react": "^18.3.1",
32
+ "lucide-react": "^0.469.0"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "license": "MIT",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/intelligaia-open-labs/nucleux.git",
41
+ "directory": "packages/direction"
42
+ },
43
+ "homepage": "https://github.com/intelligaia-open-labs/nucleux#readme",
44
+ "description": "Text direction (LTR/RTL) provider and hook — Nucleux agentic UI for React.",
45
+ "keywords": [
46
+ "nucleux",
47
+ "react",
48
+ "ui",
49
+ "components",
50
+ "agentic",
51
+ "ai",
52
+ "tailwind",
53
+ "direction"
54
+ ],
55
+ "scripts": {
56
+ "build": "tsup"
57
+ }
6
58
  }