@patternfly/pfe-core 3.0.0 → 4.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.
Files changed (102) hide show
  1. package/controllers/activedescendant-controller.d.ts +99 -0
  2. package/controllers/activedescendant-controller.js +230 -0
  3. package/controllers/activedescendant-controller.js.map +1 -0
  4. package/controllers/at-focus-controller.d.ts +56 -0
  5. package/controllers/at-focus-controller.js +168 -0
  6. package/controllers/at-focus-controller.js.map +1 -0
  7. package/controllers/cascade-controller.d.ts +7 -2
  8. package/controllers/cascade-controller.js +6 -1
  9. package/controllers/cascade-controller.js.map +1 -1
  10. package/controllers/combobox-controller.d.ts +117 -0
  11. package/controllers/combobox-controller.js +611 -0
  12. package/controllers/combobox-controller.js.map +1 -0
  13. package/controllers/css-variable-controller.js +1 -1
  14. package/controllers/css-variable-controller.js.map +1 -1
  15. package/controllers/floating-dom-controller.d.ts +8 -1
  16. package/controllers/floating-dom-controller.js +12 -5
  17. package/controllers/floating-dom-controller.js.map +1 -1
  18. package/controllers/internals-controller.d.ts +26 -9
  19. package/controllers/internals-controller.js +45 -13
  20. package/controllers/internals-controller.js.map +1 -1
  21. package/controllers/light-dom-controller.js +2 -2
  22. package/controllers/light-dom-controller.js.map +1 -1
  23. package/controllers/listbox-controller.d.ts +118 -33
  24. package/controllers/listbox-controller.js +347 -154
  25. package/controllers/listbox-controller.js.map +1 -1
  26. package/controllers/logger.d.ts +13 -10
  27. package/controllers/logger.js +15 -11
  28. package/controllers/logger.js.map +1 -1
  29. package/controllers/overflow-controller.js +10 -6
  30. package/controllers/overflow-controller.js.map +1 -1
  31. package/controllers/perf-controller.js.map +1 -1
  32. package/controllers/property-observer-controller.d.ts +13 -16
  33. package/controllers/property-observer-controller.js +54 -25
  34. package/controllers/property-observer-controller.js.map +1 -1
  35. package/controllers/roving-tabindex-controller.d.ts +12 -61
  36. package/controllers/roving-tabindex-controller.js +57 -203
  37. package/controllers/roving-tabindex-controller.js.map +1 -1
  38. package/controllers/scroll-spy-controller.d.ts +4 -1
  39. package/controllers/scroll-spy-controller.js +9 -6
  40. package/controllers/scroll-spy-controller.js.map +1 -1
  41. package/controllers/slot-controller.d.ts +12 -16
  42. package/controllers/slot-controller.js +17 -20
  43. package/controllers/slot-controller.js.map +1 -1
  44. package/controllers/style-controller.js +3 -1
  45. package/controllers/style-controller.js.map +1 -1
  46. package/controllers/tabs-aria-controller.d.ts +2 -0
  47. package/controllers/tabs-aria-controller.js +2 -0
  48. package/controllers/tabs-aria-controller.js.map +1 -1
  49. package/controllers/test/combobox-controller.spec.d.ts +1 -0
  50. package/controllers/test/combobox-controller.spec.js +282 -0
  51. package/controllers/test/combobox-controller.spec.js.map +1 -0
  52. package/controllers/timestamp-controller.js +7 -2
  53. package/controllers/timestamp-controller.js.map +1 -1
  54. package/core.d.ts +0 -23
  55. package/core.js +1 -38
  56. package/core.js.map +1 -1
  57. package/custom-elements.json +3862 -1369
  58. package/decorators/bound.d.ts +3 -1
  59. package/decorators/bound.js +3 -1
  60. package/decorators/bound.js.map +1 -1
  61. package/decorators/cascades.d.ts +2 -1
  62. package/decorators/cascades.js +2 -1
  63. package/decorators/cascades.js.map +1 -1
  64. package/decorators/deprecation.d.ts +6 -5
  65. package/decorators/deprecation.js +6 -5
  66. package/decorators/deprecation.js.map +1 -1
  67. package/decorators/initializer.js.map +1 -1
  68. package/decorators/listen.d.ts +8 -0
  69. package/decorators/listen.js +22 -0
  70. package/decorators/listen.js.map +1 -0
  71. package/decorators/observed.d.ts +12 -16
  72. package/decorators/observed.js +39 -44
  73. package/decorators/observed.js.map +1 -1
  74. package/decorators/observes.d.ts +15 -0
  75. package/decorators/observes.js +30 -0
  76. package/decorators/observes.js.map +1 -0
  77. package/decorators/time.d.ts +1 -0
  78. package/decorators/time.js +6 -9
  79. package/decorators/time.js.map +1 -1
  80. package/decorators/trace.d.ts +4 -1
  81. package/decorators/trace.js +4 -1
  82. package/decorators/trace.js.map +1 -1
  83. package/decorators.d.ts +2 -0
  84. package/decorators.js +2 -0
  85. package/decorators.js.map +1 -1
  86. package/functions/arraysAreEquivalent.d.ts +9 -0
  87. package/functions/arraysAreEquivalent.js +28 -0
  88. package/functions/arraysAreEquivalent.js.map +1 -0
  89. package/functions/containsDeep.d.ts +2 -0
  90. package/functions/containsDeep.js +2 -0
  91. package/functions/containsDeep.js.map +1 -1
  92. package/functions/context.d.ts +3 -4
  93. package/functions/context.js +6 -2
  94. package/functions/context.js.map +1 -1
  95. package/functions/debounce.js.map +1 -1
  96. package/functions/isElementInView.d.ts +4 -6
  97. package/functions/isElementInView.js +9 -11
  98. package/functions/isElementInView.js.map +1 -1
  99. package/package.json +12 -4
  100. package/ssr-shims.d.ts +17 -0
  101. package/ssr-shims.js +55 -0
  102. package/ssr-shims.js.map +1 -0
package/core.d.ts CHANGED
@@ -1,23 +1,7 @@
1
1
  import type { ComplexAttributeConverter } from 'lit';
2
- /** PatternFly Elements global config object */
3
- export interface PfeConfig {
4
- /** Set to false to disable client-side page load performance tracking */
5
- trackPerformance?: boolean;
6
- /** Set to false to disable various debug logs */
7
- log?: boolean;
8
- /** Set to false to disable automatically removing `unresolved` attr from body */
9
- autoReveal?: boolean;
10
- }
11
2
  export type RequireProps<T, Ps extends keyof T> = T & {
12
3
  [P in Ps]-?: T[P];
13
4
  };
14
- declare const noPref: unique symbol;
15
- /**
16
- * A boolean value that indicates if the performance should be tracked.
17
- * For use in a JS file or script tag; can also be added in the constructor of a component during development.
18
- * @example trackPerformance(true);
19
- */
20
- export declare function trackPerformance(preference?: boolean | typeof noPref): boolean | undefined;
21
5
  /**
22
6
  * A LitElement property converter which represents a list of numbers as a comma separated string
23
7
  * @see https://lit.dev/docs/components/properties/#conversion-converter
@@ -35,10 +19,3 @@ export declare const StringListConverter: ComplexAttributeConverter<string[] | n
35
19
  export declare class ComposedEvent extends Event {
36
20
  constructor(type: string, init?: EventInit);
37
21
  }
38
- declare global {
39
- interface Window {
40
- /** Global configuration settings for PatternFly Elements */
41
- PfeConfig: PfeConfig;
42
- }
43
- }
44
- export {};
package/core.js CHANGED
@@ -1,19 +1,3 @@
1
- const noPref = Symbol();
2
- /** Retrieve an HTML metadata item */
3
- function getMeta(name) {
4
- return document.head.querySelector(`meta[name="${name}"]`)?.content;
5
- }
6
- /**
7
- * A boolean value that indicates if the performance should be tracked.
8
- * For use in a JS file or script tag; can also be added in the constructor of a component during development.
9
- * @example trackPerformance(true);
10
- */
11
- export function trackPerformance(preference = noPref) {
12
- if (preference !== noPref) {
13
- window.PfeConfig.trackPerformance = !!preference;
14
- }
15
- return window.PfeConfig.trackPerformance;
16
- }
17
1
  function makeConverter(f) {
18
2
  return {
19
3
  fromAttribute(value) {
@@ -48,29 +32,8 @@ export class ComposedEvent extends Event {
48
32
  super(type, {
49
33
  bubbles: true,
50
34
  composed: true,
51
- ...init
35
+ ...init,
52
36
  });
53
37
  }
54
38
  }
55
- const bodyNoAutoReveal = document.body.hasAttribute('no-auto-reveal');
56
- /** Global patternfly elements config */
57
- window.PfeConfig = Object.assign(window.PfeConfig ?? {}, {
58
- trackPerformance: window.PfeConfig?.trackPerformance ?? getMeta('pf-track-performance') === 'true',
59
- // if the body tag has `no-auto-reveal` attribute, reveal immediately
60
- // if `<meta name="pf-auto-reveal">` exists, and it's `content` is 'true',
61
- // then auto-reveal the body
62
- autoReveal: window.PfeConfig?.autoReveal ?? (bodyNoAutoReveal ? !bodyNoAutoReveal
63
- : getMeta('pf-auto-reveal') === 'true'),
64
- get log() {
65
- return !!localStorage.pfeLog;
66
- },
67
- set log(v) {
68
- if (v) {
69
- localStorage.setItem('pfeLog', `${true}`);
70
- }
71
- else {
72
- localStorage.removeItem('pfeLog');
73
- }
74
- },
75
- });
76
39
  //# sourceMappingURL=core.js.map
package/core.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["core.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;AAExB,q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;SACR,CAAC,CAAC;IACL,CAAC;CACF;AAWD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;AAEtE,wCAAwC;AACxC,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,EAAE;IACvD,gBAAgB,EAAE,MAAM,CAAC,SAAS,EAAE,gBAAgB,IAAI,OAAO,CAAC,sBAAsB,CAAC,KAAK,MAAM;IAClG,qEAAqE;IACrE,0EAA0E;IAC1E,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC,SAAS,EAAE,UAAU,IAAI,CACxC,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB;QACtC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,MAAM,CACvC;IACD,IAAI,GAAG;QACL,OAAO,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC;IAC/B,CAAC;IACD,IAAI,GAAG,CAAC,CAAU;QAChB,IAAI,CAAC,EAAE,CAAC;YACN,YAAY,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;CACF,CAAC,CAAC","sourcesContent":["import type { ComplexAttributeConverter } from 'lit';\n\n/** PatternFly Elements global config object */\nexport interface PfeConfig {\n /** Set to false to disable client-side page load performance tracking */\n trackPerformance?: boolean;\n /** Set to false to disable various debug logs */\n log?: boolean;\n /** Set to false to disable automatically removing `unresolved` attr from body */\n autoReveal?: boolean;\n}\n\nexport type RequireProps<T, Ps extends keyof T> = T & {\n [P in Ps]-?: T[P];\n}\n\nconst noPref = Symbol();\n\n/** Retrieve an HTML metadata item */\nfunction getMeta(name: string): string | undefined {\n return document.head.querySelector<HTMLMetaElement>(`meta[name=\"${name}\"]`)?.content;\n}\n\n/**\n * A boolean value that indicates if the performance should be tracked.\n * For use in a JS file or script tag; can also be added in the constructor of a component during development.\n * @example trackPerformance(true);\n */\nexport function trackPerformance(preference: boolean | typeof noPref = noPref) {\n if (preference !== noPref) {\n window.PfeConfig.trackPerformance = !!preference;\n }\n return window.PfeConfig.trackPerformance;\n}\n\nfunction makeConverter<T>(f: (x: string, type?: unknown) => T): ComplexAttributeConverter<null | T[]> {\n return {\n fromAttribute(value: string) {\n if (typeof value !== 'string') {\n return null;\n } else {\n return value.split(',').map(f);\n }\n },\n toAttribute(value: T[]) {\n return value.join(',');\n },\n };\n}\n\n/**\n * A LitElement property converter which represents a list of numbers as a comma separated string\n * @see https://lit.dev/docs/components/properties/#conversion-converter\n */\nexport const NumberListConverter =\n makeConverter(x => parseInt(x?.trim(), 10));\n\n/**\n * A LitElement property converter which represents a list of strings as a comma separated string\n * @see https://lit.dev/docs/components/properties/#conversion-converter\n */\nexport const StringListConverter =\n makeConverter(x => x.trim());\n\n/**\n * A composed, bubbling event for UI interactions\n * e.g. when an accordion panel opens.\n */\nexport class ComposedEvent extends Event {\n constructor(type: string, init?: EventInit) {\n super(type, {\n bubbles: true,\n composed: true,\n ...init\n });\n }\n}\n\n// 👇 SIDE EFFECTS 👇\n\ndeclare global {\n interface Window {\n /** Global configuration settings for PatternFly Elements */\n PfeConfig: PfeConfig;\n }\n}\n\nconst bodyNoAutoReveal = document.body.hasAttribute('no-auto-reveal');\n\n/** Global patternfly elements config */\nwindow.PfeConfig = Object.assign(window.PfeConfig ?? {}, {\n trackPerformance: window.PfeConfig?.trackPerformance ?? getMeta('pf-track-performance') === 'true',\n // if the body tag has `no-auto-reveal` attribute, reveal immediately\n // if `<meta name=\"pf-auto-reveal\">` exists, and it's `content` is 'true',\n // then auto-reveal the body\n autoReveal: window.PfeConfig?.autoReveal ?? (\n bodyNoAutoReveal ? !bodyNoAutoReveal\n : getMeta('pf-auto-reveal') === 'true'\n ),\n get log() {\n return !!localStorage.pfeLog;\n },\n set log(v: boolean) {\n if (v) {\n localStorage.setItem('pfeLog', `${true}`);\n } else {\n localStorage.removeItem('pfeLog');\n }\n },\n});\n"]}
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["core.ts"],"names":[],"mappings":"AAMA,SAAS,aAAa,CACpB,CAAmC;IAEnC,OAAO;QACL,aAAa,CAAC,KAAa;YACzB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,OAAO,IAAI,CAAC;YACd,CAAC;iBAAM,CAAC;gBACN,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;QACD,WAAW,CAAC,KAAU;YACpB,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAC9B,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAC9B,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAE/B;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,IAAY,EAAE,IAAgB;QACxC,KAAK,CAAC,IAAI,EAAE;YACV,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,GAAG,IAAI;SACR,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import type { ComplexAttributeConverter } from 'lit';\n\nexport type RequireProps<T, Ps extends keyof T> = T & {\n [P in Ps]-?: T[P];\n};\n\nfunction makeConverter<T>(\n f: (x: string, type?: unknown) => T,\n): ComplexAttributeConverter<null | T[]> {\n return {\n fromAttribute(value: string) {\n if (typeof value !== 'string') {\n return null;\n } else {\n return value.split(',').map(f);\n }\n },\n toAttribute(value: T[]) {\n return value.join(',');\n },\n };\n}\n\n/**\n * A LitElement property converter which represents a list of numbers as a comma separated string\n * @see https://lit.dev/docs/components/properties/#conversion-converter\n */\nexport const NumberListConverter: ComplexAttributeConverter<number[] | null, unknown> =\n makeConverter(x => parseInt(x?.trim(), 10));\n\n/**\n * A LitElement property converter which represents a list of strings as a comma separated string\n * @see https://lit.dev/docs/components/properties/#conversion-converter\n */\nexport const StringListConverter: ComplexAttributeConverter<string[] | null, unknown> =\n makeConverter(x => x.trim());\n\n/**\n * A composed, bubbling event for UI interactions\n * e.g. when an accordion panel opens.\n */\nexport class ComposedEvent extends Event {\n constructor(type: string, init?: EventInit) {\n super(type, {\n bubbles: true,\n composed: true,\n ...init,\n });\n }\n}\n\n"]}