@redvars/peacock 3.2.8 → 3.2.10

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 (86) hide show
  1. package/dist/{PeacockComponent-DMrFEGDh.js → PeacockComponent-CxJc63xj.js} +6 -13
  2. package/dist/PeacockComponent-CxJc63xj.js.map +1 -0
  3. package/dist/assets/styles.css +1 -1
  4. package/dist/assets/styles.css.map +1 -1
  5. package/dist/assets/tokens.css +2 -0
  6. package/dist/assets/tokens.css.map +1 -0
  7. package/dist/{button-BtpAXuLN.js → button-DaL4va7Q.js} +12 -294
  8. package/dist/button-DaL4va7Q.js.map +1 -0
  9. package/dist/button-group.js +3 -2
  10. package/dist/button-group.js.map +1 -1
  11. package/dist/button.js +6 -4
  12. package/dist/button.js.map +1 -1
  13. package/dist/{class-map-CbncA34D.js → class-map-BvQRv7eW.js} +3 -2
  14. package/dist/class-map-BvQRv7eW.js.map +1 -0
  15. package/dist/clock.js +85 -0
  16. package/dist/clock.js.map +1 -0
  17. package/dist/code-editor.js +43877 -0
  18. package/dist/code-editor.js.map +1 -0
  19. package/dist/code-highlighter.js +5 -4
  20. package/dist/code-highlighter.js.map +1 -1
  21. package/dist/custom-elements-jsdocs.json +561 -0
  22. package/dist/custom-elements.json +777 -194
  23. package/dist/directive-Cuw6h7YA.js +9 -0
  24. package/dist/directive-Cuw6h7YA.js.map +1 -0
  25. package/dist/dispatch-event-utils-vbdiOSeC.js +290 -0
  26. package/dist/dispatch-event-utils-vbdiOSeC.js.map +1 -0
  27. package/dist/{breadcrumb-item-DkhwoMAH.js → image-v3BujlY5.js} +261 -92
  28. package/dist/image-v3BujlY5.js.map +1 -0
  29. package/dist/index.js +12 -87
  30. package/dist/index.js.map +1 -1
  31. package/dist/number-counter.js +3 -2
  32. package/dist/number-counter.js.map +1 -1
  33. package/dist/observe-theme-change-NneLARW8.js +51 -0
  34. package/dist/observe-theme-change-NneLARW8.js.map +1 -0
  35. package/dist/peacock-loader.js +22 -11
  36. package/dist/peacock-loader.js.map +1 -1
  37. package/dist/src/code-editor/code-editor.d.ts +45 -0
  38. package/dist/src/code-editor/index.d.ts +2 -0
  39. package/dist/src/image/image.d.ts +45 -0
  40. package/dist/src/image/index.d.ts +1 -0
  41. package/dist/src/index.d.ts +2 -0
  42. package/dist/src/utils/dispatch-event-utils.d.ts +72 -0
  43. package/dist/src/utils/observe-theme-change.d.ts +3 -0
  44. package/dist/src/utils.d.ts +1 -72
  45. package/dist/{state-CEVpI7Vv.js → state-B09bP3XH.js} +2 -2
  46. package/dist/{state-CEVpI7Vv.js.map → state-B09bP3XH.js.map} +1 -1
  47. package/dist/{style-map-mOmZwsJT.js → style-map-B8xgVEc9.js} +3 -2
  48. package/dist/style-map-B8xgVEc9.js.map +1 -0
  49. package/dist/tsconfig.tsbuildinfo +1 -1
  50. package/dist/{unsafe-html-Ca00SXpn.js → unsafe-html-B-dV3Jps.js} +3 -2
  51. package/dist/unsafe-html-B-dV3Jps.js.map +1 -0
  52. package/package.json +5 -3
  53. package/readme.md +2 -2
  54. package/scss/styles.scss +57 -1
  55. package/scss/tokens.css +1 -0
  56. package/scss/tokens.scss +1 -0
  57. package/src/accordion/accordion-item/accordion-item.scss +1 -1
  58. package/src/button/BaseButton.ts +1 -1
  59. package/src/button/button/button.scss +1 -1
  60. package/src/clock/clock.ts +4 -1
  61. package/src/code-editor/code-editor.scss +52 -0
  62. package/src/code-editor/code-editor.ts +215 -0
  63. package/src/code-editor/demo/index.html +37 -0
  64. package/src/code-editor/index.ts +3 -0
  65. package/src/container/container.scss +1 -1
  66. package/src/date-picker/date-picker.ts +1 -1
  67. package/src/image/image.scss +56 -0
  68. package/src/image/image.ts +135 -0
  69. package/src/image/index.ts +1 -0
  70. package/src/index.ts +2 -0
  71. package/src/input/input.ts +1 -2
  72. package/src/menu/menu-item/menu-item.scss +5 -4
  73. package/src/menu/menu-list/menu-list.scss +1 -0
  74. package/src/number-field/number-field.ts +1 -1
  75. package/src/peacock-loader.ts +7 -0
  76. package/src/textarea/textarea.ts +1 -1
  77. package/src/time-picker/time-picker.ts +1 -1
  78. package/src/utils/dispatch-event-utils.ts +131 -0
  79. package/src/utils/observe-theme-change.ts +30 -0
  80. package/src/utils.ts +5 -131
  81. package/dist/PeacockComponent-DMrFEGDh.js.map +0 -1
  82. package/dist/breadcrumb-item-DkhwoMAH.js.map +0 -1
  83. package/dist/button-BtpAXuLN.js.map +0 -1
  84. package/dist/class-map-CbncA34D.js.map +0 -1
  85. package/dist/style-map-mOmZwsJT.js.map +0 -1
  86. package/dist/unsafe-html-Ca00SXpn.js.map +0 -1
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Dispatches a click event to the given element that triggers a native action,
3
+ * but is not composed and therefore is not seen outside the element.
4
+ *
5
+ * This is useful for responding to an external click event on the host element
6
+ * that should trigger an internal action like a button click.
7
+ *
8
+ * Note, a helper is provided because setting this up correctly is a bit tricky.
9
+ * In particular, calling `click` on an element creates a composed event, which
10
+ * is not desirable, and a manually dispatched event must specifically be a
11
+ * `MouseEvent` to trigger a native action.
12
+ *
13
+ * @example
14
+ * hostClickListener = (event: MouseEvent) {
15
+ * if (isActivationClick(event)) {
16
+ * this.dispatchActivationClick(this.buttonElement);
17
+ * }
18
+ * }
19
+ *
20
+ */
21
+ export declare function dispatchActivationClick(element: HTMLElement): MouseEvent;
22
+ /**
23
+ * Returns true if the click event should trigger an activation behavior. The
24
+ * behavior is defined by the element and is whatever it should do when
25
+ * clicked.
26
+ *
27
+ * Typically when an element needs to handle a click, the click is generated
28
+ * from within the element and an event listener within the element implements
29
+ * the needed behavior; however, it's possible to fire a click directly
30
+ * at the element that the element should handle. This method helps
31
+ * distinguish these "external" clicks.
32
+ *
33
+ * An "external" click can be triggered in a number of ways: via a click
34
+ * on an associated label for a form associated element, calling
35
+ * `element.click()`, or calling
36
+ * `element.dispatchEvent(new MouseEvent('click', ...))`.
37
+ *
38
+ * Also works around Firefox issue
39
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=1804576 by squelching
40
+ * events for a microtask after called.
41
+ *
42
+ * @example
43
+ * hostClickListener = (event: MouseEvent) {
44
+ * if (isActivationClick(event)) {
45
+ * this.dispatchActivationClick(this.buttonElement);
46
+ * }
47
+ * }
48
+ *
49
+ */
50
+ export declare function isActivationClick(event: Event): boolean;
51
+ /**
52
+ * Re-dispatches an event from the provided element.
53
+ *
54
+ * This function is useful for forwarding non-composed events, such as `change`
55
+ * events.
56
+ *
57
+ * @example
58
+ * class MyInput extends LitElement {
59
+ * render() {
60
+ * return html`<input @change=${this.redispatchEvent}>`;
61
+ * }
62
+ *
63
+ * protected redispatchEvent(event: Event) {
64
+ * redispatchEvent(this, event);
65
+ * }
66
+ * }
67
+ *
68
+ * @param element The element to dispatch the event from.
69
+ * @param event The event to re-dispatch.
70
+ * @return Whether or not the event was dispatched (if cancelable).
71
+ */
72
+ export declare function redispatchEvent(element: Element, event: Event): boolean;
@@ -0,0 +1,3 @@
1
+ type ThemeChangeCallback = () => void;
2
+ export declare const observeThemeChange: (callback: ThemeChangeCallback) => (() => void);
3
+ export {};
@@ -5,76 +5,5 @@ export declare function throttle(func: Function, delay: number, options?: {
5
5
  leading: boolean;
6
6
  trailing: boolean;
7
7
  }): (...args: any[]) => void;
8
- /**
9
- * Dispatches a click event to the given element that triggers a native action,
10
- * but is not composed and therefore is not seen outside the element.
11
- *
12
- * This is useful for responding to an external click event on the host element
13
- * that should trigger an internal action like a button click.
14
- *
15
- * Note, a helper is provided because setting this up correctly is a bit tricky.
16
- * In particular, calling `click` on an element creates a composed event, which
17
- * is not desirable, and a manually dispatched event must specifically be a
18
- * `MouseEvent` to trigger a native action.
19
- *
20
- * @example
21
- * hostClickListener = (event: MouseEvent) {
22
- * if (isActivationClick(event)) {
23
- * this.dispatchActivationClick(this.buttonElement);
24
- * }
25
- * }
26
- *
27
- */
28
- export declare function dispatchActivationClick(element: HTMLElement): MouseEvent;
29
- /**
30
- * Returns true if the click event should trigger an activation behavior. The
31
- * behavior is defined by the element and is whatever it should do when
32
- * clicked.
33
- *
34
- * Typically when an element needs to handle a click, the click is generated
35
- * from within the element and an event listener within the element implements
36
- * the needed behavior; however, it's possible to fire a click directly
37
- * at the element that the element should handle. This method helps
38
- * distinguish these "external" clicks.
39
- *
40
- * An "external" click can be triggered in a number of ways: via a click
41
- * on an associated label for a form associated element, calling
42
- * `element.click()`, or calling
43
- * `element.dispatchEvent(new MouseEvent('click', ...))`.
44
- *
45
- * Also works around Firefox issue
46
- * https://bugzilla.mozilla.org/show_bug.cgi?id=1804576 by squelching
47
- * events for a microtask after called.
48
- *
49
- * @example
50
- * hostClickListener = (event: MouseEvent) {
51
- * if (isActivationClick(event)) {
52
- * this.dispatchActivationClick(this.buttonElement);
53
- * }
54
- * }
55
- *
56
- */
57
- export declare function isActivationClick(event: Event): boolean;
58
- /**
59
- * Re-dispatches an event from the provided element.
60
- *
61
- * This function is useful for forwarding non-composed events, such as `change`
62
- * events.
63
- *
64
- * @example
65
- * class MyInput extends LitElement {
66
- * render() {
67
- * return html`<input @change=${this.redispatchEvent}>`;
68
- * }
69
- *
70
- * protected redispatchEvent(event: Event) {
71
- * redispatchEvent(this, event);
72
- * }
73
- * }
74
- *
75
- * @param element The element to dispatch the event from.
76
- * @param event The event to re-dispatch.
77
- * @return Whether or not the event was dispatched (if cancelable).
78
- */
79
- export declare function redispatchEvent(element: Element, event: Event): boolean;
80
8
  export declare function isInViewport(element: HTMLElement): boolean;
9
+ export declare function isDarkMode(): boolean;
@@ -1,4 +1,4 @@
1
- import { n } from './PeacockComponent-DMrFEGDh.js';
1
+ import { n } from './PeacockComponent-CxJc63xj.js';
2
2
 
3
3
  /**
4
4
  * @license
@@ -7,4 +7,4 @@ import { n } from './PeacockComponent-DMrFEGDh.js';
7
7
  */function r(r){return n({...r,state:true,attribute:false})}
8
8
 
9
9
  export { r };
10
- //# sourceMappingURL=state-CEVpI7Vv.js.map
10
+ //# sourceMappingURL=state-B09bP3XH.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"state-CEVpI7Vv.js","sources":["../node_modules/@lit/reactive-element/decorators/state.js"],"sourcesContent":["import{property as t}from\"./property.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function r(r){return t({...r,state:!0,attribute:!1})}export{r as state};\n//# sourceMappingURL=state.js.map\n"],"names":["t"],"mappings":";;AACA;AACA;AACA;AACA;AACA,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAOA,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAE,CAAC,SAAS,CAAC,KAAE,CAAC,CAAC;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"state-B09bP3XH.js","sources":["../node_modules/@lit/reactive-element/decorators/state.js"],"sourcesContent":["import{property as t}from\"./property.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */function r(r){return t({...r,state:!0,attribute:!1})}export{r as state};\n//# sourceMappingURL=state.js.map\n"],"names":["t"],"mappings":";;AACA;AACA;AACA;AACA;AACA,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAOA,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAE,CAAC,SAAS,CAAC,KAAE,CAAC,CAAC;;;;","x_google_ignoreList":[0]}
@@ -1,4 +1,5 @@
1
- import { e, d as i$1, t, E } from './PeacockComponent-DMrFEGDh.js';
1
+ import { E } from './PeacockComponent-CxJc63xj.js';
2
+ import { e, i as i$1, t } from './directive-Cuw6h7YA.js';
2
3
 
3
4
  /**
4
5
  * @license
@@ -7,4 +8,4 @@ import { e, d as i$1, t, E } from './PeacockComponent-DMrFEGDh.js';
7
8
  */const n="important",i=" !"+n,o=e(class extends i$1{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"style"!==t$1.name||t$1.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.includes("-")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`},"")}update(e,[r]){const{style:s}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(r)),this.render(r);for(const t of this.ft)null==r[t]&&(this.ft.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(const t in r){const e=r[t];if(null!=e){this.ft.add(t);const r="string"==typeof e&&e.endsWith(i);t.includes("-")||r?s.setProperty(t,r?e.slice(0,-11):e,r?n:""):s[t]=e;}}return E}});
8
9
 
9
10
  export { o };
10
- //# sourceMappingURL=style-map-mOmZwsJT.js.map
11
+ //# sourceMappingURL=style-map-B8xgVEc9.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-map-B8xgVEc9.js","sources":["../node_modules/lit-html/directives/style-map.js"],"sourcesContent":["import{noChange as t}from\"../lit-html.js\";import{directive as e,Directive as r,PartType as s}from\"../directive.js\";\n/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const n=\"important\",i=\" !\"+n,o=e(class extends r{constructor(t){if(super(t),t.type!==s.ATTRIBUTE||\"style\"!==t.name||t.strings?.length>2)throw Error(\"The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.\")}render(t){return Object.keys(t).reduce((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.includes(\"-\")?r:r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,\"-$&\").toLowerCase()}:${s};`},\"\")}update(e,[r]){const{style:s}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(r)),this.render(r);for(const t of this.ft)null==r[t]&&(this.ft.delete(t),t.includes(\"-\")?s.removeProperty(t):s[t]=null);for(const t in r){const e=r[t];if(null!=e){this.ft.add(t);const r=\"string\"==typeof e&&e.endsWith(i);t.includes(\"-\")||r?s.setProperty(t,r?e.slice(0,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