@hanzogui/use-direction 2.0.0-rc.41-hanzoai.5

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) 2020 Nate Wienert
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.
@@ -0,0 +1,20 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
+ get: () => from[key],
9
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
+ });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
+ value: true
17
+ }), mod);
18
+ var index_exports = {};
19
+ module.exports = __toCommonJS(index_exports);
20
+ __reExport(index_exports, require("./useDirection.cjs"), module.exports);
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __copyProps = (to, from, except, desc) => {
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
14
+ return to;
15
+ };
16
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
18
+ value: true
19
+ }), mod);
20
+ var index_exports = {};
21
+ module.exports = __toCommonJS(index_exports);
22
+ __reExport(index_exports, require("./useDirection.native.js"), module.exports);
23
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA","ignoreList":[]}
@@ -0,0 +1,58 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
34
+ var useDirection_exports = {};
35
+ __export(useDirection_exports, {
36
+ DirectionProvider: () => DirectionProvider,
37
+ Provider: () => Provider,
38
+ useDirection: () => useDirection
39
+ });
40
+ module.exports = __toCommonJS(useDirection_exports);
41
+ var React = __toESM(require("react"), 1);
42
+ var import_jsx_runtime = require("react/jsx-runtime");
43
+ const DirectionContext = React.createContext(void 0);
44
+ const DirectionProvider = props => {
45
+ const {
46
+ dir,
47
+ children
48
+ } = props;
49
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(DirectionContext.Provider, {
50
+ value: dir,
51
+ children
52
+ });
53
+ };
54
+ function useDirection(localDir) {
55
+ const globalDir = React.useContext(DirectionContext);
56
+ return localDir || globalDir || "ltr";
57
+ }
58
+ const Provider = DirectionProvider;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
+ get: () => from[key],
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
+ value: true
35
+ }), mod);
36
+ var useDirection_exports = {};
37
+ __export(useDirection_exports, {
38
+ DirectionProvider: () => DirectionProvider,
39
+ Provider: () => Provider,
40
+ useDirection: () => useDirection
41
+ });
42
+ module.exports = __toCommonJS(useDirection_exports);
43
+ var import_jsx_runtime = require("react/jsx-runtime");
44
+ var React = __toESM(require("react"), 1);
45
+ var DirectionContext = /* @__PURE__ */React.createContext(void 0);
46
+ var DirectionProvider = function (props) {
47
+ var {
48
+ dir,
49
+ children
50
+ } = props;
51
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(DirectionContext.Provider, {
52
+ value: dir,
53
+ children
54
+ });
55
+ };
56
+ function useDirection(localDir) {
57
+ var globalDir = React.useContext(DirectionContext);
58
+ return localDir || globalDir || "ltr";
59
+ }
60
+ var Provider = DirectionProvider;
61
+ //# sourceMappingURL=useDirection.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useDirection_exports","__export","DirectionProvider","Provider","useDirection","module","exports","import_jsx_runtime","require","React","__toESM","DirectionContext","createContext","props","dir","children","jsx","localDir"],"sources":["../../src/useDirection.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,oBAAA;AAAAC,QAAA,CAAAD,oBAAA;EAAAE,iBAAA,EAAAA,CAAA,KAAAA,iBAAA;EAAAC,QAAA,EAAAA,CAAA,KAAAA,QAAA;EAAAC,YAAA,EAAAA,CAAA,KAAAA;AAAA;AAEAC,MAAA,CAAAC,OAAuB,GAAAX,YAAA,CAAAK,oBAAA;AAYd,IAAAO,kBAAA,GAAAC,OAAA;AATT,IAAAC,KAAM,GAAAC,OAAA,CAAAF,OAAmB,QAAM;AAOxB,IAAAG,gBAAM,kBAAiEF,KAAA,CAAAG,aAAA;AAC5E,IAAAV,iBAAa,GAAS,SAAAA,CAAIW,KAAA;EAC1B;IAAAC,GAAO;IAAAC;EAAA,IAAAF,KAAA;EACT,0BAAAN,kBAAA,CAAAS,GAAA,EAAAL,gBAAA,CAAAR,QAAA;IAEOJ,KAAS,EAAAe,GAAA;IACdC;EACA;AACF;AAEO,SAAMX,YAA6CA,CAAAa,QAAA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./useDirection.mjs";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./useDirection.mjs";
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export * from "./useDirection.native.js";
2
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ import * as React from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ const DirectionContext = React.createContext(void 0);
4
+ const DirectionProvider = props => {
5
+ const {
6
+ dir,
7
+ children
8
+ } = props;
9
+ return /* @__PURE__ */jsx(DirectionContext.Provider, {
10
+ value: dir,
11
+ children
12
+ });
13
+ };
14
+ function useDirection(localDir) {
15
+ const globalDir = React.useContext(DirectionContext);
16
+ return localDir || globalDir || "ltr";
17
+ }
18
+ const Provider = DirectionProvider;
19
+ export { DirectionProvider, Provider, useDirection };
20
+ //# sourceMappingURL=useDirection.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","jsx","DirectionContext","createContext","DirectionProvider","props","dir","children","Provider","value","useDirection","localDir","globalDir","useContext"],"sources":["../../src/useDirection.tsx"],"sourcesContent":[null],"mappings":"AAEA,YAAYA,KAAA,MAAW;AAYd,SAAAC,GAAA;AATT,MAAMC,gBAAA,GAAmBF,KAAA,CAAMG,aAAA,CAAqC,MAAS;AAOtE,MAAMC,iBAAA,GAAuDC,KAAA,IAAU;EAC5E,MAAM;IAAEC,GAAA;IAAKC;EAAS,IAAIF,KAAA;EAC1B,OAAO,eAAAJ,GAAA,CAACC,gBAAA,CAAiBM,QAAA,EAAjB;IAA0BC,KAAA,EAAOH,GAAA;IAAMC;EAAA,CAAS;AAC1D;AAEO,SAASG,aAAaC,QAAA,EAAiC;EAC5D,MAAMC,SAAA,GAAYZ,KAAA,CAAMa,UAAA,CAAWX,gBAAgB;EACnD,OAAOS,QAAA,IAAYC,SAAA,IAAa;AAClC;AAEO,MAAMJ,QAAA,GAA6CJ,iBAAA","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ var DirectionContext = /* @__PURE__ */React.createContext(void 0);
4
+ var DirectionProvider = function (props) {
5
+ var {
6
+ dir,
7
+ children
8
+ } = props;
9
+ return /* @__PURE__ */_jsx(DirectionContext.Provider, {
10
+ value: dir,
11
+ children
12
+ });
13
+ };
14
+ function useDirection(localDir) {
15
+ var globalDir = React.useContext(DirectionContext);
16
+ return localDir || globalDir || "ltr";
17
+ }
18
+ var Provider = DirectionProvider;
19
+ export { DirectionProvider, Provider, useDirection };
20
+ //# sourceMappingURL=useDirection.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["jsx","_jsx","React","DirectionContext","createContext","DirectionProvider","props","dir","children","Provider","value","useDirection","localDir","globalDir","useContext"],"sources":["../../src/useDirection.tsx"],"sourcesContent":[null],"mappings":"AAEA,SAAAA,GAAY,IAAAC,IAAA,QAAW;AAYd,YAAAC,KAAA;AATT,IAAAC,gBAAM,kBAAyBD,KAAA,CAAqCE,aAAS;AAOtE,IAAAC,iBAAM,YAAAA,CAAuDC,KAAU;EAC5E;IAAMC,GAAE;IAAAC;EAAK,IAASF,KAAI;EAC1B,OAAO,eAAAL,IAAC,CAAAE,gBAAiB,CAAAM,QAAA,EAAjB;IACVC,KAAA,EAAAH,GAAA;IAEOC;EACL;AACA;AACF,SAAAG,aAAAC,QAAA;EAEO,IAAMC,SAAA,GAA6CX,KAAA,CAAAY,UAAA,CAAAX,gBAAA","ignoreList":[]}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@hanzogui/use-direction",
3
+ "version": "2.0.0-rc.41-hanzoai.5",
4
+ "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
+ "files": [
6
+ "src",
7
+ "types",
8
+ "dist"
9
+ ],
10
+ "type": "module",
11
+ "sideEffects": false,
12
+ "main": "dist/cjs",
13
+ "module": "dist/esm",
14
+ "types": "./types/index.d.ts",
15
+ "exports": {
16
+ "./package.json": "./package.json",
17
+ ".": {
18
+ "types": "./types/index.d.ts",
19
+ "react-native": "./dist/esm/index.native.js",
20
+ "browser": "./dist/esm/index.mjs",
21
+ "module": "./dist/esm/index.mjs",
22
+ "import": "./dist/esm/index.mjs",
23
+ "require": "./dist/cjs/index.cjs",
24
+ "default": "./dist/esm/index.mjs"
25
+ }
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "build": "hanzogui-build",
32
+ "watch": "hanzogui-build --watch",
33
+ "clean": "hanzogui-build clean",
34
+ "clean:build": "hanzogui-build clean:build"
35
+ },
36
+ "devDependencies": {
37
+ "@hanzogui/build": "2.0.0-rc.41-hanzoai.5",
38
+ "react": ">=19"
39
+ },
40
+ "peerDependencies": {
41
+ "react": ">=19"
42
+ }
43
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './useDirection'
@@ -0,0 +1,23 @@
1
+ // forked from https://github.com/radix-ui/primitives/blob/main/packages/react/direction/src/Direction.tsx
2
+
3
+ import * as React from 'react'
4
+
5
+ type Direction = 'ltr' | 'rtl'
6
+ const DirectionContext = React.createContext<Direction | undefined>(undefined)
7
+
8
+ interface DirectionProviderProps {
9
+ children?: React.ReactNode
10
+ dir: Direction
11
+ }
12
+
13
+ export const DirectionProvider: React.FC<DirectionProviderProps> = (props) => {
14
+ const { dir, children } = props
15
+ return <DirectionContext.Provider value={dir}>{children}</DirectionContext.Provider>
16
+ }
17
+
18
+ export function useDirection(localDir?: Direction): Direction {
19
+ const globalDir = React.useContext(DirectionContext)
20
+ return localDir || globalDir || 'ltr'
21
+ }
22
+
23
+ export const Provider: React.FC<DirectionProviderProps> = DirectionProvider
@@ -0,0 +1,3 @@
1
+ export * from "./useDirection";
2
+
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,11 @@
1
+ {
2
+ "mappings": "AAAA,cAAc",
3
+ "names": [],
4
+ "sources": [
5
+ "src/index.ts"
6
+ ],
7
+ "version": 3,
8
+ "sourcesContent": [
9
+ "export * from './useDirection'\n"
10
+ ]
11
+ }
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ type Direction = "ltr" | "rtl";
3
+ interface DirectionProviderProps {
4
+ children?: React.ReactNode;
5
+ dir: Direction;
6
+ }
7
+ export declare const DirectionProvider: React.FC<DirectionProviderProps>;
8
+ export declare function useDirection(localDir?: Direction): Direction;
9
+ export declare const Provider: React.FC<DirectionProviderProps>;
10
+ export {};
11
+
12
+ //# sourceMappingURL=useDirection.d.ts.map
@@ -0,0 +1,11 @@
1
+ {
2
+ "mappings": "AAEA,YAAY,WAAW;KAElB,YAAY,QAAQ;UAGf,uBAAuB;CAC/B,WAAW,MAAM;CACjB,KAAK;;AAGP,OAAO,cAAM,mBAAmB,MAAM,GAAG;AAKzC,OAAO,iBAAS,aAAa,WAAW,YAAY;AAKpD,OAAO,cAAM,UAAU,MAAM,GAAG",
3
+ "names": [],
4
+ "sources": [
5
+ "src/useDirection.tsx"
6
+ ],
7
+ "version": 3,
8
+ "sourcesContent": [
9
+ "// forked from https://github.com/radix-ui/primitives/blob/main/packages/react/direction/src/Direction.tsx\n\nimport * as React from 'react'\n\ntype Direction = 'ltr' | 'rtl'\nconst DirectionContext = React.createContext<Direction | undefined>(undefined)\n\ninterface DirectionProviderProps {\n children?: React.ReactNode\n dir: Direction\n}\n\nexport const DirectionProvider: React.FC<DirectionProviderProps> = (props) => {\n const { dir, children } = props\n return <DirectionContext.Provider value={dir}>{children}</DirectionContext.Provider>\n}\n\nexport function useDirection(localDir?: Direction): Direction {\n const globalDir = React.useContext(DirectionContext)\n return localDir || globalDir || 'ltr'\n}\n\nexport const Provider: React.FC<DirectionProviderProps> = DirectionProvider\n"
10
+ ]
11
+ }