@arcgis/lumina 4.34.0-next.14 → 4.34.0-next.141

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.
@@ -1,7 +1,7 @@
1
- import { GenericT9nStrings, LocaleObserver } from '@arcgis/components-utils';
1
+ import { GenericT9nStrings, LocaleObserverResult } from '@arcgis/toolkit/intl';
2
2
  export type T9nMeta<T9nStrings extends GenericT9nStrings> = {
3
- _lang: LocaleObserver["lang"];
4
- _t9nLocale: LocaleObserver["t9nLocale"];
3
+ _lang: LocaleObserverResult["lang"];
4
+ _t9nLocale: LocaleObserverResult["t9nLocale"];
5
5
  _loading: boolean;
6
6
  /**
7
7
  * The "_overrides" property won't actually exist at runtime and exists only
@@ -1,5 +1,5 @@
1
1
  import { LuminaPropertyDeclaration } from './controllers/types';
2
- export { state } from '@lit/reactive-element/decorators/state.js';
2
+ export { state } from 'lit/decorators/state.js';
3
3
  /**
4
4
  * A class field or accessor decorator which creates a reactive property that
5
5
  * reflects a corresponding attribute value. When a decorated property is set
@@ -1,5 +1,5 @@
1
- import { n as noShadowRoot, P as ProxyComponent } from "./lazyLoad-DUvrNd2L.js";
2
- import { camelToKebab } from "@arcgis/components-utils";
1
+ import { n as noShadowRoot, P as ProxyComponent } from "./lazyLoad-BlK67lvm.js";
2
+ import { camelToKebab } from "@arcgis/toolkit/string";
3
3
  function handleHmrUpdate(newModules) {
4
4
  newModules.forEach((newModule) => {
5
5
  if (newModule === void 0) {
package/dist/index.d.ts CHANGED
@@ -1,16 +1,15 @@
1
- export { useContextProvider, useContextConsumer } from './context';
2
1
  export type { EventEmitter, EventOptions } from './createEvent';
3
2
  export { createEvent } from './createEvent';
4
3
  export { state, property, method } from './decorators';
5
4
  export type { DefineCustomElements, LazyLoadOptions, GlobalThisWithPuppeteerEnv } from './lazyLoad';
6
5
  export { makeDefineCustomElements } from './lazyLoad';
7
- export { LitElement } from './LitElement';
6
+ export { LitElement, disableReactiveUtilsIntegration } from './LitElement';
8
7
  export type { PublicLitElement } from './PublicLitElement';
9
8
  export type { Runtime, RuntimeOptions, DevOnlyGlobalRuntime, DevOnlyGlobalComponentRefCallback } from './makeRuntime';
10
9
  export { makeRuntime } from './makeRuntime';
11
10
  export type { EventHandler } from './jsx/baseTypes';
12
11
  export * from './jsx/types';
13
- export { safeClassMap, safeStyleMap, deferLoad, deferredLoaders, directive, live } from './jsx/directives';
12
+ export { safeClassMap, safeStyleMap, deferLoad, deferredLoaders, stabilizedRef, directive, live, } from './jsx/directives';
14
13
  export { nothing, noChange, setAttribute, stringOrBoolean } from './jsx/utils';
15
14
  export { noShadowRoot, devOnly$getLitElementTagNameAndRuntime } from './utils';
16
15
  export { makeReactWrapperFactory, getReactWrapperOptions } from './wrappersUtils';
package/dist/index.js CHANGED
@@ -1,30 +1,20 @@
1
- import { ContextProvider, ContextConsumer } from "@lit/context";
2
- import { r as retrieveComponent, G as GenericController, k as keyTrackResolve, s as setAmbientComponent, c as controllerSymbol, a as shouldBypassReadOnly } from "./Controller-BQOv8BAL.js";
3
- import { b } from "./Controller-BQOv8BAL.js";
4
- import { state } from "@lit/reactive-element/decorators/state.js";
5
- import { property as property$1 } from "@lit/reactive-element/decorators/property.js";
6
- import { e as emptyFunction, n as noShadowRoot, a as attachToAncestor } from "./lazyLoad-DUvrNd2L.js";
7
- import { d, m } from "./lazyLoad-DUvrNd2L.js";
8
- import { isEsriInternalEnv, safeCall, devToolsAwareTimeout, Deferred, camelToKebab, safeAsyncCall } from "@arcgis/components-utils";
9
- import { nothing as nothing$1, LitElement as LitElement$1, isServer, notEqual, noChange as noChange$1 } from "lit";
1
+ import { G as GenericController, p as propertyTrackResolve } from "./Controller-ftAEcdmI.js";
2
+ import { c } from "./Controller-ftAEcdmI.js";
3
+ import { state } from "lit/decorators/state.js";
4
+ import { property as property$1 } from "lit/decorators/property.js";
5
+ import { e as emptyFunction, n as noShadowRoot, a as attachToAncestor } from "./lazyLoad-BlK67lvm.js";
6
+ import { d, m } from "./lazyLoad-BlK67lvm.js";
7
+ import { isEsriInternalEnv, safeCall, safeAsyncCall } from "@arcgis/toolkit/error";
8
+ import { camelToKebab } from "@arcgis/toolkit/string";
9
+ import { devToolsAwareTimeout, Deferred } from "@arcgis/toolkit/promise";
10
+ import { nothing as nothing$1, LitElement as LitElement$1, isServer, notEqual, noChange as noChange$1, render } from "lit";
11
+ import { s as setAmbientComponent, c as controllerSymbol, a as shouldBypassReadOnly } from "./ControllerInternals-CWQrfEA8.js";
10
12
  import { propertyFlagAttribute, propertyFlagNoAccessor, propertyFlagReadOnly, propertyFlagState, propertyFlagBoolean, propertyFlagNumber, propertyFlagReflect } from "./config.js";
11
- import { classMap } from "lit-html/directives/class-map.js";
13
+ import { classMap } from "lit/directives/class-map.js";
12
14
  import { styleMap } from "lit/directives/style-map.js";
13
- import { directive as directive$1, Directive } from "lit-html/directive.js";
14
- import { live as live$1 } from "lit-html/directives/live.js";
15
- import { nothing as nothing$2, noChange as noChange$2, render } from "lit-html";
16
- const useContextProvider = (options) => {
17
- const component = retrieveComponent();
18
- const controller = new ContextProvider(component.el, options);
19
- component.addController(controller);
20
- return controller;
21
- };
22
- const useContextConsumer = (options) => {
23
- const component = retrieveComponent();
24
- const controller = new ContextConsumer(component.el, options);
25
- component.addController(controller);
26
- return controller;
27
- };
15
+ import { directive as directive$1, Directive } from "lit/directive.js";
16
+ import { live as live$1 } from "lit/directives/live.js";
17
+ import { ref } from "lit/directives/ref.js";
28
18
  const property = property$1;
29
19
  const method = void 0;
30
20
  class ControllerManager extends GenericController {
@@ -57,7 +47,7 @@ class ControllerManager extends GenericController {
57
47
  if (this.#autoDestroyTimeout !== void 0) {
58
48
  clearTimeout(this.#autoDestroyTimeout);
59
49
  }
60
- keyTrackResolve();
50
+ propertyTrackResolve();
61
51
  for (const controller of component.M) {
62
52
  if ("triggerConnected" in controller) {
63
53
  controller.triggerConnected();
@@ -331,6 +321,7 @@ class LitElement extends LitElement$1 {
331
321
  this.#observables?.get(name)?.notify();
332
322
  }
333
323
  if (manager.T.length > 0) {
324
+ propertyTrackResolve();
334
325
  manager?.S(name, rawNewValue);
335
326
  }
336
327
  }
@@ -401,10 +392,10 @@ class LitElement extends LitElement$1 {
401
392
  const options = Class.shadowRootOptions;
402
393
  const useLightDom = options === noShadowRoot;
403
394
  const renderRoot = existingShadowRoot ?? (useLightDom ? this.el : this.el.attachShadow(options));
404
- if (existingShadowRoot) {
405
- if (process.env.NODE_ENV === "production") {
406
- LitElement$1.prototype.createRenderRoot.call(this);
407
- }
395
+ if (existingShadowRoot && // The shadow root may already exist if we are doing HMR - such case is not
396
+ // SSR so ignore it
397
+ process.env.NODE_ENV !== "production" && (this.el.constructor.devOnly$hmrIndex ?? 0) === 0) {
398
+ LitElement$1.prototype.createRenderRoot.call(this);
408
399
  return existingShadowRoot;
409
400
  }
410
401
  if (this.isConnected) {
@@ -526,6 +517,9 @@ class LitElement extends LitElement$1 {
526
517
  controller.controllerRemoved?.();
527
518
  }
528
519
  }
520
+ function disableReactiveUtilsIntegration(componentClass) {
521
+ componentClass.prototype["update"] = LitElement$1.prototype["update"];
522
+ }
529
523
  const makeRuntime = (options) => {
530
524
  let assetPath;
531
525
  const setAssetPath = (path) => {
@@ -593,10 +587,29 @@ class DeferLoad extends Directive {
593
587
  }
594
588
  const deferLoad = /* @__PURE__ */ directive$1(DeferLoad)();
595
589
  const deferredLoaders = /* @__PURE__ */ new Map();
590
+ class StabilizedRef extends Directive {
591
+ #refValue;
592
+ #callback;
593
+ constructor(partInfo) {
594
+ super(partInfo);
595
+ const that = this;
596
+ this.#callback = function ref2(element) {
597
+ return that.#refValue.call(this, element);
598
+ };
599
+ }
600
+ render(refValue) {
601
+ if (typeof refValue === "function") {
602
+ this.#refValue = refValue;
603
+ return ref(this.#callback);
604
+ }
605
+ return ref(refValue);
606
+ }
607
+ }
608
+ const stabilizedRef = directive$1(StabilizedRef);
596
609
  const directive = directive$1;
597
610
  const live = live$1;
598
- const nothing = nothing$2;
599
- const noChange = noChange$2;
611
+ const nothing = nothing$1;
612
+ const noChange = noChange$1;
600
613
  function setAttribute(element, attributeName, value) {
601
614
  if (value == null) {
602
615
  element.removeAttribute(attributeName);
@@ -662,11 +675,12 @@ export {
662
675
  bindBooleanAttribute,
663
676
  bindEvent,
664
677
  bindProperty,
665
- b as createEvent,
678
+ c as createEvent,
666
679
  deferLoad,
667
680
  deferredLoaders,
668
681
  d as devOnly$getLitElementTagNameAndRuntime,
669
682
  directive,
683
+ disableReactiveUtilsIntegration,
670
684
  getReactWrapperOptions,
671
685
  live,
672
686
  m as makeDefineCustomElements,
@@ -681,8 +695,7 @@ export {
681
695
  safeClassMap,
682
696
  safeStyleMap,
683
697
  setAttribute,
698
+ stabilizedRef,
684
699
  state,
685
- stringOrBoolean,
686
- useContextConsumer,
687
- useContextProvider
700
+ stringOrBoolean
688
701
  };
@@ -1,5 +1,5 @@
1
- import { DirectiveResult } from 'lit-html/directive.js';
2
- import { Ref } from 'lit-html/directives/ref.js';
1
+ import { DirectiveResult } from 'lit/directive.js';
2
+ import { Ref } from 'lit/directives/ref.js';
3
3
  export type EventHandlerUnion<T, E extends Event> = (e: E & {
4
4
  currentTarget: T;
5
5
  target: Element;
@@ -1,11 +1,11 @@
1
- import { Nil } from '@arcgis/components-utils';
1
+ import { nil } from '@arcgis/toolkit/type';
2
2
  import { Properties as CssProperties } from 'csstype';
3
- import { ClassInfo } from 'lit-html/directives/class-map.js';
4
- import { DirectiveResult } from 'lit/directive.js';
5
- import { ClassMapDirective } from 'lit/directives/class-map.js';
3
+ import { ClassInfo, ClassMapDirective } from 'lit/directives/class-map.js';
4
+ import { DirectiveResult, DirectiveClass, ElementPart, PartInfo, Directive } from 'lit/directive.js';
6
5
  import { StyleMapDirective } from 'lit/directives/style-map.js';
7
- import { DirectiveClass, ElementPart, Directive } from 'lit-html/directive.js';
8
6
  import { noChange } from 'lit';
7
+ import { CustomAttributes } from './baseTypes';
8
+ import { RefDirective } from 'lit/directives/ref.js';
9
9
  /**
10
10
  * You likely won't have to import this directly. It will be added during
11
11
  * _JSX to lit-html_ conversion.
@@ -30,7 +30,7 @@ import { noChange } from 'lit';
30
30
  *
31
31
  * @private
32
32
  */
33
- export declare const safeClassMap: (parameters: ClassInfo | Nil | string) => DirectiveResult<typeof ClassMapDirective> | Nil | string;
33
+ export declare const safeClassMap: (parameters: ClassInfo | nil | string) => DirectiveResult<typeof ClassMapDirective> | nil | string;
34
34
  /**
35
35
  * You likely won't have to import this directly. It will be added during
36
36
  * _JSX to lit-html_ conversion.
@@ -55,7 +55,7 @@ export declare const safeClassMap: (parameters: ClassInfo | Nil | string) => Dir
55
55
  *
56
56
  * @private
57
57
  */
58
- export declare const safeStyleMap: (parameters: CssProperties | Nil | string) => DirectiveResult<typeof StyleMapDirective> | Nil | string;
58
+ export declare const safeStyleMap: (parameters: CssProperties | nil | string) => DirectiveResult<typeof StyleMapDirective> | nil | string;
59
59
  declare class DeferLoad extends Directive {
60
60
  update(part: ElementPart): void;
61
61
  render(): typeof noChange;
@@ -72,6 +72,33 @@ export declare const deferLoad: DirectiveResult<typeof DeferLoad>;
72
72
  * [Documentation](https://qawebgis.esri.com/components/lumina/jsx#deferring-web-component-load)
73
73
  */
74
74
  export declare const deferredLoaders: Map<string, () => Promise<unknown>>;
75
+ declare class StabilizedRef extends Directive {
76
+ #private;
77
+ constructor(partInfo: PartInfo);
78
+ render(refValue: CustomAttributes<Element>["ref"]): DirectiveResult<typeof RefDirective>;
79
+ }
80
+ /**
81
+ * Because of how Lit's ref() works, there are two requirements on ref
82
+ * function:
83
+ * - It must be stable between re-renders (else Lit will call it twice on each
84
+ * render() - with undefined and then with element)
85
+ * - Each element must have a unique instance of this function - if two
86
+ * elements share the same ref function, on each render Lit will call
87
+ * it multiple times (undefined, element1, undefined, element2)
88
+ *
89
+ * The `stabilizedRef` directive resolves both of these requirements by creating
90
+ * a stable wrapper function for the ref callback.
91
+ *
92
+ * @private
93
+ * Lumina will insert this directive automatically when the `ref` JSX prop is
94
+ * authored in a way that clearly creates a new function on each render:
95
+ * ```tsx
96
+ * <my-component ref={(el) => this.myComponent = el} />
97
+ * <my-component ref={this.callback.bind(this, index)} />
98
+ * ```
99
+ * @deprecated See https://discord.com/channels/1012791295170859069/1047015641225371718
100
+ */
101
+ export declare const stabilizedRef: <T extends Element>(refValue: CustomAttributes<T>["ref"]) => DirectiveResult<typeof StabilizedRef>;
75
102
  /**
76
103
  * Creates a user-facing directive function from a Directive class. This
77
104
  * function has the same parameters as the directive's render() method.
@@ -511,6 +511,7 @@ export interface AriaAttributes {
511
511
  * @see aria-controls
512
512
  */
513
513
  ["aria-owns"]?: string;
514
+ ariaActiveDescendantElement?: Element;
514
515
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAtomic) */
515
516
  ariaAtomic?: boolean | "false" | "true";
516
517
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAutoComplete) */
@@ -529,14 +530,19 @@ export interface AriaAttributes {
529
530
  ariaColIndex?: number | string;
530
531
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColSpan) */
531
532
  ariaColSpan?: number | string;
533
+ ariaControlsElements?: Element[];
532
534
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaCurrent) */
533
535
  ariaCurrent?: boolean | "date" | "false" | "location" | "page" | "step" | "time" | "true";
536
+ ariaDescribedByElements?: Element[];
534
537
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDescription) */
535
538
  ariaDescription?: string;
539
+ ariaDetailsElements?: Element[];
536
540
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDisabled) */
537
541
  ariaDisabled?: boolean | "false" | "true";
542
+ ariaErrorMessageElement?: Element;
538
543
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaExpanded) */
539
544
  ariaExpanded?: boolean | "false" | "true";
545
+ ariaFlowToElements?: Element[];
540
546
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHasPopup) */
541
547
  ariaHasPopup?: boolean | "dialog" | "false" | "grid" | "listbox" | "menu" | "tree" | "true";
542
548
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHidden) */
@@ -550,6 +556,7 @@ export interface AriaAttributes {
550
556
  ariaKeyShortcuts?: string;
551
557
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLabel) */
552
558
  ariaLabel?: string;
559
+ ariaLabelledByElements?: Element[];
553
560
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLevel) */
554
561
  ariaLevel?: number | string;
555
562
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLive) */
@@ -562,6 +569,7 @@ export interface AriaAttributes {
562
569
  ariaMultiSelectable?: boolean | "false" | "true";
563
570
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaOrientation) */
564
571
  ariaOrientation?: "horizontal" | "vertical";
572
+ ariaOwnsElements?: Element[];
565
573
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPlaceholder) */
566
574
  ariaPlaceholder?: string;
567
575
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPosInSet) */
@@ -635,11 +643,11 @@ export interface HTMLAttributes<T = HTMLElement> extends AriaAttributes, DOMAttr
635
643
  inert?: boolean;
636
644
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/inputMode) */
637
645
  inputMode?: "decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url";
638
- itemId?: string;
639
- itemProp?: string;
640
- itemRef?: string;
641
- itemScope?: boolean;
642
- itemType?: string;
646
+ itemid?: string;
647
+ itemprop?: string;
648
+ itemref?: string;
649
+ itemscope?: boolean;
650
+ itemtype?: string;
643
651
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/lang) */
644
652
  lang?: string;
645
653
  /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/nonce) */
@@ -1,5 +1,5 @@
1
- import { TemplateResult } from 'lit-html';
2
- import { DirectiveResult } from 'lit-html/directive.js';
1
+ import { TemplateResult } from 'lit';
2
+ import { DirectiveResult } from 'lit/directive.js';
3
3
  import { HTMLElementTags, HTMLAttributes, GlobalEventHandlersCamelCase, SvgElementTags, DOMAttributes, AriaAttributes } from './generatedTypes';
4
4
  import { CustomAttributes } from './baseTypes';
5
5
  /**
@@ -1,4 +1,6 @@
1
- import { isEsriInternalEnv, Deferred, camelToKebab } from "@arcgis/components-utils";
1
+ import { isEsriInternalEnv } from "@arcgis/toolkit/error";
2
+ import { camelToKebab } from "@arcgis/toolkit/string";
3
+ import { Deferred } from "@arcgis/toolkit/promise";
2
4
  import { lazyMetaGroupJoiner, lazyMetaItemJoiner, lazyMetaSubItemJoiner } from "./config.js";
3
5
  function devOnlyDetectIncorrectLazyUsages(LitClass) {
4
6
  const genericPrototype = LitClass.prototype;
@@ -16,10 +18,7 @@ function devOnlyDetectIncorrectLazyUsages(LitClass) {
16
18
  // Called by Lit - we proxy it to this.el in ProxyComponent
17
19
  "isConnected",
18
20
  // Called by Lit, but only in dev mode for warnings, so we don't have to proxy.
19
- "localName",
20
- // Called by Lit Context - we proxy it to this.el in ProxyComponent.
21
- // Interestingly, they never call removeEventListener.
22
- "addEventListener"
21
+ "localName"
23
22
  ]);
24
23
  const customErrorMessages = {
25
24
  addEventListener: "use this.listen() or this.el.addEventListener()"
@@ -276,7 +275,10 @@ class ProxyComponent extends HtmlElement {
276
275
  this.#pendingAttributes.push(name);
277
276
  }
278
277
  if (process.env.NODE_ENV !== "production" && isEsriInternalEnv()) {
279
- this.devOnly$hmrSetAttributes.add(name);
278
+ const isReflecting = this.#litElement?.["__reflectingProperty"] === name;
279
+ if (!isReflecting) {
280
+ this.devOnly$hmrSetAttributes.add(name);
281
+ }
280
282
  }
281
283
  }
282
284
  connectedCallback() {
@@ -1,4 +1,4 @@
1
- import { Deferred } from '@arcgis/components-utils';
1
+ import { Deferred } from '@arcgis/toolkit/promise';
2
2
  import { LitElement } from './LitElement';
3
3
  import { Runtime } from './makeRuntime';
4
4
  import { ControllerManager } from './controllers/ControllerManager';
@@ -102,7 +102,7 @@ export type RuntimeOptions = {
102
102
  */
103
103
  readonly defaultAssetPath: string;
104
104
  /**
105
- * The attribute that indicates a component has rendered it's content.
105
+ * The attribute that indicates a component has rendered its content.
106
106
  * Usually this attribute is added after your component's `loaded()` lifecycle
107
107
  * happened. However, during SSR, "hydrated" is added right away on the
108
108
  * server.
@@ -1,4 +1,5 @@
1
- import { d as setParentController, e as retrieveParentControllers, o as setAmbientChildController, t as trackKey, h as bypassReadOnly } from "./Controller-BQOv8BAL.js";
1
+ import { b as setParentController, d as retrieveParentControllers, j as setAmbientChildController, f as bypassReadOnly } from "./ControllerInternals-CWQrfEA8.js";
2
+ import { t as trackKey } from "./Controller-ftAEcdmI.js";
2
3
  const proxyExports = (Class) => (...args) => {
3
4
  const ambientControllers = retrieveParentControllers();
4
5
  const instance = new Class(...args);
package/dist/render.d.ts CHANGED
@@ -1,5 +1,11 @@
1
1
  import { JsxNode } from './jsx/types';
2
2
  /**
3
3
  * Retrieve an HTML element to be manually appended to an existing component.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const fullScreen = renderElement(<arcgis-fullscreen />);
8
+ * document.body.appendChild(fullScreen);
9
+ * ```
4
10
  */
5
11
  export declare const renderElement: <Element extends HTMLElement = HTMLElement>(element: JsxNode) => Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/lumina",
3
- "version": "4.34.0-next.14",
3
+ "version": "4.34.0-next.141",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -8,8 +8,8 @@
8
8
  "exports": {
9
9
  ".": "./dist/index.js",
10
10
  "./config": "./dist/config.js",
11
+ "./context": "./dist/context.js",
11
12
  "./hmrSupport": "./dist/hmrSupport.js",
12
- "./stencilSsrCompatibility": "./dist/stencilSsrCompatibility/index.js",
13
13
  "./typings": {
14
14
  "types": "./dist/typings/index.d.ts"
15
15
  },
@@ -22,12 +22,17 @@
22
22
  ],
23
23
  "license": "SEE LICENSE IN LICENSE.md",
24
24
  "dependencies": {
25
- "@arcgis/components-utils": "4.34.0-next.14",
26
- "@lit-labs/ssr": "^3.2.2",
27
- "@lit-labs/ssr-client": "^1.1.7",
28
- "@lit/context": "^1.1.5",
25
+ "@arcgis/toolkit": "~4.34.0-next.141",
29
26
  "csstype": "^3.1.3",
30
- "lit": "^3.3.0",
31
27
  "tslib": "^2.8.1"
28
+ },
29
+ "peerDependencies": {
30
+ "@lit/context": "^1.1.5",
31
+ "lit": "^3.3.0"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "@lit/context": {
35
+ "optional": true
36
+ }
32
37
  }
33
38
  }
@@ -1,73 +0,0 @@
1
- import { RenderInfo } from '@lit-labs/ssr/lib/render.js';
2
- import { Readable } from 'node:stream';
3
- /**
4
- * @deprecated
5
- * Use `render` from `@lit-labs/ssr` instead.
6
- *
7
- * @see https://lit.dev/docs/ssr/server-usage/
8
- */
9
- export interface HydrateResults {
10
- buildId: string;
11
- diagnostics: any[];
12
- url: string;
13
- host: string;
14
- hostname: string;
15
- href: string;
16
- port: string;
17
- pathname: string;
18
- search: string;
19
- hash: string;
20
- html: string;
21
- components: HydrateComponent[];
22
- anchors: any[];
23
- imgs: any[];
24
- scripts: any[];
25
- styles: any[];
26
- staticData: any[];
27
- title: string;
28
- hydratedCount: number;
29
- httpStatus: number;
30
- }
31
- export interface HydrateComponent {
32
- tag: string;
33
- mode: string;
34
- count: number;
35
- depth: number;
36
- }
37
- /**
38
- * @deprecated
39
- * Use `getWindow` from `@lit-labs/ssr/lib/dom-shim` instead.
40
- *
41
- * @see https://lit.dev/docs/ssr/server-usage/
42
- */
43
- export declare function createWindowFromHtml(templateHtml: string, uniqueId?: string): any;
44
- /**
45
- * @deprecated
46
- * Use `RenderResultReadable` from `@lit-labs/ssr` instead.
47
- *
48
- * @see https://lit.dev/docs/ssr/server-usage/
49
- */
50
- export declare function streamToString(html: any, options?: Partial<RenderInfo>): Readable;
51
- /**
52
- * @deprecated
53
- * Use `render` from `@lit-labs/ssr` instead.
54
- *
55
- * @see https://lit.dev/docs/ssr/server-usage/
56
- */
57
- export declare function renderToString(html: any, options?: Partial<RenderInfo>): Promise<HydrateResults>;
58
- export declare function renderToString(html: any, options: Partial<RenderInfo> | undefined, asStream: true): Readable;
59
- /**
60
- * @deprecated
61
- * Use `render` from `@lit-labs/ssr` instead.
62
- *
63
- * @see https://lit.dev/docs/ssr/server-usage/
64
- */
65
- export declare function hydrateDocument(doc: any, options?: Partial<RenderInfo>): Promise<HydrateResults>;
66
- export declare function hydrateDocument(doc: any, options: Partial<RenderInfo> | undefined, asStream: true): Readable;
67
- /**
68
- * @deprecated
69
- * Use `render` from `@lit-labs/ssr` instead.
70
- *
71
- * @see https://lit.dev/docs/ssr/server-usage/
72
- */
73
- export declare function serializeDocumentToString(doc: any, _unused?: unknown): string;
@@ -1,87 +0,0 @@
1
- import { getWindow } from "@lit-labs/ssr/lib/dom-shim.js";
2
- import { render } from "@lit-labs/ssr/lib/render.js";
3
- import { html } from "@lit-labs/ssr/lib/server-template.js";
4
- import { withStatic, unsafeStatic } from "lit-html/static.js";
5
- import { collectResult } from "@lit-labs/ssr/lib/render-result.js";
6
- import { RenderResultReadable } from "@lit-labs/ssr/lib/render-result-readable.js";
7
- const staticHtml = withStatic(html);
8
- function createWindowFromHtml(templateHtml, uniqueId = Math.random().toString()) {
9
- const window = getWindow({ includeJSBuiltIns: true });
10
- window.document.defaultView = window;
11
- window.document.templateHtml = templateHtml;
12
- window.document.buildId = uniqueId;
13
- return window;
14
- }
15
- function streamToString(html2, options) {
16
- const { result } = getRenderResult(html2, options);
17
- return new RenderResultReadable(result);
18
- }
19
- function getRenderResult(rawSource, options) {
20
- const maybeDocument = typeof rawSource === "object" && rawSource !== null ? "document" in rawSource ? rawSource.document : rawSource : void 0;
21
- const source = maybeDocument && "templateHtml" in maybeDocument ? maybeDocument.templateHtml : maybeDocument && "documentElement" in maybeDocument ? maybeDocument.documentElement?.outerHTML ?? maybeDocument : rawSource;
22
- const renderTemplate = typeof source === "string" ? staticHtml`${unsafeStatic(source)}` : source;
23
- const tagNames = [];
24
- const result = render(renderTemplate, {
25
- customElementRendered(tagName) {
26
- tagNames.push(tagName);
27
- },
28
- ...options
29
- });
30
- return { result, maybeDocument, tagNames };
31
- }
32
- function renderToString(html2, options, asStream = false) {
33
- if (asStream) {
34
- return streamToString(html2, options);
35
- } else {
36
- return resultsToString(html2, options);
37
- }
38
- }
39
- async function resultsToString(html2, options) {
40
- const { result, tagNames, maybeDocument } = getRenderResult(html2, options);
41
- const collected = await collectResult(result);
42
- const renderResult = {
43
- buildId: maybeDocument?.buildId ?? Math.random().toString(),
44
- diagnostics: [],
45
- url: globalThis?.location?.href ?? "https://hydrate.stenciljs.com/",
46
- host: globalThis?.location?.host ?? "hydrate.stenciljs.com",
47
- hostname: globalThis?.location?.hostname ?? "hydrate.stenciljs.com",
48
- href: globalThis?.location?.href ?? "https://hydrate.stenciljs.com/",
49
- port: globalThis?.location?.port ?? "",
50
- pathname: globalThis?.location?.pathname ?? "/",
51
- search: globalThis?.location?.search ?? "",
52
- hash: globalThis?.location?.hash ?? "",
53
- html: collected,
54
- httpStatus: 200,
55
- hydratedCount: tagNames.length,
56
- anchors: [],
57
- components: tagNames.map((tag) => ({
58
- tag,
59
- mode: "$",
60
- count: 1,
61
- depth: 1
62
- })),
63
- imgs: [],
64
- scripts: [],
65
- staticData: [],
66
- styles: [],
67
- title: globalThis?.document?.title ?? "Vite + TS"
68
- };
69
- if (maybeDocument && "templateHtml" in maybeDocument) {
70
- maybeDocument.outerHtml = collected;
71
- }
72
- return renderResult;
73
- }
74
- function hydrateDocument(doc, options, asStream) {
75
- return renderToString(doc, options, asStream);
76
- }
77
- function serializeDocumentToString(doc, _unused) {
78
- const maybeDocument = doc;
79
- return maybeDocument.outerHtml ?? maybeDocument.templateHtml ?? String(maybeDocument);
80
- }
81
- export {
82
- createWindowFromHtml,
83
- hydrateDocument,
84
- renderToString,
85
- serializeDocumentToString,
86
- streamToString
87
- };