aport-tools 1.0.11 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.babelrc +7 -0
- package/.expo/README.md +15 -0
- package/.expo/devices.json +3 -0
- package/.expo/settings.json +8 -0
- package/App.tsx +41 -0
- package/dist/Button.d.ts +12 -0
- package/dist/Theme/ThemeContext.d.ts +13 -0
- package/dist/Theme/ThemeToggle.d.ts +3 -0
- package/dist/Theme/index.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +258 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +262 -0
- package/dist/index.js.map +1 -0
- package/dist/styles/colors.d.ts +17 -0
- package/dist/styles/theme.d.ts +4 -0
- package/package.json +33 -8
- package/rollup.config.mjs +54 -0
- package/rollup.config.js +0 -31
- package/src/Button.tsx +0 -104
- package/src/components/ThemeToggle.tsx +0 -39
- package/src/context/ThemeContext.tsx +0 -70
- package/src/styles/colors.ts +0 -60
- package/src/styles/theme.ts +0 -50
- package/tsconfig.json +0 -30
package/dist/index.js
ADDED
@@ -0,0 +1,262 @@
|
|
1
|
+
/*! aport-tools v2.0.1 | ISC */
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
var React = require('react');
|
5
|
+
var reactNative = require('react-native');
|
6
|
+
var AsyncStorage = require('@react-native-async-storage/async-storage');
|
7
|
+
|
8
|
+
/******************************************************************************
|
9
|
+
Copyright (c) Microsoft Corporation.
|
10
|
+
|
11
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
12
|
+
purpose with or without fee is hereby granted.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
15
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
16
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
17
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
18
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
19
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
20
|
+
PERFORMANCE OF THIS SOFTWARE.
|
21
|
+
***************************************************************************** */
|
22
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
23
|
+
|
24
|
+
|
25
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
32
|
+
});
|
33
|
+
}
|
34
|
+
|
35
|
+
function __generator(thisArg, body) {
|
36
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
37
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
38
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
39
|
+
function step(op) {
|
40
|
+
if (f) throw new TypeError("Generator is already executing.");
|
41
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
42
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
43
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
44
|
+
switch (op[0]) {
|
45
|
+
case 0: case 1: t = op; break;
|
46
|
+
case 4: _.label++; return { value: op[1], done: false };
|
47
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
48
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
49
|
+
default:
|
50
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
51
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
52
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
53
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
54
|
+
if (t[2]) _.ops.pop();
|
55
|
+
_.trys.pop(); continue;
|
56
|
+
}
|
57
|
+
op = body.call(thisArg, _);
|
58
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
59
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
64
|
+
var e = new Error(message);
|
65
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
66
|
+
};
|
67
|
+
|
68
|
+
// src/styles/colors.ts
|
69
|
+
var lightTheme = {
|
70
|
+
primary: {
|
71
|
+
hex: '#1A73E8',
|
72
|
+
rgb: {
|
73
|
+
r: 26,
|
74
|
+
g: 115,
|
75
|
+
b: 232
|
76
|
+
}
|
77
|
+
},
|
78
|
+
secondary: {
|
79
|
+
hex: '#F0F6FF',
|
80
|
+
rgb: {
|
81
|
+
r: 240,
|
82
|
+
g: 246,
|
83
|
+
b: 255
|
84
|
+
}
|
85
|
+
},
|
86
|
+
background: {
|
87
|
+
hex: '#FFFFFF',
|
88
|
+
rgb: {
|
89
|
+
r: 255,
|
90
|
+
g: 255,
|
91
|
+
b: 255
|
92
|
+
}
|
93
|
+
},
|
94
|
+
text: {
|
95
|
+
hex: '#000000',
|
96
|
+
rgb: {
|
97
|
+
r: 0,
|
98
|
+
g: 0,
|
99
|
+
b: 0
|
100
|
+
}
|
101
|
+
}
|
102
|
+
// Add more categories as needed
|
103
|
+
};
|
104
|
+
var darkTheme = {
|
105
|
+
primary: {
|
106
|
+
hex: '#BB86FC',
|
107
|
+
rgb: {
|
108
|
+
r: 187,
|
109
|
+
g: 134,
|
110
|
+
b: 252
|
111
|
+
}
|
112
|
+
},
|
113
|
+
secondary: {
|
114
|
+
hex: '#03DAC6',
|
115
|
+
rgb: {
|
116
|
+
r: 3,
|
117
|
+
g: 218,
|
118
|
+
b: 198
|
119
|
+
}
|
120
|
+
},
|
121
|
+
background: {
|
122
|
+
hex: '#121212',
|
123
|
+
rgb: {
|
124
|
+
r: 18,
|
125
|
+
g: 18,
|
126
|
+
b: 18
|
127
|
+
}
|
128
|
+
},
|
129
|
+
text: {
|
130
|
+
hex: '#FFFFFF',
|
131
|
+
rgb: {
|
132
|
+
r: 255,
|
133
|
+
g: 255,
|
134
|
+
b: 255
|
135
|
+
}
|
136
|
+
}
|
137
|
+
// Add more categories as needed
|
138
|
+
};
|
139
|
+
|
140
|
+
var ThemeContext = /*#__PURE__*/React.createContext({
|
141
|
+
theme: {
|
142
|
+
colors: lightTheme
|
143
|
+
},
|
144
|
+
toggleTheme: function toggleTheme() {}
|
145
|
+
});
|
146
|
+
var ThemeProvider = function ThemeProvider(_a) {
|
147
|
+
var children = _a.children,
|
148
|
+
initialTheme = _a.initialTheme;
|
149
|
+
var _b = React.useState(null),
|
150
|
+
colorScheme = _b[0],
|
151
|
+
setColorScheme = _b[1];
|
152
|
+
React.useEffect(function () {
|
153
|
+
var loadTheme = function loadTheme() {
|
154
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
155
|
+
var storedTheme, systemTheme, error_1;
|
156
|
+
return __generator(this, function (_a) {
|
157
|
+
switch (_a.label) {
|
158
|
+
case 0:
|
159
|
+
_a.trys.push([0, 2,, 3]);
|
160
|
+
return [4 /*yield*/, AsyncStorage.getItem('theme')];
|
161
|
+
case 1:
|
162
|
+
storedTheme = _a.sent();
|
163
|
+
if (storedTheme === 'dark' || storedTheme === 'light') {
|
164
|
+
setColorScheme(storedTheme);
|
165
|
+
} else if (initialTheme) {
|
166
|
+
setColorScheme(initialTheme); // Use initialTheme if provided
|
167
|
+
} else {
|
168
|
+
systemTheme = reactNative.Appearance.getColorScheme();
|
169
|
+
setColorScheme(systemTheme);
|
170
|
+
}
|
171
|
+
return [3 /*break*/, 3];
|
172
|
+
case 2:
|
173
|
+
error_1 = _a.sent();
|
174
|
+
console.error('Failed to load theme.', error_1);
|
175
|
+
setColorScheme(reactNative.Appearance.getColorScheme());
|
176
|
+
return [3 /*break*/, 3];
|
177
|
+
case 3:
|
178
|
+
return [2 /*return*/];
|
179
|
+
}
|
180
|
+
});
|
181
|
+
});
|
182
|
+
};
|
183
|
+
loadTheme();
|
184
|
+
var subscription = reactNative.Appearance.addChangeListener(function (_a) {
|
185
|
+
var colorScheme = _a.colorScheme;
|
186
|
+
setColorScheme(colorScheme);
|
187
|
+
});
|
188
|
+
return function () {
|
189
|
+
return subscription.remove();
|
190
|
+
};
|
191
|
+
}, [initialTheme]);
|
192
|
+
var toggleTheme = function toggleTheme() {
|
193
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
194
|
+
var newTheme, error_2;
|
195
|
+
return __generator(this, function (_a) {
|
196
|
+
switch (_a.label) {
|
197
|
+
case 0:
|
198
|
+
_a.trys.push([0, 2,, 3]);
|
199
|
+
newTheme = colorScheme === 'dark' ? 'light' : 'dark';
|
200
|
+
setColorScheme(newTheme);
|
201
|
+
return [4 /*yield*/, AsyncStorage.setItem('theme', newTheme)];
|
202
|
+
case 1:
|
203
|
+
_a.sent();
|
204
|
+
return [3 /*break*/, 3];
|
205
|
+
case 2:
|
206
|
+
error_2 = _a.sent();
|
207
|
+
console.error('Failed to toggle theme.', error_2);
|
208
|
+
return [3 /*break*/, 3];
|
209
|
+
case 3:
|
210
|
+
return [2 /*return*/];
|
211
|
+
}
|
212
|
+
});
|
213
|
+
});
|
214
|
+
};
|
215
|
+
var theme = {
|
216
|
+
colors: colorScheme === 'dark' ? darkTheme : lightTheme
|
217
|
+
};
|
218
|
+
return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
|
219
|
+
value: {
|
220
|
+
theme: theme,
|
221
|
+
toggleTheme: toggleTheme
|
222
|
+
}
|
223
|
+
}, children);
|
224
|
+
};
|
225
|
+
|
226
|
+
var ThemeToggle = function ThemeToggle() {
|
227
|
+
var _a = React.useContext(ThemeContext),
|
228
|
+
theme = _a.theme,
|
229
|
+
toggleTheme = _a.toggleTheme;
|
230
|
+
var isDarkMode = theme.colors === darkTheme;
|
231
|
+
return /*#__PURE__*/React.createElement(reactNative.View, {
|
232
|
+
style: styles.container
|
233
|
+
}, /*#__PURE__*/React.createElement(reactNative.Text, {
|
234
|
+
style: [styles.text, {
|
235
|
+
color: theme.colors.text.hex
|
236
|
+
}]
|
237
|
+
}, "Dark Mode"), /*#__PURE__*/React.createElement(reactNative.Switch, {
|
238
|
+
value: isDarkMode,
|
239
|
+
onValueChange: toggleTheme,
|
240
|
+
trackColor: {
|
241
|
+
"false": lightTheme.secondary.hex,
|
242
|
+
"true": darkTheme.primary.hex
|
243
|
+
},
|
244
|
+
thumbColor: isDarkMode ? darkTheme.secondary.hex : lightTheme.primary.hex
|
245
|
+
}));
|
246
|
+
};
|
247
|
+
var styles = reactNative.StyleSheet.create({
|
248
|
+
container: {
|
249
|
+
marginTop: 20,
|
250
|
+
flexDirection: 'row',
|
251
|
+
alignItems: 'center'
|
252
|
+
},
|
253
|
+
text: {
|
254
|
+
marginRight: 10,
|
255
|
+
fontSize: 16
|
256
|
+
}
|
257
|
+
});
|
258
|
+
|
259
|
+
exports.ThemeContext = ThemeContext;
|
260
|
+
exports.ThemeProvider = ThemeProvider;
|
261
|
+
exports.ThemeToggle = ThemeToggle;
|
262
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../node_modules/tslib/tslib.es6.js","../src/styles/colors.ts","../src/Theme/ThemeContext.tsx","../src/Theme/ThemeToggle.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n","// src/styles/colors.ts\n\nexport interface RGB {\n r: number;\n g: number;\n b: number;\n}\n\nexport interface Color {\n hex: string;\n rgb: RGB;\n}\n\nexport interface ThemeColors {\n primary: Color;\n secondary: Color;\n background: Color;\n text: Color;\n // Add more categories as needed\n}\n\nexport const lightTheme: ThemeColors = {\n primary: {\n hex: '#1A73E8',\n rgb: { r: 26, g: 115, b: 232 },\n },\n secondary: {\n hex: '#F0F6FF',\n rgb: { r: 240, g: 246, b: 255 },\n },\n background: {\n hex: '#FFFFFF',\n rgb: { r: 255, g: 255, b: 255 },\n },\n text: {\n hex: '#000000',\n rgb: { r: 0, g: 0, b: 0 },\n },\n // Add more categories as needed\n};\n\nexport const darkTheme: ThemeColors = {\n primary: {\n hex: '#BB86FC',\n rgb: { r: 187, g: 134, b: 252 },\n },\n secondary: {\n hex: '#03DAC6',\n rgb: { r: 3, g: 218, b: 198 },\n },\n background: {\n hex: '#121212',\n rgb: { r: 18, g: 18, b: 18 },\n },\n text: {\n hex: '#FFFFFF',\n rgb: { r: 255, g: 255, b: 255 },\n },\n // Add more categories as needed\n};\n","import React, { createContext, useState, useEffect, ReactNode } from 'react';\nimport { Appearance, ColorSchemeName } from 'react-native';\nimport AsyncStorage from '@react-native-async-storage/async-storage';\nimport { lightTheme, darkTheme } from '../styles/colors';\nimport { Theme } from '../styles/theme';\n\ninterface ThemeContextProps {\n theme: Theme;\n toggleTheme: () => void;\n}\n\nexport const ThemeContext = createContext<ThemeContextProps>({\n theme: { colors: lightTheme },\n toggleTheme: () => {},\n});\n\ninterface ThemeProviderProps {\n children: ReactNode;\n initialTheme?: 'light' | 'dark'; // Added optional initial theme prop\n}\n\nexport const ThemeProvider: React.FC<ThemeProviderProps> = ({ children, initialTheme }) => {\n const [colorScheme, setColorScheme] = useState<ColorSchemeName | null>(null);\n\n useEffect(() => {\n const loadTheme = async () => {\n try {\n const storedTheme = await AsyncStorage.getItem('theme');\n if (storedTheme === 'dark' || storedTheme === 'light') {\n setColorScheme(storedTheme);\n } else if (initialTheme) {\n setColorScheme(initialTheme); // Use initialTheme if provided\n } else {\n const systemTheme = Appearance.getColorScheme();\n setColorScheme(systemTheme);\n }\n } catch (error) {\n console.error('Failed to load theme.', error);\n setColorScheme(Appearance.getColorScheme());\n }\n };\n\n loadTheme();\n\n const subscription = Appearance.addChangeListener(({ colorScheme }) => {\n setColorScheme(colorScheme);\n });\n\n return () => subscription.remove();\n }, [initialTheme]);\n\n const toggleTheme = async () => {\n try {\n const newTheme = colorScheme === 'dark' ? 'light' : 'dark';\n setColorScheme(newTheme);\n await AsyncStorage.setItem('theme', newTheme);\n } catch (error) {\n console.error('Failed to toggle theme.', error);\n }\n };\n\n const theme: Theme = {\n colors: colorScheme === 'dark' ? darkTheme : lightTheme,\n };\n\n return (\n <ThemeContext.Provider value={{ theme, toggleTheme }}>\n {children}\n </ThemeContext.Provider>\n );\n};\n","import React, { useContext } from 'react';\nimport { Switch, View, Text, StyleSheet } from 'react-native';\nimport { ThemeContext } from './ThemeContext';\nimport { darkTheme, lightTheme } from '../styles/colors';\n\nconst ThemeToggle: React.FC = () => {\n const { theme, toggleTheme } = useContext(ThemeContext);\n const isDarkMode = theme.colors === darkTheme;\n\n return (\n <View style={styles.container}>\n <Text style={[styles.text, { color: theme.colors.text.hex }]}>Dark Mode</Text>\n <Switch\n value={isDarkMode}\n onValueChange={toggleTheme}\n trackColor={{ false: lightTheme.secondary.hex, true: darkTheme.primary.hex }}\n thumbColor={isDarkMode ? darkTheme.secondary.hex : lightTheme.primary.hex}\n />\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n container: {\n marginTop: 20,\n flexDirection: 'row',\n alignItems: 'center',\n },\n text: {\n marginRight: 10,\n fontSize: 16,\n },\n});\n\nexport default ThemeToggle;\n"],"names":["lightTheme","primary","hex","rgb","r","g","b","secondary","background","text","darkTheme","ThemeContext","createContext","theme","colors","toggleTheme","ThemeProvider","_a","children","initialTheme","_b","useState","colorScheme","setColorScheme","useEffect","loadTheme","__awaiter","AsyncStorage","getItem","storedTheme","sent","systemTheme","Appearance","getColorScheme","console","error","error_1","subscription","addChangeListener","remove","newTheme","setItem","error_2","React","createElement","Provider","value","ThemeToggle","useContext","isDarkMode","View","style","styles","container","Text","color","Switch","onValueChange","trackColor","thumbColor","StyleSheet","create","marginTop","flexDirection","alignItems","marginRight","fontSize"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkGA;AACO,SAAS,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE;AAC7D,IAAI,SAAS,KAAK,CAAC,KAAK,EAAE,EAAE,OAAO,KAAK,YAAY,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,UAAU,OAAO,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;AAChH,IAAI,OAAO,K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AAA;IAACC,KAAK,EAAEC,MAAM,CAACC,SAAAA;AAAS,GAAA,eAC3BV,KAAC,CAAAC,aAAA,CAAAU,gBAAI;AAACH,IAAAA,KAAK,EAAE,CAACC,MAAM,CAAC3C,IAAI,EAAE;AAAE8C,MAAAA,KAAK,EAAE1C,KAAK,CAACC,MAAM,CAACL,IAAI,CAACP,GAAAA;KAAK,CAAA;GAAmB,EAAA,WAAA,CAAA,eAC9EyC,KAAC,CAAAC,aAAA,CAAAY,kBAAM,EACL;AAAAV,IAAAA,KAAK,EAAEG,UAAU;AACjBQ,IAAAA,aAAa,EAAE1C,WAAW;AAC1B2C,IAAAA,UAAU,EAAE;AAAE,MAAA,OAAA,EAAO1D,UAAU,CAACO,SAAS,CAACL,GAAG;MAAE,MAAMQ,EAAAA,SAAS,CAACT,OAAO,CAACC,GAAAA;KAAK;AAC5EyD,IAAAA,UAAU,EAAEV,UAAU,GAAGvC,SAAS,CAACH,SAAS,CAACL,GAAG,GAAGF,UAAU,CAACC,OAAO,CAACC,GAAAA;AAAG,GAAA,CACzE,CACG,CAAA;AAEX,EAAC;AAED,IAAMkD,MAAM,GAAGQ,sBAAU,CAACC,MAAM,CAAC;AAC/BR,EAAAA,SAAS,EAAE;AACTS,IAAAA,SAAS,EAAE,EAAE;AACbC,IAAAA,aAAa,EAAE,KAAK;AACpBC,IAAAA,UAAU,EAAE,QAAA;GACb;AACDvD,EAAAA,IAAI,EAAE;AACJwD,IAAAA,WAAW,EAAE,EAAE;AACfC,IAAAA,QAAQ,EAAE,EAAA;AACX,GAAA;AACF,CAAA,CAAC;;;;;;","x_google_ignoreList":[0]}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export interface RGB {
|
2
|
+
r: number;
|
3
|
+
g: number;
|
4
|
+
b: number;
|
5
|
+
}
|
6
|
+
export interface Color {
|
7
|
+
hex: string;
|
8
|
+
rgb: RGB;
|
9
|
+
}
|
10
|
+
export interface ThemeColors {
|
11
|
+
primary: Color;
|
12
|
+
secondary: Color;
|
13
|
+
background: Color;
|
14
|
+
text: Color;
|
15
|
+
}
|
16
|
+
export declare const lightTheme: ThemeColors;
|
17
|
+
export declare const darkTheme: ThemeColors;
|
package/package.json
CHANGED
@@ -1,16 +1,42 @@
|
|
1
1
|
{
|
2
2
|
"name": "aport-tools",
|
3
|
-
"version": "
|
4
|
-
"description": "Aport mobile Tools with
|
5
|
-
"main": "index.
|
3
|
+
"version": "2.0.1",
|
4
|
+
"description": "Aport mobile Tools with modern and minimalistic design",
|
5
|
+
"main": "dist/index.js",
|
6
|
+
"module": "dist/index.esm.js",
|
7
|
+
"react-native": "dist/index.js",
|
8
|
+
"source": "src/index.ts",
|
9
|
+
"types": "dist/index.d.ts",
|
10
|
+
"type": "module",
|
11
|
+
"exports": {
|
12
|
+
"./Theme": "./dist/Theme/index.js",
|
13
|
+
"./Theme/*": "./dist/Theme/*.js",
|
14
|
+
".": "./dist/index.js"
|
15
|
+
},
|
6
16
|
"scripts": {
|
17
|
+
"build": "rollup -c rollup.config.mjs",
|
18
|
+
"prepare": "npm run build",
|
7
19
|
"test": "echo \"Error: no test specified\" && exit 1"
|
8
20
|
},
|
9
|
-
"keywords": [
|
21
|
+
"keywords": [
|
22
|
+
"react-native",
|
23
|
+
"theme",
|
24
|
+
"provider",
|
25
|
+
"context",
|
26
|
+
"toggle",
|
27
|
+
"mobile",
|
28
|
+
"tools"
|
29
|
+
],
|
10
30
|
"author": "EvansGxz",
|
11
31
|
"license": "ISC",
|
12
32
|
"devDependencies": {
|
33
|
+
"@babel/core": "^7.25.2",
|
34
|
+
"@babel/preset-env": "^7.25.4",
|
35
|
+
"@babel/preset-react": "^7.24.7",
|
36
|
+
"@babel/preset-typescript": "^7.24.7",
|
37
|
+
"@rollup/plugin-babel": "^6.0.4",
|
13
38
|
"@rollup/plugin-commonjs": "^28.0.0",
|
39
|
+
"@rollup/plugin-json": "^6.1.0",
|
14
40
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
15
41
|
"@rollup/plugin-typescript": "^12.1.0",
|
16
42
|
"@types/react": "^18.3.10",
|
@@ -20,11 +46,10 @@
|
|
20
46
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
21
47
|
"typescript": "^5.6.2"
|
22
48
|
},
|
23
|
-
"
|
49
|
+
"peerDependencies": {
|
24
50
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
25
|
-
"
|
26
|
-
"react": "
|
27
|
-
"react-native": "^0.75.3",
|
51
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
52
|
+
"react-native": ">=0.60",
|
28
53
|
"styled-components": "^6.1.13"
|
29
54
|
}
|
30
55
|
}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
// rollup.config.mjs
|
2
|
+
|
3
|
+
import babel from '@rollup/plugin-babel';
|
4
|
+
import json from '@rollup/plugin-json';
|
5
|
+
import typescript from '@rollup/plugin-typescript';
|
6
|
+
import commonjs from '@rollup/plugin-commonjs';
|
7
|
+
import resolve from '@rollup/plugin-node-resolve';
|
8
|
+
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
9
|
+
import pkg from './package.json' assert { type: 'json' };
|
10
|
+
|
11
|
+
export default {
|
12
|
+
input: 'src/index.ts',
|
13
|
+
output: [
|
14
|
+
{
|
15
|
+
file: pkg.main,
|
16
|
+
format: 'cjs',
|
17
|
+
sourcemap: true,
|
18
|
+
exports: 'named',
|
19
|
+
banner: `/*! ${pkg.name} v${pkg.version} | ${pkg.license} */`,
|
20
|
+
},
|
21
|
+
{
|
22
|
+
file: pkg.module,
|
23
|
+
format: 'esm',
|
24
|
+
sourcemap: true,
|
25
|
+
banner: `/*! ${pkg.name} v${pkg.version} | ${pkg.license} */`,
|
26
|
+
},
|
27
|
+
],
|
28
|
+
plugins: [
|
29
|
+
peerDepsExternal(),
|
30
|
+
resolve({
|
31
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
32
|
+
}),
|
33
|
+
commonjs(),
|
34
|
+
babel({
|
35
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
36
|
+
babelHelpers: 'bundled',
|
37
|
+
include: ['src/**/*'],
|
38
|
+
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'],
|
39
|
+
}),
|
40
|
+
json(), // Handles JSON imports like package.json
|
41
|
+
typescript({
|
42
|
+
tsconfig: './tsconfig.json',
|
43
|
+
declaration: true,
|
44
|
+
declarationDir: 'dist',
|
45
|
+
emitDeclarationOnly: false,
|
46
|
+
}),
|
47
|
+
],
|
48
|
+
external: [
|
49
|
+
'react',
|
50
|
+
'react-native',
|
51
|
+
'@react-native-async-storage/async-storage',
|
52
|
+
'styled-components',
|
53
|
+
],
|
54
|
+
};
|
package/rollup.config.js
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
// rollup.config.js
|
2
|
-
|
3
|
-
import typescript from '@rollup/plugin-typescript';
|
4
|
-
import resolve from '@rollup/plugin-node-resolve';
|
5
|
-
import commonjs from '@rollup/plugin-commonjs';
|
6
|
-
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
7
|
-
|
8
|
-
export default {
|
9
|
-
input: 'src/index.ts', // Entry point of your library
|
10
|
-
output: [
|
11
|
-
{
|
12
|
-
file: 'dist/index.js', // CommonJS format
|
13
|
-
format: 'cjs',
|
14
|
-
sourcemap: true,
|
15
|
-
},
|
16
|
-
{
|
17
|
-
file: 'dist/index.es.js', // ES Module format
|
18
|
-
format: 'esm',
|
19
|
-
sourcemap: true,
|
20
|
-
},
|
21
|
-
],
|
22
|
-
plugins: [
|
23
|
-
peerDepsExternal(), // Automatically externalize peer dependencies
|
24
|
-
resolve({
|
25
|
-
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
26
|
-
}), // So Rollup can find node_modules
|
27
|
-
commonjs(), // So Rollup can convert commonjs to ES modules
|
28
|
-
typescript({ tsconfig: './tsconfig.json' }), // So Rollup can handle TypeScript
|
29
|
-
],
|
30
|
-
external: ['react', 'react-native'], // Explicitly externalize dependencies
|
31
|
-
};
|
package/src/Button.tsx
DELETED
@@ -1,104 +0,0 @@
|
|
1
|
-
// src/components/Button.tsx
|
2
|
-
|
3
|
-
import React, { useMemo, useContext } from 'react';
|
4
|
-
import { Text, ViewStyle, StyleSheet, TouchableOpacity } from 'react-native';
|
5
|
-
import { ThemeContext } from './context/ThemeContext'; // Adjust path to your ThemeContext
|
6
|
-
import { ThemeColors } from './styles/colors';
|
7
|
-
|
8
|
-
// Define the interface for the props that the Button component will accept
|
9
|
-
interface ButtonProps {
|
10
|
-
disabled?: boolean; // Optional: Disables the button if true
|
11
|
-
isFullWidth?: boolean; // Optional: Expands the button to full width if true
|
12
|
-
children?: string; // Optional: Text content of the button
|
13
|
-
onPress?: () => void; // Optional: Function to call when the button is pressed
|
14
|
-
rounded?: boolean; // Optional: Adds border radius if true
|
15
|
-
borderRadius?: number; // Optional: Custom border radius value
|
16
|
-
type?: 'submit' | 'button' | 'cancel'; // Optional: Specifies the button type for styling
|
17
|
-
}
|
18
|
-
|
19
|
-
// Function to determine the styles based on the button type and whether it is disabled
|
20
|
-
function typeStyles(type?: string, disabled?: boolean, themeColors?: ThemeColors): ViewStyle {
|
21
|
-
switch (type) {
|
22
|
-
case 'submit':
|
23
|
-
return {
|
24
|
-
backgroundColor: `rgba(${themeColors?.primary.rgb.r}, ${themeColors?.primary.rgb.g}, ${themeColors?.primary.rgb.b}, ${
|
25
|
-
disabled ? 0.5 : 1
|
26
|
-
})`,
|
27
|
-
borderWidth: 2,
|
28
|
-
borderColor: themeColors?.primary.hex,
|
29
|
-
};
|
30
|
-
case 'button':
|
31
|
-
return {
|
32
|
-
backgroundColor: themeColors?.primary.hex,
|
33
|
-
borderColor: themeColors?.secondary.hex,
|
34
|
-
opacity: disabled ? 0.5 : 1,
|
35
|
-
borderWidth: 2,
|
36
|
-
};
|
37
|
-
case 'cancel':
|
38
|
-
return {
|
39
|
-
backgroundColor: themeColors?.background.hex,
|
40
|
-
borderWidth: 0,
|
41
|
-
};
|
42
|
-
default:
|
43
|
-
return {};
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
|
-
// Button component definition
|
48
|
-
const Button: React.FC<ButtonProps> = ({
|
49
|
-
children,
|
50
|
-
disabled = false,
|
51
|
-
type = 'button',
|
52
|
-
rounded = true,
|
53
|
-
borderRadius = 30,
|
54
|
-
isFullWidth = false,
|
55
|
-
onPress,
|
56
|
-
}) => {
|
57
|
-
// Access the current theme from ThemeContext
|
58
|
-
const { theme } = useContext(ThemeContext);
|
59
|
-
const { colors } = theme; // Extract colors from the theme
|
60
|
-
|
61
|
-
// Use useMemo to memoize the computed styles
|
62
|
-
const computedStyles = useMemo(() => {
|
63
|
-
return StyleSheet.flatten([
|
64
|
-
styles.button,
|
65
|
-
typeStyles(type, disabled, colors), // Use colors directly
|
66
|
-
rounded && { borderRadius },
|
67
|
-
isFullWidth && { width: '100%' },
|
68
|
-
disabled && styles.disabled,
|
69
|
-
]);
|
70
|
-
}, [type, disabled, rounded, borderRadius, isFullWidth, colors]);
|
71
|
-
|
72
|
-
// Determine text color based on button type and theme
|
73
|
-
const textColor = useMemo(() => {
|
74
|
-
return { color: colors.text.hex }; // Access text color from the theme
|
75
|
-
}, [type, colors]);
|
76
|
-
|
77
|
-
return (
|
78
|
-
<TouchableOpacity
|
79
|
-
style={computedStyles as ViewStyle}
|
80
|
-
disabled={disabled}
|
81
|
-
onPress={onPress}
|
82
|
-
activeOpacity={0.7}
|
83
|
-
>
|
84
|
-
<Text style={textColor}>
|
85
|
-
{Array.isArray(children) ? children.join('').toUpperCase() : children?.toUpperCase()}
|
86
|
-
</Text>
|
87
|
-
</TouchableOpacity>
|
88
|
-
);
|
89
|
-
};
|
90
|
-
|
91
|
-
// Define basic styles for the button
|
92
|
-
const styles = StyleSheet.create({
|
93
|
-
button: {
|
94
|
-
justifyContent: 'center',
|
95
|
-
alignItems: 'center',
|
96
|
-
paddingVertical: 10,
|
97
|
-
paddingHorizontal: 20,
|
98
|
-
},
|
99
|
-
disabled: {
|
100
|
-
opacity: 0.6,
|
101
|
-
},
|
102
|
-
});
|
103
|
-
|
104
|
-
export default Button;
|
@@ -1,39 +0,0 @@
|
|
1
|
-
// src/components/ThemeToggle.tsx
|
2
|
-
|
3
|
-
import React, { useContext } from 'react';
|
4
|
-
import { Switch, View, Text, StyleSheet } from 'react-native';
|
5
|
-
import { ThemeContext } from '../context/ThemeContext';
|
6
|
-
import { darkTheme, lightTheme } from '../styles/colors';
|
7
|
-
|
8
|
-
const ThemeToggle: React.FC = () => {
|
9
|
-
const { theme, toggleTheme } = useContext(ThemeContext);
|
10
|
-
|
11
|
-
// Determine if the current theme is dark by checking the colors property
|
12
|
-
const isDarkMode = theme.colors === darkTheme;
|
13
|
-
|
14
|
-
return (
|
15
|
-
<View style={styles.container}>
|
16
|
-
<Text style={[styles.text, { color: theme.colors.text.hex }]}>Dark Mode</Text>
|
17
|
-
<Switch
|
18
|
-
value={isDarkMode}
|
19
|
-
onValueChange={toggleTheme}
|
20
|
-
trackColor={{ false: lightTheme.secondary.hex, true: darkTheme.primary.hex }}
|
21
|
-
thumbColor={isDarkMode ? darkTheme.secondary.hex : lightTheme.primary.hex}
|
22
|
-
/>
|
23
|
-
</View>
|
24
|
-
);
|
25
|
-
};
|
26
|
-
|
27
|
-
const styles = StyleSheet.create({
|
28
|
-
container: {
|
29
|
-
marginTop: 20,
|
30
|
-
flexDirection: 'row',
|
31
|
-
alignItems: 'center',
|
32
|
-
},
|
33
|
-
text: {
|
34
|
-
marginRight: 10,
|
35
|
-
fontSize: 16,
|
36
|
-
},
|
37
|
-
});
|
38
|
-
|
39
|
-
export default ThemeToggle;
|