@ethisyscore/host-ui-externals 1.10.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/dist/index.cjs +10 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +71 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/mock.cjs +31 -0
- package/dist/mock.cjs.map +1 -0
- package/dist/mock.d.cts +34 -0
- package/dist/mock.d.ts +34 -0
- package/dist/mock.js +27 -0
- package/dist/mock.js.map +1 -0
- package/package.json +56 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
var GOGO_EXTERNALS_SPECIFIER_MAP = Object.freeze({
|
|
5
|
+
"@ethisyscore/host-ui-externals": "@ethisyscore/host-ui-externals"
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
exports.GOGO_EXTERNALS_SPECIFIER_MAP = GOGO_EXTERNALS_SPECIFIER_MAP;
|
|
9
|
+
//# sourceMappingURL=index.cjs.map
|
|
10
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AAgFO,IAAM,4BAAA,GAAiE,OAAO,MAAA,CAAO;AAAA,EAC1F,gCAAA,EAAkC;AACpC,CAAC","file":"index.cjs","sourcesContent":["/**\n * @ethisyscore/host-ui-externals\n *\n * Type contracts for the Gogo UI components that the host exposes to\n * Tier T plugin remotes as shared externals. At runtime the host's\n * `hostModuleRegistry.ts` registers the actual `@coreconnect/gogo-ui`\n * instances under `\"@ethisyscore/host-ui-externals\"`; the rewriter maps\n * the plugin's bare import to that registry entry.\n *\n * Plugin builds:\n * 1. Add this package as a devDependency.\n * 2. In `vite.config.ts`, add `\"@ethisyscore/host-ui-externals\"` to the\n * `external` list (the `ethisysPlatformReactPlugin` handles this\n * automatically in the next build-plugin update).\n * 3. Import types from `\"@ethisyscore/host-ui-externals\"` — these are\n * erased at compile time and replaced at runtime with the host instance.\n *\n * For local standalone development (plugin CI, Storybook), replace the\n * production import with the mock sub-path:\n * `import { GogoThemeProvider } from \"@ethisyscore/host-ui-externals/mock\";`\n */\n\n// ── Re-exported type contracts ─────────────────────────────────────\n// These are TYPE-ONLY exports. They carry no runtime bundle weight —\n// the actual implementations live in the host's `@coreconnect/gogo-ui`.\n// Imported (not just re-exported) so `ReactNode` is in local scope for the\n// interface declarations below.\nimport type { ComponentType, ReactNode } from \"react\";\nexport type { ComponentType, ReactNode };\n\n/**\n * Gogo theme colour preset union.\n * Mirrors `GogoTheme` from `@coreconnect/gogo-ui` — kept in sync manually\n * until `gogo-ui` is published to npm.\n */\nexport type GogoTheme = \"theme-purple\" | \"theme-blue\" | \"theme-green\" | \"theme-orange\";\n\n/**\n * Gogo light/dark/system mode.\n */\nexport type GogoMode = \"light\" | \"dark\" | \"system\";\n\n/**\n * Props accepted by the host's `GogoThemeProvider`. Plugin remotes that need\n * to wrap their own subtree in the provider use this type.\n */\nexport interface GogoThemeProviderProps {\n theme?: GogoTheme;\n mode?: GogoMode;\n direction?: \"ltr\" | \"rtl\";\n children: ReactNode;\n}\n\nexport type { ReactNode as GogoChildren };\n\n/**\n * The menu item shape from `@coreconnect/gogo-ui`.\n */\nexport interface GogoMenuItem {\n id: string;\n label: string;\n icon?: string;\n href?: string;\n onClick?: () => void;\n}\n\n// ── Specifier map ──────────────────────────────────────────────────\n\n/**\n * Maps the npm specifier that plugin code imports from to the registry key\n * that `hostModuleRegistry.ts` registers the live instance under.\n *\n * Both keys are `\"@ethisyscore/host-ui-externals\"` because the registry key\n * equals the npm specifier — the rewriter looks up `spec in MODULES` where\n * `spec` is the bare specifier from the plugin's import statement.\n *\n * Plugin Vite configs add the key to `build.rollupOptions.external`.\n * The `ethisysPlatformReactPlugin` vite plugin will auto-add this in its\n * config hook (see `page-bundles.ts` follow-up).\n */\nexport const GOGO_EXTERNALS_SPECIFIER_MAP: Readonly<Record<string, string>> = Object.freeze({\n \"@ethisyscore/host-ui-externals\": \"@ethisyscore/host-ui-externals\",\n});\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export { ComponentType, ReactNode as GogoChildren, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @ethisyscore/host-ui-externals
|
|
6
|
+
*
|
|
7
|
+
* Type contracts for the Gogo UI components that the host exposes to
|
|
8
|
+
* Tier T plugin remotes as shared externals. At runtime the host's
|
|
9
|
+
* `hostModuleRegistry.ts` registers the actual `@coreconnect/gogo-ui`
|
|
10
|
+
* instances under `"@ethisyscore/host-ui-externals"`; the rewriter maps
|
|
11
|
+
* the plugin's bare import to that registry entry.
|
|
12
|
+
*
|
|
13
|
+
* Plugin builds:
|
|
14
|
+
* 1. Add this package as a devDependency.
|
|
15
|
+
* 2. In `vite.config.ts`, add `"@ethisyscore/host-ui-externals"` to the
|
|
16
|
+
* `external` list (the `ethisysPlatformReactPlugin` handles this
|
|
17
|
+
* automatically in the next build-plugin update).
|
|
18
|
+
* 3. Import types from `"@ethisyscore/host-ui-externals"` — these are
|
|
19
|
+
* erased at compile time and replaced at runtime with the host instance.
|
|
20
|
+
*
|
|
21
|
+
* For local standalone development (plugin CI, Storybook), replace the
|
|
22
|
+
* production import with the mock sub-path:
|
|
23
|
+
* `import { GogoThemeProvider } from "@ethisyscore/host-ui-externals/mock";`
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Gogo theme colour preset union.
|
|
28
|
+
* Mirrors `GogoTheme` from `@coreconnect/gogo-ui` — kept in sync manually
|
|
29
|
+
* until `gogo-ui` is published to npm.
|
|
30
|
+
*/
|
|
31
|
+
type GogoTheme = "theme-purple" | "theme-blue" | "theme-green" | "theme-orange";
|
|
32
|
+
/**
|
|
33
|
+
* Gogo light/dark/system mode.
|
|
34
|
+
*/
|
|
35
|
+
type GogoMode = "light" | "dark" | "system";
|
|
36
|
+
/**
|
|
37
|
+
* Props accepted by the host's `GogoThemeProvider`. Plugin remotes that need
|
|
38
|
+
* to wrap their own subtree in the provider use this type.
|
|
39
|
+
*/
|
|
40
|
+
interface GogoThemeProviderProps {
|
|
41
|
+
theme?: GogoTheme;
|
|
42
|
+
mode?: GogoMode;
|
|
43
|
+
direction?: "ltr" | "rtl";
|
|
44
|
+
children: ReactNode;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The menu item shape from `@coreconnect/gogo-ui`.
|
|
49
|
+
*/
|
|
50
|
+
interface GogoMenuItem {
|
|
51
|
+
id: string;
|
|
52
|
+
label: string;
|
|
53
|
+
icon?: string;
|
|
54
|
+
href?: string;
|
|
55
|
+
onClick?: () => void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Maps the npm specifier that plugin code imports from to the registry key
|
|
59
|
+
* that `hostModuleRegistry.ts` registers the live instance under.
|
|
60
|
+
*
|
|
61
|
+
* Both keys are `"@ethisyscore/host-ui-externals"` because the registry key
|
|
62
|
+
* equals the npm specifier — the rewriter looks up `spec in MODULES` where
|
|
63
|
+
* `spec` is the bare specifier from the plugin's import statement.
|
|
64
|
+
*
|
|
65
|
+
* Plugin Vite configs add the key to `build.rollupOptions.external`.
|
|
66
|
+
* The `ethisysPlatformReactPlugin` vite plugin will auto-add this in its
|
|
67
|
+
* config hook (see `page-bundles.ts` follow-up).
|
|
68
|
+
*/
|
|
69
|
+
declare const GOGO_EXTERNALS_SPECIFIER_MAP: Readonly<Record<string, string>>;
|
|
70
|
+
|
|
71
|
+
export { GOGO_EXTERNALS_SPECIFIER_MAP, type GogoMenuItem, type GogoMode, type GogoTheme, type GogoThemeProviderProps };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export { ComponentType, ReactNode as GogoChildren, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @ethisyscore/host-ui-externals
|
|
6
|
+
*
|
|
7
|
+
* Type contracts for the Gogo UI components that the host exposes to
|
|
8
|
+
* Tier T plugin remotes as shared externals. At runtime the host's
|
|
9
|
+
* `hostModuleRegistry.ts` registers the actual `@coreconnect/gogo-ui`
|
|
10
|
+
* instances under `"@ethisyscore/host-ui-externals"`; the rewriter maps
|
|
11
|
+
* the plugin's bare import to that registry entry.
|
|
12
|
+
*
|
|
13
|
+
* Plugin builds:
|
|
14
|
+
* 1. Add this package as a devDependency.
|
|
15
|
+
* 2. In `vite.config.ts`, add `"@ethisyscore/host-ui-externals"` to the
|
|
16
|
+
* `external` list (the `ethisysPlatformReactPlugin` handles this
|
|
17
|
+
* automatically in the next build-plugin update).
|
|
18
|
+
* 3. Import types from `"@ethisyscore/host-ui-externals"` — these are
|
|
19
|
+
* erased at compile time and replaced at runtime with the host instance.
|
|
20
|
+
*
|
|
21
|
+
* For local standalone development (plugin CI, Storybook), replace the
|
|
22
|
+
* production import with the mock sub-path:
|
|
23
|
+
* `import { GogoThemeProvider } from "@ethisyscore/host-ui-externals/mock";`
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Gogo theme colour preset union.
|
|
28
|
+
* Mirrors `GogoTheme` from `@coreconnect/gogo-ui` — kept in sync manually
|
|
29
|
+
* until `gogo-ui` is published to npm.
|
|
30
|
+
*/
|
|
31
|
+
type GogoTheme = "theme-purple" | "theme-blue" | "theme-green" | "theme-orange";
|
|
32
|
+
/**
|
|
33
|
+
* Gogo light/dark/system mode.
|
|
34
|
+
*/
|
|
35
|
+
type GogoMode = "light" | "dark" | "system";
|
|
36
|
+
/**
|
|
37
|
+
* Props accepted by the host's `GogoThemeProvider`. Plugin remotes that need
|
|
38
|
+
* to wrap their own subtree in the provider use this type.
|
|
39
|
+
*/
|
|
40
|
+
interface GogoThemeProviderProps {
|
|
41
|
+
theme?: GogoTheme;
|
|
42
|
+
mode?: GogoMode;
|
|
43
|
+
direction?: "ltr" | "rtl";
|
|
44
|
+
children: ReactNode;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The menu item shape from `@coreconnect/gogo-ui`.
|
|
49
|
+
*/
|
|
50
|
+
interface GogoMenuItem {
|
|
51
|
+
id: string;
|
|
52
|
+
label: string;
|
|
53
|
+
icon?: string;
|
|
54
|
+
href?: string;
|
|
55
|
+
onClick?: () => void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Maps the npm specifier that plugin code imports from to the registry key
|
|
59
|
+
* that `hostModuleRegistry.ts` registers the live instance under.
|
|
60
|
+
*
|
|
61
|
+
* Both keys are `"@ethisyscore/host-ui-externals"` because the registry key
|
|
62
|
+
* equals the npm specifier — the rewriter looks up `spec in MODULES` where
|
|
63
|
+
* `spec` is the bare specifier from the plugin's import statement.
|
|
64
|
+
*
|
|
65
|
+
* Plugin Vite configs add the key to `build.rollupOptions.external`.
|
|
66
|
+
* The `ethisysPlatformReactPlugin` vite plugin will auto-add this in its
|
|
67
|
+
* config hook (see `page-bundles.ts` follow-up).
|
|
68
|
+
*/
|
|
69
|
+
declare const GOGO_EXTERNALS_SPECIFIER_MAP: Readonly<Record<string, string>>;
|
|
70
|
+
|
|
71
|
+
export { GOGO_EXTERNALS_SPECIFIER_MAP, type GogoMenuItem, type GogoMode, type GogoTheme, type GogoThemeProviderProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";AAgFO,IAAM,4BAAA,GAAiE,OAAO,MAAA,CAAO;AAAA,EAC1F,gCAAA,EAAkC;AACpC,CAAC","file":"index.js","sourcesContent":["/**\n * @ethisyscore/host-ui-externals\n *\n * Type contracts for the Gogo UI components that the host exposes to\n * Tier T plugin remotes as shared externals. At runtime the host's\n * `hostModuleRegistry.ts` registers the actual `@coreconnect/gogo-ui`\n * instances under `\"@ethisyscore/host-ui-externals\"`; the rewriter maps\n * the plugin's bare import to that registry entry.\n *\n * Plugin builds:\n * 1. Add this package as a devDependency.\n * 2. In `vite.config.ts`, add `\"@ethisyscore/host-ui-externals\"` to the\n * `external` list (the `ethisysPlatformReactPlugin` handles this\n * automatically in the next build-plugin update).\n * 3. Import types from `\"@ethisyscore/host-ui-externals\"` — these are\n * erased at compile time and replaced at runtime with the host instance.\n *\n * For local standalone development (plugin CI, Storybook), replace the\n * production import with the mock sub-path:\n * `import { GogoThemeProvider } from \"@ethisyscore/host-ui-externals/mock\";`\n */\n\n// ── Re-exported type contracts ─────────────────────────────────────\n// These are TYPE-ONLY exports. They carry no runtime bundle weight —\n// the actual implementations live in the host's `@coreconnect/gogo-ui`.\n// Imported (not just re-exported) so `ReactNode` is in local scope for the\n// interface declarations below.\nimport type { ComponentType, ReactNode } from \"react\";\nexport type { ComponentType, ReactNode };\n\n/**\n * Gogo theme colour preset union.\n * Mirrors `GogoTheme` from `@coreconnect/gogo-ui` — kept in sync manually\n * until `gogo-ui` is published to npm.\n */\nexport type GogoTheme = \"theme-purple\" | \"theme-blue\" | \"theme-green\" | \"theme-orange\";\n\n/**\n * Gogo light/dark/system mode.\n */\nexport type GogoMode = \"light\" | \"dark\" | \"system\";\n\n/**\n * Props accepted by the host's `GogoThemeProvider`. Plugin remotes that need\n * to wrap their own subtree in the provider use this type.\n */\nexport interface GogoThemeProviderProps {\n theme?: GogoTheme;\n mode?: GogoMode;\n direction?: \"ltr\" | \"rtl\";\n children: ReactNode;\n}\n\nexport type { ReactNode as GogoChildren };\n\n/**\n * The menu item shape from `@coreconnect/gogo-ui`.\n */\nexport interface GogoMenuItem {\n id: string;\n label: string;\n icon?: string;\n href?: string;\n onClick?: () => void;\n}\n\n// ── Specifier map ──────────────────────────────────────────────────\n\n/**\n * Maps the npm specifier that plugin code imports from to the registry key\n * that `hostModuleRegistry.ts` registers the live instance under.\n *\n * Both keys are `\"@ethisyscore/host-ui-externals\"` because the registry key\n * equals the npm specifier — the rewriter looks up `spec in MODULES` where\n * `spec` is the bare specifier from the plugin's import statement.\n *\n * Plugin Vite configs add the key to `build.rollupOptions.external`.\n * The `ethisysPlatformReactPlugin` vite plugin will auto-add this in its\n * config hook (see `page-bundles.ts` follow-up).\n */\nexport const GOGO_EXTERNALS_SPECIFIER_MAP: Readonly<Record<string, string>> = Object.freeze({\n \"@ethisyscore/host-ui-externals\": \"@ethisyscore/host-ui-externals\",\n});\n"]}
|
package/dist/mock.cjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
|
|
5
|
+
// src/mock.ts
|
|
6
|
+
|
|
7
|
+
// src/index.ts
|
|
8
|
+
var GOGO_EXTERNALS_SPECIFIER_MAP = Object.freeze({
|
|
9
|
+
"@ethisyscore/host-ui-externals": "@ethisyscore/host-ui-externals"
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
// src/mock.ts
|
|
13
|
+
var GogoThemeProvider = ({ children }) => react.createElement("div", { "data-testid": "mock-gogo-theme-provider" }, children);
|
|
14
|
+
function useGogoTheme() {
|
|
15
|
+
return {
|
|
16
|
+
theme: "theme-blue",
|
|
17
|
+
setTheme: (_) => {
|
|
18
|
+
},
|
|
19
|
+
mode: "light",
|
|
20
|
+
isDarkMode: false,
|
|
21
|
+
direction: "ltr",
|
|
22
|
+
setMode: (_) => {
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.GOGO_EXTERNALS_SPECIFIER_MAP = GOGO_EXTERNALS_SPECIFIER_MAP;
|
|
28
|
+
exports.GogoThemeProvider = GogoThemeProvider;
|
|
29
|
+
exports.useGogoTheme = useGogoTheme;
|
|
30
|
+
//# sourceMappingURL=mock.cjs.map
|
|
31
|
+
//# sourceMappingURL=mock.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/mock.ts"],"names":["createElement"],"mappings":";;;;;;;AAgFO,IAAM,4BAAA,GAAiE,OAAO,MAAA,CAAO;AAAA,EAC1F,gCAAA,EAAkC;AACpC,CAAC;;;AC9DM,IAAM,iBAAA,GAAgD,CAAC,EAAE,QAAA,EAAS,KACvEA,mBAAA,CAAc,KAAA,EAAO,EAAE,aAAA,EAAe,0BAAA,EAA2B,EAAG,QAAqB;AAKpF,SAAS,YAAA,GAAe;AAC7B,EAAA,OAAO;AAAA,IACL,KAAA,EAAO,YAAA;AAAA,IACP,QAAA,EAAU,CAAC,CAAA,KAAc;AAAA,IAAC,CAAA;AAAA,IAC1B,IAAA,EAAM,OAAA;AAAA,IACN,UAAA,EAAY,KAAA;AAAA,IACZ,SAAA,EAAW,KAAA;AAAA,IACX,OAAA,EAAS,CAAC,CAAA,KAAc;AAAA,IAAC;AAAA,GAC3B;AACF","file":"mock.cjs","sourcesContent":["/**\n * @ethisyscore/host-ui-externals\n *\n * Type contracts for the Gogo UI components that the host exposes to\n * Tier T plugin remotes as shared externals. At runtime the host's\n * `hostModuleRegistry.ts` registers the actual `@coreconnect/gogo-ui`\n * instances under `\"@ethisyscore/host-ui-externals\"`; the rewriter maps\n * the plugin's bare import to that registry entry.\n *\n * Plugin builds:\n * 1. Add this package as a devDependency.\n * 2. In `vite.config.ts`, add `\"@ethisyscore/host-ui-externals\"` to the\n * `external` list (the `ethisysPlatformReactPlugin` handles this\n * automatically in the next build-plugin update).\n * 3. Import types from `\"@ethisyscore/host-ui-externals\"` — these are\n * erased at compile time and replaced at runtime with the host instance.\n *\n * For local standalone development (plugin CI, Storybook), replace the\n * production import with the mock sub-path:\n * `import { GogoThemeProvider } from \"@ethisyscore/host-ui-externals/mock\";`\n */\n\n// ── Re-exported type contracts ─────────────────────────────────────\n// These are TYPE-ONLY exports. They carry no runtime bundle weight —\n// the actual implementations live in the host's `@coreconnect/gogo-ui`.\n// Imported (not just re-exported) so `ReactNode` is in local scope for the\n// interface declarations below.\nimport type { ComponentType, ReactNode } from \"react\";\nexport type { ComponentType, ReactNode };\n\n/**\n * Gogo theme colour preset union.\n * Mirrors `GogoTheme` from `@coreconnect/gogo-ui` — kept in sync manually\n * until `gogo-ui` is published to npm.\n */\nexport type GogoTheme = \"theme-purple\" | \"theme-blue\" | \"theme-green\" | \"theme-orange\";\n\n/**\n * Gogo light/dark/system mode.\n */\nexport type GogoMode = \"light\" | \"dark\" | \"system\";\n\n/**\n * Props accepted by the host's `GogoThemeProvider`. Plugin remotes that need\n * to wrap their own subtree in the provider use this type.\n */\nexport interface GogoThemeProviderProps {\n theme?: GogoTheme;\n mode?: GogoMode;\n direction?: \"ltr\" | \"rtl\";\n children: ReactNode;\n}\n\nexport type { ReactNode as GogoChildren };\n\n/**\n * The menu item shape from `@coreconnect/gogo-ui`.\n */\nexport interface GogoMenuItem {\n id: string;\n label: string;\n icon?: string;\n href?: string;\n onClick?: () => void;\n}\n\n// ── Specifier map ──────────────────────────────────────────────────\n\n/**\n * Maps the npm specifier that plugin code imports from to the registry key\n * that `hostModuleRegistry.ts` registers the live instance under.\n *\n * Both keys are `\"@ethisyscore/host-ui-externals\"` because the registry key\n * equals the npm specifier — the rewriter looks up `spec in MODULES` where\n * `spec` is the bare specifier from the plugin's import statement.\n *\n * Plugin Vite configs add the key to `build.rollupOptions.external`.\n * The `ethisysPlatformReactPlugin` vite plugin will auto-add this in its\n * config hook (see `page-bundles.ts` follow-up).\n */\nexport const GOGO_EXTERNALS_SPECIFIER_MAP: Readonly<Record<string, string>> = Object.freeze({\n \"@ethisyscore/host-ui-externals\": \"@ethisyscore/host-ui-externals\",\n});\n","/**\n * @ethisyscore/host-ui-externals/mock\n *\n * Stub implementations of every host-ui-externals export for use in\n * plugin CI, Storybook, and local development (when no host is running).\n * Renders plain semantic HTML with the correct `data-testid` attributes so\n * plugin tests can assert on structure without a real MUI/Gogo tree.\n *\n * Uses `createElement` (not JSX) so this stays a plain `.ts` module — no\n * `jsx` tsconfig setting required for the package's type-check/build.\n */\nimport { createElement, type FC, type ReactNode } from \"react\";\nimport type { GogoThemeProviderProps } from \"./index\";\nexport type { GogoTheme, GogoMode, GogoThemeProviderProps, GogoMenuItem } from \"./index\";\nexport { GOGO_EXTERNALS_SPECIFIER_MAP } from \"./index\";\n\n/**\n * Mock `GogoThemeProvider` — simply renders `children` inside a `<div>`.\n * Does NOT apply any MUI theme; sufficient for unit/smoke tests.\n */\nexport const GogoThemeProvider: FC<GogoThemeProviderProps> = ({ children }) =>\n createElement(\"div\", { \"data-testid\": \"mock-gogo-theme-provider\" }, children as ReactNode);\n\n/**\n * Mock `useGogoTheme` — returns stable no-op values.\n */\nexport function useGogoTheme() {\n return {\n theme: \"theme-blue\" as const,\n setTheme: (_: string) => {},\n mode: \"light\" as const,\n isDarkMode: false,\n direction: \"ltr\" as const,\n setMode: (_: string) => {},\n };\n}\n"]}
|
package/dist/mock.d.cts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { GogoThemeProviderProps } from './index.cjs';
|
|
3
|
+
export { GOGO_EXTERNALS_SPECIFIER_MAP, GogoMenuItem, GogoMode, GogoTheme } from './index.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @ethisyscore/host-ui-externals/mock
|
|
7
|
+
*
|
|
8
|
+
* Stub implementations of every host-ui-externals export for use in
|
|
9
|
+
* plugin CI, Storybook, and local development (when no host is running).
|
|
10
|
+
* Renders plain semantic HTML with the correct `data-testid` attributes so
|
|
11
|
+
* plugin tests can assert on structure without a real MUI/Gogo tree.
|
|
12
|
+
*
|
|
13
|
+
* Uses `createElement` (not JSX) so this stays a plain `.ts` module — no
|
|
14
|
+
* `jsx` tsconfig setting required for the package's type-check/build.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Mock `GogoThemeProvider` — simply renders `children` inside a `<div>`.
|
|
19
|
+
* Does NOT apply any MUI theme; sufficient for unit/smoke tests.
|
|
20
|
+
*/
|
|
21
|
+
declare const GogoThemeProvider: FC<GogoThemeProviderProps>;
|
|
22
|
+
/**
|
|
23
|
+
* Mock `useGogoTheme` — returns stable no-op values.
|
|
24
|
+
*/
|
|
25
|
+
declare function useGogoTheme(): {
|
|
26
|
+
theme: "theme-blue";
|
|
27
|
+
setTheme: (_: string) => void;
|
|
28
|
+
mode: "light";
|
|
29
|
+
isDarkMode: boolean;
|
|
30
|
+
direction: "ltr";
|
|
31
|
+
setMode: (_: string) => void;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { GogoThemeProvider, GogoThemeProviderProps, useGogoTheme };
|
package/dist/mock.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { GogoThemeProviderProps } from './index.js';
|
|
3
|
+
export { GOGO_EXTERNALS_SPECIFIER_MAP, GogoMenuItem, GogoMode, GogoTheme } from './index.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @ethisyscore/host-ui-externals/mock
|
|
7
|
+
*
|
|
8
|
+
* Stub implementations of every host-ui-externals export for use in
|
|
9
|
+
* plugin CI, Storybook, and local development (when no host is running).
|
|
10
|
+
* Renders plain semantic HTML with the correct `data-testid` attributes so
|
|
11
|
+
* plugin tests can assert on structure without a real MUI/Gogo tree.
|
|
12
|
+
*
|
|
13
|
+
* Uses `createElement` (not JSX) so this stays a plain `.ts` module — no
|
|
14
|
+
* `jsx` tsconfig setting required for the package's type-check/build.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Mock `GogoThemeProvider` — simply renders `children` inside a `<div>`.
|
|
19
|
+
* Does NOT apply any MUI theme; sufficient for unit/smoke tests.
|
|
20
|
+
*/
|
|
21
|
+
declare const GogoThemeProvider: FC<GogoThemeProviderProps>;
|
|
22
|
+
/**
|
|
23
|
+
* Mock `useGogoTheme` — returns stable no-op values.
|
|
24
|
+
*/
|
|
25
|
+
declare function useGogoTheme(): {
|
|
26
|
+
theme: "theme-blue";
|
|
27
|
+
setTheme: (_: string) => void;
|
|
28
|
+
mode: "light";
|
|
29
|
+
isDarkMode: boolean;
|
|
30
|
+
direction: "ltr";
|
|
31
|
+
setMode: (_: string) => void;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { GogoThemeProvider, GogoThemeProviderProps, useGogoTheme };
|
package/dist/mock.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createElement } from 'react';
|
|
2
|
+
|
|
3
|
+
// src/mock.ts
|
|
4
|
+
|
|
5
|
+
// src/index.ts
|
|
6
|
+
var GOGO_EXTERNALS_SPECIFIER_MAP = Object.freeze({
|
|
7
|
+
"@ethisyscore/host-ui-externals": "@ethisyscore/host-ui-externals"
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// src/mock.ts
|
|
11
|
+
var GogoThemeProvider = ({ children }) => createElement("div", { "data-testid": "mock-gogo-theme-provider" }, children);
|
|
12
|
+
function useGogoTheme() {
|
|
13
|
+
return {
|
|
14
|
+
theme: "theme-blue",
|
|
15
|
+
setTheme: (_) => {
|
|
16
|
+
},
|
|
17
|
+
mode: "light",
|
|
18
|
+
isDarkMode: false,
|
|
19
|
+
direction: "ltr",
|
|
20
|
+
setMode: (_) => {
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { GOGO_EXTERNALS_SPECIFIER_MAP, GogoThemeProvider, useGogoTheme };
|
|
26
|
+
//# sourceMappingURL=mock.js.map
|
|
27
|
+
//# sourceMappingURL=mock.js.map
|
package/dist/mock.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/mock.ts"],"names":[],"mappings":";;;;;AAgFO,IAAM,4BAAA,GAAiE,OAAO,MAAA,CAAO;AAAA,EAC1F,gCAAA,EAAkC;AACpC,CAAC;;;AC9DM,IAAM,iBAAA,GAAgD,CAAC,EAAE,QAAA,EAAS,KACvE,aAAA,CAAc,KAAA,EAAO,EAAE,aAAA,EAAe,0BAAA,EAA2B,EAAG,QAAqB;AAKpF,SAAS,YAAA,GAAe;AAC7B,EAAA,OAAO;AAAA,IACL,KAAA,EAAO,YAAA;AAAA,IACP,QAAA,EAAU,CAAC,CAAA,KAAc;AAAA,IAAC,CAAA;AAAA,IAC1B,IAAA,EAAM,OAAA;AAAA,IACN,UAAA,EAAY,KAAA;AAAA,IACZ,SAAA,EAAW,KAAA;AAAA,IACX,OAAA,EAAS,CAAC,CAAA,KAAc;AAAA,IAAC;AAAA,GAC3B;AACF","file":"mock.js","sourcesContent":["/**\n * @ethisyscore/host-ui-externals\n *\n * Type contracts for the Gogo UI components that the host exposes to\n * Tier T plugin remotes as shared externals. At runtime the host's\n * `hostModuleRegistry.ts` registers the actual `@coreconnect/gogo-ui`\n * instances under `\"@ethisyscore/host-ui-externals\"`; the rewriter maps\n * the plugin's bare import to that registry entry.\n *\n * Plugin builds:\n * 1. Add this package as a devDependency.\n * 2. In `vite.config.ts`, add `\"@ethisyscore/host-ui-externals\"` to the\n * `external` list (the `ethisysPlatformReactPlugin` handles this\n * automatically in the next build-plugin update).\n * 3. Import types from `\"@ethisyscore/host-ui-externals\"` — these are\n * erased at compile time and replaced at runtime with the host instance.\n *\n * For local standalone development (plugin CI, Storybook), replace the\n * production import with the mock sub-path:\n * `import { GogoThemeProvider } from \"@ethisyscore/host-ui-externals/mock\";`\n */\n\n// ── Re-exported type contracts ─────────────────────────────────────\n// These are TYPE-ONLY exports. They carry no runtime bundle weight —\n// the actual implementations live in the host's `@coreconnect/gogo-ui`.\n// Imported (not just re-exported) so `ReactNode` is in local scope for the\n// interface declarations below.\nimport type { ComponentType, ReactNode } from \"react\";\nexport type { ComponentType, ReactNode };\n\n/**\n * Gogo theme colour preset union.\n * Mirrors `GogoTheme` from `@coreconnect/gogo-ui` — kept in sync manually\n * until `gogo-ui` is published to npm.\n */\nexport type GogoTheme = \"theme-purple\" | \"theme-blue\" | \"theme-green\" | \"theme-orange\";\n\n/**\n * Gogo light/dark/system mode.\n */\nexport type GogoMode = \"light\" | \"dark\" | \"system\";\n\n/**\n * Props accepted by the host's `GogoThemeProvider`. Plugin remotes that need\n * to wrap their own subtree in the provider use this type.\n */\nexport interface GogoThemeProviderProps {\n theme?: GogoTheme;\n mode?: GogoMode;\n direction?: \"ltr\" | \"rtl\";\n children: ReactNode;\n}\n\nexport type { ReactNode as GogoChildren };\n\n/**\n * The menu item shape from `@coreconnect/gogo-ui`.\n */\nexport interface GogoMenuItem {\n id: string;\n label: string;\n icon?: string;\n href?: string;\n onClick?: () => void;\n}\n\n// ── Specifier map ──────────────────────────────────────────────────\n\n/**\n * Maps the npm specifier that plugin code imports from to the registry key\n * that `hostModuleRegistry.ts` registers the live instance under.\n *\n * Both keys are `\"@ethisyscore/host-ui-externals\"` because the registry key\n * equals the npm specifier — the rewriter looks up `spec in MODULES` where\n * `spec` is the bare specifier from the plugin's import statement.\n *\n * Plugin Vite configs add the key to `build.rollupOptions.external`.\n * The `ethisysPlatformReactPlugin` vite plugin will auto-add this in its\n * config hook (see `page-bundles.ts` follow-up).\n */\nexport const GOGO_EXTERNALS_SPECIFIER_MAP: Readonly<Record<string, string>> = Object.freeze({\n \"@ethisyscore/host-ui-externals\": \"@ethisyscore/host-ui-externals\",\n});\n","/**\n * @ethisyscore/host-ui-externals/mock\n *\n * Stub implementations of every host-ui-externals export for use in\n * plugin CI, Storybook, and local development (when no host is running).\n * Renders plain semantic HTML with the correct `data-testid` attributes so\n * plugin tests can assert on structure without a real MUI/Gogo tree.\n *\n * Uses `createElement` (not JSX) so this stays a plain `.ts` module — no\n * `jsx` tsconfig setting required for the package's type-check/build.\n */\nimport { createElement, type FC, type ReactNode } from \"react\";\nimport type { GogoThemeProviderProps } from \"./index\";\nexport type { GogoTheme, GogoMode, GogoThemeProviderProps, GogoMenuItem } from \"./index\";\nexport { GOGO_EXTERNALS_SPECIFIER_MAP } from \"./index\";\n\n/**\n * Mock `GogoThemeProvider` — simply renders `children` inside a `<div>`.\n * Does NOT apply any MUI theme; sufficient for unit/smoke tests.\n */\nexport const GogoThemeProvider: FC<GogoThemeProviderProps> = ({ children }) =>\n createElement(\"div\", { \"data-testid\": \"mock-gogo-theme-provider\" }, children as ReactNode);\n\n/**\n * Mock `useGogoTheme` — returns stable no-op values.\n */\nexport function useGogoTheme() {\n return {\n theme: \"theme-blue\" as const,\n setTheme: (_: string) => {},\n mode: \"light\" as const,\n isDarkMode: false,\n direction: \"ltr\" as const,\n setMode: (_: string) => {},\n };\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ethisyscore/host-ui-externals",
|
|
3
|
+
"version": "1.10.0",
|
|
4
|
+
"description": "Type contracts and mock build for Tier T host-supplied Gogo UI externals. Plugin builds depend on this as a dev-dep; production bundles externalise the specifier so the host's registered module instance is used at runtime.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./mock": {
|
|
16
|
+
"types": "./dist/mock.d.ts",
|
|
17
|
+
"import": "./dist/mock.js",
|
|
18
|
+
"require": "./dist/mock.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup",
|
|
26
|
+
"dev": "tsup --watch",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"lint": "tsc --noEmit"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"react": ">=18.0.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^25.5.0",
|
|
35
|
+
"@types/react": "^19.0.0",
|
|
36
|
+
"react": "^19.0.0",
|
|
37
|
+
"tsup": "^8.5.1",
|
|
38
|
+
"typescript": "^5.9.3",
|
|
39
|
+
"vitest": "^4.1.0"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"ethisyscore",
|
|
43
|
+
"tier-t",
|
|
44
|
+
"gogo-ui",
|
|
45
|
+
"externals",
|
|
46
|
+
"plugin"
|
|
47
|
+
],
|
|
48
|
+
"license": "Apache-2.0",
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "https://github.com/ethisysltd/ethisyscore-plugin-sdk"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=20"
|
|
55
|
+
}
|
|
56
|
+
}
|