@arcgis/lumina-compiler 4.33.0-next.99 → 4.34.0-next.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.
@@ -1,98 +1,105 @@
1
- import { render as y } from "lit-html";
2
- import { unsafeStatic as u, html as C } from "lit-html/static.js";
3
- import { camelToKebab as N } from "@arcgis/components-utils";
4
- import { onTestFinished as L, expect as _ } from "vitest";
5
- import S from "vitest-fail-on-console";
6
- import x from "js-beautify";
7
- import { LitElement as E } from "@arcgis/lumina";
8
- import { toFunction as O } from "@arcgis/lumina/controllers";
9
- async function W(e, { parent: t = document.body, afterConnect: n, dynamicComponents: r, cleanupAfterTest: i = !0 } = {}) {
10
- const o = document.createElement("div");
11
- o.style.display = "contents", t.append(o), i && L(() => M(o)), w(e);
12
- const s = r?.some(w);
13
- let c;
1
+ import { render as C } from "lit-html";
2
+ import { unsafeStatic as m, html as w } from "lit-html/static.js";
3
+ import { devOnly$getLitElementTagNameAndRuntime as $, LitElement as S } from "@arcgis/lumina";
4
+ import { camelToKebab as _ } from "@arcgis/components-utils";
5
+ import { onTestFinished as x, expect as E } from "vitest";
6
+ import O from "vitest-fail-on-console";
7
+ import R from "js-beautify";
8
+ import { toFunction as D } from "@arcgis/lumina/controllers";
9
+ async function G(e, { parent: t = document.body, afterConnect: o, dynamicComponents: f, cleanupAfterTest: s = !0 } = {}) {
10
+ const n = document.createElement("div");
11
+ n.style.display = "contents", t.append(n), s && x(() => j(n)), v(e);
12
+ const l = f?.some(v);
13
+ let r;
14
14
  if (typeof e == "string")
15
- c = C`<${u(e)}></${u(e)}>`;
15
+ r = w`<${m(e)}></${m(e)}>`;
16
16
  else if (typeof e == "function")
17
- c = "tagName" in e ? C`<${u(e.tagName)}></${u(e.tagName)}>` : e();
17
+ if (p(e)) {
18
+ const c = $(e).tagName;
19
+ r = w`<${m(c)}></${m(c)}>`;
20
+ } else
21
+ r = e();
18
22
  else {
19
- if (s)
23
+ if (l)
20
24
  throw new Error(
21
- 'When rendering a dynamically created custom element using Lit\'s html`` function, you must ensure that the custom element class name is unique in the test file, or the class should explicitly have the `static override tagName = "some-tag-name";` property with a unique tag name within the test file'
25
+ 'When rendering a dynamically created custom element using Lit\'s html`` function, you must ensure that the custom element class name is unique in the test file, or the class should explicitly have the `static tagName = "some-tag-name";` property with a unique tag name within the test file'
22
26
  );
23
- c = e;
27
+ r = e;
24
28
  }
25
- const l = [];
26
- function p(d) {
27
- l.push(d.error), d.preventDefault(), d.stopPropagation();
29
+ const i = [];
30
+ function a(c) {
31
+ i.push(c.error), c.preventDefault(), c.stopPropagation();
28
32
  }
29
- if (window.addEventListener("error", p), y(c, o), window.removeEventListener("error", p), l.length === 1)
30
- throw l[0];
31
- if (l.length > 1)
32
- throw new AggregateError(l, "Multiple errors occurred while creating the custom element");
33
- const a = b(o), $ = h, g = n?.(a);
34
- g?.then !== void 0 && await g;
35
- const m = a;
36
- typeof m?.componentOnReady == "function" && await m.componentOnReady();
37
- const f = m?._litElement ?? $ ?? a;
33
+ if (window.addEventListener("error", a), C(r, n), window.removeEventListener("error", a), i.length === 1)
34
+ throw i[0];
35
+ if (i.length > 1)
36
+ throw new AggregateError(i, "Multiple errors occurred while creating the custom element");
37
+ const u = L(n), N = g, y = o?.(u);
38
+ y?.then !== void 0 && await y;
39
+ const d = u;
40
+ typeof d?.componentOnReady == "function" && await d.componentOnReady();
41
+ const h = d?.$component ?? N ?? u;
38
42
  return {
39
- el: a,
40
- component: f,
43
+ el: u,
44
+ component: h,
41
45
  async reRender() {
42
- return typeof e == "function" && !("tagName" in e) && y(e(), t), f.requestUpdate(), await f.updateComplete;
43
- }
46
+ return typeof e == "function" && !p(e) && C(e(), t), h.requestUpdate(), await h.updateComplete;
47
+ },
48
+ container: n
44
49
  };
45
50
  }
46
- let h;
47
- const R = globalThis;
48
- R.devOnly$luminaComponentRefCallback = (e) => {
49
- h = e;
51
+ let g;
52
+ const M = globalThis;
53
+ M.devOnly$luminaComponentRefCallback = (e) => {
54
+ g = e;
50
55
  };
51
- function M(e) {
56
+ function j(e) {
52
57
  for (; e.firstChild; )
53
58
  e.removeChild(e.firstChild);
54
59
  e instanceof HTMLElement && e.remove();
55
60
  }
56
- function w(e) {
57
- if (!j(e) || e.runtime !== void 0)
61
+ function v(e) {
62
+ if (!p(e))
63
+ return !1;
64
+ const { runtime: t, tagName: o = e.tagName } = $(e);
65
+ if (t !== void 0)
58
66
  return !1;
59
- let t = !1, n = e.tagName;
60
- if (!n) {
61
- t = !1;
62
- const r = N(
67
+ let s = !1, n = o;
68
+ if (n === void 0) {
69
+ const l = _(
63
70
  /*
64
71
  * If name is a single letter, it was probably minified - thus is not
65
72
  * stable, thus don't use it. Example: class produced by wrapController()
66
73
  */
67
74
  (e.name.length > 1 ? e.name.replaceAll(z, "") : "") || "Test"
68
- ), i = r === "test" ? "te-st" : r.includes("-") ? r : `${r}-`;
69
- n = i;
70
- for (let o = 2, s = customElements.get(n); s !== e && s !== void 0; o += 1)
71
- t = !0, n = `${i}-${o}`, s = customElements.get(n);
75
+ ), r = l === "test" ? "te-st" : l.includes("-") ? l : `${l}-`;
76
+ n = r;
77
+ for (let i = 2, a = customElements.get(n); a !== e && a !== void 0; i += 1)
78
+ s = !0, n = `${r}-${i}`, a = customElements.get(n);
72
79
  }
73
- return globalThis.devOnly$luminaRuntime?.customElement(n, e), Object.defineProperty(e.prototype, "tagName", { value: n.toUpperCase() }), t;
80
+ return globalThis.devOnly$luminaRuntime?.customElement(n, e), Object.defineProperty(e.prototype, "tagName", { value: n.toUpperCase() }), s;
74
81
  }
75
- const j = (e) => typeof e == "function" && "lumina" in e, z = /\d+$/gu;
76
- function b(e) {
82
+ const p = (e) => typeof e == "function" && "lumina" in e, z = /\d+$/gu;
83
+ function L(e) {
77
84
  for (const t of e.children)
78
85
  if ("lumina" in t.constructor)
79
86
  return t;
80
87
  for (const t of e.children) {
81
- const n = b(t);
82
- if (n != null)
83
- return n;
88
+ const o = L(t);
89
+ if (o != null)
90
+ return o;
84
91
  }
85
- return e.firstElementChild ?? h?.el;
92
+ return e.firstElementChild ?? g?.el;
86
93
  }
87
- function F() {
88
- _.addSnapshotSerializer({
94
+ function A() {
95
+ E.addSnapshotSerializer({
89
96
  // Using duck typing to detect ShadowRoot. Not using instanceof to keep test fast
90
97
  test(e) {
91
98
  return typeof e == "object" && e !== null && "innerHTML" in e && "onslotchange" in e;
92
99
  },
93
100
  serialize(e) {
94
- const t = e.innerHTML.replaceAll(q, "");
95
- return x.html(t, {
101
+ const t = e.innerHTML.replaceAll(F, "");
102
+ return R.html(t, {
96
103
  /* eslint-disable @typescript-eslint/naming-convention */
97
104
  indent_size: 2,
98
105
  indent_char: " ",
@@ -105,26 +112,26 @@ function F() {
105
112
  }
106
113
  });
107
114
  }
108
- const q = /<!--\??(?:lit\$\d+\$)?-->/gu;
109
- function G() {
110
- if (T[v])
115
+ const F = /<!--\??(?:lit\$\d+\$)?-->/gu;
116
+ function I() {
117
+ if (b[T])
111
118
  return;
112
- T[v] = !0;
119
+ b[T] = !0;
113
120
  const e = { ...console };
114
- S({
121
+ O({
115
122
  // Workaround for https://github.com/thomasbrodusch/vitest-fail-on-console/issues/61
116
- silenceMessage(t, n) {
117
- return e[n](t), !1;
123
+ silenceMessage(t, o) {
124
+ return e[o](t), !1;
118
125
  }
119
- }), F();
126
+ }), A();
120
127
  }
121
- const v = Symbol.for("lumina:didSetupTest"), T = globalThis;
122
- function I(e, t) {
123
- class n extends E {
128
+ const T = Symbol.for("lumina:didSetupTest"), b = globalThis;
129
+ function J(e, t) {
130
+ class o extends S {
124
131
  constructor() {
125
132
  super();
126
- const i = "prototype" in e ? O(e) : e;
127
- this.controller = i(this), Promise.resolve(t?.(this)).catch(console.error);
133
+ const s = "prototype" in e ? D(e) : e;
134
+ this.controller = s(this), Promise.resolve(t?.(this)).catch(console.error);
128
135
  }
129
136
  /*
130
137
  * Emitting controller's exports here is useful to let controller tests
@@ -136,10 +143,10 @@ function I(e, t) {
136
143
  );
137
144
  }
138
145
  }
139
- return n;
146
+ return o;
140
147
  }
141
148
  export {
142
- W as mount,
143
- G as setupLuminaTest,
144
- I as wrapController
149
+ G as mount,
150
+ I as setupLuminaTest,
151
+ J as wrapController
145
152
  };
@@ -19,6 +19,13 @@ export type RenderResult<Component extends HTMLElement> = {
19
19
  * All public and private members of your custom element are available here.
20
20
  */
21
21
  readonly component: Component;
22
+ /**
23
+ * The container element that was used to render the component.
24
+ *
25
+ * This element is useful to inspect for functional components and components
26
+ * that do not use shadow DOM.
27
+ */
28
+ readonly container: HTMLElement;
22
29
  /**
23
30
  * A callback for triggering component re-render. Optionally, if the first
24
31
  * argument to `mount()` was a function, that function will be called
@@ -1,4 +1,4 @@
1
1
  import { ContextDirectories } from '../context/types';
2
2
  import { CompilerContext } from '../context';
3
3
  export declare const testDir: ContextDirectories;
4
- export declare const testContext: Pick<CompilerContext, "_documentationFileNames" | "dir">;
4
+ export declare const testContext: Pick<CompilerContext, "_documentationFileNames" | "dir" | "options">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/lumina-compiler",
3
- "version": "4.33.0-next.99",
3
+ "version": "4.34.0-next.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -18,25 +18,25 @@
18
18
  ],
19
19
  "license": "SEE LICENSE IN LICENSE.md",
20
20
  "dependencies": {
21
- "@arcgis/api-extractor": "4.33.0-next.99",
22
- "@arcgis/components-build-utils": "4.33.0-next.99",
23
- "@arcgis/components-utils": "4.33.0-next.99",
21
+ "@arcgis/api-extractor": "4.34.0-next.1",
22
+ "@arcgis/components-build-utils": "4.34.0-next.1",
23
+ "@arcgis/components-utils": "4.34.0-next.1",
24
24
  "chalk": "^5.3.0",
25
- "esbuild": "^0.24.0",
25
+ "esbuild": "^0.25.4",
26
26
  "glob": "^11.0.0",
27
27
  "js-beautify": "^1.15.1",
28
28
  "mime-types": "^2.1.35",
29
- "rollup": "^4.24.0",
30
- "rollup-plugin-node-externals": "^7.1.3",
29
+ "rollup": "^4.40.2",
30
+ "rollup-plugin-node-externals": "^8.0.0",
31
31
  "sass-embedded": "^1.79.3",
32
- "tslib": "^2.7.0",
33
- "typescript": "~5.6.3",
34
- "vite": "^5.4.8",
35
- "vite-plugin-dts": "^4.3.0",
36
- "vitest": "^2.1.3",
32
+ "tslib": "^2.8.1",
33
+ "typescript": "~5.8.3",
34
+ "vite": "^6.3.4",
35
+ "vite-plugin-dts": "^4.5.3",
36
+ "vitest": "^3.1.3",
37
37
  "vitest-fail-on-console": "^0.7.1"
38
38
  },
39
39
  "peerDependencies": {
40
- "@arcgis/lumina": "~4.33.0-next.99"
40
+ "@arcgis/lumina": "~4.34.0-next.1"
41
41
  }
42
42
  }
@@ -1,11 +0,0 @@
1
- import { default as ts } from 'typescript';
2
- import { ApiCustomElementDeclaration, ApiCustomElementField, ApiDocsTag } from '@arcgis/api-extractor';
3
- export declare function symbolToDocs(checker: ts.TypeChecker, symbol: ts.Signature | ts.Symbol): {
4
- description: ApiCustomElementField["description"];
5
- docsTags: ApiDocsTag[];
6
- };
7
- export declare const internalJsDocTag = "internal";
8
- export declare const findDecorator: ({ modifiers }: {
9
- modifiers?: readonly ts.ModifierLike[];
10
- }, name: string) => ts.CallExpression | undefined;
11
- export declare function setJsDocFields(node: ts.PropertyName, checker: ts.TypeChecker, api: Partial<Pick<ApiCustomElementField, "default" | "deprecated" | "description" | "docsTags" | "privacy" | "readonly" | "summary"> & Pick<ApiCustomElementDeclaration, "cssParts" | "cssProperties" | "cssStates" | "slots">>, docs?: ReturnType<typeof symbolToDocs>): void;