@duke333/builder-ui 0.1.5 → 0.2.1

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
@@ -15,62 +15,43 @@ Use one frontend bind file:
15
15
  ```tsx
16
16
  "use client";
17
17
 
18
- import { createBuilderPortalIntegration } from "@duke333/builder-ui/integration";
18
+ import {
19
+ BuilderProvider,
20
+ createBuilderClient,
21
+ } from "@duke333/builder-ui";
22
+ import "@duke333/builder-ui/styles.css";
19
23
  import { api } from "@/lib/api/apiClient";
20
24
 
21
- export const builder = createBuilderPortalIntegration({
25
+ export const builderClient = createBuilderClient({
22
26
  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
27
  });
30
28
 
31
- export const {
32
- api: builderApi,
33
- hooks: builderHooks,
34
- routes: builderRoutes,
35
- adminPages,
36
- } = builder;
29
+ export function AppBuilderProvider({ children }: { children: React.ReactNode }) {
30
+ return <BuilderProvider client={builderClient}>{children}</BuilderProvider>;
31
+ }
37
32
  ```
38
33
 
39
- ## Route Example
34
+ ## Runtime Components
40
35
 
41
36
  ```tsx
42
- import { adminPages } from "@/features/builder/builder.config";
37
+ import { BuilderForm, BuilderGrid, BuilderView } from "@duke333/builder-ui";
43
38
 
44
39
  export default function Page() {
45
- const Component = adminPages?.AdminFormsPage;
46
- return Component ? <Component /> : null;
40
+ return <BuilderView viewId="orders-view-id" />;
47
41
  }
48
42
  ```
49
43
 
50
- ## Runtime Component Example
51
-
52
- ```tsx
53
- import { createDynamicViewComponent } from "@duke333/builder-ui/components";
54
- import { builderHooks } from "@/features/builder/builder.config";
55
-
56
- export const DynamicView = createDynamicViewComponent({
57
- hooks: builderHooks,
58
- notifications,
59
- });
60
- ```
61
-
62
- Use:
44
+ The ready components are:
63
45
 
64
- - `DynamicForm` for form-only write flow
65
- - `DynamicList` for list-only read flow
66
- - `DynamicView` for full CRUD flow
46
+ - `BuilderForm` for form-only write flow
47
+ - `BuilderGrid` for list-only read flow
48
+ - `BuilderView` for full CRUD flow
67
49
 
68
- Runtime form schemas expose `presentation: "dialog" | "drawer"`. The injected main-form and
69
- subform `DialogShell` components receive that value and choose the matching host UI shell.
50
+ They own fetching, fields, validation, search, sort, pagination, CRUD, Dialog/Drawer, subforms,
51
+ loading, empty, errors, focus restoration, and row action isolation. Runtime form schemas expose
52
+ `presentation: "dialog" | "drawer"`; no host shell mapping is required.
70
53
 
71
- When binding a data grid, forward the row click event through `onRowClick(row, event)`. Action
72
- buttons should pass their click event to `actions.onEdit(row, event)` or
73
- `actions.onDelete(row, event)` so an action click cannot also open the row editor.
54
+ The existing `createDynamic*Component` factories remain available as the advanced headless API.
74
55
 
75
56
  ## Validation
76
57
 
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  // src/admin/editorState.ts
2
4
  var BUILDER_EDITOR_NONE_VALUE = "__none";
3
5
  function builderEditorOptionsToText(options) {