@ember-eui/core 1.2.6 → 1.3.3

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 (75) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/addon/components/common.ts +13 -0
  3. package/addon/components/eui-button/index.hbs +2 -0
  4. package/addon/components/eui-button-content/index.hbs +1 -0
  5. package/addon/components/eui-button-empty/index.hbs +2 -0
  6. package/addon/components/eui-button-icon/index.hbs +2 -0
  7. package/addon/components/eui-code/index.hbs +9 -0
  8. package/addon/components/eui-code-block/index.d.ts +2 -0
  9. package/addon/components/eui-code-block/index.hbs +10 -0
  10. package/addon/components/eui-code-block-impl/code-block-controls/index.hbs +33 -0
  11. package/addon/components/eui-code-block-impl/index.hbs +111 -0
  12. package/addon/components/eui-code-block-impl/index.ts +121 -0
  13. package/addon/components/eui-copy/index.hbs +8 -0
  14. package/addon/components/eui-copy/index.ts +37 -0
  15. package/addon/components/eui-icon/index.hbs +37 -32
  16. package/addon/components/eui-inner-text/index.hbs +1 -0
  17. package/addon/components/eui-inner-text/index.ts +61 -0
  18. package/addon/components/eui-markdown-editor/index.hbs +63 -0
  19. package/addon/components/eui-markdown-editor/index.ts +221 -0
  20. package/addon/components/eui-markdown-editor-drop-zone/index.hbs +21 -0
  21. package/addon/components/eui-markdown-editor-drop-zone/index.ts +5 -0
  22. package/addon/components/eui-markdown-editor-footer/index.hbs +108 -0
  23. package/addon/components/eui-markdown-editor-footer/index.ts +20 -0
  24. package/addon/components/eui-markdown-editor-text-area/index.hbs +8 -0
  25. package/addon/components/eui-markdown-editor-toolbar/index.hbs +86 -0
  26. package/addon/components/eui-markdown-editor-toolbar/index.ts +97 -0
  27. package/addon/components/eui-markdown-format/index.hbs +13 -0
  28. package/addon/components/eui-markdown-format/index.ts +45 -0
  29. package/addon/components/eui-markdown-format/markdown-checkbox/index.hbs +8 -0
  30. package/addon/components/eui-markdown-format/markdown-checkbox/index.ts +28 -0
  31. package/addon/components/eui-markdown-format/markdown-code/index.hbs +3 -0
  32. package/addon/components/eui-markdown-format/markdown-code-block/index.hbs +7 -0
  33. package/addon/components/eui-markdown-format/markdown-tooltip/index.hbs +8 -0
  34. package/addon/components/markdown-checkmark-icon/index.hbs +0 -0
  35. package/addon/modifiers/get-cursor-node.ts +54 -0
  36. package/addon/modifiers/resize-observer.ts +6 -2
  37. package/addon/utils/copy-to-clipboard.ts +70 -0
  38. package/addon/utils/css-mappings/eui-code-block-impl.ts +24 -0
  39. package/addon/utils/css-mappings/index.ts +2 -0
  40. package/addon/utils/markdown/markdown-actions.ts +616 -0
  41. package/addon/utils/markdown/markdown-modes.ts +23 -0
  42. package/addon/utils/markdown/markdown-types.ts +140 -0
  43. package/addon/utils/markdown/markdown-unified-plugins.d.ts +27 -0
  44. package/addon/utils/markdown/plugins/markdown-add-components.ts +63 -0
  45. package/addon/utils/markdown/plugins/markdown-checkbox.ts +80 -0
  46. package/addon/utils/markdown/plugins/markdown-default-plugins.ts +100 -0
  47. package/addon/utils/markdown/plugins/markdown-tooltip.ts +113 -0
  48. package/addon/utils/markdown/plugins/to-dom.ts +93 -0
  49. package/app/components/eui-code/index.js +1 -0
  50. package/app/components/eui-code-block/index.js +1 -0
  51. package/app/components/eui-code-block-impl/code-block-controls/index.js +1 -0
  52. package/app/components/eui-code-block-impl/index.js +1 -0
  53. package/app/components/eui-copy/index.js +1 -0
  54. package/app/components/eui-inner-text/index.js +1 -0
  55. package/app/components/eui-markdown-editor/index.js +1 -0
  56. package/app/components/eui-markdown-editor-drop-zone/index.js +1 -0
  57. package/app/components/eui-markdown-editor-footer/index.js +1 -0
  58. package/app/components/eui-markdown-editor-text-area/index.js +1 -0
  59. package/app/components/eui-markdown-editor-toolbar/index.js +1 -0
  60. package/app/components/eui-markdown-format/index.js +1 -0
  61. package/app/components/eui-markdown-format/markdown-checkbox/index.js +1 -0
  62. package/app/components/eui-markdown-format/markdown-code/index.js +1 -0
  63. package/app/components/eui-markdown-format/markdown-code-block/index.js +1 -0
  64. package/app/components/eui-markdown-format/markdown-tooltip/index.js +1 -0
  65. package/app/modifiers/get-cursor-node.js +1 -0
  66. package/app/styles/ember-eui.scss +13 -0
  67. package/docs/editors/code/code-block-demo/demo1.md +62 -0
  68. package/docs/editors/code/code-block.md +1 -0
  69. package/docs/editors/code/inline-demo/demo1.md +49 -0
  70. package/docs/editors/code/inline.md +1 -0
  71. package/docs/editors/markdown-editor/base-editor-demo/demo1.md +86 -0
  72. package/docs/editors/markdown-editor/base-editor.md +1 -0
  73. package/package.json +31 -5
  74. package/public/markdown-checkmark.svg +3 -0
  75. package/public/markdown-logo.svg +3 -0
@@ -14,4 +14,17 @@
14
14
  overflow-x: hidden;
15
15
  font-weight: 500;
16
16
  }
17
+
18
+ .euiMarkdownEditor--fullHeight {
19
+ display: -webkit-flex;
20
+ display: flex;
21
+ -webkit-flex-direction: column;
22
+ flex-direction: column;
23
+ height: 100%;
24
+ }
25
+
26
+ .euiMarkdownEditor--isPreviewing .euiMarkdownEditor__toggleContainer {
27
+ display: none;
28
+ }
29
+
17
30
  @import 'ember-eui-components';
@@ -0,0 +1,62 @@
1
+ ---
2
+ order: 1
3
+ ---
4
+
5
+ # Demo
6
+
7
+ ```hbs template
8
+ <div>
9
+ <EuiCodeBlock
10
+ @language={{this.language}}
11
+ @isCopyable={{true}}
12
+ @overflowHeight='500px'
13
+ >
14
+ {{this.htmlCode}}
15
+ </EuiCodeBlock>
16
+ </div>
17
+ <EuiTextArea
18
+ @value={{this.htmlCode}}
19
+ {{on 'input' (pick 'target.value' (set this 'htmlCode'))}}
20
+ />
21
+
22
+ <EuiSelect
23
+ @value={{this.language}}
24
+ @hasNoInitialSelection={{true}}
25
+ @options={{array
26
+ (hash value='javascript' text='javascript')
27
+ (hash value='html' text='html')
28
+ (hash value='golang' text='golang')
29
+ }}
30
+ @id={{selectId}}
31
+ {{on 'change' (pick 'target.value' (set this 'language'))}}
32
+ >
33
+ <:prepend as |classes|>
34
+ <EuiFormLabel class={{classes}} for={{selectId}}>
35
+ Choose a language
36
+ </EuiFormLabel>
37
+ </:prepend>
38
+ </EuiSelect>
39
+ ```
40
+
41
+ ```javascript component
42
+ import Component from '@glimmer/component';
43
+ import { tracked } from '@glimmer/tracking';
44
+ import { action } from '@ember/object';
45
+
46
+ export default class EuiMarkdownEditor1 extends Component {
47
+ @tracked language = 'html';
48
+ @tracked value = `### hehe
49
+ - [ ] hola
50
+ - [ ] hola
51
+ - [x] hola
52
+ \`\`\`javascript
53
+ class Human {}
54
+ \`\`\`
55
+ `;
56
+ @tracked htmlCode = `<!--I'm an example of HTML-->
57
+ <div>
58
+ asdf
59
+ </div>
60
+ `;
61
+ }
62
+ ```
@@ -0,0 +1 @@
1
+ # CodeBlock
@@ -0,0 +1,49 @@
1
+ ---
2
+ order: 1
3
+ ---
4
+
5
+ # Demo
6
+
7
+ ```hbs template
8
+ <EuiText>
9
+ <p>
10
+ Sometimes you need to emphasize
11
+ <EuiCode>Code</EuiCode>
12
+ like this.
13
+ </p>
14
+ <p>
15
+ You can also pass a language in like
16
+ <EuiCode language='html'>{{this.htmlCode}}</EuiCode>.
17
+ </p>
18
+ <p>
19
+ Make the background transparent like this
20
+ <EuiCode @language='html' @transparentBackground={{true}}>
21
+ {{this.htmlCode}}
22
+ </EuiCode>
23
+ .
24
+ </p>
25
+ </EuiText>
26
+ <EuiTextArea @value={{this.htmlCode}} {{on "input" (pick "target.value" (set this "htmlCode"))}}/>
27
+ ```
28
+
29
+ ```javascript component
30
+ import Component from '@glimmer/component';
31
+ import { tracked } from '@glimmer/tracking';
32
+ import { action } from '@ember/object';
33
+
34
+ export default class EuiMarkdownEditor1 extends Component {
35
+ @tracked value = `### hehe
36
+ - [ ] hola
37
+ - [ ] hola
38
+ - [x] hola
39
+ \`\`\`javascript
40
+ class Human {}
41
+ \`\`\`
42
+ `;
43
+ @tracked htmlCode = `<!--I'm an example of HTML-->
44
+ <div>
45
+ asdf
46
+ </div>
47
+ `;
48
+ }
49
+ ```
@@ -0,0 +1 @@
1
+ # Inline
@@ -0,0 +1,86 @@
1
+ ---
2
+ order: 1
3
+ ---
4
+
5
+ # Demo
6
+
7
+ ```hbs template
8
+ <EuiMarkdownEditor
9
+ @value={{this.value}}
10
+ @onChange={{set this 'value'}}
11
+ />
12
+ ```
13
+
14
+ ```javascript component
15
+ import Component from '@glimmer/component';
16
+ import { tracked } from '@glimmer/tracking';
17
+ import { action } from '@ember/object';
18
+
19
+ export default class EuiMarkdownEditor1 extends Component {
20
+ @tracked value = `## 👋 Hello there!
21
+
22
+ I'm a **EuiMarkdownEditor** with:
23
+
24
+ - a \`height\` set to \`200\`
25
+ - my parent container is a flex item
26
+
27
+
28
+ ### Things you should know
29
+
30
+ When my content is very long 😅
31
+
32
+ The preview height is automatically adjusted 😉
33
+
34
+ To avoid a scrollbar 😌
35
+
36
+ ### That's why I look good 😍
37
+
38
+ - [ ] First Checkbox
39
+ - [ ] Second Checkbox
40
+ - [x] Third Checkbox
41
+
42
+ \`\`\`ts
43
+ class Human {
44
+ get fullName() {
45
+ return \`${this.name} ${this.lastName}\`;
46
+ }
47
+ }
48
+ \`\`\`
49
+
50
+ \`\`\`golang
51
+ package main
52
+
53
+ import \"fmt\"
54
+
55
+ func main() {
56
+
57
+ // \`var\` declares 1 or more variables.
58
+ var a = "initial"
59
+ fmt.Println(a)
60
+
61
+ // You can declare multiple variables at once.
62
+ var b, c int = 1, 2
63
+ fmt.Println(b, c)
64
+
65
+ // Go will infer the type of initialized variables.
66
+ var d = true
67
+ fmt.Println(d)
68
+
69
+ // Variables declared without a corresponding
70
+ // initialization are _zero-valued_. For example, the
71
+ // zero value for an \`int\` is \`0\`.
72
+ var e int
73
+ fmt.Println(e)
74
+
75
+ // The \`:=\` syntax is shorthand for declaring and
76
+ // initializing a variable, e.g. for
77
+ // \`var f string = "apple"\` in this case.
78
+ f := "apple"
79
+ fmt.Println(f)
80
+ }
81
+
82
+ \`\`\`
83
+
84
+ `;
85
+ }
86
+ ```
@@ -0,0 +1 @@
1
+ # Base Editor
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-eui/core",
3
- "version": "1.2.6",
3
+ "version": "1.3.3",
4
4
  "description": "Ember Components for Elastic UI",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -77,9 +77,22 @@
77
77
  "ember-style-modifier": "^0.6.0",
78
78
  "ember-svg-jar": "https://github.com/betocantu93/ember-svg-jar.git#add-bundle-flag",
79
79
  "ember-truth-helpers": "^2.1.0",
80
+ "resolve": "^1.13.1"
81
+ },
82
+ "peerDependencies": {
83
+ "highlight.js": "^9.18.5",
80
84
  "lodash-es": "^4.17.21",
81
- "resolve": "^1.13.1",
82
- "tabbable": "^5.1.5"
85
+ "mdast-util-to-hast": "^10.0.0",
86
+ "rehype-raw": "^5.0.0",
87
+ "rehype-stringify": "^8.0.0",
88
+ "remark-breaks": "^3.0.2",
89
+ "remark-emoji": "^2.1.0",
90
+ "remark-highlight.js": "^6.0.0",
91
+ "remark-parse": "^8.0.3",
92
+ "remark-rehype": "^8.0.0",
93
+ "tabbable": "^5.1.5",
94
+ "unified": "^9.2.0",
95
+ "vfile": "^4.2.0"
83
96
  },
84
97
  "devDependencies": {
85
98
  "@ember/optional-features": "^1.3.0",
@@ -120,11 +133,24 @@
120
133
  "eslint-plugin-ember": "^8.9.1",
121
134
  "eslint-plugin-node": "^11.1.0",
122
135
  "eslint-plugin-prettier": "^3.3.1",
136
+ "highlight.js": "^9.18.5",
123
137
  "loader.js": "^4.7.0",
138
+ "lodash-es": "^4.17.21",
139
+ "mdast-util-to-hast": "^10.0.0",
124
140
  "npm-run-all": "^4.1.5",
125
141
  "prettier": "^2.2.1",
126
142
  "qunit-dom": "^1.2.0",
127
- "typescript": "^4.0.3"
143
+ "rehype-raw": "^5.0.0",
144
+ "rehype-stringify": "^8.0.0",
145
+ "remark-breaks": "^3.0.2",
146
+ "remark-emoji": "^2.1.0",
147
+ "remark-highlight.js": "^6.0.0",
148
+ "remark-parse": "^8.0.3",
149
+ "remark-rehype": "^8.0.0",
150
+ "tabbable": "^5.1.5",
151
+ "typescript": "^4.0.3",
152
+ "unified": "^9.2.0",
153
+ "vfile": "^4.2.0"
128
154
  },
129
155
  "publishConfig": {
130
156
  "access": "public"
@@ -141,5 +167,5 @@
141
167
  "volta": {
142
168
  "node": "12.22.1"
143
169
  },
144
- "gitHead": "86127330c27486495fc56259e63163d5e34642a4"
170
+ "gitHead": "dd9fe0c7f4587eb88bdf6191ff445e78c7d221ec"
145
171
  }
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16">
2
+ <path d="M11.828 13H4.172A1.173 1.173 0 013 11.828V4.172C3 3.526 3.526 3 4.172 3h7.656C12.474 3 13 3.526 13 4.172v7.656c0 .646-.526 1.172-1.172 1.172zM4.172 3.781a.391.391 0 00-.39.39v7.657c0 .216.175.39.39.39h7.656a.39.39 0 00.39-.39V4.172a.391.391 0 00-.39-.39H4.172zm7.244 2.175l-.582-.521L7.22 9.469 5.125 7.476l-.539.566 2.68 2.548 4.15-4.634z" />
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="26" height="16" fill="none" viewBox="0 0 26 16">
2
+ <path d="M1.25 1.875c0-.345.28-.625.625-.625h22.25c.345 0 .625.28.625.625v12.25c0 .345-.28.625-.625.625H1.875a.625.625 0 01-.625-.625V1.875zM1.875 0C.839 0 0 .84 0 1.875v12.25C0 15.161.84 16 1.875 16h22.25C25.16 16 26 15.16 26 14.125V1.875C26 .839 25.16 0 24.125 0H1.875zM3.75 3.75v8.5h2.5V7.375l2.5 3.125 2.5-3.125v4.875h2.5v-8.5h-2.5l-2.5 3.125-2.5-3.125h-2.5zm11.875 4.375l3.75 4.125 3.75-4.125h-2.5V3.75h-2.5v4.375h-2.5z" />
3
+ </svg>