@apps-in-toss/framework 0.0.0-dev.1736241821988 → 0.0.2

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 CHANGED
@@ -187,7 +187,7 @@
187
187
  same "printed page" as the copyright notice for easier
188
188
  identification within third-party archives.
189
189
 
190
- Copyright 2024 Viva Republica, Inc
190
+ Copyright 2025 Viva Republica, Inc
191
191
 
192
192
  Licensed under the Apache License, Version 2.0 (the "License");
193
193
  you may not use this file except in compliance with the License.
@@ -199,4 +199,4 @@
199
199
  distributed under the License is distributed on an "AS IS" BASIS,
200
200
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
201
  See the License for the specific language governing permissions and
202
- limitations under the License.
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
- # @apps-in-toss/cli-commands
1
+ # @apps-in-toss/framework
2
2
 
3
- CLI presets package for Apps In Toss.
3
+ Hub package for Apps In Toss
4
4
 
5
5
  ## License
6
6
 
7
7
  This software is licensed under the [Apache 2 license](LICENSE), quoted below.
8
8
 
9
9
  ```
10
- Copyright 2024 Viva Republica, Inc
10
+ Copyright 2025 Viva Republica, Inc
11
11
 
12
12
  Licensed under the Apache License, Version 2.0 (the "License");
13
13
  you may not use this file except in compliance with the License.
package/dist/index.d.ts CHANGED
@@ -1 +1,75 @@
1
- export {};
1
+ /**
2
+ * @public
3
+ * @tag AppsInTossModule
4
+ * @category AppsInTossModules
5
+ * @kind function
6
+ * @name setClipboardText
7
+ * @description 텍스트를 클립보드에 복사해서 사용자가 다른 곳에 붙여 넣기 할 수 있어요.
8
+ * @param {Promise<void>} text - 클립보드에 복사할 텍스트예요. 문자열 형식으로 입력해요.
9
+ *
10
+ * @example
11
+ * ### 텍스트를 클립보드에 복사하기
12
+ *
13
+ * ```tsx
14
+ * import { Button } from 'react-native';
15
+ * import { setClipboardText } from '@apps-in-toss/framework';
16
+ *
17
+ * // '복사' 버튼을 누르면 "복사할 텍스트"가 클립보드에 복사돼요.
18
+ * function CopyButton() {
19
+ * const handleCopy = async () => {
20
+ * try {
21
+ * await setClipboardText('복사할 텍스트');
22
+ * console.log('텍스트가 복사됐어요!');
23
+ * } catch (error) {
24
+ * console.error('텍스트 복사에 실패했어요:', error);
25
+ * }
26
+ * };
27
+ *
28
+ * return <Button title="복사" onPress={handleCopy} />;
29
+ * }
30
+ * ```
31
+ */
32
+ declare function setClipboardText(text: string): Promise<void>;
33
+
34
+ /**
35
+ * @public
36
+ * @tag AppsInTossModule
37
+ * @category AppsInTossModules
38
+ * @kind function
39
+ * @name getClipboardText
40
+ * @description 클립보드에 저장된 텍스트를 가져오는 함수예요. 복사된 텍스트를 읽어서 다른 작업에 활용할 수 있어요.
41
+ * @returns {Promise<string>} - 클립보드에 저장된 텍스트를 반환해요. 클립보드에 텍스트가 없으면 빈 문자열을 반환해요.
42
+ *
43
+ * @example
44
+ * ### 클립보드의 텍스트 가져오기
45
+ *
46
+ * ```tsx
47
+ * import React, { useState } from 'react';
48
+ * import { View, Text, Button } from 'react-native';
49
+ * import { getClipboardText } from '@apps-in-toss/framework';
50
+ *
51
+ * // '붙여넣기' 버튼을 누르면 클립보드에 저장된 텍스트를 가져와 화면에 표시해요.
52
+ * function PasteButton() {
53
+ * const [text, setText] = useState('');
54
+ *
55
+ * const handlePress = async () => {
56
+ * try {
57
+ * const clipboardText = await getClipboardText();
58
+ * setText(clipboardText || '클립보드에 텍스트가 없어요.');
59
+ * } catch (error) {
60
+ * console.error('클립보드에서 텍스트를 가져오지 못했어요:', error);
61
+ * }
62
+ * };
63
+ *
64
+ * return (
65
+ * <View>
66
+ * <Text>{text}</Text>
67
+ * <Button title="붙여넣기" onPress={handlePress} />
68
+ * </View>
69
+ * );
70
+ * }
71
+ * ```
72
+ */
73
+ declare function getClipboardText(): Promise<string>;
74
+
75
+ export { getClipboardText, setClipboardText };
package/dist/index.js CHANGED
@@ -1,4 +1,75 @@
1
1
  "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2
19
 
3
20
  // src/index.ts
4
- throw new Error("not implemented");
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ getClipboardText: () => getClipboardText,
24
+ setClipboardText: () => setClipboardText
25
+ });
26
+ module.exports = __toCommonJS(src_exports);
27
+
28
+ // src/native-modules/AppsInTossModule.ts
29
+ var import_react_native = require("react-native");
30
+ var AppsInTossModule = import_react_native.NativeModules.AppsInTossModule;
31
+
32
+ // src/native-modules/getPermission.ts
33
+ function getPermission(permission) {
34
+ return AppsInTossModule.getPermission(permission);
35
+ }
36
+
37
+ // src/native-modules/openPermissionDialog.ts
38
+ function openPermissionDialog(permission) {
39
+ return AppsInTossModule.openPermissionDialog(permission);
40
+ }
41
+
42
+ // src/native-modules/requestPermission.ts
43
+ async function requestPermission(permission) {
44
+ const permissionStatus = await getPermission(permission);
45
+ switch (permissionStatus) {
46
+ case "allowed":
47
+ case "denied":
48
+ return permissionStatus;
49
+ default:
50
+ return openPermissionDialog(permission);
51
+ }
52
+ }
53
+
54
+ // src/native-modules/setClipboardText.ts
55
+ async function setClipboardText(text) {
56
+ const permissionStatus = await requestPermission({ name: "clipboard", access: "write" });
57
+ if (permissionStatus === "denied") {
58
+ throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
59
+ }
60
+ return AppsInTossModule.setClipboardText({ text });
61
+ }
62
+
63
+ // src/native-modules/getClipboardText.ts
64
+ async function getClipboardText() {
65
+ const permissionStatus = await requestPermission({ name: "clipboard", access: "read" });
66
+ if (permissionStatus === "denied") {
67
+ throw new Error("\uD074\uB9BD\uBCF4\uB4DC \uC77D\uAE30 \uAD8C\uD55C\uC774 \uAC70\uBD80\uB418\uC5C8\uC5B4\uC694.");
68
+ }
69
+ return AppsInTossModule.getClipboardText({});
70
+ }
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ getClipboardText,
74
+ setClipboardText
75
+ });
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@apps-in-toss/framework",
3
- "version": "0.0.0-dev.1736241821988",
3
+ "version": "0.0.2",
4
4
  "description": "Hub package for Apps In Toss",
5
5
  "scripts": {
6
6
  "prepack": "yarn build",
7
7
  "typecheck": "tsc --noEmit",
8
8
  "lint": "eslint .",
9
- "build": "bedrock-tools build --format cjs"
9
+ "build": "tsup src/index.ts src/cli-presets.ts --format cjs --dts"
10
10
  },
11
11
  "main": "./dist/index.js",
12
12
  "types": "./dist/index.d.ts",
@@ -27,13 +27,13 @@
27
27
  "dist/**/*.d.ts"
28
28
  ],
29
29
  "dependencies": {
30
- "@apps-in-toss/cli-presets": "0.0.0-dev.1736241821988"
30
+ "@apps-in-toss/cli-presets": "0.0.2"
31
31
  },
32
32
  "devDependencies": {
33
- "@react-native-bedrock/tools": "0.0.0-dev.1736241821988",
34
33
  "eslint": "^9.7.0",
35
34
  "react": "18.2.0",
36
35
  "react-native": "0.72.6",
36
+ "tsup": "^8.3.5",
37
37
  "typescript": "4.9.5"
38
38
  },
39
39
  "peerDependencies": {
@@ -44,5 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "9d18d2607f91268a3d80d74ddd88fb7300567d6c"
47
+ "gitHead": "9212d74bccf4ba3ff3940ae45b59fb64c9092e9c"
48
48
  }