@patternfly/pfe-core 4.0.5 → 5.0.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.
@@ -6,6 +6,11 @@ function makeContextRoot() {
6
6
  if (!isServer) {
7
7
  root.attach(document.body);
8
8
  }
9
+ else {
10
+ root.attach(
11
+ // @ts-expect-error: enable context root in ssr
12
+ globalThis.litServerRoot);
13
+ }
9
14
  return root;
10
15
  }
11
16
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAgB,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAE/B,IAAI,IAAiB,CAAC;AAEtB,SAAS,eAAe;IACtB,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;IAC/B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,GAAG,IAAsC;IAEzC,IAAI,KAAJ,IAAI,GAAK,eAAe,EAAE,EAAC;IAC3B,OAAO,aAAa,CAAI,GAAG,IAAI,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import { ContextRoot, createContext, type Context } from '@lit/context';\nimport { isServer } from 'lit';\n\nlet root: ContextRoot;\n\nfunction makeContextRoot() {\n const root = new ContextRoot();\n if (!isServer) {\n root.attach(document.body);\n }\n return root;\n}\n\n/**\n * In order to prevent late-upgrading-context-consumers from 'missing'\n * their rightful context providers, we must set up a `ContextRoot` on the body.\n * Always use this function when creating contexts that are shared with child elements.\n * @param args createContext args\n */\nexport function createContextWithRoot<T>(\n ...args: Parameters<typeof createContext>\n): Context<unknown, T> {\n root ??= makeContextRoot();\n return createContext<T>(...args);\n}\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAgB,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAE/B,IAAI,IAAiB,CAAC;AAEtB,SAAS,eAAe;IACtB,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;IAC/B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,MAAM;QACT,+CAA+C;QAC/C,UAAU,CAAC,aAAa,CACzB,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,GAAG,IAAsC;IAEzC,IAAI,KAAJ,IAAI,GAAK,eAAe,EAAE,EAAC;IAC3B,OAAO,aAAa,CAAI,GAAG,IAAI,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import { ContextRoot, createContext, type Context } from '@lit/context';\nimport { isServer } from 'lit';\n\nlet root: ContextRoot;\n\nfunction makeContextRoot() {\n const root = new ContextRoot();\n if (!isServer) {\n root.attach(document.body);\n } else {\n root.attach(\n // @ts-expect-error: enable context root in ssr\n globalThis.litServerRoot,\n );\n }\n return root;\n}\n\n/**\n * In order to prevent late-upgrading-context-consumers from 'missing'\n * their rightful context providers, we must set up a `ContextRoot` on the body.\n * Always use this function when creating contexts that are shared with child elements.\n * @param args createContext args\n */\nexport function createContextWithRoot<T>(\n ...args: Parameters<typeof createContext>\n): Context<unknown, T> {\n root ??= makeContextRoot();\n return createContext<T>(...args);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/pfe-core",
3
- "version": "4.0.5",
3
+ "version": "5.0.1",
4
4
  "license": "MIT",
5
5
  "description": "PatternFly Elements Core Library",
6
6
  "customElements": "custom-elements.json",
@@ -32,7 +32,11 @@
32
32
  "./controllers/property-observer-controller.js": "./controllers/property-observer-controller.js",
33
33
  "./controllers/roving-tabindex-controller.js": "./controllers/roving-tabindex-controller.js",
34
34
  "./controllers/scroll-spy-controller.js": "./controllers/scroll-spy-controller.js",
35
- "./controllers/slot-controller.js": "./controllers/slot-controller.js",
35
+ "./controllers/slot-controller.js": {
36
+ "node": "./controllers/slot-controller-server.js",
37
+ "import": "./controllers/slot-controller.js",
38
+ "default": "./controllers/slot-controller.js"
39
+ },
36
40
  "./controllers/style-controller.js": "./controllers/style-controller.js",
37
41
  "./controllers/timestamp-controller.js": "./controllers/timestamp-controller.js",
38
42
  "./controllers/tabs-controller.js": "./controllers/tabs-controller.js",
@@ -62,8 +66,8 @@
62
66
  },
63
67
  "dependencies": {
64
68
  "@floating-ui/dom": "^1.6.10",
65
- "@lit/context": "^1.1.2",
66
- "lit": "^3.2.0"
69
+ "@lit/context": "^1.1.3",
70
+ "lit": "^3.2.1"
67
71
  },
68
72
  "repository": {
69
73
  "type": "git",
package/ssr-shims.d.ts CHANGED
@@ -1,17 +1 @@
1
- declare class ObserverShim {
2
- observe(): void;
3
- disconnect(): void;
4
- }
5
- declare class MiniHTMLElement {
6
- tagName: string;
7
- innerHTML: string;
8
- constructor(tagName: string);
9
- }
10
- declare class MiniHTMLTemplateElement extends MiniHTMLElement {
11
- content: {
12
- cloneNode: () => string;
13
- };
14
- }
15
- declare class MiniDocument {
16
- createElement(tagName: string): MiniHTMLElement;
17
- }
1
+ export {};
package/ssr-shims.js CHANGED
@@ -1,4 +1,5 @@
1
- "use strict";
1
+ var _a;
2
+ import { installWindowOnGlobal } from '@lit-labs/ssr/lib/dom-shim.js';
2
3
  class ObserverShim {
3
4
  observe() {
4
5
  void 0;
@@ -19,32 +20,7 @@ class MiniHTMLTemplateElement extends MiniHTMLElement {
19
20
  this.content = { cloneNode: () => this.innerHTML };
20
21
  }
21
22
  }
22
- class MiniDocument {
23
- createElement(tagName) {
24
- switch (tagName) {
25
- case 'template':
26
- return new MiniHTMLTemplateElement(tagName);
27
- default:
28
- return new MiniHTMLElement(tagName);
29
- }
30
- }
31
- }
32
- // @ts-expect-error: this runs in node
33
- globalThis.window ?? (globalThis.window = globalThis);
34
- // @ts-expect-error: this runs in node
35
- globalThis.document ?? (globalThis.document = new MiniDocument());
36
- // @ts-expect-error: this runs in node
37
- globalThis.navigator ?? (globalThis.navigator = { userAgent: '' });
38
- // @ts-expect-error: this runs in node
39
- globalThis.ErrorEvent ?? (globalThis.ErrorEvent = Event);
40
- // @ts-expect-error: this runs in node
41
- globalThis.IntersectionObserver ?? (globalThis.IntersectionObserver = ObserverShim);
42
- // @ts-expect-error: this runs in node
43
- globalThis.MutationObserver ?? (globalThis.MutationObserver = ObserverShim);
44
- // @ts-expect-error: this runs in node
45
- globalThis.ResizeObserver ?? (globalThis.ResizeObserver = ObserverShim);
46
- // @ts-expect-error: this runs in node
47
- globalThis.getComputedStyle ?? (globalThis.getComputedStyle = function () {
23
+ function getComputedStyle() {
48
24
  return {
49
25
  getPropertyPriority() {
50
26
  return '';
@@ -53,5 +29,25 @@ globalThis.getComputedStyle ?? (globalThis.getComputedStyle = function () {
53
29
  return '';
54
30
  },
55
31
  };
32
+ }
33
+ ;
34
+ // @ts-expect-error: opt in to event support in ssr
35
+ globalThis.litSsrCallConnectedCallback = true;
36
+ installWindowOnGlobal({
37
+ ErrorEvent: Event,
38
+ IntersectionObserver: ObserverShim,
39
+ MutationObserver: ObserverShim,
40
+ ResizeObserver: ObserverShim,
41
+ getComputedStyle,
56
42
  });
43
+ // @ts-expect-error: this runs in node
44
+ (_a = globalThis.navigator).userAgent ?? (_a.userAgent = '@lit-labs/ssr');
45
+ globalThis.document.createElement = function createElement(tagName) {
46
+ switch (tagName) {
47
+ case 'template':
48
+ return new MiniHTMLTemplateElement(tagName);
49
+ default:
50
+ return new MiniHTMLElement(tagName);
51
+ }
52
+ };
57
53
  //# sourceMappingURL=ssr-shims.js.map
package/ssr-shims.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ssr-shims.js","sourceRoot":"","sources":["ssr-shims.ts"],"names":[],"mappings":";AAAA,MAAM,YAAY;IAChB,OAAO;QACL,KAAK,CAAC,CAAC;IACT,CAAC;IAED,UAAU;QACR,KAAK,CAAC,CAAC;IACT,CAAC;CACF;AAED,MAAM,eAAe;IAEnB,YAAmB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QADlC,cAAS,GAAG,EAAE,CAAC;IACuB,CAAC;CACxC;AAED,MAAM,uBAAwB,SAAQ,eAAe;IAArD;;QACE,YAAO,GAAG,EAAE,SAAS,EAAE,GAAW,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;IACxD,CAAC;CAAA;AAED,MAAM,YAAY;IAChB,aAAa,CAAC,OAAe;QAC3B,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,UAAU;gBACb,OAAO,IAAI,uBAAuB,CAAC,OAAO,CAAC,CAAC;YAC9C;gBACE,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF;AAED,sCAAsC;AACtC,UAAU,CAAC,MAAM,KAAjB,UAAU,CAAC,MAAM,GAAK,UAAU,EAAC;AACjC,sCAAsC;AACtC,UAAU,CAAC,QAAQ,KAAnB,UAAU,CAAC,QAAQ,GAAK,IAAI,YAAY,EAAE,EAAC;AAC3C,sCAAsC;AACtC,UAAU,CAAC,SAAS,KAApB,UAAU,CAAC,SAAS,GAAK,EAAE,SAAS,EAAE,EAAE,EAAE,EAAC;AAC3C,sCAAsC;AACtC,UAAU,CAAC,UAAU,KAArB,UAAU,CAAC,UAAU,GAAK,KAAK,EAAC;AAChC,sCAAsC;AACtC,UAAU,CAAC,oBAAoB,KAA/B,UAAU,CAAC,oBAAoB,GAAK,YAAY,EAAC;AACjD,sCAAsC;AACtC,UAAU,CAAC,gBAAgB,KAA3B,UAAU,CAAC,gBAAgB,GAAK,YAAY,EAAC;AAC7C,sCAAsC;AACtC,UAAU,CAAC,cAAc,KAAzB,UAAU,CAAC,cAAc,GAAK,YAAY,EAAC;AAC3C,sCAAsC;AACtC,UAAU,CAAC,gBAAgB,KAA3B,UAAU,CAAC,gBAAgB,GAAK;IAC9B,OAAO;QACL,mBAAmB;YACjB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,gBAAgB;YACd,OAAO,EAAE,CAAC;QACZ,CAAC;KACF,CAAC;AACJ,CAAC,EAEA","sourcesContent":["class ObserverShim {\n observe(): void {\n void 0;\n }\n\n disconnect(): void {\n void 0;\n }\n}\n\nclass MiniHTMLElement {\n innerHTML = '';\n constructor(public tagName: string) { }\n}\n\nclass MiniHTMLTemplateElement extends MiniHTMLElement {\n content = { cloneNode: (): string => this.innerHTML };\n}\n\nclass MiniDocument {\n createElement(tagName: string): MiniHTMLElement {\n switch (tagName) {\n case 'template':\n return new MiniHTMLTemplateElement(tagName);\n default:\n return new MiniHTMLElement(tagName);\n }\n }\n}\n\n// @ts-expect-error: this runs in node\nglobalThis.window ??= globalThis;\n// @ts-expect-error: this runs in node\nglobalThis.document ??= new MiniDocument();\n// @ts-expect-error: this runs in node\nglobalThis.navigator ??= { userAgent: '' };\n// @ts-expect-error: this runs in node\nglobalThis.ErrorEvent ??= Event;\n// @ts-expect-error: this runs in node\nglobalThis.IntersectionObserver ??= ObserverShim;\n// @ts-expect-error: this runs in node\nglobalThis.MutationObserver ??= ObserverShim;\n// @ts-expect-error: this runs in node\nglobalThis.ResizeObserver ??= ObserverShim;\n// @ts-expect-error: this runs in node\nglobalThis.getComputedStyle ??= function() {\n return {\n getPropertyPriority() {\n return '';\n },\n getPropertyValue() {\n return '';\n },\n };\n}\n\n;\n\n"]}
1
+ {"version":3,"file":"ssr-shims.js","sourceRoot":"","sources":["ssr-shims.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,YAAY;IAChB,OAAO;QACL,KAAK,CAAC,CAAC;IACT,CAAC;IAED,UAAU;QACR,KAAK,CAAC,CAAC;IACT,CAAC;CACF;AAED,MAAM,eAAe;IAEnB,YAAmB,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QADlC,cAAS,GAAG,EAAE,CAAC;IACuB,CAAC;CACxC;AAED,MAAM,uBAAwB,SAAQ,eAAe;IAArD;;QACE,YAAO,GAAG,EAAE,SAAS,EAAE,GAAW,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;IACxD,CAAC;CAAA;AAED,SAAS,gBAAgB;IACvB,OAAO;QACL,mBAAmB;YACjB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,gBAAgB;YACd,OAAO,EAAE,CAAC;QACZ,CAAC;KACF,CAAC;AACJ,CAAC;AAAA,CAAC;AAEF,mDAAmD;AACnD,UAAU,CAAC,2BAA2B,GAAG,IAAI,CAAC;AAE9C,qBAAqB,CAAC;IACpB,UAAU,EAAE,KAAK;IACjB,oBAAoB,EAAE,YAAY;IAClC,gBAAgB,EAAE,YAAY;IAC9B,cAAc,EAAE,YAAY;IAC5B,gBAAgB;CACjB,CAAC,CAAC;AAEH,sCAAsC;AACtC,MAAA,UAAU,CAAC,SAAS,EAAC,SAAS,QAAT,SAAS,GAAK,eAAe,EAAC;AAEnD,UAAU,CAAC,QAAQ,CAAC,aAAa,GAAG,SAAS,aAAa,CAAC,OAAe;IACxE,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,UAAU;YACb,OAAO,IAAI,uBAAuB,CAAC,OAAO,CAA2B,CAAC;QACxE;YACE,OAAO,IAAI,eAAe,CAAC,OAAO,CAAgB,CAAC;IACvD,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { installWindowOnGlobal } from '@lit-labs/ssr/lib/dom-shim.js';\n\nclass ObserverShim {\n observe(): void {\n void 0;\n }\n\n disconnect(): void {\n void 0;\n }\n}\n\nclass MiniHTMLElement {\n innerHTML = '';\n constructor(public tagName: string) { }\n}\n\nclass MiniHTMLTemplateElement extends MiniHTMLElement {\n content = { cloneNode: (): string => this.innerHTML };\n}\n\nfunction getComputedStyle() {\n return {\n getPropertyPriority() {\n return '';\n },\n getPropertyValue() {\n return '';\n },\n };\n};\n\n// @ts-expect-error: opt in to event support in ssr\nglobalThis.litSsrCallConnectedCallback = true;\n\ninstallWindowOnGlobal({\n ErrorEvent: Event,\n IntersectionObserver: ObserverShim,\n MutationObserver: ObserverShim,\n ResizeObserver: ObserverShim,\n getComputedStyle,\n});\n\n// @ts-expect-error: this runs in node\nglobalThis.navigator.userAgent ??= '@lit-labs/ssr';\n\nglobalThis.document.createElement = function createElement(tagName: string): HTMLElement {\n switch (tagName) {\n case 'template':\n return new MiniHTMLTemplateElement(tagName) as unknown as HTMLElement;\n default:\n return new MiniHTMLElement(tagName) as HTMLElement;\n }\n};\n"]}