@pictogrammers/components 0.5.15 → 0.5.18

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 (149) hide show
  1. package/package.json +1 -1
  2. package/pg/autocompleteItem/__examples__/basic/basic.html +3 -0
  3. package/pg/autocompleteItem/autocompleteItem.css +55 -0
  4. package/pg/autocompleteItem/autocompleteItem.html +1 -0
  5. package/pg/autocompleteItem/autocompleteItem.ts +65 -0
  6. package/pg/button/button.css +5 -0
  7. package/pg/buttonMenu/buttonMenu.ts +1 -1
  8. package/pg/inputCombobox/__examples__/basic/basic.ts +33 -0
  9. package/pg/inputCombobox/inputCombobox.ts +158 -0
  10. package/pg/inputCombobox/inputCombobox.ts.tmp.44252.751480cb81cc +158 -0
  11. package/pg/inputCombobox/inputCombobox.ts.tmp.44252.dcea847c40a8 +156 -0
  12. package/pg/inputPill/inputPill.html +6 -0
  13. package/pg/inputPill/inputPill.html.tmp.26852.84ac63f4c46f +6 -0
  14. package/pg/inputPill/inputPill.ts +41 -0
  15. package/pg/inputPills/__examples__/basic/basic.html +9 -0
  16. package/pg/inputPills/__examples__/basic/basic.html.tmp.26852.4771e4cad5b7 +9 -0
  17. package/pg/inputPills/__examples__/basic/basic.ts.tmp.26852.d8fe41df18bd +0 -0
  18. package/pg/inputPixelEditor/README.md +104 -69
  19. package/pg/inputPixelEditor/README.md.tmp.42596.658de5f0a6f5 +0 -0
  20. package/pg/inputPixelEditor/__examples__/basic/basic.ts +6 -5
  21. package/pg/inputPixelEditor/inputPixelEditor.ts +96 -24
  22. package/pg/inputPixelEditor/inputPixelEditor.ts.tmp.38516.96529dd82670 +1703 -0
  23. package/pg/inputPixelEditor/inputPixelEditor.ts.tmp.42596.48ecc3ad9c72 +1724 -0
  24. package/pg/inputPixelEditor/utils/bitmapToMask.ts +113 -79
  25. package/pg/inputPixelEditor/utils/getLassoPixels.ts +51 -0
  26. package/pg/inputSelect/inputSelect.ts +5 -1
  27. package/pg/inputText/README.md +6 -6
  28. package/pg/inputText/__examples__/basic/basic.ts +1 -1
  29. package/pg/inputText/inputText.css +2 -2
  30. package/pg/inputText copy/README.md +38 -0
  31. package/pg/inputText copy/inputText.css +41 -0
  32. package/pg/inputText copy/inputText.html +1 -0
  33. package/pg/inputText copy/inputText.spec.ts +59 -0
  34. package/pg/inputText copy/inputText.ts +67 -0
  35. package/pg/inputTextarea/README.md +39 -0
  36. package/pg/inputTextarea/__examples__/basic/basic.html +9 -0
  37. package/pg/inputTextarea/__examples__/basic/basic.ts +30 -0
  38. package/pg/inputTextarea/inputTextarea.ts +121 -0
  39. package/pg/inputTextarea copy/README.md +39 -0
  40. package/pg/inputTextarea copy/inputTextarea.css +41 -0
  41. package/pg/inputTextarea copy/inputTextarea.html +1 -0
  42. package/pg/inputTextarea copy/inputTextarea.spec.ts +59 -0
  43. package/pg/inputTextarea copy/inputTextarea.ts +79 -0
  44. package/pg/inputTextareaAutocomplete/README.md +70 -0
  45. package/pg/inputTextareaAutocomplete/__examples__/basic/basic.ts +67 -0
  46. package/pg/inputTextareaAutocomplete/inputTextareaAutocomplete.ts +267 -0
  47. package/pg/node/README.md +35 -0
  48. package/pg/node/__examples__/basic/basic.ts +34 -0
  49. package/pg/node/index.ts +3 -0
  50. package/pg/node/node.css +53 -0
  51. package/pg/node/node.html +5 -0
  52. package/pg/node/node.ts +270 -0
  53. package/pg/nodeEditorLink/nodeEditorLink.css +69 -0
  54. package/pg/nodeEditorLink/nodeEditorLink.css.tmp.1408.09e961fd0dcc +69 -0
  55. package/pg/nodeEditorLink/nodeEditorLink.html +9 -0
  56. package/pg/nodeEditorNumber/nodeEditorNumber.css +59 -0
  57. package/pg/nodeEditorNumber/nodeEditorNumber.ts +57 -0
  58. package/pg/nodeEditorRange/nodeEditorRange.css +23 -0
  59. package/pg/nodeEditorRange/nodeEditorRange.ts +69 -0
  60. package/pg/nodeEditorText/__examples__/basic/basic.html +9 -0
  61. package/pg/nodeEditorText/__examples__/basic/basic.ts +30 -0
  62. package/pg/nodeEditorText/nodeEditorText.css +17 -0
  63. package/pg/nodeEditorText/nodeEditorText.html +4 -0
  64. package/pg/nodeEditorText/nodeEditorText.ts +57 -0
  65. package/pg/nodeEditorText copy/README.md +35 -0
  66. package/pg/nodeEditorText copy/nodeEditorText.css +49 -0
  67. package/pg/nodeEditorText copy/nodeEditorText.html +4 -0
  68. package/pg/nodeEditorText copy/nodeEditorText.ts +50 -0
  69. package/pg/nodeEditorTextArray/nodeEditorTextArray.css +68 -0
  70. package/pg/nodeEditorTextArray/nodeEditorTextArray.html +9 -0
  71. package/pg/nodeEditorTextArray/nodeEditorTextArray.ts +162 -0
  72. package/pg/nodeEntry/nodeEntry.css +61 -0
  73. package/pg/nodeEntry/nodeEntry.ts +164 -0
  74. package/pg/nodeEntry/nodeEntry.ts.tmp.28724.dda67762bca5 +164 -0
  75. package/pg/nodeInputText/nodeInputText.css +75 -0
  76. package/pg/nodeInputText/nodeInputText.html +4 -0
  77. package/pg/nodeInputText/nodeInputText.ts +105 -0
  78. package/pg/nodeOutput/nodeOutput.css +32 -0
  79. package/pg/nodeResize/README.md +3 -0
  80. package/pg/nodeResize/THINKING.md +81 -0
  81. package/pg/nodeResize/THINKING.md.tmp.24812.99a70ba81062 +81 -0
  82. package/pg/nodeResize/basic/basic.ts +17 -0
  83. package/pg/nodeResize/dragUtil.ts +105 -0
  84. package/pg/nodeResize/dragUtil.ts.tmp.34372.787464c73309 +75 -0
  85. package/pg/nodeResize/nodeResize.css +187 -0
  86. package/pg/nodeResize/nodeResize.html +9 -0
  87. package/pg/nodeResize/nodeResize.ts +156 -0
  88. package/pg/nodes/README.md +177 -0
  89. package/pg/nodes/__examples__/basic/basic.html +33 -0
  90. package/pg/nodes/__examples__/basic/basic.ts +716 -0
  91. package/pg/nodes/__examples__/basic/exampleNodes.ts +129 -0
  92. package/pg/nodes/__examples__/basic/exampleScripts.ts +129 -0
  93. package/pg/nodes/__examples__/basic/keystore.ts +38 -0
  94. package/pg/nodes/executeInSandbox.ts +32 -0
  95. package/pg/nodes/index.ts +3 -0
  96. package/pg/nodes/nodes.css +69 -0
  97. package/pg/nodes/nodes.html +6 -0
  98. package/pg/nodes/nodes.ts +1240 -0
  99. package/pg/nodes copy/nodes.css +41 -0
  100. package/pg/nodes copy/nodes.html +1 -0
  101. package/pg/overlayContextMenu/__examples__/filter/filter.ts +87 -0
  102. package/pg/overlayContextMenu/overlayContextMenu.css +14 -0
  103. package/pg/overlayContextMenu/overlayContextMenu.html +4 -3
  104. package/pg/overlayContextMenu/overlayContextMenu.ts +6 -2
  105. package/pg/overlayContextMenu/overlayContextMenu.ts.tmp.37088.530ff1c0a321 +0 -0
  106. package/pg/overlayMenu/overlayMenu.css +3 -1
  107. package/pg/overlayMenu/overlayMenu.ts +11 -2
  108. package/pg/overlayMenu/overlayMenu.ts.tmp.44252.9bb22fd59ede +80 -0
  109. package/pg/overlaySelectMenu/overlaySelectMenu.css +2 -0
  110. package/pg/overlaySubMenu/overlaySubMenu.css +8 -6
  111. package/pg/poco/README.md +22 -0
  112. package/pg/poco/__examples__/basic/basic.html +11 -0
  113. package/pg/poco/__examples__/basic/basic.ts +95 -0
  114. package/pg/poco/__examples__/basic/examples.ts +258 -0
  115. package/pg/poco/__examples__/basic/myFont.ts +1300 -0
  116. package/pg/poco/index.ts +3 -0
  117. package/pg/poco/mockPoco.ts +640 -0
  118. package/pg/poco/poco.css +7 -0
  119. package/pg/poco/poco.html +1 -0
  120. package/pg/poco/poco.ts +75 -0
  121. package/pg/popover/README.md +47 -0
  122. package/pg/popover/__examples__/basic/basic.html +3 -0
  123. package/pg/popover/popover.html +3 -0
  124. package/pg/popover/popover.ts +44 -0
  125. package/pg/popoverAutocomplete/__examples__/basic/basic.html +4 -0
  126. package/pg/popoverAutocomplete/__examples__/basic/basic.ts +46 -0
  127. package/pg/popoverAutocomplete/popoverAutocomplete.css +25 -0
  128. package/pg/popoverAutocomplete/popoverAutocomplete.html +1 -0
  129. package/pg/popoverAutocomplete/popoverAutocomplete.ts +134 -0
  130. package/pg/popoverAutocompleteItem/popoverAutocompleteItem.css +69 -0
  131. package/pg/popoverAutocompleteItem/popoverAutocompleteItem.ts +90 -0
  132. package/pg/table/__examples__/basic/basic.ts +1 -0
  133. package/pg/tableCellFileLocal/tableCellFileLocal.html +3 -0
  134. package/pg/tableCellFileLocal/tableCellFileLocal.html.tmp.20484.68ee2e30710e +3 -0
  135. package/pg/tableCellFileLocal/tableCellFileLocal.ts +44 -0
  136. package/pg/tableCellSelect/tableCellSelect.html +3 -0
  137. package/pg/tableCellSelect/tableCellSelect.html.tmp.41808.99c1a6f14340 +3 -0
  138. package/pg/tableCellSelect/tableCellSelect.ts +51 -0
  139. package/pg/tree/__examples__/basic/basic.ts +12 -5
  140. package/pg/tree/tree.html +1 -1
  141. package/pg/tree/tree.ts +385 -227
  142. package/pg/tree/tree.ts.tmp.38376.07d376a04f41 +343 -0
  143. package/pg/tree/tree.ts.tmp.38376.2a04599ade9f +361 -0
  144. package/pg/tree/tree.ts.tmp.38376.6cb2c663d476 +0 -0
  145. package/pg/tree/tree.ts.tmp.38376.ac5af1aff2b0 +393 -0
  146. package/pg/tree/tree.ts.tmp.38376.ac9acfc4f95f +324 -0
  147. package/pg/treeItem/treeItem.ts +536 -558
  148. package/pg/treeItem/treeItem.ts.tmp.38376.145d3121d648 +530 -0
  149. package/pg/treeItem/treeItem.ts.tmp.38376.b5224d48e5c0 +0 -0
@@ -0,0 +1,69 @@
1
+ :host {
2
+ display: block;
3
+ font-family: var(--pg-font-family, system-ui);
4
+ }
5
+
6
+ .wrapper {
7
+ display: flex;
8
+ flex-direction: column;
9
+ padding-inline: 0.25rem;
10
+ }
11
+
12
+ [part=label] {
13
+ font-size: 0.625rem;
14
+ line-height: 1rem;
15
+ padding-inline: 0.25rem;
16
+ color: rgba(255, 255, 255, 0.8);
17
+ }
18
+
19
+ .row {
20
+ display: flex;
21
+ flex-direction: row;
22
+ align-items: center;
23
+ gap: 0.25rem;
24
+ }
25
+
26
+ [part=link] {
27
+ flex: 1;
28
+ border: 0;
29
+ background: none;
30
+ text-align: start;
31
+ padding-block: 0;
32
+ padding-inline: 0.25rem;
33
+ font-family: var(--pg-font-family, system-ui);
34
+ font-size: 0.75rem;
35
+ line-height: 1rem;
36
+ color: rgb(79, 143, 249);
37
+ text-decoration: underline;
38
+ cursor: pointer;
39
+ border-radius: 0.125rem;
40
+ outline: none;
41
+ }
42
+
43
+ [part=link]:hover {
44
+ color: rgb(127, 173, 255);
45
+ }
46
+
47
+ [part=link]:focus-visible {
48
+ outline: 1px solid rgb(79, 143, 249, 0.75);
49
+ }
50
+
51
+ [part=select] {
52
+ border: 0;
53
+ background: none;
54
+ color: rgba(255, 255, 255, 0.5);
55
+ cursor: pointer;
56
+ line-height: 0;
57
+ padding-block: 0.0625rem;
58
+ padding-inline: 0.0625rem;
59
+ border-radius: 0.125rem;
60
+ outline: none;
61
+ }
62
+
63
+ [part=select]:hover {
64
+ color: rgba(255, 255, 255, 0.8);
65
+ }
66
+
67
+ [part=select]:focus-visible {
68
+ outline: 1px solid rgb(79, 143, 249, 0.75);
69
+ }
@@ -0,0 +1,69 @@
1
+ :host {
2
+ display: block;
3
+ font-family: var(--pg-font-family, system-ui);
4
+ }
5
+
6
+ .wrapper {
7
+ display: flex;
8
+ flex-direction: column;
9
+ padding-inline: 0.25rem;
10
+ }
11
+
12
+ [part=label] {
13
+ font-size: 0.625rem;
14
+ line-height: 1rem;
15
+ padding-inline: 0.25rem;
16
+ color: rgba(255, 255, 255, 0.8);
17
+ }
18
+
19
+ .row {
20
+ display: flex;
21
+ flex-direction: row;
22
+ align-items: center;
23
+ gap: 0.25rem;
24
+ }
25
+
26
+ [part=link] {
27
+ flex: 1;
28
+ border: 0;
29
+ background: none;
30
+ text-align: start;
31
+ padding-block: 0;
32
+ padding-inline: 0.25rem;
33
+ font-family: var(--pg-font-family, system-ui);
34
+ font-size: 0.75rem;
35
+ line-height: 1rem;
36
+ color: rgb(79, 143, 249);
37
+ text-decoration: underline;
38
+ cursor: pointer;
39
+ border-radius: 0.125rem;
40
+ outline: none;
41
+ }
42
+
43
+ [part=link]:hover {
44
+ color: rgb(127, 173, 255);
45
+ }
46
+
47
+ [part=link]:focus-visible {
48
+ outline: 1px solid rgb(79, 143, 249, 0.75);
49
+ }
50
+
51
+ [part=select] {
52
+ border: 0;
53
+ background: none;
54
+ color: rgba(255, 255, 255, 0.5);
55
+ cursor: pointer;
56
+ line-height: 0;
57
+ padding-block: 0.125rem;
58
+ padding-inline: 0.125rem;
59
+ border-radius: 0.125rem;
60
+ outline: none;
61
+ }
62
+
63
+ [part=select]:hover {
64
+ color: rgba(255, 255, 255, 0.8);
65
+ }
66
+
67
+ [part=select]:focus-visible {
68
+ outline: 1px solid rgb(79, 143, 249, 0.75);
69
+ }
@@ -0,0 +1,9 @@
1
+ <div class="wrapper">
2
+ <span part="label"></span>
3
+ <div class="row">
4
+ <button part="link" type="button" title="Show linked node"></button>
5
+ <button part="select" type="button" title="Select a node">
6
+ <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14"><path fill="currentColor" d="M7 .5a1 1 0 0 1 1 1v.6A5.01 5.01 0 0 1 11.9 6h.6a1 1 0 1 1 0 2h-.6A5 5 0 0 1 8 11.9v.6a1 1 0 1 1-2 0v-.6A5 5 0 0 1 2.1 8h-.6a1 1 0 0 1 0-2h.6A5.01 5.01 0 0 1 6 2.1v-.6a1 1 0 0 1 1-1m.984 3.668a.999.999 0 0 1-1.97 0c-.863.3-1.546.983-1.846 1.847a1 1 0 0 1 0 1.97c.3.863.983 1.545 1.847 1.846a1 1 0 0 1 1.97 0A3 3 0 0 0 9.83 7.984a.999.999 0 0 1 0-1.97 3 3 0 0 0-1.847-1.846"/></svg>
7
+ </button>
8
+ </div>
9
+ </div>
@@ -0,0 +1,59 @@
1
+ :host {
2
+ display: block;
3
+ font-family: var(--pg-font-family, system-ui);
4
+ }
5
+
6
+ label {
7
+ display: flex;
8
+ flex-direction: column;
9
+ padding-inline: 0.25rem;
10
+ }
11
+
12
+ [part=label] {
13
+ font-size: 0.625rem;
14
+ line-height: 1rem;
15
+ padding-inline: 0.25rem;
16
+ color: rgba(255, 255, 255, 0.8);
17
+ }
18
+
19
+ [part=input]::-webkit-outer-spin-button,
20
+ [part=input]::-webkit-inner-spin-button {
21
+ -webkit-appearance: none;
22
+ margin: 0;
23
+ }
24
+
25
+ [part=input] {
26
+ -moz-appearance: textfield;
27
+ appearance: textfield;
28
+ border: 0;
29
+ border-radius: 0.125rem;
30
+ padding-inline-start: 0.25rem;
31
+ padding-inline-end: 0.25rem;
32
+ padding-block-start: 0;
33
+ padding-block-end: 0;
34
+ font-family: var(--pg-input-text-font-family, var(--pg-font-family));
35
+ font-size: 0.75rem;
36
+ line-height: 1rem;
37
+ outline: none;
38
+ field-sizing: content;
39
+ min-width: calc(
40
+ 100%
41
+ - var(--pg-input-text-padding-inline-start, var(--pg-input-text-padding-inline, 0.5rem))
42
+ - var(--pg-input-text-padding-inline-end, var(--pg-input-text-padding-inline, 0.5rem))
43
+ - 2px
44
+ );
45
+ background-color: #2B2B2B;
46
+ color: #FFF;
47
+ outline: 1px solid #444;
48
+ }
49
+
50
+ [part=input]:read-only {
51
+ border-color: transparent;
52
+ }
53
+
54
+ [part=input]:active {
55
+ outline-color: rgb(79, 143, 249, 0.75);
56
+ }
57
+ [part=input]:focus {
58
+ outline-color: rgb(79, 143, 249, 0.75);
59
+ }
@@ -0,0 +1,57 @@
1
+ import { Component, Prop, Part } from '@pictogrammers/element';
2
+
3
+ import template from './nodeEditorNumber.html';
4
+ import style from './nodeEditorNumber.css';
5
+
6
+ @Component({
7
+ selector: 'pg-node-editor-number',
8
+ style,
9
+ template,
10
+ })
11
+ export default class PgNodeEditorNumber extends HTMLElement {
12
+
13
+ static type = 'Number';
14
+
15
+ @Prop() label: string = '';
16
+ @Prop() value: number = 0;
17
+ @Prop() name: string = '';
18
+
19
+ @Part() $label: HTMLLabelElement;
20
+ @Part() $input: HTMLInputElement;
21
+
22
+ connectedCallback() {
23
+ this.$input.addEventListener('change', (e: any) => {
24
+ e.stopPropagation();
25
+ this.dispatchEvent(new CustomEvent('change', {
26
+ detail: {
27
+ value: Number(this.$input.value),
28
+ }
29
+ }));
30
+ });
31
+ this.$input.addEventListener('input', (e: any) => {
32
+ e.stopPropagation();
33
+ this.dispatchEvent(new CustomEvent('input', {
34
+ detail: {
35
+ value: Number(this.$input.value),
36
+ }
37
+ }));
38
+ });
39
+ }
40
+
41
+ render(changes: any) {
42
+ if (changes.label) {
43
+ this.$label.textContent = this.label;
44
+ }
45
+ if (changes.value) {
46
+ this.$input.value = String(this.value);
47
+ }
48
+ }
49
+
50
+ get height() {
51
+ return 2;
52
+ }
53
+
54
+ focus() {
55
+ this.$input.focus();
56
+ }
57
+ }
@@ -0,0 +1,23 @@
1
+ :host {
2
+ display: block;
3
+ font-family: var(--pg-font-family, system-ui);
4
+ }
5
+
6
+ label {
7
+ display: flex;
8
+ flex-direction: column;
9
+ padding-inline: 0.25rem;
10
+ }
11
+
12
+ [part=label] {
13
+ font-size: 0.625rem;
14
+ line-height: 1rem;
15
+ padding-inline: 0.25rem;
16
+ color: rgba(255, 255, 255, 0.8);
17
+ }
18
+
19
+ [part=input] {
20
+ width: 100%;
21
+ box-sizing: border-box;
22
+ accent-color: #248BE5;
23
+ }
@@ -0,0 +1,69 @@
1
+ import { Component, Prop, Part } from '@pictogrammers/element';
2
+
3
+ import template from './nodeEditorRange.html';
4
+ import style from './nodeEditorRange.css';
5
+
6
+ @Component({
7
+ selector: 'pg-node-editor-range',
8
+ style,
9
+ template,
10
+ })
11
+ export default class PgNodeEditorRange extends HTMLElement {
12
+
13
+ static type = 'Range';
14
+
15
+ @Prop() label: string = '';
16
+ @Prop() value: number = 0;
17
+ @Prop() name: string = '';
18
+ @Prop() min: number = 0;
19
+ @Prop() max: number = 100;
20
+ @Prop() step: number = 1;
21
+
22
+ @Part() $label: HTMLLabelElement;
23
+ @Part() $input: HTMLInputElement;
24
+
25
+ connectedCallback() {
26
+ this.$input.addEventListener('change', (e: any) => {
27
+ e.stopPropagation();
28
+ this.dispatchEvent(new CustomEvent('change', {
29
+ detail: {
30
+ value: Number(this.$input.value),
31
+ }
32
+ }));
33
+ });
34
+ this.$input.addEventListener('input', (e: any) => {
35
+ e.stopPropagation();
36
+ this.dispatchEvent(new CustomEvent('input', {
37
+ detail: {
38
+ value: Number(this.$input.value),
39
+ }
40
+ }));
41
+ });
42
+ }
43
+
44
+ render(changes: any) {
45
+ if (changes.label) {
46
+ this.$label.textContent = this.label;
47
+ }
48
+ if (changes.value) {
49
+ this.$input.value = String(this.value);
50
+ }
51
+ if (changes.min) {
52
+ this.$input.min = String(this.min);
53
+ }
54
+ if (changes.max) {
55
+ this.$input.max = String(this.max);
56
+ }
57
+ if (changes.step) {
58
+ this.$input.step = String(this.step);
59
+ }
60
+ }
61
+
62
+ get height() {
63
+ return 2;
64
+ }
65
+
66
+ focus() {
67
+ this.$input.focus();
68
+ }
69
+ }
@@ -0,0 +1,9 @@
1
+ <div class="example">
2
+ <pg-node-editor-text part="input"></pg-node-editor-text>
3
+ <div>
4
+ <code>onchange: <span part="value1"></span></code>
5
+ </div>
6
+ <div>
7
+ <code>oninput: <span part="value2"></span></code>
8
+ </div>
9
+ </div>
@@ -0,0 +1,30 @@
1
+ import { Component, Part } from '@pictogrammers/element';
2
+ import PgNodes from '../../nodeEditorText';
3
+
4
+ import template from './basic.html';
5
+
6
+ @Component({
7
+ selector: 'x-pg-node-editor-text-basic',
8
+ template,
9
+ })
10
+ export default class XPgNodesEditorTextBasic extends HTMLElement {
11
+
12
+ @Part() $input: PgNodes;
13
+ @Part() $value1: HTMLDivElement;
14
+ @Part() $value2: HTMLDivElement;
15
+
16
+ connectedCallback() {
17
+ this.$input.addEventListener('change', this.#handleChange.bind(this));
18
+ this.$input.addEventListener('input', this.#handleInput.bind(this));
19
+ }
20
+
21
+ #handleChange(e: CustomEvent) {
22
+ const { value } = e.detail;
23
+ this.$value1.textContent = value;
24
+ }
25
+
26
+ #handleInput(e: CustomEvent) {
27
+ const { value } = e.detail;
28
+ this.$value2.textContent = value;
29
+ }
30
+ }
@@ -0,0 +1,17 @@
1
+ :host {
2
+ display: block;
3
+ font-family: var(--pg-font-family, system-ui);
4
+ }
5
+
6
+ label {
7
+ display: flex;
8
+ flex-direction: column;
9
+ padding-inline: 0.25rem;
10
+ }
11
+
12
+ [part=label] {
13
+ font-size: 0.625rem;
14
+ line-height: 1rem;
15
+ padding-inline: 0.25rem;
16
+ color: rgba(255, 255, 255, 0.8);
17
+ }
@@ -0,0 +1,4 @@
1
+ <label>
2
+ <span part="label"></span>
3
+ <input type="text" part="input">
4
+ </label>
@@ -0,0 +1,57 @@
1
+ import { Component, Prop, Part } from '@pictogrammers/element';
2
+
3
+ import template from './nodeEditorText.html';
4
+ import style from './nodeEditorText.css';
5
+
6
+ @Component({
7
+ selector: 'pg-node-editor-text',
8
+ style,
9
+ template,
10
+ })
11
+ export default class PgNodeEditorText extends HTMLElement {
12
+
13
+ static type = 'Text';
14
+
15
+ @Prop() label: string = '';
16
+ @Prop() value: string = '';
17
+ @Prop() name: string = '';
18
+
19
+ @Part() $label: HTMLLabelElement;
20
+ @Part() $input: HTMLInputElement;
21
+
22
+ connectedCallback() {
23
+ this.$input.addEventListener('change', (e: any) => {
24
+ e.stopPropagation();
25
+ this.dispatchEvent(new CustomEvent('change', {
26
+ detail: {
27
+ value: this.$input.value,
28
+ }
29
+ }));
30
+ });
31
+ this.$input.addEventListener('input', (e: any) => {
32
+ e.stopPropagation();
33
+ this.dispatchEvent(new CustomEvent('input', {
34
+ detail: {
35
+ value: this.$input.value,
36
+ }
37
+ }));
38
+ });
39
+ }
40
+
41
+ render(changes: any) {
42
+ if (changes.label) {
43
+ this.$label.textContent = this.label;
44
+ }
45
+ if (changes.value) {
46
+ this.$input.value = this.value;
47
+ }
48
+ }
49
+
50
+ get height() {
51
+ return 2;
52
+ }
53
+
54
+ focus() {
55
+ this.$input.focus();
56
+ }
57
+ }
@@ -0,0 +1,35 @@
1
+ # `<pg-nodes>`
2
+
3
+ The `pg-nodes` component allows creating and linking `PgNode` extended data types.
4
+
5
+ > If a `type` is omitted a `fields` property is required. See below for details.
6
+
7
+ ```typescript
8
+ import '@pictogrammers/components/pgNodeEditorText';
9
+ import { PgNodeEditorText } from '@pictogrammers/components/pgNodeEditorText';
10
+ ```
11
+
12
+ ```html
13
+ <pg-node-editor-text></pg-node-editor-text>
14
+ ```
15
+
16
+ ## Attributes
17
+
18
+ | Attributes | Tested | Description |
19
+ | ----------- | -------- | ----------- |
20
+ | `items` | | Node list |
21
+
22
+ > Note: All nodes are sized off a `1rem` grid.
23
+
24
+ ## Events
25
+
26
+ | Events | Tested | Description |
27
+ | ---------- | -------- | ----------- |
28
+ | change | | `{ detail: { index, item[, field] }` |
29
+ | input | | `{ detail: { index, item[, field] }` |
30
+
31
+ ## CSS Variables
32
+
33
+ | CSS Variables | Default | Description |
34
+ | ------------------- | --------- | ----------- |
35
+ | n/a | | |
@@ -0,0 +1,49 @@
1
+ :host {
2
+ display: block;
3
+ font-family: var(--pg-font-family, system-ui);
4
+ }
5
+
6
+ label {
7
+ display: flex;
8
+ flex-direction: column;
9
+ padding-inline: 0.25rem;
10
+ }
11
+
12
+ [part=label] {
13
+ font-size: 0.625rem;
14
+ line-height: 0.875rem;
15
+ padding-inline: 0.25rem;
16
+ color: rgba(255, 255, 255, 0.8);
17
+ }
18
+
19
+ [part=input] {
20
+ border: 0;
21
+ border-radius: 0;
22
+ padding-inline-start: 0.25rem;
23
+ padding-inline-end: 0.25rem;
24
+ padding-block-start: 0;
25
+ padding-block-end: 0;
26
+ font-family: var(--pg-input-text-font-family, var(--pg-font-family));
27
+ font-size: 0.875rem;
28
+ outline: none;
29
+ field-sizing: content;
30
+ min-width: calc(
31
+ 100%
32
+ - var(--pg-input-text-padding-inline-start, var(--pg-input-text-padding-inline, 0.5rem))
33
+ - var(--pg-input-text-padding-inline-end, var(--pg-input-text-padding-inline, 0.5rem))
34
+ - 2px
35
+ );
36
+ background-color: #2B2B2B;
37
+ color: #FFF;
38
+ }
39
+
40
+ [part=input]:read-only {
41
+ border-color: transparent;
42
+ }
43
+
44
+ [part=input]:active {
45
+ box-shadow: 0 0 0 3px var(--pg-input-text-active-glow, rgb(79, 143, 249, 0.6));
46
+ }
47
+ [part=input]:focus {
48
+ box-shadow: 0 0 0 2px var(--pg-input-text-focus-glow, rgb(79, 143, 249, 0.75));
49
+ }
@@ -0,0 +1,4 @@
1
+ <label>
2
+ <span part="label"></span>
3
+ <input type="text" part="input">
4
+ </label>
@@ -0,0 +1,50 @@
1
+ import { Component, Prop, Part } from '@pictogrammers/element';
2
+
3
+ import template from './nodeEditorText.html';
4
+ import style from './nodeEditorText.css';
5
+
6
+ @Component({
7
+ selector: 'pg-node-editor-text',
8
+ style,
9
+ template,
10
+ })
11
+ export default class PgNodeEditorText extends HTMLElement {
12
+ @Prop() label: string = '';
13
+ @Prop() value: string = '';
14
+ @Prop() name: string = '';
15
+
16
+ @Part() $label: HTMLLabelElement;
17
+ @Part() $input: HTMLInputElement;
18
+
19
+ connectedCallback() {
20
+ this.$input.addEventListener('change', (e: any) => {
21
+ e.stopPropagation();
22
+ this.dispatchEvent(new CustomEvent('change', {
23
+ detail: {
24
+ value: this.$input.value,
25
+ }
26
+ }));
27
+ });
28
+ this.$input.addEventListener('input', (e: any) => {
29
+ e.stopPropagation();
30
+ this.dispatchEvent(new CustomEvent('input', {
31
+ detail: {
32
+ value: this.$input.value,
33
+ }
34
+ }));
35
+ });
36
+ }
37
+
38
+ render(changes: any) {
39
+ if (changes.label) {
40
+ this.$label.textContent = this.label;
41
+ }
42
+ if (changes.value) {
43
+ this.$input.value = this.value;
44
+ }
45
+ }
46
+
47
+ get height() {
48
+ return 2;
49
+ }
50
+ }
@@ -0,0 +1,68 @@
1
+ :host {
2
+ display: block;
3
+ font-family: var(--pg-font-family, system-ui);
4
+ }
5
+
6
+ div.wrapper {
7
+ display: flex;
8
+ flex-direction: column;
9
+ padding-inline: 0.25rem;
10
+ }
11
+
12
+ div.labelAdd {
13
+ display: flex;
14
+ flex-direction: row;
15
+ }
16
+
17
+ [part=label] {
18
+ flex: 1;
19
+ font-size: 0.625rem;
20
+ line-height: 1rem;
21
+ padding-inline: 0.25rem;
22
+ color: rgba(255, 255, 255, 0.8);
23
+ }
24
+
25
+ [part=inputs] {
26
+ display: flex;
27
+ flex-direction: column;
28
+ }
29
+
30
+ [part=inputs] > *:first-child:not(:only-child) {
31
+ --pg-node-input-text-border-top-right-radius: 0;
32
+ --pg-node-input-text-border-bottom-left-radius: 0;
33
+ --pg-node-input-text-border-bottom-right-radius: 0;
34
+ }
35
+ [part=inputs] > *:not(:last-child):not(:first-child):not(:only-child) {
36
+ --pg-node-input-text-border-top-left-radius: 0;
37
+ --pg-node-input-text-border-top-right-radius: 0;
38
+ --pg-node-input-text-border-bottom-left-radius: 0;
39
+ --pg-node-input-text-border-bottom-right-radius: 0;
40
+ }
41
+ [part=inputs] > *:last-child:not(:only-child) {
42
+ --pg-node-input-text-border-top-left-radius: 0;
43
+ --pg-node-input-text-border-top-right-radius: 0;
44
+ }
45
+
46
+ [part=inputs] > *:only-child {
47
+ --pg-node-input-text-border-top-right-radius: 0;
48
+ }
49
+
50
+ [part=add] {
51
+ border: 0;
52
+ background: none;
53
+ color: rgba(255, 255, 255, 0.5);
54
+ cursor: pointer;
55
+ line-height: 0.625rem;
56
+ font-size: 0.875rem;
57
+ text-align: center;
58
+ outline: 1px solid #444;
59
+ border-top-left-radius: 0.125rem;
60
+ border-top-right-radius: 0.125rem;
61
+ padding-block: 0;
62
+ padding-inline: 0.125rem;
63
+ }
64
+
65
+ [part=add]:hover {
66
+ color: rgba(255, 255, 255, 0.8);
67
+ outline: 1px solid #666;
68
+ }
@@ -0,0 +1,9 @@
1
+ <div class="wrapper">
2
+ <div class="labelAdd">
3
+ <span part="label"></span>
4
+ <button part="add">
5
+ <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14"><path fill="currentColor" d="M7 2a1 1 0 0 1 1 1v3h3a1 1 0 1 1 0 2H8v3a1 1 0 1 1-2 0V8H3a1 1 0 0 1 0-2h3V3a1 1 0 0 1 1-1"/></svg>
6
+ </button>
7
+ </div>
8
+ <div part="inputs"></div>
9
+ </div>