miaoda-expo-devkit 0.1.1-beta.55 → 0.1.1-beta.56
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/metro.d.mts +27 -1
- package/dist/metro.d.ts +27 -1
- package/dist/metro.js +40 -0
- package/dist/metro.mjs +38 -0
- package/dist/rules/no-undeclared-expo-plugin.js +1 -1
- package/dist/stubs/expo-contacts-stub.js +309 -0
- package/dist/stubs/expo-haptics-stub.js +84 -0
- package/dist/stubs/lgui-control.js +3 -1
- package/package.json +2 -1
package/dist/metro.d.mts
CHANGED
|
@@ -335,6 +335,32 @@ declare function withExpoFileSystemStub(config: MetroConfig): MetroConfig;
|
|
|
335
335
|
|
|
336
336
|
declare function withExpoImagePickerStub(config: MetroConfig): MetroConfig;
|
|
337
337
|
|
|
338
|
+
/**
|
|
339
|
+
* withExpoHapticsStub — Web 平台将 expo-haptics 替换为 stub
|
|
340
|
+
*
|
|
341
|
+
* Web 没有振动/触觉硬件 API,expo-haptics 在 web 会运行时崩溃。
|
|
342
|
+
* stub 提供 no-op 实现并在核心 API 调用时弹出 Dialog 显示参数信息。
|
|
343
|
+
*
|
|
344
|
+
* native(Expo Go 和 Dev Build)不经过此 stub,直接使用真实 expo-haptics。
|
|
345
|
+
*/
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* @param config Metro config 对象
|
|
349
|
+
* @returns 注入 resolveRequest 后的新 Metro config
|
|
350
|
+
*/
|
|
351
|
+
declare function withExpoHapticsStub(config: MetroConfig): MetroConfig;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* withExpoContactsStub — Web / Expo Go 将 expo-contacts 替换为 stub
|
|
355
|
+
*
|
|
356
|
+
* expo-contacts 依赖 native module,在 Web 和 Expo Go 中不可用。
|
|
357
|
+
* stub 在运行时通过 Platform.OS 和 isRunningInExpoGo() 判断:
|
|
358
|
+
* - Web / Expo Go:no-op(核心 API 弹 Dialog / Alert 提示,不崩溃)
|
|
359
|
+
* - Development Build(原生):透传真实 expo-contacts,功能完全正常
|
|
360
|
+
*/
|
|
361
|
+
|
|
362
|
+
declare function withExpoContactsStub(config: MetroConfig): MetroConfig;
|
|
363
|
+
|
|
338
364
|
/**
|
|
339
365
|
* 将 Metro transformer 的 minifier 切换为 esbuild。
|
|
340
366
|
*
|
|
@@ -404,4 +430,4 @@ declare function withWasmSupport(config: MetroConfig): MetroConfig;
|
|
|
404
430
|
*/
|
|
405
431
|
declare function withTransformLogger(config: MetroConfig): MetroConfig;
|
|
406
432
|
|
|
407
|
-
export { type DevkitOptions, type InjectOptions, type PatchNativeWindCacheOptions, type RouteEndpointOptions, patchNativeWindCachePath, withCssInterop, withDevStubs, withDevkit, withEntryInjection, withEsbuildMinify, withExpoCalendarStub, withExpoFileSystemStub, withExpoImagePickerStub, withExpoMediaLibraryStub, withExpoNotificationsStub, withLucideResolver, withNativeWind, withRouteEndpoint, withTransformLogger, withWasmSupport, withWorkspaceNodeModules };
|
|
433
|
+
export { type DevkitOptions, type InjectOptions, type PatchNativeWindCacheOptions, type RouteEndpointOptions, patchNativeWindCachePath, withCssInterop, withDevStubs, withDevkit, withEntryInjection, withEsbuildMinify, withExpoCalendarStub, withExpoContactsStub, withExpoFileSystemStub, withExpoHapticsStub, withExpoImagePickerStub, withExpoMediaLibraryStub, withExpoNotificationsStub, withLucideResolver, withNativeWind, withRouteEndpoint, withTransformLogger, withWasmSupport, withWorkspaceNodeModules };
|
package/dist/metro.d.ts
CHANGED
|
@@ -335,6 +335,32 @@ declare function withExpoFileSystemStub(config: MetroConfig): MetroConfig;
|
|
|
335
335
|
|
|
336
336
|
declare function withExpoImagePickerStub(config: MetroConfig): MetroConfig;
|
|
337
337
|
|
|
338
|
+
/**
|
|
339
|
+
* withExpoHapticsStub — Web 平台将 expo-haptics 替换为 stub
|
|
340
|
+
*
|
|
341
|
+
* Web 没有振动/触觉硬件 API,expo-haptics 在 web 会运行时崩溃。
|
|
342
|
+
* stub 提供 no-op 实现并在核心 API 调用时弹出 Dialog 显示参数信息。
|
|
343
|
+
*
|
|
344
|
+
* native(Expo Go 和 Dev Build)不经过此 stub,直接使用真实 expo-haptics。
|
|
345
|
+
*/
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* @param config Metro config 对象
|
|
349
|
+
* @returns 注入 resolveRequest 后的新 Metro config
|
|
350
|
+
*/
|
|
351
|
+
declare function withExpoHapticsStub(config: MetroConfig): MetroConfig;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* withExpoContactsStub — Web / Expo Go 将 expo-contacts 替换为 stub
|
|
355
|
+
*
|
|
356
|
+
* expo-contacts 依赖 native module,在 Web 和 Expo Go 中不可用。
|
|
357
|
+
* stub 在运行时通过 Platform.OS 和 isRunningInExpoGo() 判断:
|
|
358
|
+
* - Web / Expo Go:no-op(核心 API 弹 Dialog / Alert 提示,不崩溃)
|
|
359
|
+
* - Development Build(原生):透传真实 expo-contacts,功能完全正常
|
|
360
|
+
*/
|
|
361
|
+
|
|
362
|
+
declare function withExpoContactsStub(config: MetroConfig): MetroConfig;
|
|
363
|
+
|
|
338
364
|
/**
|
|
339
365
|
* 将 Metro transformer 的 minifier 切换为 esbuild。
|
|
340
366
|
*
|
|
@@ -404,4 +430,4 @@ declare function withWasmSupport(config: MetroConfig): MetroConfig;
|
|
|
404
430
|
*/
|
|
405
431
|
declare function withTransformLogger(config: MetroConfig): MetroConfig;
|
|
406
432
|
|
|
407
|
-
export { type DevkitOptions, type InjectOptions, type PatchNativeWindCacheOptions, type RouteEndpointOptions, patchNativeWindCachePath, withCssInterop, withDevStubs, withDevkit, withEntryInjection, withEsbuildMinify, withExpoCalendarStub, withExpoFileSystemStub, withExpoImagePickerStub, withExpoMediaLibraryStub, withExpoNotificationsStub, withLucideResolver, withNativeWind, withRouteEndpoint, withTransformLogger, withWasmSupport, withWorkspaceNodeModules };
|
|
433
|
+
export { type DevkitOptions, type InjectOptions, type PatchNativeWindCacheOptions, type RouteEndpointOptions, patchNativeWindCachePath, withCssInterop, withDevStubs, withDevkit, withEntryInjection, withEsbuildMinify, withExpoCalendarStub, withExpoContactsStub, withExpoFileSystemStub, withExpoHapticsStub, withExpoImagePickerStub, withExpoMediaLibraryStub, withExpoNotificationsStub, withLucideResolver, withNativeWind, withRouteEndpoint, withTransformLogger, withWasmSupport, withWorkspaceNodeModules };
|
package/dist/metro.js
CHANGED
|
@@ -37,7 +37,9 @@ __export(metro_exports, {
|
|
|
37
37
|
withEntryInjection: () => withEntryInjection,
|
|
38
38
|
withEsbuildMinify: () => withEsbuildMinify,
|
|
39
39
|
withExpoCalendarStub: () => withExpoCalendarStub,
|
|
40
|
+
withExpoContactsStub: () => withExpoContactsStub,
|
|
40
41
|
withExpoFileSystemStub: () => withExpoFileSystemStub,
|
|
42
|
+
withExpoHapticsStub: () => withExpoHapticsStub,
|
|
41
43
|
withExpoImagePickerStub: () => withExpoImagePickerStub,
|
|
42
44
|
withExpoMediaLibraryStub: () => withExpoMediaLibraryStub,
|
|
43
45
|
withExpoNotificationsStub: () => withExpoNotificationsStub,
|
|
@@ -564,6 +566,42 @@ function withDevkit(config, options = {}) {
|
|
|
564
566
|
return withNativeWind(config, { input, inlineRem: 16 });
|
|
565
567
|
}
|
|
566
568
|
|
|
569
|
+
// src/metro/withExpoHapticsStub.ts
|
|
570
|
+
var import_path14 = __toESM(require("path"));
|
|
571
|
+
var EXPO_HAPTICS_STUB_FILENAME = "expo-haptics-stub.js";
|
|
572
|
+
var EXPO_HAPTICS_STUB_PATH = import_path14.default.resolve(__dirname, "stubs", EXPO_HAPTICS_STUB_FILENAME);
|
|
573
|
+
function withExpoHapticsStub(config) {
|
|
574
|
+
const upstream = config.resolver?.resolveRequest ?? null;
|
|
575
|
+
const resolveRequest = (context, moduleName, platform) => {
|
|
576
|
+
if (platform === "web" && moduleName === "expo-haptics" && !context.originModulePath.includes(EXPO_HAPTICS_STUB_FILENAME)) {
|
|
577
|
+
return { filePath: EXPO_HAPTICS_STUB_PATH, type: "sourceFile" };
|
|
578
|
+
}
|
|
579
|
+
if (upstream) return upstream(context, moduleName, platform);
|
|
580
|
+
return context.resolveRequest(context, moduleName, platform);
|
|
581
|
+
};
|
|
582
|
+
return { ...config, resolver: { ...config.resolver, resolveRequest } };
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// src/metro/withExpoContactsStub.ts
|
|
586
|
+
var import_path15 = __toESM(require("path"));
|
|
587
|
+
var EXPO_CONTACTS_STUB_FILENAME = "expo-contacts-stub.js";
|
|
588
|
+
var EXPO_CONTACTS_STUB_PATH = import_path15.default.resolve(
|
|
589
|
+
__dirname,
|
|
590
|
+
"stubs",
|
|
591
|
+
EXPO_CONTACTS_STUB_FILENAME
|
|
592
|
+
);
|
|
593
|
+
function withExpoContactsStub(config) {
|
|
594
|
+
const upstream = config.resolver?.resolveRequest ?? null;
|
|
595
|
+
const resolveRequest = (context, moduleName, platform) => {
|
|
596
|
+
if (platform === "web" && moduleName === "expo-contacts" && !context.originModulePath.includes(EXPO_CONTACTS_STUB_FILENAME)) {
|
|
597
|
+
return { filePath: EXPO_CONTACTS_STUB_PATH, type: "sourceFile" };
|
|
598
|
+
}
|
|
599
|
+
if (upstream) return upstream(context, moduleName, platform);
|
|
600
|
+
return context.resolveRequest(context, moduleName, platform);
|
|
601
|
+
};
|
|
602
|
+
return { ...config, resolver: { ...config.resolver, resolveRequest } };
|
|
603
|
+
}
|
|
604
|
+
|
|
567
605
|
// src/metro/index.ts
|
|
568
606
|
try {
|
|
569
607
|
require.resolve("react-native-css-interop/package.json");
|
|
@@ -580,7 +618,9 @@ try {
|
|
|
580
618
|
withEntryInjection,
|
|
581
619
|
withEsbuildMinify,
|
|
582
620
|
withExpoCalendarStub,
|
|
621
|
+
withExpoContactsStub,
|
|
583
622
|
withExpoFileSystemStub,
|
|
623
|
+
withExpoHapticsStub,
|
|
584
624
|
withExpoImagePickerStub,
|
|
585
625
|
withExpoMediaLibraryStub,
|
|
586
626
|
withExpoNotificationsStub,
|
package/dist/metro.mjs
CHANGED
|
@@ -519,6 +519,42 @@ function withDevkit(config, options = {}) {
|
|
|
519
519
|
return withNativeWind(config, { input, inlineRem: 16 });
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
+
// src/metro/withExpoHapticsStub.ts
|
|
523
|
+
import path15 from "path";
|
|
524
|
+
var EXPO_HAPTICS_STUB_FILENAME = "expo-haptics-stub.js";
|
|
525
|
+
var EXPO_HAPTICS_STUB_PATH = path15.resolve(__dirname, "stubs", EXPO_HAPTICS_STUB_FILENAME);
|
|
526
|
+
function withExpoHapticsStub(config) {
|
|
527
|
+
const upstream = config.resolver?.resolveRequest ?? null;
|
|
528
|
+
const resolveRequest = (context, moduleName, platform) => {
|
|
529
|
+
if (platform === "web" && moduleName === "expo-haptics" && !context.originModulePath.includes(EXPO_HAPTICS_STUB_FILENAME)) {
|
|
530
|
+
return { filePath: EXPO_HAPTICS_STUB_PATH, type: "sourceFile" };
|
|
531
|
+
}
|
|
532
|
+
if (upstream) return upstream(context, moduleName, platform);
|
|
533
|
+
return context.resolveRequest(context, moduleName, platform);
|
|
534
|
+
};
|
|
535
|
+
return { ...config, resolver: { ...config.resolver, resolveRequest } };
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// src/metro/withExpoContactsStub.ts
|
|
539
|
+
import path16 from "path";
|
|
540
|
+
var EXPO_CONTACTS_STUB_FILENAME = "expo-contacts-stub.js";
|
|
541
|
+
var EXPO_CONTACTS_STUB_PATH = path16.resolve(
|
|
542
|
+
__dirname,
|
|
543
|
+
"stubs",
|
|
544
|
+
EXPO_CONTACTS_STUB_FILENAME
|
|
545
|
+
);
|
|
546
|
+
function withExpoContactsStub(config) {
|
|
547
|
+
const upstream = config.resolver?.resolveRequest ?? null;
|
|
548
|
+
const resolveRequest = (context, moduleName, platform) => {
|
|
549
|
+
if (platform === "web" && moduleName === "expo-contacts" && !context.originModulePath.includes(EXPO_CONTACTS_STUB_FILENAME)) {
|
|
550
|
+
return { filePath: EXPO_CONTACTS_STUB_PATH, type: "sourceFile" };
|
|
551
|
+
}
|
|
552
|
+
if (upstream) return upstream(context, moduleName, platform);
|
|
553
|
+
return context.resolveRequest(context, moduleName, platform);
|
|
554
|
+
};
|
|
555
|
+
return { ...config, resolver: { ...config.resolver, resolveRequest } };
|
|
556
|
+
}
|
|
557
|
+
|
|
522
558
|
// src/metro/index.ts
|
|
523
559
|
try {
|
|
524
560
|
__require.resolve("react-native-css-interop/package.json");
|
|
@@ -534,7 +570,9 @@ export {
|
|
|
534
570
|
withEntryInjection,
|
|
535
571
|
withEsbuildMinify,
|
|
536
572
|
withExpoCalendarStub,
|
|
573
|
+
withExpoContactsStub,
|
|
537
574
|
withExpoFileSystemStub,
|
|
575
|
+
withExpoHapticsStub,
|
|
538
576
|
withExpoImagePickerStub,
|
|
539
577
|
withExpoMediaLibraryStub,
|
|
540
578
|
withExpoNotificationsStub,
|
|
@@ -126,7 +126,7 @@ var requireExpoPluginRule = {
|
|
|
126
126
|
schema: [],
|
|
127
127
|
messages: {
|
|
128
128
|
missingPlugin: "'{{packageName}}' has a config plugin but is not declared in app.json \u2192 expo.plugins.",
|
|
129
|
-
missingAliasPlugin: "'{{importPackage}}' requires '{{pluginPackage}}'
|
|
129
|
+
missingAliasPlugin: "'{{importPackage}}' requires '{{pluginPackage}}' as a config plugin. Install it (pnpm expo install {{pluginPackage}}) and add it to app.json \u2192 expo.plugins."
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
132
|
create(context) {
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_react_native = require("react-native");
|
|
3
|
+
var import_expo = require("expo");
|
|
4
|
+
var import_web_stub_dialog = require("./web-stub-dialog");
|
|
5
|
+
if (import_react_native.Platform.OS !== "web" && !(0, import_expo.isRunningInExpoGo)()) {
|
|
6
|
+
module.exports = require("expo-contacts");
|
|
7
|
+
} else {
|
|
8
|
+
let showContactsAlert = function(title, lines, errors) {
|
|
9
|
+
const hasErrors = !!errors && errors.length > 0;
|
|
10
|
+
if (import_react_native.Platform.OS === "web") {
|
|
11
|
+
(0, import_web_stub_dialog.showWebStubDialog)({
|
|
12
|
+
title,
|
|
13
|
+
details: lines,
|
|
14
|
+
errors: hasErrors ? errors : void 0
|
|
15
|
+
});
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const statusLine = hasErrors ? "\u274C \u53C2\u6570\u6709\u8BEF" : "\u2705 \u53C2\u6570\u5408\u89C4";
|
|
19
|
+
const parts = ["\u79D2\u54D2\u626B\u7801\u9884\u89C8\u4E0D\u652F\u6301\u8BBF\u95EE\u901A\u8BAF\u5F55", "", ...lines, "", statusLine];
|
|
20
|
+
if (hasErrors) {
|
|
21
|
+
parts.push(`\u95EE\u9898: ${errors.join(" / ")}`);
|
|
22
|
+
parts.push("");
|
|
23
|
+
parts.push("\u8BF7\u622A\u56FE\u53D1\u7ED9\u79D2\u54D2 Agent \u4FEE\u590D");
|
|
24
|
+
} else {
|
|
25
|
+
parts.push("");
|
|
26
|
+
parts.push("\u53D1\u5E03\u4E3A\u6B63\u5F0F App \u540E\u53EF\u6B63\u5E38\u4F7F\u7528");
|
|
27
|
+
}
|
|
28
|
+
import_react_native.Alert.alert(title, parts.join("\n"), [{ text: "\u77E5\u9053\u4E86" }]);
|
|
29
|
+
}, validateId = function(id, label = "id") {
|
|
30
|
+
if (typeof id !== "string" || id.trim().length === 0) {
|
|
31
|
+
return [`${label} \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32`];
|
|
32
|
+
}
|
|
33
|
+
return [];
|
|
34
|
+
};
|
|
35
|
+
var showContactsAlert2 = showContactsAlert, validateId2 = validateId;
|
|
36
|
+
const UNDETERMINED_PERMISSION = {
|
|
37
|
+
status: "undetermined",
|
|
38
|
+
granted: false,
|
|
39
|
+
canAskAgain: true,
|
|
40
|
+
expires: "never",
|
|
41
|
+
accessPrivileges: "none"
|
|
42
|
+
};
|
|
43
|
+
const DENIED_PERMISSION = {
|
|
44
|
+
status: "denied",
|
|
45
|
+
granted: false,
|
|
46
|
+
canAskAgain: false,
|
|
47
|
+
expires: "never",
|
|
48
|
+
accessPrivileges: "none"
|
|
49
|
+
};
|
|
50
|
+
const Fields = {
|
|
51
|
+
ID: "id",
|
|
52
|
+
ContactType: "contactType",
|
|
53
|
+
Name: "name",
|
|
54
|
+
FirstName: "firstName",
|
|
55
|
+
MiddleName: "middleName",
|
|
56
|
+
LastName: "lastName",
|
|
57
|
+
MaidenName: "maidenName",
|
|
58
|
+
NamePrefix: "namePrefix",
|
|
59
|
+
NameSuffix: "nameSuffix",
|
|
60
|
+
Nickname: "nickname",
|
|
61
|
+
PhoneticFirstName: "phoneticFirstName",
|
|
62
|
+
PhoneticMiddleName: "phoneticMiddleName",
|
|
63
|
+
PhoneticLastName: "phoneticLastName",
|
|
64
|
+
Birthday: "birthday",
|
|
65
|
+
NonGregorianBirthday: "nonGregorianBirthday",
|
|
66
|
+
Emails: "emails",
|
|
67
|
+
PhoneNumbers: "phoneNumbers",
|
|
68
|
+
Addresses: "addresses",
|
|
69
|
+
SocialProfiles: "socialProfiles",
|
|
70
|
+
InstantMessageAddresses: "instantMessageAddresses",
|
|
71
|
+
UrlAddresses: "urlAddresses",
|
|
72
|
+
Company: "company",
|
|
73
|
+
JobTitle: "jobTitle",
|
|
74
|
+
Department: "department",
|
|
75
|
+
ImageAvailable: "imageAvailable",
|
|
76
|
+
Image: "image",
|
|
77
|
+
RawImage: "rawImage",
|
|
78
|
+
ExtraNames: "extraNames",
|
|
79
|
+
Note: "note",
|
|
80
|
+
Dates: "dates",
|
|
81
|
+
Relationships: "relationships",
|
|
82
|
+
IsFavorite: "isFavorite"
|
|
83
|
+
};
|
|
84
|
+
const CalendarFormats = {
|
|
85
|
+
Gregorian: "gregorian",
|
|
86
|
+
Buddhist: "buddhist",
|
|
87
|
+
Chinese: "chinese",
|
|
88
|
+
Coptic: "coptic",
|
|
89
|
+
EthiopicAmeteMihret: "ethiopicAmeteMihret",
|
|
90
|
+
EthiopicAmeteAlem: "ethiopicAmeteAlem",
|
|
91
|
+
Hebrew: "hebrew",
|
|
92
|
+
ISO8601: "iso8601",
|
|
93
|
+
Indian: "indian",
|
|
94
|
+
Islamic: "islamic",
|
|
95
|
+
IslamicCivil: "islamicCivil",
|
|
96
|
+
Japanese: "japanese",
|
|
97
|
+
Persian: "persian",
|
|
98
|
+
RepublicOfChina: "republicOfChina"
|
|
99
|
+
};
|
|
100
|
+
const ContainerTypes = {
|
|
101
|
+
Local: "local",
|
|
102
|
+
Exchange: "exchange",
|
|
103
|
+
CardDAV: "cardDAV",
|
|
104
|
+
Unassigned: "unassigned"
|
|
105
|
+
};
|
|
106
|
+
const SortTypes = {
|
|
107
|
+
UserDefault: "userDefault",
|
|
108
|
+
FirstName: "firstName",
|
|
109
|
+
LastName: "lastName",
|
|
110
|
+
None: "none"
|
|
111
|
+
};
|
|
112
|
+
const ContactTypes = {
|
|
113
|
+
Person: "person",
|
|
114
|
+
Company: "company"
|
|
115
|
+
};
|
|
116
|
+
const getPermissionsAsync = async () => DENIED_PERMISSION;
|
|
117
|
+
const requestPermissionsAsync = async () => {
|
|
118
|
+
showContactsAlert("\u8BF7\u6C42\u901A\u8BAF\u5F55\u6743\u9650", ["\u64CD\u4F5C: requestPermissionsAsync()", "\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u4E0D\u652F\u6301\u8BBF\u95EE\u901A\u8BAF\u5F55"]);
|
|
119
|
+
return UNDETERMINED_PERMISSION;
|
|
120
|
+
};
|
|
121
|
+
const isAvailableAsync = async () => false;
|
|
122
|
+
const hasContactsAsync = async () => false;
|
|
123
|
+
const getContactsAsync = async (query) => {
|
|
124
|
+
const queryStr = query ? JSON.stringify(query) : "(\u65E0\u8FC7\u6EE4)";
|
|
125
|
+
showContactsAlert("\u83B7\u53D6\u901A\u8BAF\u5F55\u8054\u7CFB\u4EBA", [
|
|
126
|
+
`query: ${queryStr}`,
|
|
127
|
+
"\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u8FD4\u56DE\u7A7A\u5217\u8868"
|
|
128
|
+
]);
|
|
129
|
+
return { data: [], hasNextPage: false, hasPreviousPage: false, total: 0 };
|
|
130
|
+
};
|
|
131
|
+
const getPagedContactsAsync = async (query) => {
|
|
132
|
+
const queryStr = query ? JSON.stringify(query) : "(\u65E0\u8FC7\u6EE4)";
|
|
133
|
+
showContactsAlert("\u5206\u9875\u83B7\u53D6\u8054\u7CFB\u4EBA", [
|
|
134
|
+
`query: ${queryStr}`,
|
|
135
|
+
"\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u8FD4\u56DE\u7A7A\u5217\u8868"
|
|
136
|
+
]);
|
|
137
|
+
return { data: [], hasNextPage: false, hasPreviousPage: false, total: 0 };
|
|
138
|
+
};
|
|
139
|
+
const getContactByIdAsync = async (id) => {
|
|
140
|
+
const errors = validateId(id, "contactId");
|
|
141
|
+
showContactsAlert("\u901A\u8FC7 ID \u83B7\u53D6\u8054\u7CFB\u4EBA", [`contactId: ${JSON.stringify(id)}`], errors.length ? errors : void 0);
|
|
142
|
+
return null;
|
|
143
|
+
};
|
|
144
|
+
const addContactAsync = async (contact) => {
|
|
145
|
+
const nameStr = contact?.name ?? "(\u672A\u4F20\u59D3\u540D)";
|
|
146
|
+
showContactsAlert("\u6DFB\u52A0\u8054\u7CFB\u4EBA", [`name: ${nameStr}`]);
|
|
147
|
+
return "stub-contact-id";
|
|
148
|
+
};
|
|
149
|
+
const updateContactAsync = async (contact) => {
|
|
150
|
+
const idStr = contact?.id ?? "(\u672A\u4F20 id)";
|
|
151
|
+
const errors = validateId(idStr, "contact.id");
|
|
152
|
+
showContactsAlert("\u66F4\u65B0\u8054\u7CFB\u4EBA", [`id: ${idStr}`], errors.length ? errors : void 0);
|
|
153
|
+
return {};
|
|
154
|
+
};
|
|
155
|
+
const removeContactAsync = async (contactId) => {
|
|
156
|
+
const errors = validateId(contactId, "contactId");
|
|
157
|
+
showContactsAlert("\u5220\u9664\u8054\u7CFB\u4EBA", [`contactId: ${JSON.stringify(contactId)}`], errors.length ? errors : void 0);
|
|
158
|
+
return {};
|
|
159
|
+
};
|
|
160
|
+
const shareContactAsync = async (contactId, message) => {
|
|
161
|
+
const errors = validateId(contactId, "contactId");
|
|
162
|
+
showContactsAlert("\u5206\u4EAB\u8054\u7CFB\u4EBA", [
|
|
163
|
+
`contactId: ${JSON.stringify(contactId)}`,
|
|
164
|
+
`message: ${message != null ? JSON.stringify(message) : "(\u65E0)"}`
|
|
165
|
+
], errors.length ? errors : void 0);
|
|
166
|
+
};
|
|
167
|
+
const writeContactToFileAsync = async (query) => {
|
|
168
|
+
showContactsAlert("\u5BFC\u51FA\u8054\u7CFB\u4EBA\u5230\u6587\u4EF6", [
|
|
169
|
+
`query: ${query ? JSON.stringify(query) : "(\u65E0)"}`,
|
|
170
|
+
"\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u4E0D\u652F\u6301\u6B64\u64CD\u4F5C"
|
|
171
|
+
]);
|
|
172
|
+
return "file://stub/contact.vcf";
|
|
173
|
+
};
|
|
174
|
+
const presentFormAsync = async (contactId) => {
|
|
175
|
+
showContactsAlert("\u663E\u793A\u8054\u7CFB\u4EBA\u8868\u5355", [
|
|
176
|
+
`contactId: ${contactId != null ? JSON.stringify(contactId) : "(\u65B0\u5EFA)"}`,
|
|
177
|
+
"Web \u5E73\u53F0\u4E0D\u652F\u6301\u7CFB\u7EDF\u8054\u7CFB\u4EBA\u8868\u5355"
|
|
178
|
+
]);
|
|
179
|
+
return {};
|
|
180
|
+
};
|
|
181
|
+
const presentContactPickerAsync = async () => {
|
|
182
|
+
showContactsAlert("\u9009\u62E9\u8054\u7CFB\u4EBA", ["Web \u5E73\u53F0\u4E0D\u652F\u6301\u901A\u8BAF\u5F55\u9009\u62E9\u5668"]);
|
|
183
|
+
return null;
|
|
184
|
+
};
|
|
185
|
+
const createGroupAsync = async (name) => {
|
|
186
|
+
const errors = [];
|
|
187
|
+
if (typeof name !== "string" || !name.trim()) errors.push("name \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32");
|
|
188
|
+
showContactsAlert("\u521B\u5EFA\u8054\u7CFB\u4EBA\u5206\u7EC4", [`name: ${JSON.stringify(name)}`], errors.length ? errors : void 0);
|
|
189
|
+
return "stub-group-id";
|
|
190
|
+
};
|
|
191
|
+
const updateGroupNameAsync = async (groupName, groupId) => {
|
|
192
|
+
const errors = [
|
|
193
|
+
...typeof groupName !== "string" || !groupName.trim() ? ["groupName \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32"] : [],
|
|
194
|
+
...validateId(groupId, "groupId")
|
|
195
|
+
];
|
|
196
|
+
showContactsAlert("\u66F4\u65B0\u5206\u7EC4\u540D\u79F0", [
|
|
197
|
+
`groupName: ${JSON.stringify(groupName)}`,
|
|
198
|
+
`groupId: ${JSON.stringify(groupId)}`
|
|
199
|
+
], errors.length ? errors : void 0);
|
|
200
|
+
return {};
|
|
201
|
+
};
|
|
202
|
+
const removeGroupAsync = async (groupId) => {
|
|
203
|
+
const errors = validateId(groupId, "groupId");
|
|
204
|
+
showContactsAlert("\u5220\u9664\u5206\u7EC4", [`groupId: ${JSON.stringify(groupId)}`], errors.length ? errors : void 0);
|
|
205
|
+
return {};
|
|
206
|
+
};
|
|
207
|
+
const getGroupsAsync = async (query) => {
|
|
208
|
+
showContactsAlert("\u83B7\u53D6\u8054\u7CFB\u4EBA\u5206\u7EC4", [
|
|
209
|
+
`query: ${query ? JSON.stringify(query) : "(\u65E0)"}`,
|
|
210
|
+
"\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u8FD4\u56DE\u7A7A\u5217\u8868"
|
|
211
|
+
]);
|
|
212
|
+
return [];
|
|
213
|
+
};
|
|
214
|
+
const addExistingContactToGroupAsync = async (contactId, groupId) => {
|
|
215
|
+
const errors = [
|
|
216
|
+
...validateId(contactId, "contactId"),
|
|
217
|
+
...validateId(groupId, "groupId")
|
|
218
|
+
];
|
|
219
|
+
showContactsAlert("\u6DFB\u52A0\u8054\u7CFB\u4EBA\u5230\u5206\u7EC4", [
|
|
220
|
+
`contactId: ${JSON.stringify(contactId)}`,
|
|
221
|
+
`groupId: ${JSON.stringify(groupId)}`
|
|
222
|
+
], errors.length ? errors : void 0);
|
|
223
|
+
return {};
|
|
224
|
+
};
|
|
225
|
+
const removeContactFromGroupAsync = async (contactId, groupId) => {
|
|
226
|
+
const errors = [
|
|
227
|
+
...validateId(contactId, "contactId"),
|
|
228
|
+
...validateId(groupId, "groupId")
|
|
229
|
+
];
|
|
230
|
+
showContactsAlert("\u4ECE\u5206\u7EC4\u79FB\u9664\u8054\u7CFB\u4EBA", [
|
|
231
|
+
`contactId: ${JSON.stringify(contactId)}`,
|
|
232
|
+
`groupId: ${JSON.stringify(groupId)}`
|
|
233
|
+
], errors.length ? errors : void 0);
|
|
234
|
+
return {};
|
|
235
|
+
};
|
|
236
|
+
const addExistingGroupToContainerAsync = async (groupId, containerId) => {
|
|
237
|
+
const errors = [
|
|
238
|
+
...validateId(groupId, "groupId"),
|
|
239
|
+
...validateId(containerId, "containerId")
|
|
240
|
+
];
|
|
241
|
+
showContactsAlert("\u5C06\u5206\u7EC4\u6DFB\u52A0\u5230\u5BB9\u5668", [
|
|
242
|
+
`groupId: ${JSON.stringify(groupId)}`,
|
|
243
|
+
`containerId: ${JSON.stringify(containerId)}`
|
|
244
|
+
], errors.length ? errors : void 0);
|
|
245
|
+
return {};
|
|
246
|
+
};
|
|
247
|
+
const getContainersAsync = async (query) => {
|
|
248
|
+
showContactsAlert("\u83B7\u53D6\u8054\u7CFB\u4EBA\u5BB9\u5668", [
|
|
249
|
+
`query: ${query ? JSON.stringify(query) : "(\u65E0)"}`,
|
|
250
|
+
"\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u8FD4\u56DE\u7A7A\u5217\u8868"
|
|
251
|
+
]);
|
|
252
|
+
return [];
|
|
253
|
+
};
|
|
254
|
+
const getDefaultContainerIdAsync = async () => {
|
|
255
|
+
showContactsAlert("\u83B7\u53D6\u9ED8\u8BA4\u5BB9\u5668 ID", ["\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u4E0D\u652F\u6301\u6B64\u64CD\u4F5C"]);
|
|
256
|
+
return null;
|
|
257
|
+
};
|
|
258
|
+
const addContactsChangeListener = (_listener) => {
|
|
259
|
+
return { remove: () => {
|
|
260
|
+
} };
|
|
261
|
+
};
|
|
262
|
+
const presentAccessPickerAsync = async () => {
|
|
263
|
+
showContactsAlert("\u9009\u62E9\u901A\u8BAF\u5F55\u8BBF\u95EE\u6743\u9650", ["Web \u5E73\u53F0\u4E0D\u652F\u6301\u6B64\u64CD\u4F5C"]);
|
|
264
|
+
return [];
|
|
265
|
+
};
|
|
266
|
+
const enums = {
|
|
267
|
+
Fields,
|
|
268
|
+
CalendarFormats,
|
|
269
|
+
ContainerTypes,
|
|
270
|
+
SortTypes,
|
|
271
|
+
ContactTypes
|
|
272
|
+
};
|
|
273
|
+
const api = {
|
|
274
|
+
isAvailableAsync,
|
|
275
|
+
hasContactsAsync,
|
|
276
|
+
getPermissionsAsync,
|
|
277
|
+
requestPermissionsAsync,
|
|
278
|
+
getContactsAsync,
|
|
279
|
+
getPagedContactsAsync,
|
|
280
|
+
getContactByIdAsync,
|
|
281
|
+
addContactAsync,
|
|
282
|
+
updateContactAsync,
|
|
283
|
+
removeContactAsync,
|
|
284
|
+
shareContactAsync,
|
|
285
|
+
writeContactToFileAsync,
|
|
286
|
+
presentFormAsync,
|
|
287
|
+
presentContactPickerAsync,
|
|
288
|
+
createGroupAsync,
|
|
289
|
+
updateGroupNameAsync,
|
|
290
|
+
removeGroupAsync,
|
|
291
|
+
getGroupsAsync,
|
|
292
|
+
addExistingContactToGroupAsync,
|
|
293
|
+
removeContactFromGroupAsync,
|
|
294
|
+
addExistingGroupToContainerAsync,
|
|
295
|
+
getContainersAsync,
|
|
296
|
+
getDefaultContainerIdAsync,
|
|
297
|
+
addContactsChangeListener,
|
|
298
|
+
presentAccessPickerAsync,
|
|
299
|
+
...enums
|
|
300
|
+
};
|
|
301
|
+
const noop = async () => void 0;
|
|
302
|
+
module.exports = new Proxy(api, {
|
|
303
|
+
get(target, key) {
|
|
304
|
+
if (key in target) return target[key];
|
|
305
|
+
return noop;
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
//# sourceMappingURL=expo-contacts-stub.js.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_expo = require("expo");
|
|
3
|
+
var import_react_native = require("react-native");
|
|
4
|
+
var import_web_stub_dialog = require("./web-stub-dialog");
|
|
5
|
+
if (import_react_native.Platform.OS !== "web" && !(0, import_expo.isRunningInExpoGo)()) {
|
|
6
|
+
module.exports = require("expo-haptics");
|
|
7
|
+
} else {
|
|
8
|
+
let validateImpactStyle = function(style) {
|
|
9
|
+
const valid = Object.values(ImpactFeedbackStyle);
|
|
10
|
+
if (style == null) return { ok: true, errors: [] };
|
|
11
|
+
if (typeof style !== "string" || !valid.includes(style)) {
|
|
12
|
+
return {
|
|
13
|
+
ok: false,
|
|
14
|
+
errors: [`style \u5FC5\u987B\u662F ImpactFeedbackStyle \u679A\u4E3E\u503C\u4E4B\u4E00\uFF08${valid.join(" / ")}\uFF09\uFF0C\u6536\u5230: ${JSON.stringify(style)}`]
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return { ok: true, errors: [] };
|
|
18
|
+
}, validateNotificationType = function(type) {
|
|
19
|
+
const valid = Object.values(NotificationFeedbackType);
|
|
20
|
+
if (type == null) return { ok: true, errors: [] };
|
|
21
|
+
if (typeof type !== "string" || !valid.includes(type)) {
|
|
22
|
+
return {
|
|
23
|
+
ok: false,
|
|
24
|
+
errors: [`type \u5FC5\u987B\u662F NotificationFeedbackType \u679A\u4E3E\u503C\u4E4B\u4E00\uFF08${valid.join(" / ")}\uFF09\uFF0C\u6536\u5230: ${JSON.stringify(type)}`]
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return { ok: true, errors: [] };
|
|
28
|
+
};
|
|
29
|
+
var validateImpactStyle2 = validateImpactStyle, validateNotificationType2 = validateNotificationType;
|
|
30
|
+
const ImpactFeedbackStyle = {
|
|
31
|
+
Light: "light",
|
|
32
|
+
Medium: "medium",
|
|
33
|
+
Heavy: "heavy",
|
|
34
|
+
Rigid: "rigid",
|
|
35
|
+
Soft: "soft"
|
|
36
|
+
};
|
|
37
|
+
const NotificationFeedbackType = {
|
|
38
|
+
Success: "success",
|
|
39
|
+
Warning: "warning",
|
|
40
|
+
Error: "error"
|
|
41
|
+
};
|
|
42
|
+
const SelectionFeedbackType = {};
|
|
43
|
+
const handleImpactAsync = async (style) => {
|
|
44
|
+
const { ok, errors } = validateImpactStyle(style);
|
|
45
|
+
(0, import_web_stub_dialog.showWebStubDialog)({
|
|
46
|
+
title: "\u89E6\u89C9\u53CD\u9988 impactAsync",
|
|
47
|
+
details: [`style: ${style != null ? JSON.stringify(style) : "(\u9ED8\u8BA4 Medium)"}`, "Web \u5E73\u53F0\u4E0D\u652F\u6301\u89E6\u89C9\u53CD\u9988\uFF0C\u5DF2\u8DF3\u8FC7"],
|
|
48
|
+
errors: ok ? void 0 : errors
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
const handleNotificationAsync = async (type) => {
|
|
52
|
+
const { ok, errors } = validateNotificationType(type);
|
|
53
|
+
(0, import_web_stub_dialog.showWebStubDialog)({
|
|
54
|
+
title: "\u901A\u77E5\u89E6\u89C9\u53CD\u9988 notificationAsync",
|
|
55
|
+
details: [`type: ${type != null ? JSON.stringify(type) : "(\u9ED8\u8BA4 Success)"}`, "Web \u5E73\u53F0\u4E0D\u652F\u6301\u89E6\u89C9\u53CD\u9988\uFF0C\u5DF2\u8DF3\u8FC7"],
|
|
56
|
+
errors: ok ? void 0 : errors
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
const handleSelectionAsync = async () => {
|
|
60
|
+
(0, import_web_stub_dialog.showWebStubDialog)({
|
|
61
|
+
title: "\u9009\u62E9\u89E6\u89C9\u53CD\u9988 selectionAsync",
|
|
62
|
+
details: ["Web \u5E73\u53F0\u4E0D\u652F\u6301\u89E6\u89C9\u53CD\u9988\uFF0C\u5DF2\u8DF3\u8FC7"]
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const enums = {
|
|
66
|
+
ImpactFeedbackStyle,
|
|
67
|
+
NotificationFeedbackType,
|
|
68
|
+
SelectionFeedbackType
|
|
69
|
+
};
|
|
70
|
+
const coreHandlers = {
|
|
71
|
+
impactAsync: handleImpactAsync,
|
|
72
|
+
notificationAsync: handleNotificationAsync,
|
|
73
|
+
selectionAsync: handleSelectionAsync
|
|
74
|
+
};
|
|
75
|
+
const noop = async () => void 0;
|
|
76
|
+
module.exports = new Proxy(enums, {
|
|
77
|
+
get(target, key) {
|
|
78
|
+
if (key in target) return target[key];
|
|
79
|
+
if (key in coreHandlers) return coreHandlers[key];
|
|
80
|
+
return noop;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=expo-haptics-stub.js.map
|
|
@@ -359,8 +359,10 @@ class EditorController {
|
|
|
359
359
|
if (!this.activeNode) return;
|
|
360
360
|
this.stopObservingActiveNode();
|
|
361
361
|
this.clearSiblingHighlights();
|
|
362
|
-
|
|
362
|
+
const node = this.activeNode;
|
|
363
|
+
removeActiveAttr(node);
|
|
363
364
|
this.activeNode = null;
|
|
365
|
+
node.remove();
|
|
364
366
|
postToParent("iframe-node-clear");
|
|
365
367
|
}
|
|
366
368
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "miaoda-expo-devkit",
|
|
3
|
-
"version": "0.1.1-beta.
|
|
3
|
+
"version": "0.1.1-beta.56",
|
|
4
4
|
"description": "Expo 应用开发工具集:Sentry DSN 替换 stub、错误/网络捕获、Metro 符号化",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"./expo-media-library-stub": "./dist/stubs/expo-media-library-stub.js",
|
|
49
49
|
"./expo-calendar-stub": "./dist/stubs/expo-calendar-stub.js",
|
|
50
50
|
"./expo-image-picker-stub": "./dist/stubs/expo-image-picker-stub.js",
|
|
51
|
+
"./expo-haptics-stub": "./dist/stubs/expo-haptics-stub.js",
|
|
51
52
|
"./rules/no-undeclared-expo-plugin": "./dist/rules/no-undeclared-expo-plugin.js",
|
|
52
53
|
"./rules/no-unused-expo-plugin": "./dist/rules/no-unused-expo-plugin.js",
|
|
53
54
|
"./rules/no-unstable-expo-router": "./dist/rules/no-unstable-expo-router.js",
|