@hai3/react 0.4.0-alpha.1 → 0.4.0-alpha.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/commands/hai3-new-component.md +16 -18
- package/commands/hai3-new-mfe.md +2 -3
- package/commands/hai3-new-screen.md +2 -3
- package/commands/hai3-new-screenset.md +3 -4
- package/dist/index.cjs +11 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,36 +2,35 @@
|
|
|
2
2
|
# hai3:new-component - Add New UI Component
|
|
3
3
|
|
|
4
4
|
## AI WORKFLOW (REQUIRED)
|
|
5
|
-
1) Check
|
|
5
|
+
1) Check for existing equivalent in project (e.g. components/ui/) and configured UI library first.
|
|
6
6
|
2) Gather requirements from user.
|
|
7
|
-
3)
|
|
8
|
-
4) Implement.
|
|
7
|
+
3) Implement.
|
|
9
8
|
|
|
10
|
-
## CHECK
|
|
11
|
-
- REQUIRED:
|
|
12
|
-
-
|
|
9
|
+
## CHECK EXISTING COMPONENTS FIRST
|
|
10
|
+
- REQUIRED: Read `hai3.config.json` to find the `uikit` value.
|
|
11
|
+
- If uikit is a third-party package (not `shadcn` or `none`): read its exports from `node_modules/<package>/` to check for existing components.
|
|
12
|
+
- REQUIRED: Before creating a new component, scan the project AND the configured UI library for existing equivalents.
|
|
13
|
+
- REQUIRED: Reuse existing components if equivalent exists.
|
|
13
14
|
|
|
14
15
|
## GATHER REQUIREMENTS
|
|
15
16
|
Ask user for:
|
|
16
17
|
- Component name (e.g., "DataTable", "ColorPicker").
|
|
17
|
-
- Component type: screenset composite (default) | screenset base (rare).
|
|
18
18
|
- Component description and props.
|
|
19
|
-
- If screenset base: justification why composite is insufficient.
|
|
20
19
|
|
|
21
20
|
## IF SCREENSET COMPONENT
|
|
22
21
|
|
|
23
22
|
### STEP 0: Determine Subfolder
|
|
24
|
-
-
|
|
25
|
-
-
|
|
23
|
+
- components/ui/: Base UI primitives (shadcn components or custom).
|
|
24
|
+
- screens/{screen}/components/: Screen-specific components.
|
|
25
|
+
- components/: Shared composites used across screens.
|
|
26
26
|
|
|
27
27
|
### STEP 1: Implementation
|
|
28
28
|
|
|
29
29
|
#### 1.1 Create Component
|
|
30
|
-
File: src/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
- Must be reusable within the
|
|
34
|
-
- NO @hai3/uicore imports (except types).
|
|
30
|
+
File: src/components/ui/{ComponentName}.tsx (base primitives)
|
|
31
|
+
or: src/screens/{screen}/components/{ComponentName}.tsx (screen-specific)
|
|
32
|
+
or: src/components/{ComponentName}.tsx (shared composites)
|
|
33
|
+
- Must be reusable within the MFE.
|
|
35
34
|
- NO Redux or state management.
|
|
36
35
|
- Accept value/onChange pattern for state.
|
|
37
36
|
|
|
@@ -43,8 +42,7 @@ Run: npm run arch:check && npm run dev
|
|
|
43
42
|
Test component in UI.
|
|
44
43
|
|
|
45
44
|
## RULES
|
|
46
|
-
- REQUIRED: Check
|
|
47
|
-
- REQUIRED: Screenset base components need strong justification.
|
|
45
|
+
- REQUIRED: Check existing project UI components first; create new only if missing.
|
|
48
46
|
- FORBIDDEN: Redux, business logic, side effects in components.
|
|
49
|
-
- FORBIDDEN: Inline styles outside
|
|
47
|
+
- FORBIDDEN: Inline styles outside components/ui/.
|
|
50
48
|
- REQUIRED: Accept value/onChange pattern for state.
|
package/commands/hai3-new-mfe.md
CHANGED
|
@@ -76,9 +76,8 @@ class Lifecycle extends ThemeAwareReactLifecycle {
|
|
|
76
76
|
const div = document.createElement('div');
|
|
77
77
|
shadowRoot.appendChild(div);
|
|
78
78
|
|
|
79
|
-
// Initialize Tailwind/UIKit styles
|
|
80
79
|
const style = document.createElement('style');
|
|
81
|
-
style.textContent = tailwindStyles;
|
|
80
|
+
style.textContent = tailwindStyles;
|
|
82
81
|
shadowRoot.appendChild(style);
|
|
83
82
|
|
|
84
83
|
// Render component
|
|
@@ -151,7 +150,7 @@ npm run dev:all
|
|
|
151
150
|
- Set `preview` script with `--port NNNN` for port auto-discovery
|
|
152
151
|
- Use mock data with useState for UI-only MFEs
|
|
153
152
|
- Keep MFE logic isolated and simple
|
|
154
|
-
- Use
|
|
153
|
+
- Use local components (e.g. components/ui/)
|
|
155
154
|
- Run `npm run generate:mfe-manifests` after creating the MFE
|
|
156
155
|
|
|
157
156
|
❌ **DON'T:**
|
|
@@ -30,9 +30,8 @@ Ask user for:
|
|
|
30
30
|
- STOP if MCP connection fails
|
|
31
31
|
|
|
32
32
|
## COMPONENT PLAN
|
|
33
|
-
- REQUIRED: Use
|
|
34
|
-
-
|
|
35
|
-
- uikit/composite/: screenset composites (theme tokens only)
|
|
33
|
+
- REQUIRED: Use local components (e.g. `components/ui/`) — no shared UI kit package.
|
|
34
|
+
- components/ui/: base UI primitives (shadcn components or custom)
|
|
36
35
|
- screens/{screen}/components/: screen-specific components
|
|
37
36
|
|
|
38
37
|
## DATA FLOW
|
|
@@ -36,10 +36,9 @@ Ask user for:
|
|
|
36
36
|
- STOP if MCP connection fails
|
|
37
37
|
|
|
38
38
|
## COMPONENT PLAN
|
|
39
|
-
- REQUIRED: Use
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
- components/: multi-screen components
|
|
39
|
+
- REQUIRED: Use local components (e.g. `components/ui/`) — no shared UI kit package.
|
|
40
|
+
- components/ui/: base UI primitives (shadcn components or custom)
|
|
41
|
+
- components/: multi-screen shared components
|
|
43
42
|
- screens/{screen}/components/: screen-specific components
|
|
44
43
|
|
|
45
44
|
## DATA FLOW
|
package/dist/index.cjs
CHANGED
|
@@ -81,13 +81,14 @@ __export(src_exports, {
|
|
|
81
81
|
createHAI3: () => import_framework6.createHAI3,
|
|
82
82
|
createHAI3App: () => import_framework6.createHAI3App,
|
|
83
83
|
createI18nRegistry: () => import_framework6.createI18nRegistry,
|
|
84
|
-
createShadowRoot: () =>
|
|
84
|
+
createShadowRoot: () => import_framework18.createShadowRoot,
|
|
85
85
|
createSlice: () => import_framework6.createSlice,
|
|
86
86
|
createStore: () => import_framework6.createStore,
|
|
87
87
|
createThemeRegistry: () => import_framework6.createThemeRegistry,
|
|
88
88
|
effects: () => import_framework6.effects,
|
|
89
89
|
eventBus: () => eventBus,
|
|
90
|
-
|
|
90
|
+
extensionScreenSchema: () => import_framework17.extensionScreenSchema,
|
|
91
|
+
extractGtsPackage: () => import_framework18.extractGtsPackage,
|
|
91
92
|
footerActions: () => import_framework6.footerActions,
|
|
92
93
|
footerSlice: () => import_framework6.footerSlice,
|
|
93
94
|
getLanguageMetadata: () => import_framework6.getLanguageMetadata,
|
|
@@ -101,11 +102,12 @@ __export(src_exports, {
|
|
|
101
102
|
i18nRegistry: () => import_framework6.i18nRegistry,
|
|
102
103
|
initMockEffects: () => import_framework6.initMockEffects,
|
|
103
104
|
initTenantEffects: () => import_framework6.initTenantEffects,
|
|
104
|
-
injectCssVariables: () =>
|
|
105
|
+
injectCssVariables: () => import_framework18.injectCssVariables,
|
|
105
106
|
isMockPlugin: () => import_framework6.isMockPlugin,
|
|
106
107
|
isRestShortCircuit: () => import_framework6.isRestShortCircuit,
|
|
107
108
|
isShortCircuit: () => import_framework6.isShortCircuit,
|
|
108
109
|
isSseShortCircuit: () => import_framework6.isSseShortCircuit,
|
|
110
|
+
languageSchema: () => import_framework17.languageSchema,
|
|
109
111
|
layout: () => import_framework6.layout,
|
|
110
112
|
layoutDomainReducers: () => import_framework6.layoutDomainReducers,
|
|
111
113
|
layoutReducer: () => import_framework6.layoutReducer,
|
|
@@ -165,6 +167,7 @@ __export(src_exports, {
|
|
|
165
167
|
tenantActions: () => import_framework6.tenantActions,
|
|
166
168
|
tenantReducer: () => import_framework6.tenantReducer,
|
|
167
169
|
tenantSlice: () => import_framework6.tenantSlice,
|
|
170
|
+
themeSchema: () => import_framework17.themeSchema,
|
|
168
171
|
themes: () => import_framework6.themes,
|
|
169
172
|
toggleMenu: () => import_framework6.toggleMenu,
|
|
170
173
|
toggleMockMode: () => import_framework6.toggleMockMode,
|
|
@@ -724,7 +727,8 @@ var import_framework15 = require("@hai3/framework");
|
|
|
724
727
|
var import_framework16 = require("@hai3/framework");
|
|
725
728
|
var import_framework17 = require("@hai3/framework");
|
|
726
729
|
var import_framework18 = require("@hai3/framework");
|
|
727
|
-
var
|
|
730
|
+
var import_framework19 = require("@hai3/framework");
|
|
731
|
+
var eventBus = import_framework19.eventBus;
|
|
728
732
|
// Annotate the CommonJS export names for ESM import in node:
|
|
729
733
|
0 && (module.exports = {
|
|
730
734
|
ACCOUNTS_DOMAIN,
|
|
@@ -794,6 +798,7 @@ var eventBus = import_framework18.eventBus;
|
|
|
794
798
|
createThemeRegistry,
|
|
795
799
|
effects,
|
|
796
800
|
eventBus,
|
|
801
|
+
extensionScreenSchema,
|
|
797
802
|
extractGtsPackage,
|
|
798
803
|
footerActions,
|
|
799
804
|
footerSlice,
|
|
@@ -813,6 +818,7 @@ var eventBus = import_framework18.eventBus;
|
|
|
813
818
|
isRestShortCircuit,
|
|
814
819
|
isShortCircuit,
|
|
815
820
|
isSseShortCircuit,
|
|
821
|
+
languageSchema,
|
|
816
822
|
layout,
|
|
817
823
|
layoutDomainReducers,
|
|
818
824
|
layoutReducer,
|
|
@@ -872,6 +878,7 @@ var eventBus = import_framework18.eventBus;
|
|
|
872
878
|
tenantActions,
|
|
873
879
|
tenantReducer,
|
|
874
880
|
tenantSlice,
|
|
881
|
+
themeSchema,
|
|
875
882
|
themes,
|
|
876
883
|
toggleMenu,
|
|
877
884
|
toggleMockMode,
|