@rnzeus/atlas 0.1.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/dist/README.md +21 -0
- package/dist/config/internal.d.ts +1 -0
- package/dist/config/internal.js +1 -0
- package/dist/config/navigation/index.d.ts +1 -0
- package/dist/config/navigation/index.js +1 -0
- package/dist/config/navigation/types.d.ts +55 -0
- package/dist/config/navigation/types.js +1 -0
- package/dist/config/navigation.types.d.ts +25 -0
- package/dist/config/navigation.types.js +1 -0
- package/dist/hooks/README.md +11 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/internal.d.ts +1 -0
- package/dist/hooks/internal.js +1 -0
- package/dist/hooks/use-path-navigation/README.md +66 -0
- package/dist/hooks/use-path-navigation/hook.d.ts +119 -0
- package/dist/hooks/use-path-navigation/hook.js +52 -0
- package/dist/hooks/use-path-navigation/index.d.ts +1 -0
- package/dist/hooks/use-path-navigation/index.js +1 -0
- package/dist/services/README.md +17 -0
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.js +3 -0
- package/dist/services/internal.d.ts +1 -0
- package/dist/services/internal.js +1 -0
- package/dist/services/navigation/README.md +131 -0
- package/dist/services/navigation/api.d.ts +5 -0
- package/dist/services/navigation/api.js +11 -0
- package/dist/services/navigation/chain-builder.d.ts +16 -0
- package/dist/services/navigation/chain-builder.js +31 -0
- package/dist/services/navigation/index.d.ts +3 -0
- package/dist/services/navigation/index.js +3 -0
- package/dist/services/navigation/service.d.ts +55 -0
- package/dist/services/navigation/service.js +536 -0
- package/dist/services/navigation/types.d.ts +13 -0
- package/dist/services/navigation/types.js +1 -0
- package/dist/services/navigation/zod-adapter.d.ts +22 -0
- package/dist/services/navigation/zod-adapter.js +36 -0
- package/dist/services/transport/README.md +79 -0
- package/dist/services/transport/build-query.d.ts +2 -0
- package/dist/services/transport/build-query.js +3 -0
- package/dist/services/transport/create-transport-methods.d.ts +8 -0
- package/dist/services/transport/create-transport-methods.js +34 -0
- package/dist/services/transport/error-exception.d.ts +8 -0
- package/dist/services/transport/error-exception.js +16 -0
- package/dist/services/transport/index.d.ts +3 -0
- package/dist/services/transport/index.js +2 -0
- package/dist/services/transport/read-response-body.d.ts +3 -0
- package/dist/services/transport/read-response-body.js +27 -0
- package/dist/services/transport/service.d.ts +22 -0
- package/dist/services/transport/service.js +102 -0
- package/dist/services/transport/types.d.ts +4 -0
- package/dist/services/transport/types.js +1 -0
- package/dist/ui/README.md +17 -0
- package/dist/ui/debug-dock/README.md +58 -0
- package/dist/ui/debug-dock/debug-dock.d.ts +13 -0
- package/dist/ui/debug-dock/debug-dock.js +20 -0
- package/dist/ui/debug-dock/index.d.ts +2 -0
- package/dist/ui/debug-dock/index.js +1 -0
- package/dist/ui/debug-dock/styles.d.ts +8 -0
- package/dist/ui/debug-dock/styles.js +25 -0
- package/dist/ui/debug-dock/use-debug-dock.d.ts +20 -0
- package/dist/ui/debug-dock/use-debug-dock.js +71 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +2 -0
- package/dist/ui/toast/README.md +62 -0
- package/dist/ui/toast/context.d.ts +7 -0
- package/dist/ui/toast/context.js +6 -0
- package/dist/ui/toast/index.d.ts +5 -0
- package/dist/ui/toast/index.js +2 -0
- package/dist/ui/toast/toast-plate/README.md +38 -0
- package/dist/ui/toast/toast-plate/index.d.ts +2 -0
- package/dist/ui/toast/toast-plate/index.js +1 -0
- package/dist/ui/toast/toast-plate/toast-plate.d.ts +9 -0
- package/dist/ui/toast/toast-plate/toast-plate.js +11 -0
- package/dist/ui/toast/toast-plate/use-toast-plate.d.ts +4 -0
- package/dist/ui/toast/toast-plate/use-toast-plate.js +33 -0
- package/dist/ui/toast/toast-provider.d.ts +10 -0
- package/dist/ui/toast/toast-provider.js +53 -0
- package/dist/ui/toast/toast-viewport/README.md +38 -0
- package/dist/ui/toast/toast-viewport/index.d.ts +2 -0
- package/dist/ui/toast/toast-viewport/index.js +1 -0
- package/dist/ui/toast/toast-viewport/styles.d.ts +5 -0
- package/dist/ui/toast/toast-viewport/styles.js +10 -0
- package/dist/ui/toast/toast-viewport/toast-viewport.d.ts +10 -0
- package/dist/ui/toast/toast-viewport/toast-viewport.js +13 -0
- package/dist/ui/toast/types.d.ts +25 -0
- package/dist/ui/toast/types.js +1 -0
- package/dist/ui/toast/use-toast.d.ts +1 -0
- package/dist/ui/toast/use-toast.js +5 -0
- package/dist/utils/README.md +23 -0
- package/dist/utils/create-typography/README.md +71 -0
- package/dist/utils/create-typography/helper.d.ts +23 -0
- package/dist/utils/create-typography/helper.js +72 -0
- package/dist/utils/create-typography/index.d.ts +1 -0
- package/dist/utils/create-typography/index.js +1 -0
- package/dist/utils/define-route/README.md +50 -0
- package/dist/utils/define-route/helper.d.ts +2 -0
- package/dist/utils/define-route/helper.js +1 -0
- package/dist/utils/define-route/index.d.ts +1 -0
- package/dist/utils/define-route/index.js +1 -0
- package/dist/utils/display-name/README.md +46 -0
- package/dist/utils/display-name/helper.d.ts +2 -0
- package/dist/utils/display-name/helper.js +91 -0
- package/dist/utils/display-name/index.d.ts +1 -0
- package/dist/utils/display-name/index.js +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/internal.d.ts +3 -0
- package/dist/utils/internal.js +3 -0
- package/package.json +74 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const LAYER_TO_PREFIX = {
|
|
2
|
+
app: 'A',
|
|
3
|
+
pages: 'P',
|
|
4
|
+
widgets: 'W',
|
|
5
|
+
features: 'F',
|
|
6
|
+
entities: 'E',
|
|
7
|
+
shared: 'S',
|
|
8
|
+
};
|
|
9
|
+
function extractLayerFromComponentPath(componentSource) {
|
|
10
|
+
const normalized = componentSource
|
|
11
|
+
.replace(/^@/, '')
|
|
12
|
+
.replace(/^\.?\/?/, '')
|
|
13
|
+
.replace(/\\/g, '/')
|
|
14
|
+
.toLowerCase();
|
|
15
|
+
if (/(^|\/)app(\/|$)/.test(normalized))
|
|
16
|
+
return 'app';
|
|
17
|
+
if (/(^|\/)pages(\/|$)/.test(normalized))
|
|
18
|
+
return 'pages';
|
|
19
|
+
if (/(^|\/)widgets(\/|$)/.test(normalized))
|
|
20
|
+
return 'widgets';
|
|
21
|
+
if (/\bfeatures(\/|$)/.test(normalized))
|
|
22
|
+
return 'features';
|
|
23
|
+
if (/\bentities(\/|$)/.test(normalized))
|
|
24
|
+
return 'entities';
|
|
25
|
+
if (/\bshared(\/|$)/.test(normalized))
|
|
26
|
+
return 'shared';
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
function normalizeLayer(input) {
|
|
30
|
+
const value = input.trim().toLowerCase();
|
|
31
|
+
const map = {
|
|
32
|
+
a: 'app',
|
|
33
|
+
app: 'app',
|
|
34
|
+
p: 'pages',
|
|
35
|
+
page: 'pages',
|
|
36
|
+
pages: 'pages',
|
|
37
|
+
w: 'widgets',
|
|
38
|
+
widget: 'widgets',
|
|
39
|
+
widgets: 'widgets',
|
|
40
|
+
f: 'features',
|
|
41
|
+
feature: 'features',
|
|
42
|
+
features: 'features',
|
|
43
|
+
e: 'entities',
|
|
44
|
+
entity: 'entities',
|
|
45
|
+
entities: 'entities',
|
|
46
|
+
s: 'shared',
|
|
47
|
+
shared: 'shared',
|
|
48
|
+
};
|
|
49
|
+
return map[value] ?? null;
|
|
50
|
+
}
|
|
51
|
+
function getFileBaseName(input) {
|
|
52
|
+
const normalized = input.replace(/\\/g, '/');
|
|
53
|
+
const lastSlashIndex = normalized.lastIndexOf('/');
|
|
54
|
+
const fileName = lastSlashIndex >= 0 ? normalized.slice(lastSlashIndex + 1) : normalized;
|
|
55
|
+
const lastDotIndex = fileName.lastIndexOf('.');
|
|
56
|
+
return lastDotIndex > 0 ? fileName.slice(0, lastDotIndex) : fileName;
|
|
57
|
+
}
|
|
58
|
+
function toPascalCase(input) {
|
|
59
|
+
const withoutDelimiters = input
|
|
60
|
+
// insert a space before capitals in camelCase/PascalCase words
|
|
61
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
62
|
+
// split on non-alphanumeric delimiters
|
|
63
|
+
.split(/[^a-zA-Z0-9]+/)
|
|
64
|
+
.filter(Boolean);
|
|
65
|
+
return withoutDelimiters.map(segment => segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()).join('');
|
|
66
|
+
}
|
|
67
|
+
function sanitizeGenericNames(componentName) {
|
|
68
|
+
// Avoid overly generic names like "index" by falling back to parent folder if available
|
|
69
|
+
if (componentName.toLowerCase() !== 'index')
|
|
70
|
+
return componentName;
|
|
71
|
+
return componentName; // keep as-is if we only received a bare name
|
|
72
|
+
}
|
|
73
|
+
function displayNameFromPath(componentPath) {
|
|
74
|
+
const layer = extractLayerFromComponentPath(componentPath);
|
|
75
|
+
const prefix = layer ? LAYER_TO_PREFIX[layer] : LAYER_TO_PREFIX.shared;
|
|
76
|
+
const baseName = sanitizeGenericNames(getFileBaseName(componentPath));
|
|
77
|
+
const pascalName = toPascalCase(baseName);
|
|
78
|
+
return `${prefix}${pascalName}`;
|
|
79
|
+
}
|
|
80
|
+
const displayName = (layerOrPath, nameMaybe) => {
|
|
81
|
+
// Overload 1: displayName('features', 'logger-button')
|
|
82
|
+
// Overload 2: displayName('src/features/logger/ui/logger-button/button.tsx')
|
|
83
|
+
if (nameMaybe === undefined) {
|
|
84
|
+
return displayNameFromPath(layerOrPath);
|
|
85
|
+
}
|
|
86
|
+
const layerNormalized = normalizeLayer(layerOrPath) ?? 'shared';
|
|
87
|
+
const prefix = LAYER_TO_PREFIX[layerNormalized];
|
|
88
|
+
const pascalName = toPascalCase(nameMaybe);
|
|
89
|
+
return `${prefix}${pascalName}`;
|
|
90
|
+
};
|
|
91
|
+
export default displayName;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as displayName } from './helper';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as displayName } from './helper';
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rnzeus/atlas",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Services, hooks and helpers for RN apps",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
"./services": {
|
|
8
|
+
"types": "./dist/services/index.d.ts",
|
|
9
|
+
"import": "./dist/services/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./hooks": {
|
|
12
|
+
"types": "./dist/hooks/index.d.ts",
|
|
13
|
+
"import": "./dist/hooks/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./utils": {
|
|
16
|
+
"types": "./dist/utils/index.d.ts",
|
|
17
|
+
"import": "./dist/utils/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./ui": {
|
|
20
|
+
"types": "./dist/ui/index.d.ts",
|
|
21
|
+
"import": "./dist/ui/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"scripts": {
|
|
29
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
30
|
+
"build": "tsc -p tsconfig.build.json",
|
|
31
|
+
"docs:mirror": "node scripts/mirror-docs-to-dist.mjs",
|
|
32
|
+
"prepublishOnly": "npm run build && npm run docs:mirror"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@react-navigation/native": ">=7",
|
|
36
|
+
"qs": "^6",
|
|
37
|
+
"react": ">=18",
|
|
38
|
+
"react-native": ">=0.81",
|
|
39
|
+
"react-native-gesture-handler": ">=2",
|
|
40
|
+
"react-native-reanimated": ">=3",
|
|
41
|
+
"react-native-safe-area-context": ">=4",
|
|
42
|
+
"react-native-worklets": ">=0.3"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@react-native/typescript-config": "^0.83.1",
|
|
46
|
+
"@react-navigation/native": ">=7",
|
|
47
|
+
"@rnzeus/themis": "^0.1.2",
|
|
48
|
+
"@types/qs": "^6",
|
|
49
|
+
"@types/react": "^19.2.8",
|
|
50
|
+
"@vitest/coverage-v8": "^3",
|
|
51
|
+
"@vitest/ui": "^3",
|
|
52
|
+
"eslint": "^9.39.2",
|
|
53
|
+
"eslint-plugin-react": "^7.37.5",
|
|
54
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
55
|
+
"eslint-plugin-react-native": "^5.0.0",
|
|
56
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
57
|
+
"eslint-plugin-unused-imports": "^4.3.0",
|
|
58
|
+
"prettier": "^3.8.0",
|
|
59
|
+
"qs": "^6",
|
|
60
|
+
"react": ">=18",
|
|
61
|
+
"react-native": ">=0.81",
|
|
62
|
+
"react-native-gesture-handler": "^2.30.1",
|
|
63
|
+
"react-native-reanimated": "^3",
|
|
64
|
+
"react-native-safe-area-context": "^5.7.0",
|
|
65
|
+
"react-native-worklets": "^0.5.1",
|
|
66
|
+
"typescript": "^5",
|
|
67
|
+
"typescript-eslint": "^8.53.0",
|
|
68
|
+
"vitest": "^3"
|
|
69
|
+
},
|
|
70
|
+
"volta": {
|
|
71
|
+
"node": "22.14.0",
|
|
72
|
+
"yarn": "4.6.0"
|
|
73
|
+
}
|
|
74
|
+
}
|