create-ec-app 1.1.0 → 1.3.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.
Files changed (80) hide show
  1. package/README.md +77 -0
  2. package/dist/index.js +304 -78
  3. package/dist/index.js.map +1 -1
  4. package/dist/pcf.d.ts.map +1 -1
  5. package/dist/pcf.js +82 -0
  6. package/dist/pcf.js.map +1 -1
  7. package/package.json +3 -1
  8. package/scripts/check-generated-css-scope.mjs +61 -0
  9. package/templates/base/package-lock.json +713 -1466
  10. package/templates/base/package.json +19 -19
  11. package/templates/base/src/App.tsx +1 -1
  12. package/templates/base/src/index.css +4 -1
  13. package/templates/base/src/main.tsx +4 -1
  14. package/templates/base/src/runtime/EcAppShell.tsx +29 -0
  15. package/templates/base/tsconfig.app.json +0 -1
  16. package/templates/base/tsconfig.json +1 -2
  17. package/templates/pcf/base/README.md +13 -0
  18. package/templates/pcf/base/index.ts +9 -3
  19. package/templates/pcf/base/package-lock.json +7290 -0
  20. package/templates/pcf/base/package.json +3 -3
  21. package/templates/targets/power-pages/src/App.patch.tsx +1 -1
  22. package/templates/targets/swa/package.patch.json +1 -1
  23. package/templates/ui/kendo/package.patch.json +2 -2
  24. package/templates/ui/kendo/src/main.patch.tsx +4 -1
  25. package/templates/ui/shadcn-ui/components.json +5 -2
  26. package/templates/ui/shadcn-ui/package.patch.json +3 -41
  27. package/templates/ui/shadcn-ui/src/index.patch.css +26 -9
  28. package/templates/ui/shadcn-ui/src/components/ui/accordion.tsx +0 -64
  29. package/templates/ui/shadcn-ui/src/components/ui/alert-dialog.tsx +0 -155
  30. package/templates/ui/shadcn-ui/src/components/ui/alert.tsx +0 -66
  31. package/templates/ui/shadcn-ui/src/components/ui/aspect-ratio.tsx +0 -11
  32. package/templates/ui/shadcn-ui/src/components/ui/avatar.tsx +0 -51
  33. package/templates/ui/shadcn-ui/src/components/ui/badge.tsx +0 -46
  34. package/templates/ui/shadcn-ui/src/components/ui/breadcrumb.tsx +0 -109
  35. package/templates/ui/shadcn-ui/src/components/ui/button-group.tsx +0 -83
  36. package/templates/ui/shadcn-ui/src/components/ui/button.tsx +0 -60
  37. package/templates/ui/shadcn-ui/src/components/ui/calendar.tsx +0 -216
  38. package/templates/ui/shadcn-ui/src/components/ui/card.tsx +0 -92
  39. package/templates/ui/shadcn-ui/src/components/ui/carousel.tsx +0 -239
  40. package/templates/ui/shadcn-ui/src/components/ui/chart.tsx +0 -357
  41. package/templates/ui/shadcn-ui/src/components/ui/checkbox.tsx +0 -32
  42. package/templates/ui/shadcn-ui/src/components/ui/collapsible.tsx +0 -31
  43. package/templates/ui/shadcn-ui/src/components/ui/command.tsx +0 -182
  44. package/templates/ui/shadcn-ui/src/components/ui/context-menu.tsx +0 -252
  45. package/templates/ui/shadcn-ui/src/components/ui/dialog.tsx +0 -141
  46. package/templates/ui/shadcn-ui/src/components/ui/drawer.tsx +0 -135
  47. package/templates/ui/shadcn-ui/src/components/ui/dropdown-menu.tsx +0 -255
  48. package/templates/ui/shadcn-ui/src/components/ui/empty.tsx +0 -104
  49. package/templates/ui/shadcn-ui/src/components/ui/field.tsx +0 -246
  50. package/templates/ui/shadcn-ui/src/components/ui/form.tsx +0 -167
  51. package/templates/ui/shadcn-ui/src/components/ui/hover-card.tsx +0 -44
  52. package/templates/ui/shadcn-ui/src/components/ui/input-group.tsx +0 -170
  53. package/templates/ui/shadcn-ui/src/components/ui/input-otp.tsx +0 -75
  54. package/templates/ui/shadcn-ui/src/components/ui/input.tsx +0 -21
  55. package/templates/ui/shadcn-ui/src/components/ui/item.tsx +0 -193
  56. package/templates/ui/shadcn-ui/src/components/ui/kbd.tsx +0 -28
  57. package/templates/ui/shadcn-ui/src/components/ui/label.tsx +0 -24
  58. package/templates/ui/shadcn-ui/src/components/ui/menubar.tsx +0 -274
  59. package/templates/ui/shadcn-ui/src/components/ui/navigation-menu.tsx +0 -168
  60. package/templates/ui/shadcn-ui/src/components/ui/pagination.tsx +0 -127
  61. package/templates/ui/shadcn-ui/src/components/ui/popover.tsx +0 -48
  62. package/templates/ui/shadcn-ui/src/components/ui/progress.tsx +0 -29
  63. package/templates/ui/shadcn-ui/src/components/ui/radio-group.tsx +0 -45
  64. package/templates/ui/shadcn-ui/src/components/ui/resizable.tsx +0 -54
  65. package/templates/ui/shadcn-ui/src/components/ui/scroll-area.tsx +0 -58
  66. package/templates/ui/shadcn-ui/src/components/ui/select.tsx +0 -185
  67. package/templates/ui/shadcn-ui/src/components/ui/separator.tsx +0 -28
  68. package/templates/ui/shadcn-ui/src/components/ui/sheet.tsx +0 -137
  69. package/templates/ui/shadcn-ui/src/components/ui/sidebar.tsx +0 -726
  70. package/templates/ui/shadcn-ui/src/components/ui/skeleton.tsx +0 -13
  71. package/templates/ui/shadcn-ui/src/components/ui/slider.tsx +0 -63
  72. package/templates/ui/shadcn-ui/src/components/ui/sonner.tsx +0 -38
  73. package/templates/ui/shadcn-ui/src/components/ui/spinner.tsx +0 -16
  74. package/templates/ui/shadcn-ui/src/components/ui/switch.tsx +0 -31
  75. package/templates/ui/shadcn-ui/src/components/ui/table.tsx +0 -114
  76. package/templates/ui/shadcn-ui/src/components/ui/tabs.tsx +0 -66
  77. package/templates/ui/shadcn-ui/src/components/ui/textarea.tsx +0 -18
  78. package/templates/ui/shadcn-ui/src/components/ui/toggle-group.tsx +0 -81
  79. package/templates/ui/shadcn-ui/src/components/ui/toggle.tsx +0 -45
  80. 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.2.1",
20
- "tailwindcss": "^4.2.1",
21
- "@tanstack/react-query": "^5.90.21",
22
- "@types/xrm": "^9.0.88",
23
- "react": "^19.2.4",
24
- "react-dom": "^19.2.4",
25
- "zod": "^4.3.6",
26
- "zustand": "^5.0.11"
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": "^9.39.3",
30
- "@tanstack/eslint-plugin-query": "^5.91.4",
31
- "@types/node": "^24.11.0",
32
- "@types/react": "^19.2.14",
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": "^5.1.4",
35
- "eslint": "^9.39.3",
36
- "eslint-plugin-react-hooks": "^7.0.1",
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": "^16.5.0",
39
- "typescript": "~5.9.3",
40
- "typescript-eslint": "^8.56.1",
41
- "vite": "^7.3.1"
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
  }
@@ -2,7 +2,7 @@ import "./App.css";
2
2
 
3
3
  function App() {
4
4
  return (
5
- <div className="flex flex-col h-screen items-center justify-center">
5
+ <div className="ec:flex ec:flex-col ec:h-screen ec:items-center ec:justify-center">
6
6
  <p>Hello, world!</p>
7
7
  </div>
8
8
  );
@@ -1,3 +1,6 @@
1
- @import "tailwindcss";
1
+ @layer theme, base, components, utilities;
2
+
3
+ @import "tailwindcss/theme.css" layer(theme) prefix(ec);
4
+ @import "tailwindcss/utilities.css" layer(utilities) prefix(ec);
2
5
 
3
6
  @custom-variant hover (&:hover);
@@ -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
- <App />
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
+ }
@@ -22,7 +22,6 @@
22
22
  "noFallthroughCasesInSwitch": true,
23
23
  "noUncheckedSideEffectImports": true,
24
24
 
25
- "baseUrl": ".",
26
25
  "paths": {
27
26
  "@/*": ["./src/*"]
28
27
  }
@@ -9,11 +9,10 @@
9
9
  }
10
10
  ],
11
11
  "compilerOptions": {
12
- "baseUrl": ".",
13
12
  "paths": {
14
13
  "@/*": [
15
14
  "./src/*"
16
15
  ]
17
16
  }
18
17
  }
19
- }
18
+ }
@@ -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
- QueryClientProvider,
146
- { client: this.queryClient },
147
- React.createElement(App, { runtime: this.runtime }),
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
  );