create-ec-app 1.2.0 → 1.4.0
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 +87 -0
- package/dist/index.js +115 -2
- package/dist/index.js.map +1 -1
- package/dist/pcf.d.ts.map +1 -1
- package/dist/pcf.js +82 -0
- package/dist/pcf.js.map +1 -1
- package/package.json +3 -1
- package/scripts/check-generated-css-scope.mjs +61 -0
- package/templates/base/package-lock.json +713 -1466
- package/templates/base/package.json +19 -19
- package/templates/base/src/App.tsx +1 -1
- package/templates/base/src/index.css +4 -1
- package/templates/base/src/main.tsx +4 -1
- package/templates/base/src/runtime/EcAppShell.tsx +29 -0
- package/templates/base/tsconfig.app.json +0 -1
- package/templates/base/tsconfig.json +1 -2
- package/templates/pcf/base/README.md +13 -0
- package/templates/pcf/base/index.ts +9 -3
- package/templates/pcf/base/package-lock.json +7290 -0
- package/templates/pcf/base/package.json +3 -3
- package/templates/targets/power-pages/src/App.patch.tsx +1 -1
- package/templates/targets/swa/package.patch.json +1 -1
- package/templates/targets/webresource/README.md +7 -6
- package/templates/ui/kendo/package.patch.json +2 -2
- package/templates/ui/kendo/src/main.patch.tsx +4 -1
- package/templates/ui/shadcn-ui/components.json +5 -2
- package/templates/ui/shadcn-ui/package.patch.json +4 -41
- package/templates/ui/shadcn-ui/src/index.patch.css +27 -9
- package/templates/ui/shadcn-ui/src/components/ui/accordion.tsx +0 -64
- package/templates/ui/shadcn-ui/src/components/ui/alert-dialog.tsx +0 -155
- package/templates/ui/shadcn-ui/src/components/ui/alert.tsx +0 -66
- package/templates/ui/shadcn-ui/src/components/ui/aspect-ratio.tsx +0 -11
- package/templates/ui/shadcn-ui/src/components/ui/avatar.tsx +0 -51
- package/templates/ui/shadcn-ui/src/components/ui/badge.tsx +0 -46
- package/templates/ui/shadcn-ui/src/components/ui/breadcrumb.tsx +0 -109
- package/templates/ui/shadcn-ui/src/components/ui/button-group.tsx +0 -83
- package/templates/ui/shadcn-ui/src/components/ui/button.tsx +0 -60
- package/templates/ui/shadcn-ui/src/components/ui/calendar.tsx +0 -216
- package/templates/ui/shadcn-ui/src/components/ui/card.tsx +0 -92
- package/templates/ui/shadcn-ui/src/components/ui/carousel.tsx +0 -239
- package/templates/ui/shadcn-ui/src/components/ui/chart.tsx +0 -357
- package/templates/ui/shadcn-ui/src/components/ui/checkbox.tsx +0 -32
- package/templates/ui/shadcn-ui/src/components/ui/collapsible.tsx +0 -31
- package/templates/ui/shadcn-ui/src/components/ui/command.tsx +0 -182
- package/templates/ui/shadcn-ui/src/components/ui/context-menu.tsx +0 -252
- package/templates/ui/shadcn-ui/src/components/ui/dialog.tsx +0 -141
- package/templates/ui/shadcn-ui/src/components/ui/drawer.tsx +0 -135
- package/templates/ui/shadcn-ui/src/components/ui/dropdown-menu.tsx +0 -255
- package/templates/ui/shadcn-ui/src/components/ui/empty.tsx +0 -104
- package/templates/ui/shadcn-ui/src/components/ui/field.tsx +0 -246
- package/templates/ui/shadcn-ui/src/components/ui/form.tsx +0 -167
- package/templates/ui/shadcn-ui/src/components/ui/hover-card.tsx +0 -44
- package/templates/ui/shadcn-ui/src/components/ui/input-group.tsx +0 -170
- package/templates/ui/shadcn-ui/src/components/ui/input-otp.tsx +0 -75
- package/templates/ui/shadcn-ui/src/components/ui/input.tsx +0 -21
- package/templates/ui/shadcn-ui/src/components/ui/item.tsx +0 -193
- package/templates/ui/shadcn-ui/src/components/ui/kbd.tsx +0 -28
- package/templates/ui/shadcn-ui/src/components/ui/label.tsx +0 -24
- package/templates/ui/shadcn-ui/src/components/ui/menubar.tsx +0 -274
- package/templates/ui/shadcn-ui/src/components/ui/navigation-menu.tsx +0 -168
- package/templates/ui/shadcn-ui/src/components/ui/pagination.tsx +0 -127
- package/templates/ui/shadcn-ui/src/components/ui/popover.tsx +0 -48
- package/templates/ui/shadcn-ui/src/components/ui/progress.tsx +0 -29
- package/templates/ui/shadcn-ui/src/components/ui/radio-group.tsx +0 -45
- package/templates/ui/shadcn-ui/src/components/ui/resizable.tsx +0 -54
- package/templates/ui/shadcn-ui/src/components/ui/scroll-area.tsx +0 -58
- package/templates/ui/shadcn-ui/src/components/ui/select.tsx +0 -185
- package/templates/ui/shadcn-ui/src/components/ui/separator.tsx +0 -28
- package/templates/ui/shadcn-ui/src/components/ui/sheet.tsx +0 -137
- package/templates/ui/shadcn-ui/src/components/ui/sidebar.tsx +0 -726
- package/templates/ui/shadcn-ui/src/components/ui/skeleton.tsx +0 -13
- package/templates/ui/shadcn-ui/src/components/ui/slider.tsx +0 -63
- package/templates/ui/shadcn-ui/src/components/ui/sonner.tsx +0 -38
- package/templates/ui/shadcn-ui/src/components/ui/spinner.tsx +0 -16
- package/templates/ui/shadcn-ui/src/components/ui/switch.tsx +0 -31
- package/templates/ui/shadcn-ui/src/components/ui/table.tsx +0 -114
- package/templates/ui/shadcn-ui/src/components/ui/tabs.tsx +0 -66
- package/templates/ui/shadcn-ui/src/components/ui/textarea.tsx +0 -18
- package/templates/ui/shadcn-ui/src/components/ui/toggle-group.tsx +0 -81
- package/templates/ui/shadcn-ui/src/components/ui/toggle.tsx +0 -45
- package/templates/ui/shadcn-ui/src/components/ui/tooltip.tsx +0 -61
|
@@ -16,28 +16,28 @@
|
|
|
16
16
|
"lint:fix": "biome lint --apply ."
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@tailwindcss/vite": "^4.
|
|
20
|
-
"tailwindcss": "^4.
|
|
21
|
-
"@tanstack/react-query": "^5.
|
|
22
|
-
"@types/xrm": "^9.0.
|
|
23
|
-
"react": "^19.2.
|
|
24
|
-
"react-dom": "^19.2.
|
|
25
|
-
"zod": "^4.3
|
|
26
|
-
"zustand": "^5.0.
|
|
19
|
+
"@tailwindcss/vite": "^4.3.0",
|
|
20
|
+
"tailwindcss": "^4.3.0",
|
|
21
|
+
"@tanstack/react-query": "^5.100.14",
|
|
22
|
+
"@types/xrm": "^9.0.94",
|
|
23
|
+
"react": "^19.2.7",
|
|
24
|
+
"react-dom": "^19.2.7",
|
|
25
|
+
"zod": "^4.4.3",
|
|
26
|
+
"zustand": "^5.0.14"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@eslint/js": "^
|
|
30
|
-
"@tanstack/eslint-plugin-query": "^5.
|
|
31
|
-
"@types/node": "^24.
|
|
32
|
-
"@types/react": "^19.2.
|
|
29
|
+
"@eslint/js": "^10.0.1",
|
|
30
|
+
"@tanstack/eslint-plugin-query": "^5.100.14",
|
|
31
|
+
"@types/node": "^24.12.4",
|
|
32
|
+
"@types/react": "^19.2.16",
|
|
33
33
|
"@types/react-dom": "^19.2.3",
|
|
34
|
-
"@vitejs/plugin-react": "^
|
|
35
|
-
"eslint": "^
|
|
36
|
-
"eslint-plugin-react-hooks": "^7.
|
|
34
|
+
"@vitejs/plugin-react": "^6.0.2",
|
|
35
|
+
"eslint": "^10.4.1",
|
|
36
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
37
37
|
"eslint-plugin-react-refresh": "^0.5.2",
|
|
38
|
-
"globals": "^
|
|
39
|
-
"typescript": "~
|
|
40
|
-
"typescript-eslint": "^8.
|
|
41
|
-
"vite": "^
|
|
38
|
+
"globals": "^17.6.0",
|
|
39
|
+
"typescript": "~6.0.3",
|
|
40
|
+
"typescript-eslint": "^8.60.1",
|
|
41
|
+
"vite": "^8.0.16"
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -4,6 +4,7 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
|
4
4
|
|
|
5
5
|
import "./index.css";
|
|
6
6
|
import App from "./App.tsx";
|
|
7
|
+
import { EcAppShell } from "./runtime/EcAppShell.tsx";
|
|
7
8
|
|
|
8
9
|
const queryClient = new QueryClient({
|
|
9
10
|
defaultOptions: {
|
|
@@ -23,7 +24,9 @@ const root = createRoot(document.getElementById("root")!);
|
|
|
23
24
|
root.render(
|
|
24
25
|
<StrictMode>
|
|
25
26
|
<QueryClientProvider client={queryClient}>
|
|
26
|
-
<
|
|
27
|
+
<EcAppShell>
|
|
28
|
+
<App />
|
|
29
|
+
</EcAppShell>
|
|
27
30
|
</QueryClientProvider>
|
|
28
31
|
</StrictMode>
|
|
29
32
|
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export const EC_APP_SCOPE_CLASS = "ec-app";
|
|
4
|
+
export const EC_APP_ID = "{{APP_NAME}}";
|
|
5
|
+
export const EC_PCF_SCOPE_CLASS = "ec-pcf-shell-control";
|
|
6
|
+
|
|
7
|
+
const EcPortalContainerContext = React.createContext<HTMLElement | null>(null);
|
|
8
|
+
|
|
9
|
+
export function useEcPortalContainer() {
|
|
10
|
+
return React.useContext(EcPortalContainerContext);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function EcAppShell({ children }: { children: React.ReactNode }) {
|
|
14
|
+
const [portalContainer, setPortalContainer] =
|
|
15
|
+
React.useState<HTMLDivElement | null>(null);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div
|
|
19
|
+
className={EC_APP_SCOPE_CLASS}
|
|
20
|
+
data-ec-app-id={EC_APP_ID}
|
|
21
|
+
data-ec-app-root=""
|
|
22
|
+
>
|
|
23
|
+
<EcPortalContainerContext.Provider value={portalContainer}>
|
|
24
|
+
{children}
|
|
25
|
+
<div data-ec-portal-root="" ref={setPortalContainer} />
|
|
26
|
+
</EcPortalContainerContext.Provider>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -21,3 +21,16 @@ npm run build
|
|
|
21
21
|
- The wrapper imports `src/App` directly and reuses the built `dist/main.css`.
|
|
22
22
|
- Regenerate this folder after rebuilding the webresource whenever the app changes.
|
|
23
23
|
- The project includes both `pcf-scripts` build support and a `.pcfproj` for Dataverse solution packaging flows.
|
|
24
|
+
|
|
25
|
+
## CSS scoping
|
|
26
|
+
|
|
27
|
+
This PCF control renders the app inside `.ec-app` and keeps the PCF host container class `.ec-pcf-shell-control`.
|
|
28
|
+
|
|
29
|
+
Generated Tailwind/shadcn styles are scoped for embeddability:
|
|
30
|
+
|
|
31
|
+
- Tailwind Preflight is not imported globally.
|
|
32
|
+
- Tailwind utilities use the `ec:` prefix.
|
|
33
|
+
- shadcn theme variables are defined under `.ec-app`.
|
|
34
|
+
- Radix/shadcn portals render into the app-local portal root where supported.
|
|
35
|
+
|
|
36
|
+
If this PCF was generated from an older app whose `dist/main.css` contains global Tailwind/shadcn styles, those styles may still leak into the model-driven app form. Regenerate or migrate the source app to the scoped CSS template.
|
|
@@ -4,6 +4,7 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
|
4
4
|
|
|
5
5
|
import App from "{{PROJECT_APP_IMPORT}}";
|
|
6
6
|
import "{{PROJECT_CSS_IMPORT}}";
|
|
7
|
+
import { EcAppShell } from "{{PROJECT_EC_APP_SHELL_IMPORT}}";
|
|
7
8
|
import type { IInputs, IOutputs } from "./control/generated/ManifestTypes";
|
|
8
9
|
import type {
|
|
9
10
|
PcfRuntimeContext,
|
|
@@ -112,6 +113,7 @@ export class {{PCF_CONSTRUCTOR}}
|
|
|
112
113
|
container: HTMLDivElement,
|
|
113
114
|
): void {
|
|
114
115
|
container.classList.add("ec-pcf-shell-control");
|
|
116
|
+
container.dataset.ecPcfControl = "{{PCF_CONSTRUCTOR}}";
|
|
115
117
|
this.runtime = createRuntime(context);
|
|
116
118
|
this.root = createRoot(container);
|
|
117
119
|
this.render();
|
|
@@ -142,9 +144,13 @@ export class {{PCF_CONSTRUCTOR}}
|
|
|
142
144
|
StrictMode,
|
|
143
145
|
null,
|
|
144
146
|
React.createElement(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
React.createElement(
|
|
147
|
+
EcAppShell,
|
|
148
|
+
null,
|
|
149
|
+
React.createElement(
|
|
150
|
+
QueryClientProvider,
|
|
151
|
+
{ client: this.queryClient },
|
|
152
|
+
React.createElement(App, { runtime: this.runtime }),
|
|
153
|
+
),
|
|
148
154
|
),
|
|
149
155
|
),
|
|
150
156
|
);
|