@duke333/builder-ui 0.1.0 → 0.1.3

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/README.md CHANGED
@@ -1,85 +1,73 @@
1
1
  # @duke333/builder-ui
2
2
 
3
- Frontend талын builder package. Энэ package нь dynamic form/list/view runtime logic,
4
- builder admin factory components, API client factory, React Query hook factory-уудыг
5
- эзэмшинэ.
3
+ React Builder package for admin screens and runtime form/list/view UI.
6
4
 
7
- ## Workspace Development
8
-
9
- This repository uses the package as a workspace dependency:
10
-
11
- ```json
12
- {
13
- "dependencies": {
14
- "@duke333/builder-ui": "workspace:*"
15
- }
16
- }
17
- ```
18
-
19
- Ажиллуулах:
5
+ ## Install
20
6
 
21
7
  ```bash
22
- pnpm install
23
- pnpm build
24
- pnpm typecheck
25
- pnpm test:run
8
+ pnpm add @duke333/builder-ui
26
9
  ```
27
10
 
28
- ## Хэрэглэх
11
+ ## One File Setup
29
12
 
30
- Host app дээр package factory-уудыг host wrapper component болгон угсарна:
13
+ Use one frontend bind file:
31
14
 
32
- ```text
33
- src/features/builder/api.ts
34
- src/features/builder/hooks/useBuilder.ts
35
- src/features/builder/components/DynamicForm.tsx
36
- src/features/builder/components/DynamicList.tsx
37
- src/features/builder/components/DynamicView.tsx
15
+ ```tsx
16
+ "use client";
17
+
18
+ import { createBuilderPortalIntegration } from "@duke333/builder-ui/integration";
19
+ import { api } from "@/lib/api/apiClient";
20
+
21
+ export const builder = createBuilderPortalIntegration({
22
+ transport: api,
23
+ adminBasePath: "/admin/dev/builder",
24
+ runtimeBasePath: "/admin/winu",
25
+ adminPages: {
26
+ permissionOptions: [{ value: "org:manage", label: "org:manage" }],
27
+ defaultPermission: "org:manage",
28
+ },
29
+ });
30
+
31
+ export const {
32
+ api: builderApi,
33
+ hooks: builderHooks,
34
+ routes: builderRoutes,
35
+ adminPages,
36
+ } = builder;
38
37
  ```
39
38
 
40
- App page дээр wrapper-уудыг ашиглана:
39
+ ## Route Example
41
40
 
42
41
  ```tsx
43
- import { DynamicView } from "../features/builder/components/DynamicView";
42
+ import { adminPages } from "@/features/builder/builder.config";
44
43
 
45
- export default function RuntimePage() {
46
- return <DynamicView viewId="..." />;
44
+ export default function Page() {
45
+ const Component = adminPages?.AdminFormsPage;
46
+ return Component ? <Component /> : null;
47
47
  }
48
48
  ```
49
49
 
50
- Дангаар нь дуудах contract:
50
+ ## Runtime Component Example
51
51
 
52
52
  ```tsx
53
- <DynamicForm formId="..." />
54
- <DynamicList listId="..." />
55
- <DynamicView viewId="..." />
56
- ```
57
-
58
- `DynamicView` нь form + list нийлсэн CRUD screen. Харин зөвхөн form эсвэл зөвхөн
59
- grid/list хэрэгтэй бол `DynamicForm`, `DynamicList`-ийг шууд ашиглана.
53
+ import { createDynamicViewComponent } from "@duke333/builder-ui/components";
54
+ import { builderHooks } from "@/features/builder/builder.config";
60
55
 
61
- ## Host UI Adapter
62
-
63
- Package нь shadcn/ui-г шууд эзэмшихгүй. Host app өөрийн Button, Dialog, DataGrid,
64
- form renderer зэрэг design-system component-уудаа adapter-аар өгнө. Ингэснээр portal
65
- энгийн shadcn app хэвээр, builder нь нэмэлт reusable layer хэвээр үлдэнэ.
66
-
67
- ## Publish / Update
68
-
69
- Publish after `@duke333/builder-contracts` and `@duke333/builder-backend` are available in the
70
- target registry. The package is configured for public npm publishing.
56
+ export const DynamicView = createDynamicViewComponent({
57
+ hooks: builderHooks,
58
+ notifications,
59
+ });
60
+ ```
71
61
 
72
- External portal project дээр:
62
+ Use:
73
63
 
74
- ```bash
75
- pnpm add @duke333/builder-ui
76
- ```
64
+ - `DynamicForm` for form-only write flow
65
+ - `DynamicList` for list-only read flow
66
+ - `DynamicView` for full CRUD flow
77
67
 
78
- Update:
68
+ ## Validation
79
69
 
80
70
  ```bash
81
- pnpm update @duke333/builder-ui
71
+ pnpm typecheck
72
+ pnpm test:run
82
73
  ```
83
-
84
- Package нь `dist` output publish хийнэ. `prepack` нь publish/pack хийхээс өмнө
85
- `pnpm build` ажиллуулна.