@apps-in-toss/web-framework 0.0.0-dev.1739416338672 → 0.0.0-dev.1740740040772

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.
@@ -0,0 +1,15 @@
1
+ import * as _react_native_bedrock_cli from '@react-native-bedrock/cli';
2
+ import { Permission } from '@apps-in-toss/framework/plugins';
3
+ import { BedrockPlugin } from 'react-native-bedrock/config';
4
+
5
+ interface AppsInTossWebPluginOptions {
6
+ port: number;
7
+ commands: {
8
+ dev: string;
9
+ build: string;
10
+ };
11
+ permissions: Permission[];
12
+ }
13
+ declare function appsInTossWeb(options: AppsInTossWebPluginOptions): (BedrockPlugin | (_react_native_bedrock_cli.BedrockPluginCore | Promise<_react_native_bedrock_cli.BedrockPluginCore>)[])[];
14
+
15
+ export { type AppsInTossWebPluginOptions, appsInTossWeb };
@@ -0,0 +1,15 @@
1
+ import * as _react_native_bedrock_cli from '@react-native-bedrock/cli';
2
+ import { Permission } from '@apps-in-toss/framework/plugins';
3
+ import { BedrockPlugin } from 'react-native-bedrock/config';
4
+
5
+ interface AppsInTossWebPluginOptions {
6
+ port: number;
7
+ commands: {
8
+ dev: string;
9
+ build: string;
10
+ };
11
+ permissions: Permission[];
12
+ }
13
+ declare function appsInTossWeb(options: AppsInTossWebPluginOptions): (BedrockPlugin | (_react_native_bedrock_cli.BedrockPluginCore | Promise<_react_native_bedrock_cli.BedrockPluginCore>)[])[];
14
+
15
+ export { type AppsInTossWebPluginOptions, appsInTossWeb };
@@ -0,0 +1,11 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ appsInTossWeb,
4
+ init_esm_shims
5
+ } from "../chunk-LJBVSTWE.js";
6
+
7
+ // src/plugins/index.ts
8
+ init_esm_shims();
9
+ export {
10
+ appsInTossWeb
11
+ };
@@ -0,0 +1,34 @@
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
+ *
15
+ * import { setClipboardText } from '@apps-in-toss/web-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 <input type="button" value="복사" onClick={handleCopy} />;
29
+ * }
30
+ * ```
31
+ */
32
+ export declare function setClipboardText(text: string): Promise<void>;
33
+
34
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,151 @@
1
+
2
+
3
+ export interface EventEmitterSchema<K extends string, P extends unknown[]> {
4
+ name: K;
5
+ params: P;
6
+ }
7
+ declare enum Accuracy {
8
+ /**
9
+ * 오차범위 3KM 이내
10
+ */
11
+ Lowest = 1,
12
+ /**
13
+ * 오차범위 1KM 이내
14
+ */
15
+ Low,
16
+ /**
17
+ * 오차범위 몇 백미터 이내
18
+ */
19
+ Balanced,
20
+ /**
21
+ * 오차범위 10M 이내
22
+ */
23
+ High,
24
+ /**
25
+ * 가장 높은 정확도
26
+ */
27
+ Highest,
28
+ /**
29
+ * 네비게이션을 위한 최고 정확도
30
+ */
31
+ BestForNavigation
32
+ }
33
+ export interface Location {
34
+ /**
35
+ * Android에서만 지원하는 옵션이에요.
36
+ *
37
+ * - `FINE`: 정확한 위치
38
+ * - `COARSE`: 대략적인 위치
39
+ *
40
+ * @see https://developer.android.com/codelabs/approximate-location
41
+ */
42
+ accessLocation?: "FINE" | "COARSE";
43
+ /**
44
+ * 위치가 업데이트된 시점의 유닉스 타임스탬프예요.
45
+ */
46
+ timestamp: number;
47
+ coords: {
48
+ latitude: number; // 위도
49
+ longitude: number; // 경도
50
+ altitude: number; // 높이
51
+ accuracy: number; // 위치 정확도 (미터)
52
+ altitudeAccuracy: number; // 고도 정확도 (미터)
53
+ heading: number; // 방향 (북: 0°, 동: 90°, 남: 180°, 서: 270°)
54
+ };
55
+ }
56
+ export interface StartUpdateLocationOptions {
57
+ /**
58
+ * 위치 정확도를 설정해요.
59
+ */
60
+ accuracy: Accuracy;
61
+ /**
62
+ * 위치 업데이트 주기를 밀리초(ms) 단위로 설정해요.
63
+ */
64
+ timeInterval: number;
65
+ /**
66
+ * 위치 변경 거리를 미터(m) 단위로 설정해요.
67
+ */
68
+ distanceInterval: number;
69
+ }
70
+ export interface StartUpdateLocationSubscription extends EmitterSubscription {
71
+ remove: () => Promise<void>;
72
+ }
73
+ /**
74
+ * @name UpdateLocationEventEmitter
75
+ * @kind typedef
76
+ * @description
77
+ * 디바이스의 위치 정보 변경을 감지해요
78
+ * @extends {EventEmitterSchema<'updateLocation', [Location]>}
79
+ */
80
+ export interface UpdateLocationEventEmitter extends EventEmitterSchema<"updateLocation", [
81
+ Location
82
+ ]> {
83
+ }
84
+ /**
85
+ * @public
86
+ * @tag AppsInTossModule
87
+ * @category AppsInTossModules
88
+ * @kind function
89
+ * @name startUpdateLocation
90
+ * @description 디바이스의 위치 정보를 지속적으로 감지하고, 위치가 변경되면 콜백을 실행하는 함수예요. 콜백 함수를 등록하면 위치가 변경될 때마다 자동으로 호출돼요.
91
+ * 실시간 위치 추적이 필요한 기능을 구현할 때 사용할 수 있어요. 예를 들어 지도 앱에서 사용자의 현재 위치를 실시간으로 업데이트할 때, 운동 앱에서 사용자의 이동 거리를 기록할 때 등이에요.
92
+ * 위치 업데이트 주기와 정확도를 조정해 배터리 소모를 최소화하면서도 필요한 정보를 얻을 수 있어요.
93
+ *
94
+ * @param {StartUpdateLocationOptions} options - 위치 정보 감지에 필요한 설정 객체에요.
95
+ * @param {number} [options.accuracy] 위치 정확도를 설정해요.
96
+ * @param {number} [options.timeInterval] 위치 정보를 업데이트하는 최소 주기로, 단위는 밀리초(ms)예요. 이 값은 위치 업데이트가 발생하는 가장 짧은 간격을 설정하지만, 시스템이나 환경의 영향을 받아 지정한 주기보다 더 긴 간격으로 업데이트될 수 있어요.
97
+ * @param {number} [options.distanceInterval] 위치 변경 거리를 미터(m) 단위로 설정해요.
98
+ * @param {(location: Location) => void} [options.callback] 위치 정보가 변경될 때 호출되는 콜백 함수예요.
99
+ *
100
+ * @example
101
+ * ### 위치 정보 변경 감지하기
102
+ *
103
+ * ```tsx
104
+ * import React, { useState, useEffect } from 'react';
105
+ *
106
+ * import { startUpdateLocation } from '@apps-in-toss/web-framework';
107
+ *
108
+ * // 위치 정보 변경 감지하기
109
+ * function LocationWatcher() {
110
+ * const [location, setLocation] = useState(null);
111
+ *
112
+ * useEffect(() => {
113
+ * return startUpdateLocation({
114
+ * options: {
115
+ * accuracy: Accuracy.Default,
116
+ * timeInterval: 3000,
117
+ * distanceInterval: 10,
118
+ * },
119
+ * onEvent: (location) => {
120
+ * setLocation(location);
121
+ * },
122
+ * onError: (error) => {
123
+ * console.error('위치 정보를 가져오는데 실패했어요:', error);
124
+ * },
125
+ * });
126
+ * }, []);
127
+ *
128
+ * if (location == null) {
129
+ * return <span>위치 정보를 가져오는 중이에요...</span>;
130
+ * }
131
+ *
132
+ * return (
133
+ * <div>
134
+ * <span>위도: {location.coords.latitude}</span>
135
+ * <span>경도: {location.coords.longitude}</span>
136
+ * <span>위치 정확도: {location.coords.accuracy}m</span>
137
+ * <span>높이: {location.coords.altitude}m</span>
138
+ * <span>고도 정확도: {location.coords.altitudeAccuracy}m</span>
139
+ * <span>방향: {location.coords.heading}°</span>
140
+ * </div>
141
+ * );
142
+ * }
143
+ * ```
144
+ */
145
+ export declare function startUpdateLocation(eventParams: {
146
+ onEvent: (response: Location) => void;
147
+ onError: (error: unknown) => void;
148
+ options: StartUpdateLocationOptions;
149
+ }): () => void;
150
+
151
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apps-in-toss/web-framework",
3
3
  "type": "module",
4
- "version": "0.0.0-dev.1739416338672",
4
+ "version": "0.0.0-dev.1740740040772",
5
5
  "description": "Web Framework for Apps In Toss",
6
6
  "scripts": {
7
7
  "prepack": "yarn build",
@@ -9,37 +9,48 @@
9
9
  "lint": "eslint .",
10
10
  "build": "tsup"
11
11
  },
12
- "types": "./dist/index.d.ts",
13
12
  "main": "./dist/index.cjs",
14
13
  "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
15
  "exports": {
16
16
  ".": {
17
17
  "types": "./dist/index.d.ts",
18
18
  "import": "./dist/index.js",
19
19
  "require": "./dist/index.cjs"
20
20
  },
21
+ "./config": {
22
+ "types": "./dist/config/index.d.ts",
23
+ "import": "./dist/config/index.js",
24
+ "require": "./dist/config/index.cjs"
25
+ },
21
26
  "./package.json": "./package.json"
22
27
  },
23
28
  "bin": {
24
- "ait": "./bin.js"
29
+ "ait": "./ait.js",
30
+ "bedrock": "./bin.js"
25
31
  },
26
32
  "files": [
27
33
  "dist",
34
+ "bin.js",
35
+ "config.d.ts",
28
36
  "react-native"
29
37
  ],
30
38
  "devDependencies": {
39
+ "@react-native-bedrock/bridgepack": "^0.0.0-dev.1740740040772",
31
40
  "@types/babel__core": "^7.20.5",
32
41
  "@types/debug": "^4",
33
42
  "@types/node": "^22.10.2",
34
- "@types/yauzl": "^2.10.3",
35
43
  "eslint": "^9.7.0",
44
+ "execa": "^9.5.2",
45
+ "find-up": "^7.0.0",
36
46
  "tsup": "^8.3.5",
37
47
  "typescript": "4.9.5",
38
48
  "vitest": "^3.0.5"
39
49
  },
40
50
  "dependencies": {
41
- "@apps-in-toss/babel-plugin-json": "0.0.0-dev.1739416338672",
42
- "@apps-in-toss/framework": "0.0.0-dev.1739416338672",
51
+ "@apps-in-toss/babel-plugin-json": "0.0.0-dev.1740740040772",
52
+ "@apps-in-toss/cli": "0.0.0-dev.1740740040772",
53
+ "@apps-in-toss/framework": "0.0.0-dev.1740740040772",
43
54
  "@babel/core": "7.23.9",
44
55
  "@babel/plugin-proposal-class-properties": "^7.16.7",
45
56
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
@@ -52,26 +63,18 @@
52
63
  "@babel/preset-react": "^7.16.7",
53
64
  "@babel/preset-typescript": "^7.16.7",
54
65
  "@babel/runtime": "7.18.9",
55
- "@clack/prompts": "^0.10.0",
56
- "@react-native-bedrock/mpack-next": "0.0.0-dev.1739416149790",
57
- "@react-native-bedrock/native": "0.0.0-dev.1739416149790",
66
+ "@react-native-bedrock/mpack-next": "0.0.0-dev.1740739857744",
67
+ "@react-native-bedrock/native": "0.0.0-dev.1740739857744",
58
68
  "@types/react": "18.3.3",
59
- "clipanion": "^4.0.0-rc.4",
60
- "cosmiconfig": "^9.0.0",
61
- "cosmiconfig-typescript-loader": "^5.1.0",
62
- "debug": "^4.4.0",
63
69
  "es-toolkit": "^1.32.0",
64
- "execa": "^9.5.2",
65
70
  "picocolors": "^1.1.1",
66
71
  "react": "18.2.0",
67
72
  "react-native": "0.72.6",
68
- "react-native-bedrock": "0.0.0-dev.1739416149790",
69
- "yaml": "^2.7.0",
70
- "yauzl": "^3.2.0",
73
+ "react-native-bedrock": "0.0.0-dev.1740739857744",
71
74
  "zod": "^3.24.1"
72
75
  },
73
76
  "publishConfig": {
74
77
  "access": "public"
75
78
  },
76
- "gitHead": "5c24130807211edbfa1c82bac88039112fa319c3"
79
+ "gitHead": "bf62e2a7b092e720e9e14a9e3ef80891bf0cf2bc"
77
80
  }
@@ -1,5 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-require-imports */
2
- /* eslint-disable @typescript-eslint/no-var-requires */
3
1
  module.exports = {
4
2
  reactNativePath: require('path').dirname(require.resolve('react-native/package.json')),
5
3
  };
@@ -1,52 +0,0 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
- // ../../.yarn/__virtual__/tsup-virtual-dfda26f750/0/cache/tsup-npm-8.3.5-ed25596739-7794953cbc.zip/node_modules/tsup/assets/esm_shims.js
9
- import { fileURLToPath } from "url";
10
- import path from "path";
11
- var getFilename = () => fileURLToPath(import.meta.url);
12
- var getDirname = () => path.dirname(getFilename());
13
- var __dirname = /* @__PURE__ */ getDirname();
14
-
15
- // src/defineConfig.ts
16
- import { z } from "zod";
17
- var AppsInTossConfigSchema = z.object({
18
- appName: z.string(),
19
- web: z.object({
20
- port: z.number(),
21
- commands: z.object({
22
- dev: z.string(),
23
- build: z.string()
24
- })
25
- })
26
- });
27
- var defineConfig = (config) => {
28
- return AppsInTossConfigSchema.parse(config);
29
- };
30
-
31
- // src/loadConfig.ts
32
- import { cosmiconfig } from "cosmiconfig";
33
- import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
34
- var loadConfig = async () => {
35
- const explorer = cosmiconfig("apps-in-toss", {
36
- searchPlaces: ["apps-in-toss.config.web.ts", "apps-in-toss.config.web.mts"],
37
- loaders: {
38
- ".ts": TypeScriptLoader(),
39
- ".mts": TypeScriptLoader()
40
- }
41
- });
42
- const result = await explorer.search(process.cwd());
43
- const config = defineConfig(result?.config ?? {});
44
- return config;
45
- };
46
-
47
- export {
48
- __require,
49
- __dirname,
50
- defineConfig,
51
- loadConfig
52
- };
@@ -1,53 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
3
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
4
- }) : x)(function(x) {
5
- if (typeof require !== "undefined") return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
-
9
- // ../../.yarn/__virtual__/tsup-virtual-dfda26f750/0/cache/tsup-npm-8.3.5-ed25596739-7794953cbc.zip/node_modules/tsup/assets/esm_shims.js
10
- import { fileURLToPath } from "url";
11
- import path from "path";
12
- var getFilename = () => fileURLToPath(import.meta.url);
13
- var getDirname = () => path.dirname(getFilename());
14
- var __dirname = /* @__PURE__ */ getDirname();
15
-
16
- // src/defineConfig.ts
17
- import { z } from "zod";
18
- var AppsInTossConfigSchema = z.object({
19
- appName: z.string(),
20
- web: z.object({
21
- port: z.number(),
22
- commands: z.object({
23
- dev: z.string(),
24
- build: z.string()
25
- })
26
- })
27
- });
28
- var defineConfig = (config) => {
29
- return AppsInTossConfigSchema.parse(config);
30
- };
31
-
32
- // src/loadConfig.ts
33
- import { cosmiconfig } from "cosmiconfig";
34
- import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
35
- var loadConfig = async () => {
36
- const explorer = cosmiconfig("apps-in-toss", {
37
- searchPlaces: ["apps-in-toss.config.web.ts", "apps-in-toss.config.web.mts"],
38
- loaders: {
39
- ".ts": TypeScriptLoader(),
40
- ".mts": TypeScriptLoader()
41
- }
42
- });
43
- const result = await explorer.search(process.cwd());
44
- const config = defineConfig(result?.config ?? {});
45
- return config;
46
- };
47
-
48
- export {
49
- __require,
50
- __dirname,
51
- defineConfig,
52
- loadConfig
53
- };