@arcgis/lumina 4.32.0-next.4 → 4.32.0-next.41

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.
@@ -26,6 +26,8 @@ import type { DirectiveClass } from "lit-html/directive.js";
26
26
  * Instead, if the prop value is a object definition, variable reference,
27
27
  * ternary expression or etc, the `safeClassMap` will be called, which will
28
28
  * determine at runtime if directive should be called
29
+ *
30
+ * @private
29
31
  */
30
32
  export declare const safeClassMap: (parameters: ClassInfo | Nil | string) => DirectiveResult<typeof ClassMapDirective> | Nil | string;
31
33
  /**
@@ -49,6 +51,8 @@ export declare const safeClassMap: (parameters: ClassInfo | Nil | string) => Dir
49
51
  * Instead, if the prop value is a object definition, variable reference,
50
52
  * ternary expression or etc, the `safeStyleMap` will be called, which will
51
53
  * determine at runtime if directive should be called
54
+ *
55
+ * @private
52
56
  */
53
57
  export declare const safeStyleMap: (parameters: CssProperties | Nil | string) => DirectiveResult<typeof StyleMapDirective> | Nil | string;
54
58
  /**
package/dist/jsx/jsx.d.ts CHANGED
@@ -6,7 +6,6 @@
6
6
  * /// <reference types="@arcgis/lumina/typings" />
7
7
  * ```
8
8
  */
9
- /// <reference path="../typings/jsxGlobals.d.ts" />
10
9
  import type { Properties as CssProperties } from "csstype";
11
10
  import type { TemplateResult } from "lit-html";
12
11
  import type { DirectiveResult } from "lit-html/directive.js";
@@ -28,13 +27,13 @@ export declare const Fragment: (props: {
28
27
  children?: JsxNode;
29
28
  }) => TemplateResult;
30
29
  /**
31
- * @internal
30
+ * @private
32
31
  * The references to this function are removed at build time. You do not need
33
32
  * to import it directly
34
33
  */
35
34
  export declare function jsx(type: string, props: unknown, key?: unknown): JsxNode;
36
35
  /**
37
- * @internal
36
+ * @private
38
37
  * The references to this function are removed at build time. You do not need
39
38
  * to import it directly
40
39
  */
@@ -201,6 +200,26 @@ export type ToElement<Component> = Omit<Component, LuminaJsx.ExcludedProperties>
201
200
  export type ToJsx<Component extends {
202
201
  el: unknown;
203
202
  }> = LuminaJsx.HTMLAttributes<Component["el"]> & LuminaJsx.RemapEvents<Component> & Partial<Omit<Component, LuminaJsx.ExcludedProperties | keyof HTMLElement | keyof LuminaJsx.RemapEvents<Component>>>;
203
+ /**
204
+ * This interface will be automatically extended in src/lumina.ts files to add
205
+ * typings for Stencil elements usages in Lumina. You do not need to manually
206
+ * extend this interface.
207
+ *
208
+ * @example
209
+ * ```ts
210
+ * import type { JSX as CalciteJSX } from "@esri/calcite-components/dist/types/components";
211
+ * import type { JSX as CommonComponentsJsx } from "@arcgis/common-components/dist/types/components";
212
+ *
213
+ * declare module "@arcgis/lumina" {
214
+ * interface ImportStencilElements
215
+ * extends CalciteJSX.IntrinsicElements,
216
+ * CommonComponentsJsx.IntrinsicElements {
217
+ * }
218
+ * }
219
+ * ```
220
+ */
221
+ export interface ImportStencilElements {
222
+ }
204
223
  /**
205
224
  * Get the type of all events for a given component. Includes native DOM events
206
225
  * and custom events.
@@ -208,9 +227,9 @@ export type ToJsx<Component extends {
208
227
  * @example
209
228
  * ```tsx
210
229
  * render() {
211
- * return <arcgis-counter onArcgisOverflow={this._handleOverflow} />
230
+ * return <arcgis-map onArcgisViewClick={this._handleViewClick} />
212
231
  * }
213
- * _handleOverflow(event: ToEvents<ArcgisCounter>["arcgisOverflow"]) {
232
+ * _handleViewClick(event: ToEvents<HTMLArcgisMapElement>["arcgisViewClick"]) {
214
233
  * // event.detail
215
234
  * // event.currentTarget
216
235
  * }
@@ -237,6 +256,7 @@ export type ToJsx<Component extends {
237
256
  export type ToEvents<Component> = GlobalEventTypes<MaybeEl<Component>> & {
238
257
  [Key in keyof Component as ListenerToPayloadType<Component[Key]> extends CustomEvent ? Key : never]-?: ListenerToPayloadType<Component[Key]> & {
239
258
  currentTarget: MaybeEl<Component>;
259
+ target: MaybeEl<Component>;
240
260
  };
241
261
  };
242
262
  type MaybeEl<Component> = Component extends {
@@ -252,6 +272,12 @@ type GlobalEventTypes<Target = HTMLElement> = {
252
272
  type ListenerToPayloadType<Listener> = unknown extends Listener ? void : Listener extends {
253
273
  emit: (...rest: never[]) => infer PayloadType;
254
274
  } ? PayloadType : Listener extends CustomEvent ? Listener : void;
275
+ /**
276
+ * Defined Lumina custom elements. This interface is used only for internal
277
+ * type-checking only.
278
+ */
279
+ export interface DeclareElements {
280
+ }
255
281
  /**
256
282
  * These typings are based on dom-expressions typings:
257
283
  * https://github.com/ryansolid/dom-expressions/blob/main/packages/dom-expressions/src/jsx.d.ts
@@ -307,7 +333,7 @@ export declare namespace LuminaJsx {
307
333
  */
308
334
  key?: unknown;
309
335
  }
310
- interface IntrinsicElements extends HTMLElementTags, SVGElementTags, ReMappedComponents<globalThis.DeclareElements>, Omit<ReMapStencilComponents<globalThis.ImportStencilElements>, keyof HTMLElementTags | keyof SVGElementTags> {
336
+ interface IntrinsicElements extends HTMLElementTags, SVGElementTags, ReMappedComponents<DeclareElements>, Omit<ReMapStencilComponents<ImportStencilElements>, keyof HTMLElementTags | keyof SVGElementTags> {
311
337
  }
312
338
  /**
313
339
  * By not requiring to have some sort of typings generation watcher to run
@@ -349,6 +375,7 @@ export declare namespace LuminaJsx {
349
375
  emit: (...rest: never[]) => infer PayloadType;
350
376
  } ? (event: PayloadType & {
351
377
  currentTarget: Component["el"];
378
+ target: Component["el"];
352
379
  }) => void : never;
353
380
  };
354
381
  /**
@@ -843,6 +870,7 @@ export declare namespace LuminaJsx {
843
870
  }
844
871
  interface HTMLAttributes<T = HTMLElement> extends AriaAttributes, DOMAttributes<T>, RdfaAttributes {
845
872
  accessKey?: string;
873
+ autofocus?: boolean;
846
874
  dir?: HTMLDir;
847
875
  draggable?: boolean;
848
876
  hidden?: boolean | "hidden" | "until-found";
@@ -922,7 +950,6 @@ export declare namespace LuminaJsx {
922
950
  cite?: string;
923
951
  }
924
952
  interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> {
925
- autofocus?: boolean;
926
953
  disabled?: boolean;
927
954
  form?: string;
928
955
  name?: string;
@@ -1031,7 +1058,6 @@ export declare namespace LuminaJsx {
1031
1058
  autocomplete?: AutoFill;
1032
1059
  accept?: string;
1033
1060
  alt?: string;
1034
- autofocus?: boolean;
1035
1061
  capture?: boolean | string;
1036
1062
  checked?: boolean;
1037
1063
  disabled?: boolean;
@@ -1313,7 +1339,6 @@ export declare namespace LuminaJsx {
1313
1339
  referrerPolicy?: HTMLReferrerPolicy;
1314
1340
  }
1315
1341
  interface SelectHTMLAttributes<T> extends HTMLAttributes<T> {
1316
- autofocus?: boolean;
1317
1342
  disabled?: boolean;
1318
1343
  form?: string;
1319
1344
  multiple?: boolean;
@@ -1350,7 +1375,6 @@ export declare namespace LuminaJsx {
1350
1375
  }
1351
1376
  interface TextareaHTMLAttributes<T> extends HTMLAttributes<T> {
1352
1377
  children?: "Error: Use value property instead. See https://lit.dev/docs/templates/expressions/#invalid-locations";
1353
- autofocus?: boolean;
1354
1378
  cols?: number | string;
1355
1379
  dirname?: string;
1356
1380
  disabled?: boolean;
@@ -15,6 +15,9 @@ export interface DefineCustomElements {
15
15
  export type LazyLoadOptions = {
16
16
  readonly resourcesUrl?: string;
17
17
  };
18
+ interface CommonInterface extends HTMLElement {
19
+ componentOnReady: () => Promise<this>;
20
+ }
18
21
  export declare const makeDefineCustomElements: (runtime: Runtime, structure: Readonly<Record<string, CompactMeta>>) => DefineCustomElements;
19
22
  /**
20
23
  * Use compact meta to reduce bundle size (otherwise, it would be ~65kb for
@@ -105,7 +108,9 @@ export declare abstract class ProxyComponent extends HtmlElement {
105
108
  /**
106
109
  * Direct offspring that should be awaited before loaded() is emitted
107
110
  */
108
- _offspring: (Element & Partial<Pick<LitElement, "manager">> & Pick<LitElement, "componentOnReady">)[];
111
+ _offspring: (CommonInterface & {
112
+ manager?: LitElement["manager"];
113
+ })[];
109
114
  /**
110
115
  * Promise that resolves once parent's load() completed. False if there is no
111
116
  * parent
@@ -147,10 +152,19 @@ export declare abstract class ProxyComponent extends HtmlElement {
147
152
  /**
148
153
  * Create a promise that resolves once component is fully loaded
149
154
  */
150
- componentOnReady(): Promise<LitElement>;
155
+ componentOnReady(): Promise<this>;
151
156
  /** @internal */
152
157
  _initializeComponent(module: Record<string, typeof LitElement>): void;
158
+ /**
159
+ * Implemented on the proxy for compatibility with Lit Context.
160
+ */
161
+ addController(): void;
162
+ /**
163
+ * Implemented on the proxy for compatibility with Lit Context.
164
+ */
165
+ requestUpdate(): void;
153
166
  }
167
+ /** @private */
154
168
  export type GlobalThisWithPuppeteerEnv = typeof globalThis & {
155
169
  devOnly$createdElements?: WeakRef<ProxyComponent>[];
156
170
  };
package/dist/runtime.d.ts CHANGED
@@ -8,7 +8,7 @@ import type { LitElement } from "./LitElement";
8
8
  export type Runtime = RuntimeOptions & {
9
9
  /**
10
10
  * Get the base path to where the package assets can be found.
11
- * By default, the package asset path is set to "https://js.arcgis.com/<simplified-package-name>/<released-verion>/".
11
+ * By default, the package asset path is set to `https://js.arcgis.com/<simplified-package-name>/<released-verion>/`.
12
12
  * We are hosting our assets on a CDN (Content Delivery Network) to ensure fast and reliable access.
13
13
  * It is CORS-enabled, so you can load the assets from any domain.
14
14
  * Use "setAssetPath(path)" if the path needs to be customized.
@@ -18,8 +18,8 @@ export type Runtime = RuntimeOptions & {
18
18
  * Used to manually set the base path where package assets (like localization
19
19
  * and icons) can be found.
20
20
  *
21
- * By default, the package asset path is set to "https://js.arcgis.com/<simplified-package-name>/<released-verion>/".
22
- * For example, "https://js.arcgis.com/map-components/4.30/".
21
+ * By default, the package asset path is set to `https://js.arcgis.com/<simplified-package-name>/<released-verion>/`.
22
+ * For example, `https://js.arcgis.com/map-components/4.30/`.
23
23
  * We are hosting our assets on a CDN (Content Delivery Network) to ensure fast and reliable access.
24
24
  * It is CORS-enabled, so you can load the assets from any domain.
25
25
  * This is the recommended way to load the assets and avoid bundling them with your application.
@@ -92,6 +92,8 @@ export declare function makeRuntime(options?: RuntimeOptions): Runtime;
92
92
  /**
93
93
  * Exposing the reference to the runtime globally when in tests or development.
94
94
  * This is primarily for usage by dynamically created components in tests
95
+ *
96
+ * @private
95
97
  */
96
98
  export type DevOnlyGlobalRuntime = typeof globalThis & {
97
99
  devOnly$luminaRuntime?: Runtime;
@@ -99,6 +101,8 @@ export type DevOnlyGlobalRuntime = typeof globalThis & {
99
101
  /**
100
102
  * Called from the component constructor when in development or test mode.
101
103
  * Used primarily by mount to get a reference to the rendered component.
104
+ *
105
+ * @private
102
106
  */
103
107
  export type DevOnlyGlobalComponentRefCallback = typeof globalThis & {
104
108
  devOnly$luminaComponentRefCallback?: (component: LitElement) => void;
@@ -2,7 +2,6 @@
2
2
  * Lots of silencing of ESLint in this file to be compatible with Stencil's
3
3
  * unsafe typings.
4
4
  */
5
- /// <reference types="node" />
6
5
  import { type RenderInfo } from "@lit-labs/ssr/lib/render.js";
7
6
  import type { Readable } from "node:stream";
8
7
  /**
@@ -1,4 +1,4 @@
1
- /// <reference path="jsxGlobals.d.ts" />
2
- /// <reference path="loadLitCss.d.ts" />
3
- /// <reference path="viteEnv.d.ts" />
4
- /// <reference path="importMeta.d.ts" />
1
+ /// <reference path="jsxGlobals.d.ts" preserve="true" />
2
+ /// <reference path="loadLitCss.d.ts" preserve="true" />
3
+ /// <reference path="viteEnv.d.ts" preserve="true" />
4
+ /// <reference path="importMeta.d.ts" preserve="true" />
@@ -1,4 +1,8 @@
1
- export {};
1
+ /**
2
+ * This file is used for internal type checking only. It should not be
3
+ * referenced in public types of your package to not pollute the global types
4
+ * namespace
5
+ */
2
6
  declare global {
3
7
  /**
4
8
  * This interface will be extended in each source file that defines a LitElement.
@@ -19,23 +23,17 @@ declare global {
19
23
  };
20
24
  interface HTMLElementTagNameMap extends ReMappedDeclareElements {
21
25
  }
22
- /**
23
- * Extend this interface with Stencil web components that you wish to use
24
- * in Lit
25
- *
26
- * @example
27
- * ```ts
28
- * import type { JSX as CalciteJSX } from "@esri/calcite-components/dist/types/components";
29
- * import type { JSX as CommonComponentsJsx } from "@arcgis/common-components/dist/types/components";
30
- *
31
- * declare global {
32
- * interface ImportStencilElements
33
- * extends CalciteJSX.IntrinsicElements,
34
- * CommonComponentsJsx.IntrinsicElements {
35
- * }
36
- * }
37
- * ```
38
- */
39
- export interface ImportStencilElements {
26
+ }
27
+ export interface DeclareElements extends globalThis.DeclareElements {
28
+ }
29
+ /**
30
+ * In the component files, we declare "DeclareElements" interface on the
31
+ * `declare global` namespace as it's shorter than writing
32
+ * `declare module "@arcgis/lumina"`. However, we want to avoid polluting
33
+ * global typings with this interface - thus we use namespace merging to
34
+ * extend the namespaced DeclareElements based on the global DeclareElements.
35
+ */
36
+ declare module "../jsx/jsx" {
37
+ interface DeclareElements extends globalThis.DeclareElements {
40
38
  }
41
39
  }
@@ -1,9 +1,33 @@
1
+ export interface Options<I extends HTMLElement, E extends EventNames> {
2
+ react: any;
3
+ tagName: string;
4
+ elementClass: Constructor<I>;
5
+ events?: E;
6
+ displayName?: string;
7
+ }
8
+ export type EventNames = Record<string, string>;
9
+ type Constructor<T> = new () => T;
1
10
  /**
2
- * Returns a proxy object for a custom element prototype.
3
- * The function that creates a React wrapper component for a custom element,
4
- * if rendered, will need the custom element prototype to define the React component properties.
5
- * Because the custom element may not yet be defined in global scope when
6
- * `createPrototypeProxy()` is called, this small proxy delays retrieving the custom
7
- * element prototype until it is actually needed, and caches the result for future calls.
11
+ * Wrap `createComponent` from `@lit/react` to improve lazy loading
12
+ * compatibility.
13
+ *
14
+ * @private
8
15
  */
9
- export declare function createPrototypeProxy<T extends HTMLElement>(tagName: string): new () => T;
16
+ export declare const makeReactWrapperFactory: (react: unknown, createComponent: (options: Options<HTMLElement, EventNames>) => unknown) => (options: Pick<Options<HTMLElement, EventNames>, "events" | "tagName">) => unknown;
17
+ /**
18
+ * Helper for `createComponent` to declare options in a type-safe and concise
19
+ * manner.
20
+ *
21
+ * @remarks
22
+ * Only tagName and events need to be provided to the wrapped version of the
23
+ * `createComponent` function. However, since we inherit the typings from
24
+ * the original `createComponent`, TypeScript would still force us to provide
25
+ * `react` and `elementClass` properties - instead, this helper convinces
26
+ * TypeScript that we are providing `react` and `elementClass` properties.
27
+ *
28
+ * @private
29
+ */
30
+ export declare const getReactWrapperOptions: <Element extends HTMLElement, Events extends EventNames>(tagNameAndElement: Element, events: Events) => Options<Element & {
31
+ class?: string;
32
+ }, Events>;
33
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/lumina",
3
- "version": "4.32.0-next.4",
3
+ "version": "4.32.0-next.41",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -8,6 +8,7 @@
8
8
  "exports": {
9
9
  ".": "./dist/index.js",
10
10
  "./config": "./dist/config.js",
11
+ "./hmrSupport": "./dist/hmrSupport.js",
11
12
  "./stencilSsrCompatibility": "./dist/stencilSsrCompatibility/index.js",
12
13
  "./typings": {
13
14
  "types": "./dist/typings/index.d.ts"
@@ -17,33 +18,15 @@
17
18
  "files": [
18
19
  "dist/"
19
20
  ],
20
- "publishConfig": {
21
- "registry": "https://registry.npmjs.org/",
22
- "access": "public"
23
- },
24
21
  "license": "SEE LICENSE IN LICENSE.md",
25
- "scripts": {
26
- "build": "tsup",
27
- "build:dev": "tsup --sourcemap",
28
- "watch": "yarn build:dev --watch",
29
- "clean": "rimraf ./dist ./build ./turbo ./node_modules"
30
- },
31
22
  "dependencies": {
32
- "@arcgis/components-controllers": "4.32.0-next.4",
33
- "@arcgis/components-utils": "4.32.0-next.4",
23
+ "@arcgis/components-controllers": "4.32.0-next.41",
24
+ "@arcgis/components-utils": "4.32.0-next.41",
34
25
  "@lit-labs/ssr": "^3.2.2",
35
26
  "@lit-labs/ssr-client": "^1.1.7",
27
+ "@lit/context": "^1.1.3",
36
28
  "csstype": "^3.1.3",
37
29
  "lit": "^3.2.0",
38
30
  "tslib": "^2.7.0"
39
- },
40
- "devDependencies": {
41
- "@arcgis/typescript-config": "4.32.0-next.4",
42
- "@types/node": "^20.2.5",
43
- "eslint": "^8.55.0",
44
- "rimraf": "^5.0.0",
45
- "tsup": "^8.3.0",
46
- "typescript": "~5.4.0"
47
- },
48
- "gitHead": "57612a8bfbd9ba14535ca2b0d3ff66ab1d6a57f5"
49
- }
31
+ }
32
+ }