@redvars/peacock 3.8.5 → 3.8.6

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 (44) hide show
  1. package/dist/button.js +4 -0
  2. package/dist/button.js.map +1 -1
  3. package/dist/custom-elements-jsdocs.json +185 -15
  4. package/dist/custom-elements.json +886 -177
  5. package/dist/floating-controller-CZYwnRVu.js +185 -0
  6. package/dist/floating-controller-CZYwnRVu.js.map +1 -0
  7. package/dist/{floating-controller-CnUZnOhK.js → floating-ui.dom-oQieRCpS.js} +2 -183
  8. package/dist/floating-ui.dom-oQieRCpS.js.map +1 -0
  9. package/dist/html-editor.js +3 -21091
  10. package/dist/html-editor.js.map +1 -1
  11. package/dist/index-DcbiqHpf.js +21091 -0
  12. package/dist/index-DcbiqHpf.js.map +1 -0
  13. package/dist/index.js +5 -2
  14. package/dist/index.js.map +1 -1
  15. package/dist/loader.js +7 -2
  16. package/dist/loader.js.map +1 -1
  17. package/dist/markdown-editor.js +4439 -0
  18. package/dist/markdown-editor.js.map +1 -0
  19. package/dist/menu.js +2 -1
  20. package/dist/menu.js.map +1 -1
  21. package/dist/popover.js +2 -1
  22. package/dist/popover.js.map +1 -1
  23. package/dist/{select-D85kpjUt.js → select-CnnPbvpQ.js} +68 -71
  24. package/dist/select-CnnPbvpQ.js.map +1 -0
  25. package/dist/src/index.d.ts +1 -0
  26. package/dist/src/input/input.d.ts +5 -5
  27. package/dist/src/markdown-editor/index.d.ts +2 -0
  28. package/dist/src/markdown-editor/markdown-editor.d.ts +116 -0
  29. package/dist/sub-menu.js +2 -1
  30. package/dist/sub-menu.js.map +1 -1
  31. package/dist/tooltip.js +2 -1
  32. package/dist/tooltip.js.map +1 -1
  33. package/dist/tsconfig.tsbuildinfo +1 -1
  34. package/package.json +5 -1
  35. package/readme.md +2 -2
  36. package/src/button/button/button-sizes.scss +4 -0
  37. package/src/index.ts +1 -0
  38. package/src/input/input.ts +85 -82
  39. package/src/loader.ts +4 -0
  40. package/src/markdown-editor/index.ts +3 -0
  41. package/src/markdown-editor/markdown-editor.scss +378 -0
  42. package/src/markdown-editor/markdown-editor.ts +994 -0
  43. package/dist/floating-controller-CnUZnOhK.js.map +0 -1
  44. package/dist/select-D85kpjUt.js.map +0 -1
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@redvars/peacock",
3
3
  "description": "The foundation for beautiful user interfaces",
4
4
  "license": "Apache-2.0",
5
- "version": "3.8.5",
5
+ "version": "3.8.6",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
@@ -50,13 +50,16 @@
50
50
  "@tiptap/extension-underline": "^2.11.3",
51
51
  "@tiptap/pm": "^2.11.3",
52
52
  "@tiptap/starter-kit": "^2.11.3",
53
+ "@tiptap/suggestion": "^2.11.3",
53
54
  "@types/prettier": "^3.0.0",
54
55
  "d3": "^7.9.0",
55
56
  "install": "^0.13.0",
56
57
  "js-beautify": "^1.15.4",
57
58
  "lit": "^3.1.4",
59
+ "marked": "^14.1.3",
58
60
  "modern-monaco": "^0.4.0",
59
61
  "monaco-editor": "^0.55.1",
62
+ "turndown": "^7.2.0",
60
63
  "npm": "^11.11.0",
61
64
  "prettier": "^3.8.1",
62
65
  "rollup-plugin-postcss": "^4.0.2",
@@ -75,6 +78,7 @@
75
78
  "@types/js-beautify": "^1.14.3",
76
79
  "@types/mocha": "^10.0.7",
77
80
  "@types/prismjs": "^1.26.6",
81
+ "@types/turndown": "^5.0.5",
78
82
  "@typescript-eslint/eslint-plugin": "^7.16.0",
79
83
  "@typescript-eslint/parser": "^7.16.0",
80
84
  "@wc-toolkit/jsdoc-tags": "^1.1.0",
package/readme.md CHANGED
@@ -44,9 +44,9 @@ Visit [https://peacock.redvars.com](https://peacock.redvars.com) to view the doc
44
44
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
45
45
  <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
46
46
 
47
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.8.5/dist/assets/styles.css"></link>
47
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.8.6/dist/assets/styles.css"></link>
48
48
  <script type='module'
49
- src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.8.5/dist/loader.js'></script>
49
+ src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.8.6/dist/loader.js'></script>
50
50
  </head>
51
51
 
52
52
  <wc-button>Button</wc-button>
@@ -5,6 +5,7 @@
5
5
  --button-height: 2rem;
6
6
  --private-button-icon-size: 1rem;
7
7
  --private-button-container-padding: 0.75rem;
8
+ --private-button-icon-label-spacing: 0.5rem;
8
9
 
9
10
  --private-button-font-size: 0.875rem !important;
10
11
  --private-button-font-weight: var(--font-weight-medium) !important;
@@ -30,6 +31,7 @@
30
31
  --button-height: 3.5rem;
31
32
  --private-button-icon-size: 1.5rem;
32
33
  --private-button-container-padding: 1.5rem;
34
+ --private-button-icon-label-spacing: 0.5rem;
33
35
 
34
36
  --private-button-font-size: 1rem !important;
35
37
  --private-button-font-weight: var(--font-weight-medium) !important;
@@ -42,6 +44,7 @@
42
44
  --button-height: 6rem;
43
45
  --private-button-icon-size: 2rem;
44
46
  --private-button-container-padding: 3rem;
47
+ --private-button-icon-label-spacing: 0.75rem;
45
48
 
46
49
  --private-button-font-size: 1.5rem !important;
47
50
  --private-button-font-weight: var(--font-weight-regular) !important;
@@ -54,6 +57,7 @@
54
57
  --button-height: 8.5rem;
55
58
  --private-button-icon-size: 2.5rem;
56
59
  --private-button-container-padding: 4rem;
60
+ --private-button-icon-label-spacing: 1rem;
57
61
 
58
62
  --private-button-font-size: 2rem !important;
59
63
  --private-button-font-weight: var(--font-weight-regular) !important;
package/src/index.ts CHANGED
@@ -47,6 +47,7 @@ export { Item } from './item/index.js';
47
47
  export { CodeHighlighter } from './code-highlighter/index.js';
48
48
  export { CodeEditor } from './code-editor/index.js';
49
49
  export { HtmlEditor } from './html-editor/index.js';
50
+ export { MarkdownEditor } from './markdown-editor/index.js';
50
51
  export { Image } from './image/index.js';
51
52
  export { Svg } from './svg/index.js';
52
53
  export { Tab, TabGroup, TabPanel, Tabs } from './tabs/index.js';
@@ -1,11 +1,11 @@
1
- import { html, nothing } from 'lit';
2
- import { property, query, state } from 'lit/decorators.js';
1
+ import { html, nothing } from "lit";
2
+ import { property, query, state } from "lit/decorators.js";
3
3
 
4
- import { redispatchEvent } from '@/__internal/utils/dispatch-event-utils.js';
5
- import { spread } from '@/__internal/directive/spread.js';
4
+ import { redispatchEvent } from "@/__internal/utils/dispatch-event-utils.js";
5
+ import { spread } from "@/__internal/directive/spread.js";
6
6
 
7
- import BaseInput from './BaseInput.js';
8
- import styles from './input.scss';
7
+ import BaseInput from "./BaseInput.js";
8
+ import styles from "./input.scss";
9
9
 
10
10
  /**
11
11
  * @label Input
@@ -23,46 +23,52 @@ export class Input extends BaseInput {
23
23
  static styles = [styles];
24
24
 
25
25
  @property({ type: String })
26
- value = '';
26
+ value = "";
27
27
 
28
28
  @property({ type: String })
29
- name: string = '';
29
+ name: string = "";
30
30
 
31
- @property({ type: String }) placeholder = '';
31
+ @property({ type: String })
32
+ placeholder = "";
32
33
 
33
- @property({ type: String }) label = '';
34
+ @property({ type: String })
35
+ label = "";
34
36
 
35
- @property({ type: Boolean, reflect: true }) inline = false;
37
+ @property({ type: Boolean, reflect: true })
38
+ inline = false;
36
39
 
37
- @property({ type: String, reflect: true }) size: 'sm' | 'md' | 'lg' = 'md';
40
+ @property({ type: String, reflect: true })
41
+ size: "sm" | "md" | "lg" = "md";
38
42
 
39
- @property({ type: String }) type: 'text' | 'password' | 'email' | 'tel' =
40
- 'text';
43
+ @property({ type: String })
44
+ type: "text" | "password" | "email" | "tel" = "text";
41
45
 
42
- @property({ type: String }) autocomplete: 'on' | 'off' = 'off';
46
+ @property({ type: String })
47
+ autocomplete: "on" | "off" = "off";
43
48
 
44
- @property({ type: Object }) configAria: Record<string, string> = {};
49
+ @property({ type: Object })
50
+ configAria: Record<string, string> = {};
45
51
 
46
52
  @property({ type: String })
47
- variant: 'filled' | 'outlined' | 'default' = 'default';
53
+ variant: "filled" | "outlined" | "default" = "default";
48
54
 
49
55
  /**
50
56
  * Helper text to display below the input.
51
57
  */
52
- @property({ type: String, attribute: 'helper-text' })
53
- helperText: string = '';
58
+ @property({ type: String, attribute: "helper-text" })
59
+ helperText: string = "";
54
60
 
55
61
  @property({ type: Boolean })
56
62
  error: boolean = false;
57
63
 
58
- @property({ type: String, attribute: 'error-text' })
59
- errorText: string = '';
64
+ @property({ type: String, attribute: "error-text" })
65
+ errorText: string = "";
60
66
 
61
67
  @property({ type: Boolean })
62
68
  warning: boolean = false;
63
69
 
64
- @property({ type: String, attribute: 'warning-text' })
65
- warningText: string = '';
70
+ @property({ type: String, attribute: "warning-text" })
71
+ warningText: string = "";
66
72
 
67
73
  @state()
68
74
  private focused = false;
@@ -74,15 +80,16 @@ export class Input extends BaseInput {
74
80
  * Returns true when the text field has been interacted with. Native
75
81
  * validation errors only display in response to user interactions.
76
82
  */
77
- @state() private dirty = false;
83
+ @state()
84
+ private dirty = false;
78
85
 
79
- @query('.input-element')
86
+ @query(".input-element")
80
87
  private inputElement?: HTMLInputElement;
81
88
 
82
89
  override async focus() {
83
90
  await Promise.all([
84
- customElements.whenDefined('wc-input'),
85
- customElements.whenDefined('wc-field'),
91
+ customElements.whenDefined("wc-input"),
92
+ customElements.whenDefined("wc-field"),
86
93
  ]);
87
94
  await this.updateComplete;
88
95
  this.inputElement?.focus();
@@ -94,8 +101,8 @@ export class Input extends BaseInput {
94
101
  }
95
102
 
96
103
  private handleInitialAttributes() {
97
- Array.from(this.attributes).forEach(attr => {
98
- if (attr.name.startsWith('aria-')) {
104
+ Array.from(this.attributes).forEach((attr) => {
105
+ if (attr.name.startsWith("aria-")) {
99
106
  this.configAria[attr.name] = attr.value;
100
107
  this.removeAttribute(attr.name);
101
108
  }
@@ -108,7 +115,7 @@ export class Input extends BaseInput {
108
115
  }
109
116
 
110
117
  private __handleFocusChange = (event: FocusEvent) => {
111
- this.focused = event.type === 'focus';
118
+ this.focused = event.type === "focus";
112
119
  };
113
120
 
114
121
  private __redispatchEvent(event: Event) {
@@ -116,72 +123,68 @@ export class Input extends BaseInput {
116
123
  }
117
124
 
118
125
  render() {
119
- const displayType =
120
- this.type === 'password' && this.passwordVisible ? 'text' : this.type;
126
+ const displayType = this.type === "password" && this.passwordVisible
127
+ ? "text"
128
+ : this.type;
121
129
 
122
130
  return html`
123
131
  <wc-field
124
- ?required=${this.required}
125
- ?disabled=${this.disabled}
126
- ?readonly=${this.readonly}
127
- ?skeleton=${this.skeleton}
128
- helper-text=${this.helperText}
129
- ?error=${this.error}
130
- error-text=${this.errorText}
131
- ?warning=${this.warning}
132
- variant=${this.variant}
133
- ?populated=${!!this.value}
134
- warning-text=${this.warningText}
135
- label=${this.label}
136
- ?focused=${this.focused}
137
- .host=${this}
132
+ ?required="${this.required}"
133
+ ?disabled="${this.disabled}"
134
+ ?readonly="${this.readonly}"
135
+ ?skeleton="${this.skeleton}"
136
+ helper-text="${this.helperText}"
137
+ ?error="${this.error}"
138
+ error-text="${this.errorText}"
139
+ ?warning="${this.warning}"
140
+ variant="${this.variant}"
141
+ ?populated="${!!this.value}"
142
+ warning-text="${this.warningText}"
143
+ label="${this.label}"
144
+ ?focused="${this.focused}"
145
+ .host="${this}"
138
146
  class="input-wrapper"
139
147
  >
140
148
  <slot name="start" slot="field-start"></slot>
141
149
 
142
150
  <input
143
151
  class="input input-element"
144
- name=${this.name}
145
- type=${displayType}
146
- placeholder=${this.placeholder}
147
- autocomplete=${this.autocomplete}
148
- .value=${this.value}
149
- ?readonly=${this.readonly}
150
- ?required=${this.required}
151
- ?disabled=${this.disabled}
152
- @input=${this.__handleInput}
153
- @change=${this.__redispatchEvent}
154
- @focus=${this.__handleFocusChange}
155
- @blur=${this.__handleFocusChange}
152
+ name="${this.name}"
153
+ type="${displayType}"
154
+ placeholder="${this.placeholder}"
155
+ autocomplete="${this.autocomplete}"
156
+ .value="${this.value}"
157
+ ?readonly="${this.readonly}"
158
+ ?required="${this.required}"
159
+ ?disabled="${this.disabled}"
160
+ @input="${this.__handleInput}"
161
+ @change="${this.__redispatchEvent}"
162
+ @focus="${this.__handleFocusChange}"
163
+ @blur="${this.__handleFocusChange}"
156
164
  ${spread(this.configAria)}
157
165
  />
158
166
 
159
- ${this.type === 'password'
167
+ <slot name="end" slot="field-end"></slot>
168
+
169
+ ${this.type === "password"
160
170
  ? html`
161
- <wc-tooltip
162
- slot="field-end"
163
- content=${this.passwordVisible
164
- ? 'Hide password'
165
- : 'Show password'}
166
- >
167
- <wc-icon-button
168
- class="password-toggle"
169
- variant="text"
170
- @click=${() => {
171
- this.passwordVisible = !this.passwordVisible;
172
- }}
173
- >
174
- <wc-icon
175
- name=${this.passwordVisible
176
- ? 'visibility_off'
177
- : 'visibility'}
178
- ></wc-icon>
179
- </wc-icon-button>
180
- </wc-tooltip>
181
- `
171
+ <wc-icon-button
172
+ class="password-toggle"
173
+ variant="text"
174
+ slot="field-end"
175
+ tooltip="${this.passwordVisible
176
+ ? "Hide password"
177
+ : "Show password"}"
178
+ @click="${() => {
179
+ this.passwordVisible = !this.passwordVisible;
180
+ }}"
181
+ >
182
+ <wc-icon
183
+ name="${this.passwordVisible ? "visibility_off" : "visibility"}"
184
+ ></wc-icon>
185
+ </wc-icon-button>
186
+ `
182
187
  : nothing}
183
-
184
- <slot name="end" slot="field-end"></slot>
185
188
  </wc-field>
186
189
  `;
187
190
  }
package/src/loader.ts CHANGED
@@ -262,6 +262,10 @@ const loaderConfig: LoaderConfig = {
262
262
  importPath: `${distDirectory}/html-editor.js`,
263
263
  dependencies: ['wc-code-editor'],
264
264
  },
265
+ 'wc-markdown-editor': {
266
+ importPath: `${distDirectory}/markdown-editor.js`,
267
+ dependencies: ['wc-code-editor'],
268
+ },
265
269
  'wc-code-highlighter': {
266
270
  importPath: `${distDirectory}/code-highlighter.js`,
267
271
  },
@@ -0,0 +1,3 @@
1
+ import { MarkdownEditor } from './markdown-editor.js';
2
+
3
+ export { MarkdownEditor };