@adminiumjs/add-on-contracts 0.2.9 → 0.3.0-rc.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/dist/add-on-block.d.ts +134 -6
- package/dist/add-on-block.d.ts.map +1 -1
- package/dist/add-on-block.js +173 -7
- package/dist/add-on-block.js.map +1 -1
- package/dist/artwork-source.d.ts +2 -2
- package/dist/artwork-source.js +2 -2
- package/dist/contracts.d.ts +3 -3
- package/dist/contracts.js +16 -16
- package/dist/document-render.d.ts +17 -17
- package/dist/document-render.d.ts.map +1 -1
- package/dist/document-render.js +11 -11
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/nav-groups.d.ts +28 -0
- package/dist/nav-groups.d.ts.map +1 -0
- package/dist/nav-groups.js +28 -0
- package/dist/nav-groups.js.map +1 -0
- package/dist/product-personalizer.d.ts +3 -3
- package/dist/product-personalizer.js +3 -3
- package/dist/runtime/app-types.d.ts +165 -0
- package/dist/runtime/app-types.d.ts.map +1 -0
- package/dist/runtime/app-types.js +2 -0
- package/dist/runtime/app-types.js.map +1 -0
- package/dist/runtime/app.d.ts +31 -0
- package/dist/runtime/app.d.ts.map +1 -0
- package/dist/runtime/app.js +29 -0
- package/dist/runtime/app.js.map +1 -0
- package/dist/runtime/compiler-runtime.d.ts +7 -0
- package/dist/runtime/compiler-runtime.d.ts.map +1 -0
- package/dist/runtime/compiler-runtime.js +10 -0
- package/dist/runtime/compiler-runtime.js.map +1 -0
- package/dist/runtime/i18n.d.ts +15 -0
- package/dist/runtime/i18n.d.ts.map +1 -0
- package/dist/runtime/i18n.js +17 -0
- package/dist/runtime/i18n.js.map +1 -0
- package/dist/runtime/index.d.ts +189 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +272 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/jsx-runtime.d.ts +12 -0
- package/dist/runtime/jsx-runtime.d.ts.map +1 -0
- package/dist/runtime/jsx-runtime.js +15 -0
- package/dist/runtime/jsx-runtime.js.map +1 -0
- package/dist/runtime/query.d.ts +19 -0
- package/dist/runtime/query.d.ts.map +1 -0
- package/dist/runtime/query.js +21 -0
- package/dist/runtime/query.js.map +1 -0
- package/dist/runtime/react-dom.d.ts +22 -0
- package/dist/runtime/react-dom.d.ts.map +1 -0
- package/dist/runtime/react-dom.js +28 -0
- package/dist/runtime/react-dom.js.map +1 -0
- package/dist/runtime/react.d.ts +56 -0
- package/dist/runtime/react.d.ts.map +1 -0
- package/dist/runtime/react.js +58 -0
- package/dist/runtime/react.js.map +1 -0
- package/dist/runtime/router.d.ts +18 -0
- package/dist/runtime/router.d.ts.map +1 -0
- package/dist/runtime/router.js +20 -0
- package/dist/runtime/router.js.map +1 -0
- package/dist/runtime/ui.d.ts +36 -0
- package/dist/runtime/ui.d.ts.map +1 -0
- package/dist/runtime/ui.js +38 -0
- package/dist/runtime/ui.js.map +1 -0
- package/dist/shipping-carrier.d.ts +2 -2
- package/dist/shipping-carrier.js +2 -2
- package/dist/slots.d.ts +2 -3
- package/dist/slots.d.ts.map +1 -1
- package/dist/slots.js +13 -15
- package/dist/slots.js.map +1 -1
- package/dist/testing/index.d.ts +6 -6
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +8 -8
- package/dist/testing/index.js.map +1 -1
- package/package.json +45 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE HOST RUNTIME CONTRACT: how code loaded at run time gets React from the
|
|
3
|
+
* page that loads it.
|
|
4
|
+
*
|
|
5
|
+
* Two kinds of code arrive as ES modules the host did not build: an add-on's
|
|
6
|
+
* client bundle, and a project's own pages and widgets. Both must render with
|
|
7
|
+
* the host's React. Two copies of React in one page are two reconcilers arguing
|
|
8
|
+
* over one DOM tree: hooks throw, context is empty.
|
|
9
|
+
*
|
|
10
|
+
* So the host publishes its React on a well-known global before it imports any
|
|
11
|
+
* such module, and the module's build replaces `react`, `react/jsx-runtime`,
|
|
12
|
+
* `react/compiler-runtime` and `react-dom` with the shims beside this file,
|
|
13
|
+
* which read that global. A built bundle then has no bare import a browser
|
|
14
|
+
* would have to resolve, loads from a plain same-origin URL (the CSP needs
|
|
15
|
+
* nothing beyond `'self'`), and still uses exactly one React.
|
|
16
|
+
*
|
|
17
|
+
* This is a copy of the contract `Adminiumjs/add-ons` defines in
|
|
18
|
+
* `packages/host/src/runtime/`, with two optional additions that code written
|
|
19
|
+
* against the original never reads: `reactDom`, and `ui` (the UI kit a project
|
|
20
|
+
* imports from `@adminiumjs/adminium/ui`). `test/runtime.test.ts` pins the
|
|
21
|
+
* shared part, so the two copies cannot drift apart silently.
|
|
22
|
+
*
|
|
23
|
+
* ─── The ordering rule ─────────────────────────────────────────────────────
|
|
24
|
+
*
|
|
25
|
+
* A host MUST call {@link installAddOnRuntime} before it imports a bundle. The
|
|
26
|
+
* shims read the global when their module initialises, so a bundle imported
|
|
27
|
+
* first sees nothing, and the error it throws names the missing call instead
|
|
28
|
+
* of failing later as `undefined is not a function` inside a hook.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* The React values a bundle may use. An index signature on purpose: the host
|
|
32
|
+
* passes its React namespace straight through, and bundled libraries reach for
|
|
33
|
+
* more of it than any hand-written list would guess.
|
|
34
|
+
*/
|
|
35
|
+
export type AddOnReactRuntime = Readonly<Record<string, unknown>>;
|
|
36
|
+
/** The automatic JSX runtime's entry points. */
|
|
37
|
+
export interface AddOnJsxRuntime {
|
|
38
|
+
jsx: unknown;
|
|
39
|
+
jsxs: unknown;
|
|
40
|
+
Fragment: unknown;
|
|
41
|
+
}
|
|
42
|
+
export interface AddOnRuntime {
|
|
43
|
+
react: AddOnReactRuntime;
|
|
44
|
+
jsx: AddOnJsxRuntime;
|
|
45
|
+
/** The host's `react-dom` namespace, for `createPortal` and friends. */
|
|
46
|
+
reactDom?: Readonly<Record<string, unknown>> | undefined;
|
|
47
|
+
/** The project UI kit, keyed by the names in {@link PROJECT_UI_EXPORTS}. */
|
|
48
|
+
ui?: Readonly<Record<string, unknown>> | undefined;
|
|
49
|
+
/** The host API an add-on PAGE is built against (51c). */
|
|
50
|
+
host?: AddOnHostApi | undefined;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* THE HOST API — what a dashboard publishes to an add-on's page bundle (51c).
|
|
54
|
+
*
|
|
55
|
+
* Four namespaces, each aliased at build time to the shim beside this file, so
|
|
56
|
+
* an add-on's page imports `@adminium/ui`, `@tanstack/react-router`,
|
|
57
|
+
* `@tanstack/react-query` and `@adminium/i18n` by their real names and gets the
|
|
58
|
+
* HOST's copies. Two of those are not optional niceties: a second react-query
|
|
59
|
+
* is a second cache behind an empty provider, and a second router is a second
|
|
60
|
+
* history — both render a blank screen with no error at all.
|
|
61
|
+
*
|
|
62
|
+
* WHY RAW LIBRARIES RATHER THAN A CURATED KIT. `PROJECT_UI_EXPORTS` above is a
|
|
63
|
+
* curated surface, and it is right for a project's own pages: someone writing
|
|
64
|
+
* one is writing new code against a small API. An add-on page is EXISTING code
|
|
65
|
+
* moving across a repository boundary — 51d moves 11,100 lines of it — and a
|
|
66
|
+
* curated kit would mean rewriting every one of those files to import
|
|
67
|
+
* different names for the same components. The lists below are a census of
|
|
68
|
+
* what that code actually imports, not a guess at what it might.
|
|
69
|
+
*
|
|
70
|
+
* WHAT THIS COSTS, SAID OUT LOUD. Every name in the four lists below is public
|
|
71
|
+
* API from the moment a published add-on imports it. `version` is how that is
|
|
72
|
+
* survivable: it is pinned in the manifest as `addOn.hostApi`, and a host that
|
|
73
|
+
* does not recognise a version refuses the page by name instead of mounting it
|
|
74
|
+
* into a blank screen.
|
|
75
|
+
*/
|
|
76
|
+
export interface AddOnHostApi {
|
|
77
|
+
/** Matches `HOST_API_VERSION`; a bundle built against another is refused. */
|
|
78
|
+
version: number;
|
|
79
|
+
/** `@adminium/ui`, keyed by {@link ADD_ON_UI_EXPORTS}. */
|
|
80
|
+
ui: Readonly<Record<string, unknown>>;
|
|
81
|
+
/** `@tanstack/react-router`, keyed by {@link ADD_ON_ROUTER_EXPORTS}. */
|
|
82
|
+
router: Readonly<Record<string, unknown>>;
|
|
83
|
+
/** `@tanstack/react-query`, keyed by {@link ADD_ON_QUERY_EXPORTS}. */
|
|
84
|
+
query: Readonly<Record<string, unknown>>;
|
|
85
|
+
/** `@adminium/i18n`, keyed by {@link ADD_ON_I18N_EXPORTS}. */
|
|
86
|
+
i18n: Readonly<Record<string, unknown>>;
|
|
87
|
+
/** The DASHBOARD's own helpers, keyed by {@link ADD_ON_APP_EXPORTS}. */
|
|
88
|
+
app: Readonly<Record<string, unknown>>;
|
|
89
|
+
}
|
|
90
|
+
export type * from './app-types.js';
|
|
91
|
+
/** The host API version this package defines; `addOn.hostApi` must equal it. */
|
|
92
|
+
export declare const HOST_API_VERSION = 1;
|
|
93
|
+
/**
|
|
94
|
+
* Read the host API, or explain exactly what the host forgot — and never
|
|
95
|
+
* return a half-installed one, because the failure a bundle would otherwise
|
|
96
|
+
* hit is `undefined is not a function` three stack frames inside a hook.
|
|
97
|
+
*/
|
|
98
|
+
export declare function requireAddOnHost(): AddOnHostApi;
|
|
99
|
+
/**
|
|
100
|
+
* The global a host publishes on. A global rather than an argument because
|
|
101
|
+
* JSX compiles to `jsx(...)` calls at module scope: a bundle's first
|
|
102
|
+
* expression may already need the runtime.
|
|
103
|
+
*/
|
|
104
|
+
export declare const ADD_ON_RUNTIME_KEY = "__ADMINIUM_ADD_ON_RUNTIME__";
|
|
105
|
+
/** Called by the HOST, once, before importing any bundle. */
|
|
106
|
+
export declare function installAddOnRuntime(runtime: AddOnRuntime): void;
|
|
107
|
+
/** Whether a host has published a runtime yet. */
|
|
108
|
+
export declare function hasAddOnRuntime(): boolean;
|
|
109
|
+
/** Read the runtime, or explain precisely what the host forgot. */
|
|
110
|
+
export declare function requireAddOnRuntime(): AddOnRuntime;
|
|
111
|
+
/** For a host to clear between tests. */
|
|
112
|
+
export declare function clearAddOnRuntime(): void;
|
|
113
|
+
/**
|
|
114
|
+
* What the `react` shim re-exports: React 19's public surface. A name a
|
|
115
|
+
* bundle imports that is missing here fails its build, never its page, and
|
|
116
|
+
* the dashboard's test compares this list with the React it ships.
|
|
117
|
+
*/
|
|
118
|
+
export declare const REACT_EXPORTS: readonly ["Activity", "Children", "Component", "Fragment", "Profiler", "PureComponent", "StrictMode", "Suspense", "__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE", "__COMPILER_RUNTIME", "act", "cache", "cacheSignal", "captureOwnerStack", "cloneElement", "createContext", "createElement", "createRef", "forwardRef", "isValidElement", "lazy", "memo", "startTransition", "unstable_useCacheRefresh", "use", "useActionState", "useCallback", "useContext", "useDebugValue", "useDeferredValue", "useEffect", "useEffectEvent", "useId", "useImperativeHandle", "useInsertionEffect", "useLayoutEffect", "useMemo", "useOptimistic", "useReducer", "useRef", "useState", "useSyncExternalStore", "useTransition", "version"];
|
|
119
|
+
/** What the `react/jsx-runtime` shim exports (`jsxDEV` maps to `jsx`). */
|
|
120
|
+
export declare const JSX_RUNTIME_EXPORTS: readonly ["Fragment", "jsx", "jsxDEV", "jsxs"];
|
|
121
|
+
/** What the `react-dom` shim re-exports. `react-dom/client` is the host's alone. */
|
|
122
|
+
export declare const REACT_DOM_EXPORTS: readonly ["__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE", "createPortal", "flushSync", "preconnect", "prefetchDNS", "preinit", "preinitModule", "preload", "preloadModule", "requestFormReset", "unstable_batchedUpdates", "useFormState", "useFormStatus", "version"];
|
|
123
|
+
/**
|
|
124
|
+
* The project UI kit (`@adminiumjs/adminium/ui`): what a host puts in `ui`.
|
|
125
|
+
* `definePage` and `defineWidget` are not here; they are plain functions
|
|
126
|
+
* inside the kit module itself, so a build can read a page's settings without
|
|
127
|
+
* a host.
|
|
128
|
+
*/
|
|
129
|
+
export declare const PROJECT_UI_EXPORTS: readonly ["Button", "Card", "DataTable", "EmptyState", "GeneratedPage", "Grid", "Icon", "Input", "Link", "Page", "Select", "Stack", "Stat", "Switch", "toast", "useCurrentUser", "useMutation", "useNavigate", "useRecord", "useRecords"];
|
|
130
|
+
export type ProjectUiExport = (typeof PROJECT_UI_EXPORTS)[number];
|
|
131
|
+
/**
|
|
132
|
+
* THE DASHBOARD'S OWN HELPERS — the fifth namespace (51d, O7).
|
|
133
|
+
*
|
|
134
|
+
* The first four are libraries an add-on could in principle bundle for itself
|
|
135
|
+
* (wrongly, but it could). These eleven are the HOST: its translation function,
|
|
136
|
+
* its API client, its toast bus, its page chrome, its icon resolver. An add-on
|
|
137
|
+
* page cannot reimplement them — a second `t()` reads a second catalogue, a
|
|
138
|
+
* second API client misses the CSRF token, a second toast bus renders toasts
|
|
139
|
+
* nobody sees — so they are published rather than copied.
|
|
140
|
+
*
|
|
141
|
+
* THIS IS THE SURFACE O7 ADDED, AND IT IS THE WIDER HALF OF THE DOOR. It was
|
|
142
|
+
* found by counting: the invoice surface imports these at 254 sites across 72
|
|
143
|
+
* of its 85 files, which is what turned "move the page" from a file move into
|
|
144
|
+
* an API decision. `t` alone is 59 of them.
|
|
145
|
+
*
|
|
146
|
+
* `formatSince` lives in `team/teamApi.ts` today, which is an accident of where
|
|
147
|
+
* it was first needed — it is a pure `Intl.RelativeTimeFormat` wrapper over the
|
|
148
|
+
* host's cached formatters. Published here rather than copied, so two relative
|
|
149
|
+
* clocks cannot disagree on the same screen.
|
|
150
|
+
*/
|
|
151
|
+
export declare const ADD_ON_APP_EXPORTS: readonly ["ApiError", "PageActions", "PageSurface", "api", "formatSince", "lucideByName", "registerMessages", "t", "useLocaleTag", "useAppToasts", "useShortcut"];
|
|
152
|
+
export type AddOnAppExport = (typeof ADD_ON_APP_EXPORTS)[number];
|
|
153
|
+
/**
|
|
154
|
+
* `@adminium/ui` — the components an add-on page may import (51c).
|
|
155
|
+
*
|
|
156
|
+
* A census, not a guess: every symbol the invoice surface imports from the
|
|
157
|
+
* kit, which is the first and largest page to move. Adding a
|
|
158
|
+
* name here is adding public API and is a deliberate act; `add-on-host.test.ts`
|
|
159
|
+
* holds the shim and this list equal so neither can grow quietly.
|
|
160
|
+
*/
|
|
161
|
+
export declare const ADD_ON_UI_EXPORTS: readonly ["Alert", "AutosaveIndicator", "Badge", "Button", "EmptyState", "IconButton", "Modal", "ModalBody", "ModalFooter", "ModalHeader", "Popover", "PopoverContent", "PopoverTrigger", "SearchInput", "SegmentedControl", "Spinner", "Tabs", "TabsContent", "TabsList", "TabsTrigger", "Tag", "cn"];
|
|
162
|
+
export type AddOnUiExport = (typeof ADD_ON_UI_EXPORTS)[number];
|
|
163
|
+
/**
|
|
164
|
+
* `@tanstack/react-router` — navigation only.
|
|
165
|
+
*
|
|
166
|
+
* No `Link`, no route-building: an add-on page lives under one route the HOST
|
|
167
|
+
* registered (`/add-ons/$key/$`), and giving it the router's route API would
|
|
168
|
+
* let it define routes the host's tree has never heard of.
|
|
169
|
+
*/
|
|
170
|
+
export declare const ADD_ON_ROUTER_EXPORTS: readonly ["useBlocker", "useNavigate", "useParams", "useSearch"];
|
|
171
|
+
export type AddOnRouterExport = (typeof ADD_ON_ROUTER_EXPORTS)[number];
|
|
172
|
+
/**
|
|
173
|
+
* `@tanstack/react-query` — the host's client, never a second one.
|
|
174
|
+
*
|
|
175
|
+
* `QueryClient` is here as a TYPE consumers annotate with; a page that
|
|
176
|
+
* constructs one gets its own cache, which is the bug this namespace exists to
|
|
177
|
+
* prevent, and `useQueryClient` is what it should reach for instead.
|
|
178
|
+
*/
|
|
179
|
+
export declare const ADD_ON_QUERY_EXPORTS: readonly ["QueryClient", "queryOptions", "useMutation", "useQuery", "useQueryClient"];
|
|
180
|
+
export type AddOnQueryExport = (typeof ADD_ON_QUERY_EXPORTS)[number];
|
|
181
|
+
/**
|
|
182
|
+
* `@adminium/i18n` — turning the session's locale id into something `Intl`
|
|
183
|
+
* understands. `tagForLocale` is the one the invoice surface actually calls
|
|
184
|
+
* (`de_DE` → `de-DE`); `LocaleId` travels with it as a type, which needs no
|
|
185
|
+
* runtime export.
|
|
186
|
+
*/
|
|
187
|
+
export declare const ADD_ON_I18N_EXPORTS: readonly ["tagForLocale"];
|
|
188
|
+
export type AddOnI18nExport = (typeof ADD_ON_I18N_EXPORTS)[number];
|
|
189
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAElE,gDAAgD;AAChD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,iBAAiB,CAAC;IACzB,GAAG,EAAE,eAAe,CAAC;IACrB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IACzD,4EAA4E;IAC5E,EAAE,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IACnD,0DAA0D;IAC1D,IAAI,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,YAAY;IAC3B,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,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AAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,wSAuBpB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,kEAAmE,CAAC;AACtG,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,uFAMvB,CAAC;AACX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,2BAA4B,CAAC;AAC7D,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* THE HOST RUNTIME CONTRACT: how code loaded at run time gets React from the
|
|
4
|
+
* page that loads it.
|
|
5
|
+
*
|
|
6
|
+
* Two kinds of code arrive as ES modules the host did not build: an add-on's
|
|
7
|
+
* client bundle, and a project's own pages and widgets. Both must render with
|
|
8
|
+
* the host's React. Two copies of React in one page are two reconcilers arguing
|
|
9
|
+
* over one DOM tree: hooks throw, context is empty.
|
|
10
|
+
*
|
|
11
|
+
* So the host publishes its React on a well-known global before it imports any
|
|
12
|
+
* such module, and the module's build replaces `react`, `react/jsx-runtime`,
|
|
13
|
+
* `react/compiler-runtime` and `react-dom` with the shims beside this file,
|
|
14
|
+
* which read that global. A built bundle then has no bare import a browser
|
|
15
|
+
* would have to resolve, loads from a plain same-origin URL (the CSP needs
|
|
16
|
+
* nothing beyond `'self'`), and still uses exactly one React.
|
|
17
|
+
*
|
|
18
|
+
* This is a copy of the contract `Adminiumjs/add-ons` defines in
|
|
19
|
+
* `packages/host/src/runtime/`, with two optional additions that code written
|
|
20
|
+
* against the original never reads: `reactDom`, and `ui` (the UI kit a project
|
|
21
|
+
* imports from `@adminiumjs/adminium/ui`). `test/runtime.test.ts` pins the
|
|
22
|
+
* shared part, so the two copies cannot drift apart silently.
|
|
23
|
+
*
|
|
24
|
+
* ─── The ordering rule ─────────────────────────────────────────────────────
|
|
25
|
+
*
|
|
26
|
+
* A host MUST call {@link installAddOnRuntime} before it imports a bundle. The
|
|
27
|
+
* shims read the global when their module initialises, so a bundle imported
|
|
28
|
+
* first sees nothing, and the error it throws names the missing call instead
|
|
29
|
+
* of failing later as `undefined is not a function` inside a hook.
|
|
30
|
+
*/
|
|
31
|
+
/** The host API version this package defines; `addOn.hostApi` must equal it. */
|
|
32
|
+
export const HOST_API_VERSION = 1;
|
|
33
|
+
/**
|
|
34
|
+
* Read the host API, or explain exactly what the host forgot — and never
|
|
35
|
+
* return a half-installed one, because the failure a bundle would otherwise
|
|
36
|
+
* hit is `undefined is not a function` three stack frames inside a hook.
|
|
37
|
+
*/
|
|
38
|
+
export function requireAddOnHost() {
|
|
39
|
+
const { host } = requireAddOnRuntime();
|
|
40
|
+
if (host === undefined) {
|
|
41
|
+
throw new Error('This host published no add-on host API. Install the runtime with ' +
|
|
42
|
+
'installAddOnRuntime({ react, jsx, host }) BEFORE importing a page bundle.');
|
|
43
|
+
}
|
|
44
|
+
if (host.version !== HOST_API_VERSION) {
|
|
45
|
+
throw new Error(`This page was built against host API ${HOST_API_VERSION}, and the host publishes ` +
|
|
46
|
+
`${host.version}. Bring whichever is older forward; mounting it anyway is how a blank ` +
|
|
47
|
+
'screen with no error happens.');
|
|
48
|
+
}
|
|
49
|
+
return host;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The global a host publishes on. A global rather than an argument because
|
|
53
|
+
* JSX compiles to `jsx(...)` calls at module scope: a bundle's first
|
|
54
|
+
* expression may already need the runtime.
|
|
55
|
+
*/
|
|
56
|
+
export const ADD_ON_RUNTIME_KEY = '__ADMINIUM_ADD_ON_RUNTIME__';
|
|
57
|
+
const carrier = () => globalThis;
|
|
58
|
+
/** Called by the HOST, once, before importing any bundle. */
|
|
59
|
+
export function installAddOnRuntime(runtime) {
|
|
60
|
+
carrier()[ADD_ON_RUNTIME_KEY] = runtime;
|
|
61
|
+
}
|
|
62
|
+
/** Whether a host has published a runtime yet. */
|
|
63
|
+
export function hasAddOnRuntime() {
|
|
64
|
+
return carrier()[ADD_ON_RUNTIME_KEY] !== undefined;
|
|
65
|
+
}
|
|
66
|
+
/** Read the runtime, or explain precisely what the host forgot. */
|
|
67
|
+
export function requireAddOnRuntime() {
|
|
68
|
+
const runtime = carrier()[ADD_ON_RUNTIME_KEY];
|
|
69
|
+
if (runtime === undefined) {
|
|
70
|
+
throw new Error('No add-on runtime was installed by the host. Call installAddOnRuntime({ react, jsx }) ' +
|
|
71
|
+
'BEFORE importing any add-on bundle — the bundle reads it as its module initialises, ' +
|
|
72
|
+
'so installing it afterwards is too late.');
|
|
73
|
+
}
|
|
74
|
+
return runtime;
|
|
75
|
+
}
|
|
76
|
+
/** For a host to clear between tests. */
|
|
77
|
+
export function clearAddOnRuntime() {
|
|
78
|
+
delete carrier()[ADD_ON_RUNTIME_KEY];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* What the `react` shim re-exports: React 19's public surface. A name a
|
|
82
|
+
* bundle imports that is missing here fails its build, never its page, and
|
|
83
|
+
* the dashboard's test compares this list with the React it ships.
|
|
84
|
+
*/
|
|
85
|
+
export const REACT_EXPORTS = [
|
|
86
|
+
'Activity',
|
|
87
|
+
'Children',
|
|
88
|
+
'Component',
|
|
89
|
+
'Fragment',
|
|
90
|
+
'Profiler',
|
|
91
|
+
'PureComponent',
|
|
92
|
+
'StrictMode',
|
|
93
|
+
'Suspense',
|
|
94
|
+
'__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE',
|
|
95
|
+
'__COMPILER_RUNTIME',
|
|
96
|
+
'act',
|
|
97
|
+
'cache',
|
|
98
|
+
'cacheSignal',
|
|
99
|
+
'captureOwnerStack',
|
|
100
|
+
'cloneElement',
|
|
101
|
+
'createContext',
|
|
102
|
+
'createElement',
|
|
103
|
+
'createRef',
|
|
104
|
+
'forwardRef',
|
|
105
|
+
'isValidElement',
|
|
106
|
+
'lazy',
|
|
107
|
+
'memo',
|
|
108
|
+
'startTransition',
|
|
109
|
+
'unstable_useCacheRefresh',
|
|
110
|
+
'use',
|
|
111
|
+
'useActionState',
|
|
112
|
+
'useCallback',
|
|
113
|
+
'useContext',
|
|
114
|
+
'useDebugValue',
|
|
115
|
+
'useDeferredValue',
|
|
116
|
+
'useEffect',
|
|
117
|
+
'useEffectEvent',
|
|
118
|
+
'useId',
|
|
119
|
+
'useImperativeHandle',
|
|
120
|
+
'useInsertionEffect',
|
|
121
|
+
'useLayoutEffect',
|
|
122
|
+
'useMemo',
|
|
123
|
+
'useOptimistic',
|
|
124
|
+
'useReducer',
|
|
125
|
+
'useRef',
|
|
126
|
+
'useState',
|
|
127
|
+
'useSyncExternalStore',
|
|
128
|
+
'useTransition',
|
|
129
|
+
'version',
|
|
130
|
+
];
|
|
131
|
+
/** What the `react/jsx-runtime` shim exports (`jsxDEV` maps to `jsx`). */
|
|
132
|
+
export const JSX_RUNTIME_EXPORTS = ['Fragment', 'jsx', 'jsxDEV', 'jsxs'];
|
|
133
|
+
/** What the `react-dom` shim re-exports. `react-dom/client` is the host's alone. */
|
|
134
|
+
export const REACT_DOM_EXPORTS = [
|
|
135
|
+
'__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE',
|
|
136
|
+
'createPortal',
|
|
137
|
+
'flushSync',
|
|
138
|
+
'preconnect',
|
|
139
|
+
'prefetchDNS',
|
|
140
|
+
'preinit',
|
|
141
|
+
'preinitModule',
|
|
142
|
+
'preload',
|
|
143
|
+
'preloadModule',
|
|
144
|
+
'requestFormReset',
|
|
145
|
+
'unstable_batchedUpdates',
|
|
146
|
+
'useFormState',
|
|
147
|
+
'useFormStatus',
|
|
148
|
+
'version',
|
|
149
|
+
];
|
|
150
|
+
/**
|
|
151
|
+
* The project UI kit (`@adminiumjs/adminium/ui`): what a host puts in `ui`.
|
|
152
|
+
* `definePage` and `defineWidget` are not here; they are plain functions
|
|
153
|
+
* inside the kit module itself, so a build can read a page's settings without
|
|
154
|
+
* a host.
|
|
155
|
+
*/
|
|
156
|
+
export const PROJECT_UI_EXPORTS = [
|
|
157
|
+
'Button',
|
|
158
|
+
'Card',
|
|
159
|
+
'DataTable',
|
|
160
|
+
'EmptyState',
|
|
161
|
+
'GeneratedPage',
|
|
162
|
+
'Grid',
|
|
163
|
+
'Icon',
|
|
164
|
+
'Input',
|
|
165
|
+
'Link',
|
|
166
|
+
'Page',
|
|
167
|
+
'Select',
|
|
168
|
+
'Stack',
|
|
169
|
+
'Stat',
|
|
170
|
+
'Switch',
|
|
171
|
+
'toast',
|
|
172
|
+
'useCurrentUser',
|
|
173
|
+
'useMutation',
|
|
174
|
+
'useNavigate',
|
|
175
|
+
'useRecord',
|
|
176
|
+
'useRecords',
|
|
177
|
+
];
|
|
178
|
+
/**
|
|
179
|
+
* THE DASHBOARD'S OWN HELPERS — the fifth namespace (51d, O7).
|
|
180
|
+
*
|
|
181
|
+
* The first four are libraries an add-on could in principle bundle for itself
|
|
182
|
+
* (wrongly, but it could). These eleven are the HOST: its translation function,
|
|
183
|
+
* its API client, its toast bus, its page chrome, its icon resolver. An add-on
|
|
184
|
+
* page cannot reimplement them — a second `t()` reads a second catalogue, a
|
|
185
|
+
* second API client misses the CSRF token, a second toast bus renders toasts
|
|
186
|
+
* nobody sees — so they are published rather than copied.
|
|
187
|
+
*
|
|
188
|
+
* THIS IS THE SURFACE O7 ADDED, AND IT IS THE WIDER HALF OF THE DOOR. It was
|
|
189
|
+
* found by counting: the invoice surface imports these at 254 sites across 72
|
|
190
|
+
* of its 85 files, which is what turned "move the page" from a file move into
|
|
191
|
+
* an API decision. `t` alone is 59 of them.
|
|
192
|
+
*
|
|
193
|
+
* `formatSince` lives in `team/teamApi.ts` today, which is an accident of where
|
|
194
|
+
* it was first needed — it is a pure `Intl.RelativeTimeFormat` wrapper over the
|
|
195
|
+
* host's cached formatters. Published here rather than copied, so two relative
|
|
196
|
+
* clocks cannot disagree on the same screen.
|
|
197
|
+
*/
|
|
198
|
+
export const ADD_ON_APP_EXPORTS = [
|
|
199
|
+
'ApiError',
|
|
200
|
+
'PageActions',
|
|
201
|
+
'PageSurface',
|
|
202
|
+
'api',
|
|
203
|
+
'formatSince',
|
|
204
|
+
'lucideByName',
|
|
205
|
+
'registerMessages',
|
|
206
|
+
't',
|
|
207
|
+
'useLocaleTag',
|
|
208
|
+
'useAppToasts',
|
|
209
|
+
'useShortcut',
|
|
210
|
+
];
|
|
211
|
+
/**
|
|
212
|
+
* `@adminium/ui` — the components an add-on page may import (51c).
|
|
213
|
+
*
|
|
214
|
+
* A census, not a guess: every symbol the invoice surface imports from the
|
|
215
|
+
* kit, which is the first and largest page to move. Adding a
|
|
216
|
+
* name here is adding public API and is a deliberate act; `add-on-host.test.ts`
|
|
217
|
+
* holds the shim and this list equal so neither can grow quietly.
|
|
218
|
+
*/
|
|
219
|
+
export const ADD_ON_UI_EXPORTS = [
|
|
220
|
+
'Alert',
|
|
221
|
+
'AutosaveIndicator',
|
|
222
|
+
'Badge',
|
|
223
|
+
'Button',
|
|
224
|
+
'EmptyState',
|
|
225
|
+
'IconButton',
|
|
226
|
+
'Modal',
|
|
227
|
+
'ModalBody',
|
|
228
|
+
'ModalFooter',
|
|
229
|
+
'ModalHeader',
|
|
230
|
+
'Popover',
|
|
231
|
+
'PopoverContent',
|
|
232
|
+
'PopoverTrigger',
|
|
233
|
+
'SearchInput',
|
|
234
|
+
'SegmentedControl',
|
|
235
|
+
'Spinner',
|
|
236
|
+
'Tabs',
|
|
237
|
+
'TabsContent',
|
|
238
|
+
'TabsList',
|
|
239
|
+
'TabsTrigger',
|
|
240
|
+
'Tag',
|
|
241
|
+
'cn',
|
|
242
|
+
];
|
|
243
|
+
/**
|
|
244
|
+
* `@tanstack/react-router` — navigation only.
|
|
245
|
+
*
|
|
246
|
+
* No `Link`, no route-building: an add-on page lives under one route the HOST
|
|
247
|
+
* registered (`/add-ons/$key/$`), and giving it the router's route API would
|
|
248
|
+
* let it define routes the host's tree has never heard of.
|
|
249
|
+
*/
|
|
250
|
+
export const ADD_ON_ROUTER_EXPORTS = ['useBlocker', 'useNavigate', 'useParams', 'useSearch'];
|
|
251
|
+
/**
|
|
252
|
+
* `@tanstack/react-query` — the host's client, never a second one.
|
|
253
|
+
*
|
|
254
|
+
* `QueryClient` is here as a TYPE consumers annotate with; a page that
|
|
255
|
+
* constructs one gets its own cache, which is the bug this namespace exists to
|
|
256
|
+
* prevent, and `useQueryClient` is what it should reach for instead.
|
|
257
|
+
*/
|
|
258
|
+
export const ADD_ON_QUERY_EXPORTS = [
|
|
259
|
+
'QueryClient',
|
|
260
|
+
'queryOptions',
|
|
261
|
+
'useMutation',
|
|
262
|
+
'useQuery',
|
|
263
|
+
'useQueryClient',
|
|
264
|
+
];
|
|
265
|
+
/**
|
|
266
|
+
* `@adminium/i18n` — turning the session's locale id into something `Intl`
|
|
267
|
+
* understands. `tagForLocale` is the one the invoice surface actually calls
|
|
268
|
+
* (`de_DE` → `de-DE`); `LocaleId` travels with it as a type, which needs no
|
|
269
|
+
* runtime export.
|
|
270
|
+
*/
|
|
271
|
+
export const ADD_ON_I18N_EXPORTS = ['tagForLocale'];
|
|
272
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAyEH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CAAC;AAIX;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,UAAU;IACV,aAAa;IACb,aAAa;IACb,KAAK;IACL,aAAa;IACb,cAAc;IACd,kBAAkB;IAClB,GAAG;IACH,cAAc;IACd,cAAc;IACd,aAAa;CACL,CAAC;AAGX;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,OAAO;IACP,mBAAmB;IACnB,OAAO;IACP,QAAQ;IACR,YAAY;IACZ,YAAY;IACZ,OAAO;IACP,WAAW;IACX,aAAa;IACb,aAAa;IACb,SAAS;IACT,gBAAgB;IAChB,gBAAgB;IAChB,aAAa;IACb,kBAAkB;IAClB,SAAS;IACT,MAAM;IACN,aAAa;IACb,UAAU;IACV,aAAa;IACb,KAAK;IACL,IAAI;CACI,CAAC;AAGX;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,CAAU,CAAC;AAGtG;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,aAAa;IACb,cAAc;IACd,aAAa;IACb,UAAU;IACV,gBAAgB;CACR,CAAC;AAGX;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,cAAc,CAAU,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `react/jsx-runtime` shim a bundle build aliases to (see `./index.ts`).
|
|
3
|
+
*
|
|
4
|
+
* The automatic JSX transform emits `jsx`/`jsxs` calls at module scope, which
|
|
5
|
+
* is why the runtime is a global. `react/jsx-dev-runtime` aliases here too: a
|
|
6
|
+
* production build never emits `jsxDEV`, and one that did gets `jsx`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const jsx: never;
|
|
9
|
+
export declare const jsxs: never;
|
|
10
|
+
export declare const jsxDEV: never;
|
|
11
|
+
export declare const Fragment: never;
|
|
12
|
+
//# sourceMappingURL=jsx-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/jsx-runtime.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAMH,eAAO,MAAM,GAAG,EAAkB,KAAK,CAAC;AACxC,eAAO,MAAM,IAAI,EAAmB,KAAK,CAAC;AAC1C,eAAO,MAAM,MAAM,EAAkB,KAAK,CAAC;AAC3C,eAAO,MAAM,QAAQ,EAAuB,KAAK,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* The `react/jsx-runtime` shim a bundle build aliases to (see `./index.ts`).
|
|
4
|
+
*
|
|
5
|
+
* The automatic JSX transform emits `jsx`/`jsxs` calls at module scope, which
|
|
6
|
+
* is why the runtime is a global. `react/jsx-dev-runtime` aliases here too: a
|
|
7
|
+
* production build never emits `jsxDEV`, and one that did gets `jsx`.
|
|
8
|
+
*/
|
|
9
|
+
import { requireAddOnRuntime } from './index.js';
|
|
10
|
+
const runtime = requireAddOnRuntime().jsx;
|
|
11
|
+
export const jsx = runtime.jsx;
|
|
12
|
+
export const jsxs = runtime.jsxs;
|
|
13
|
+
export const jsxDEV = runtime.jsx;
|
|
14
|
+
export const Fragment = runtime.Fragment;
|
|
15
|
+
//# sourceMappingURL=jsx-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../../src/runtime/jsx-runtime.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;GAMG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,OAAO,GAAG,mBAAmB,EAAE,CAAC,GAAG,CAAC;AAE1C,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAY,CAAC;AACxC,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAa,CAAC;AAC1C,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAY,CAAC;AAC3C,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAiB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@tanstack/react-query` shim a page bundle's build aliases that specifier to
|
|
3
|
+
* (see `./index.ts`), so the page uses the HOST's copy of
|
|
4
|
+
* the host's QueryClient and its hooks.
|
|
5
|
+
*
|
|
6
|
+
* A second react-query is a second cache behind an empty `QueryClientProvider`. Hooks do not throw there — they hang, which is a blank screen with no error.
|
|
7
|
+
*
|
|
8
|
+
* The names are `ADD_ON_QUERY_EXPORTS` and nothing else: an ES module cannot export a
|
|
9
|
+
* name it does not spell, which is what makes this list the API rather than a
|
|
10
|
+
* description of one. `add-on-host.test.ts` holds the two equal.
|
|
11
|
+
*/
|
|
12
|
+
declare const query: Readonly<Record<string, unknown>>;
|
|
13
|
+
export declare const QueryClient: never;
|
|
14
|
+
export declare const queryOptions: never;
|
|
15
|
+
export declare const useMutation: never;
|
|
16
|
+
export declare const useQuery: never;
|
|
17
|
+
export declare const useQueryClient: never;
|
|
18
|
+
export default query;
|
|
19
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/runtime/query.ts"],"names":[],"mappings":"AACA;;;;;;;;;;GAUG;AAIH,QAAA,MAAM,KAAK,mCAA2B,CAAC;AAEvC,eAAO,MAAM,WAAW,EAA2B,KAAK,CAAC;AACzD,eAAO,MAAM,YAAY,EAA4B,KAAK,CAAC;AAC3D,eAAO,MAAM,WAAW,EAA2B,KAAK,CAAC;AACzD,eAAO,MAAM,QAAQ,EAAwB,KAAK,CAAC;AACnD,eAAO,MAAM,cAAc,EAA8B,KAAK,CAAC;AAE/D,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* The `@tanstack/react-query` shim a page bundle's build aliases that specifier to
|
|
4
|
+
* (see `./index.ts`), so the page uses the HOST's copy of
|
|
5
|
+
* the host's QueryClient and its hooks.
|
|
6
|
+
*
|
|
7
|
+
* A second react-query is a second cache behind an empty `QueryClientProvider`. Hooks do not throw there — they hang, which is a blank screen with no error.
|
|
8
|
+
*
|
|
9
|
+
* The names are `ADD_ON_QUERY_EXPORTS` and nothing else: an ES module cannot export a
|
|
10
|
+
* name it does not spell, which is what makes this list the API rather than a
|
|
11
|
+
* description of one. `add-on-host.test.ts` holds the two equal.
|
|
12
|
+
*/
|
|
13
|
+
import { requireAddOnHost } from './index.js';
|
|
14
|
+
const query = requireAddOnHost().query;
|
|
15
|
+
export const QueryClient = query['QueryClient'];
|
|
16
|
+
export const queryOptions = query['queryOptions'];
|
|
17
|
+
export const useMutation = query['useMutation'];
|
|
18
|
+
export const useQuery = query['useQuery'];
|
|
19
|
+
export const useQueryClient = query['useQueryClient'];
|
|
20
|
+
export default query;
|
|
21
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/runtime/query.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC,KAAK,CAAC;AAEvC,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAU,CAAC;AACzD,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,cAAc,CAAU,CAAC;AAC3D,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAU,CAAC;AACzD,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAU,CAAC;AACnD,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC,gBAAgB,CAAU,CAAC;AAE/D,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `react-dom` shim a bundle build aliases `react-dom` to (see
|
|
3
|
+
* `./index.ts`). A bundle may portal and flush with the host's `react-dom`;
|
|
4
|
+
* it never creates a root of its own, so `react-dom/client` has no shim.
|
|
5
|
+
*/
|
|
6
|
+
declare const reactDom: Record<string, unknown>;
|
|
7
|
+
export declare const __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE: never;
|
|
8
|
+
export declare const createPortal: never;
|
|
9
|
+
export declare const flushSync: never;
|
|
10
|
+
export declare const preconnect: never;
|
|
11
|
+
export declare const prefetchDNS: never;
|
|
12
|
+
export declare const preinit: never;
|
|
13
|
+
export declare const preinitModule: never;
|
|
14
|
+
export declare const preload: never;
|
|
15
|
+
export declare const preloadModule: never;
|
|
16
|
+
export declare const requestFormReset: never;
|
|
17
|
+
export declare const unstable_batchedUpdates: never;
|
|
18
|
+
export declare const useFormState: never;
|
|
19
|
+
export declare const useFormStatus: never;
|
|
20
|
+
export declare const version: never;
|
|
21
|
+
export default reactDom;
|
|
22
|
+
//# sourceMappingURL=react-dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-dom.d.ts","sourceRoot":"","sources":["../../src/runtime/react-dom.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAUH,QAAA,MAAM,QAAQ,EAAuB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7D,eAAO,MAAM,4DAA4D,EAA+E,KAAK,CAAC;AAC9J,eAAO,MAAM,YAAY,EAA+B,KAAK,CAAC;AAC9D,eAAO,MAAM,SAAS,EAA4B,KAAK,CAAC;AACxD,eAAO,MAAM,UAAU,EAA6B,KAAK,CAAC;AAC1D,eAAO,MAAM,WAAW,EAA8B,KAAK,CAAC;AAC5D,eAAO,MAAM,OAAO,EAA0B,KAAK,CAAC;AACpD,eAAO,MAAM,aAAa,EAAgC,KAAK,CAAC;AAChE,eAAO,MAAM,OAAO,EAA0B,KAAK,CAAC;AACpD,eAAO,MAAM,aAAa,EAAgC,KAAK,CAAC;AAChE,eAAO,MAAM,gBAAgB,EAAmC,KAAK,CAAC;AACtE,eAAO,MAAM,uBAAuB,EAA0C,KAAK,CAAC;AACpF,eAAO,MAAM,YAAY,EAA+B,KAAK,CAAC;AAC9D,eAAO,MAAM,aAAa,EAAgC,KAAK,CAAC;AAChE,eAAO,MAAM,OAAO,EAA0B,KAAK,CAAC;AAEpD,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* The `react-dom` shim a bundle build aliases `react-dom` to (see
|
|
4
|
+
* `./index.ts`). A bundle may portal and flush with the host's `react-dom`;
|
|
5
|
+
* it never creates a root of its own, so `react-dom/client` has no shim.
|
|
6
|
+
*/
|
|
7
|
+
import { requireAddOnRuntime } from './index.js';
|
|
8
|
+
const runtime = requireAddOnRuntime();
|
|
9
|
+
if (runtime.reactDom === undefined) {
|
|
10
|
+
throw new Error('This host did not publish react-dom. Install the runtime with installAddOnRuntime({ react, jsx, reactDom }).');
|
|
11
|
+
}
|
|
12
|
+
const reactDom = runtime.reactDom;
|
|
13
|
+
export const __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = reactDom['__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE'];
|
|
14
|
+
export const createPortal = reactDom['createPortal'];
|
|
15
|
+
export const flushSync = reactDom['flushSync'];
|
|
16
|
+
export const preconnect = reactDom['preconnect'];
|
|
17
|
+
export const prefetchDNS = reactDom['prefetchDNS'];
|
|
18
|
+
export const preinit = reactDom['preinit'];
|
|
19
|
+
export const preinitModule = reactDom['preinitModule'];
|
|
20
|
+
export const preload = reactDom['preload'];
|
|
21
|
+
export const preloadModule = reactDom['preloadModule'];
|
|
22
|
+
export const requestFormReset = reactDom['requestFormReset'];
|
|
23
|
+
export const unstable_batchedUpdates = reactDom['unstable_batchedUpdates'];
|
|
24
|
+
export const useFormState = reactDom['useFormState'];
|
|
25
|
+
export const useFormStatus = reactDom['useFormStatus'];
|
|
26
|
+
export const version = reactDom['version'];
|
|
27
|
+
export default reactDom;
|
|
28
|
+
//# sourceMappingURL=react-dom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-dom.js","sourceRoot":"","sources":["../../src/runtime/react-dom.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,OAAO,GAAG,mBAAmB,EAAE,CAAC;AACtC,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;IACnC,MAAM,IAAI,KAAK,CACb,8GAA8G,CAC/G,CAAC;AACJ,CAAC;AACD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAmC,CAAC;AAE7D,MAAM,CAAC,MAAM,4DAA4D,GAAG,QAAQ,CAAC,8DAA8D,CAAU,CAAC;AAC9J,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC,cAAc,CAAU,CAAC;AAC9D,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,CAAU,CAAC;AACxD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,YAAY,CAAU,CAAC;AAC1D,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAU,CAAC;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAU,CAAC;AACpD,MAAM,CAAC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