@pictogrammers/components 0.5.14 → 0.5.17

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 (153) 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/inputNumber/inputNumber.ts +31 -13
  13. package/pg/inputPill/inputPill.html +6 -0
  14. package/pg/inputPill/inputPill.html.tmp.26852.84ac63f4c46f +6 -0
  15. package/pg/inputPill/inputPill.ts +41 -0
  16. package/pg/inputPills/__examples__/basic/basic.html +9 -0
  17. package/pg/inputPills/__examples__/basic/basic.html.tmp.26852.4771e4cad5b7 +9 -0
  18. package/pg/inputPills/__examples__/basic/basic.ts.tmp.26852.d8fe41df18bd +0 -0
  19. package/pg/inputPixelEditor/README.md +104 -69
  20. package/pg/inputPixelEditor/README.md.tmp.42596.658de5f0a6f5 +0 -0
  21. package/pg/inputPixelEditor/__examples__/basic/basic.ts +6 -5
  22. package/pg/inputPixelEditor/inputPixelEditor.ts +95 -23
  23. package/pg/inputPixelEditor/inputPixelEditor.ts.tmp.38516.96529dd82670 +1703 -0
  24. package/pg/inputPixelEditor/inputPixelEditor.ts.tmp.42596.48ecc3ad9c72 +1724 -0
  25. package/pg/inputPixelEditor/utils/bitmapToMask.ts +113 -79
  26. package/pg/inputPixelEditor/utils/getLassoPixels.ts +51 -0
  27. package/pg/inputRange/inputRange.css +7 -0
  28. package/pg/inputSelect/__examples__/basic/basic.ts +2 -2
  29. package/pg/inputSelect/inputSelect.css +1 -1
  30. package/pg/inputSelect/inputSelect.ts +62 -5
  31. package/pg/inputText/README.md +6 -6
  32. package/pg/inputText/__examples__/basic/basic.ts +1 -1
  33. package/pg/inputText/inputText.css +2 -2
  34. package/pg/inputText copy/README.md +38 -0
  35. package/pg/inputText copy/inputText.css +41 -0
  36. package/pg/inputText copy/inputText.html +1 -0
  37. package/pg/inputText copy/inputText.spec.ts +59 -0
  38. package/pg/inputText copy/inputText.ts +67 -0
  39. package/pg/inputTextarea/README.md +39 -0
  40. package/pg/inputTextarea/__examples__/basic/basic.html +9 -0
  41. package/pg/inputTextarea/__examples__/basic/basic.ts +30 -0
  42. package/pg/inputTextarea/inputTextarea.ts +121 -0
  43. package/pg/inputTextarea copy/README.md +39 -0
  44. package/pg/inputTextarea copy/inputTextarea.css +41 -0
  45. package/pg/inputTextarea copy/inputTextarea.html +1 -0
  46. package/pg/inputTextarea copy/inputTextarea.spec.ts +59 -0
  47. package/pg/inputTextarea copy/inputTextarea.ts +79 -0
  48. package/pg/inputTextareaAutocomplete/README.md +70 -0
  49. package/pg/inputTextareaAutocomplete/__examples__/basic/basic.ts +67 -0
  50. package/pg/inputTextareaAutocomplete/inputTextareaAutocomplete.ts +267 -0
  51. package/pg/node/README.md +35 -0
  52. package/pg/node/__examples__/basic/basic.ts +34 -0
  53. package/pg/node/index.ts +3 -0
  54. package/pg/node/node.css +53 -0
  55. package/pg/node/node.html +5 -0
  56. package/pg/node/node.ts +270 -0
  57. package/pg/nodeEditorLink/nodeEditorLink.css +69 -0
  58. package/pg/nodeEditorLink/nodeEditorLink.css.tmp.1408.09e961fd0dcc +69 -0
  59. package/pg/nodeEditorLink/nodeEditorLink.html +9 -0
  60. package/pg/nodeEditorNumber/nodeEditorNumber.css +59 -0
  61. package/pg/nodeEditorNumber/nodeEditorNumber.ts +57 -0
  62. package/pg/nodeEditorRange/nodeEditorRange.css +23 -0
  63. package/pg/nodeEditorRange/nodeEditorRange.ts +69 -0
  64. package/pg/nodeEditorText/__examples__/basic/basic.html +9 -0
  65. package/pg/nodeEditorText/__examples__/basic/basic.ts +30 -0
  66. package/pg/nodeEditorText/nodeEditorText.css +17 -0
  67. package/pg/nodeEditorText/nodeEditorText.html +4 -0
  68. package/pg/nodeEditorText/nodeEditorText.ts +57 -0
  69. package/pg/nodeEditorText copy/README.md +35 -0
  70. package/pg/nodeEditorText copy/nodeEditorText.css +49 -0
  71. package/pg/nodeEditorText copy/nodeEditorText.html +4 -0
  72. package/pg/nodeEditorText copy/nodeEditorText.ts +50 -0
  73. package/pg/nodeEditorTextArray/nodeEditorTextArray.css +68 -0
  74. package/pg/nodeEditorTextArray/nodeEditorTextArray.html +9 -0
  75. package/pg/nodeEditorTextArray/nodeEditorTextArray.ts +162 -0
  76. package/pg/nodeEntry/nodeEntry.css +61 -0
  77. package/pg/nodeEntry/nodeEntry.ts +164 -0
  78. package/pg/nodeEntry/nodeEntry.ts.tmp.28724.dda67762bca5 +164 -0
  79. package/pg/nodeInputText/nodeInputText.css +75 -0
  80. package/pg/nodeInputText/nodeInputText.html +4 -0
  81. package/pg/nodeInputText/nodeInputText.ts +105 -0
  82. package/pg/nodeOutput/nodeOutput.css +32 -0
  83. package/pg/nodeResize/README.md +3 -0
  84. package/pg/nodeResize/THINKING.md +81 -0
  85. package/pg/nodeResize/THINKING.md.tmp.24812.99a70ba81062 +81 -0
  86. package/pg/nodeResize/basic/basic.ts +17 -0
  87. package/pg/nodeResize/dragUtil.ts +105 -0
  88. package/pg/nodeResize/dragUtil.ts.tmp.34372.787464c73309 +75 -0
  89. package/pg/nodeResize/nodeResize.css +187 -0
  90. package/pg/nodeResize/nodeResize.html +9 -0
  91. package/pg/nodeResize/nodeResize.ts +156 -0
  92. package/pg/nodes/README.md +177 -0
  93. package/pg/nodes/__examples__/basic/basic.html +33 -0
  94. package/pg/nodes/__examples__/basic/basic.ts +716 -0
  95. package/pg/nodes/__examples__/basic/exampleNodes.ts +129 -0
  96. package/pg/nodes/__examples__/basic/exampleScripts.ts +129 -0
  97. package/pg/nodes/__examples__/basic/keystore.ts +38 -0
  98. package/pg/nodes/executeInSandbox.ts +32 -0
  99. package/pg/nodes/index.ts +3 -0
  100. package/pg/nodes/nodes.css +69 -0
  101. package/pg/nodes/nodes.html +6 -0
  102. package/pg/nodes/nodes.ts +1240 -0
  103. package/pg/nodes copy/nodes.css +41 -0
  104. package/pg/nodes copy/nodes.html +1 -0
  105. package/pg/overlayContextMenu/__examples__/filter/filter.ts +87 -0
  106. package/pg/overlayContextMenu/overlayContextMenu.css +14 -0
  107. package/pg/overlayContextMenu/overlayContextMenu.html +4 -3
  108. package/pg/overlayContextMenu/overlayContextMenu.ts +6 -2
  109. package/pg/overlayContextMenu/overlayContextMenu.ts.tmp.37088.530ff1c0a321 +0 -0
  110. package/pg/overlayMenu/overlayMenu.css +3 -1
  111. package/pg/overlayMenu/overlayMenu.ts +11 -2
  112. package/pg/overlayMenu/overlayMenu.ts.tmp.44252.9bb22fd59ede +80 -0
  113. package/pg/overlaySelectMenu/overlaySelectMenu.css +2 -0
  114. package/pg/overlaySubMenu/overlaySubMenu.css +8 -6
  115. package/pg/poco/README.md +22 -0
  116. package/pg/poco/__examples__/basic/basic.html +11 -0
  117. package/pg/poco/__examples__/basic/basic.ts +95 -0
  118. package/pg/poco/__examples__/basic/examples.ts +258 -0
  119. package/pg/poco/__examples__/basic/myFont.ts +1300 -0
  120. package/pg/poco/index.ts +3 -0
  121. package/pg/poco/mockPoco.ts +640 -0
  122. package/pg/poco/poco.css +7 -0
  123. package/pg/poco/poco.html +1 -0
  124. package/pg/poco/poco.ts +75 -0
  125. package/pg/popover/README.md +47 -0
  126. package/pg/popover/__examples__/basic/basic.html +3 -0
  127. package/pg/popover/popover.html +3 -0
  128. package/pg/popover/popover.ts +44 -0
  129. package/pg/popoverAutocomplete/__examples__/basic/basic.html +4 -0
  130. package/pg/popoverAutocomplete/__examples__/basic/basic.ts +46 -0
  131. package/pg/popoverAutocomplete/popoverAutocomplete.css +25 -0
  132. package/pg/popoverAutocomplete/popoverAutocomplete.html +1 -0
  133. package/pg/popoverAutocomplete/popoverAutocomplete.ts +134 -0
  134. package/pg/popoverAutocompleteItem/popoverAutocompleteItem.css +69 -0
  135. package/pg/popoverAutocompleteItem/popoverAutocompleteItem.ts +90 -0
  136. package/pg/table/__examples__/basic/basic.ts +1 -0
  137. package/pg/tableCellFileLocal/tableCellFileLocal.html +3 -0
  138. package/pg/tableCellFileLocal/tableCellFileLocal.html.tmp.20484.68ee2e30710e +3 -0
  139. package/pg/tableCellFileLocal/tableCellFileLocal.ts +44 -0
  140. package/pg/tableCellSelect/tableCellSelect.html +3 -0
  141. package/pg/tableCellSelect/tableCellSelect.html.tmp.41808.99c1a6f14340 +3 -0
  142. package/pg/tableCellSelect/tableCellSelect.ts +51 -0
  143. package/pg/tree/__examples__/basic/basic.ts +12 -5
  144. package/pg/tree/tree.html +1 -1
  145. package/pg/tree/tree.ts +385 -227
  146. package/pg/tree/tree.ts.tmp.38376.07d376a04f41 +343 -0
  147. package/pg/tree/tree.ts.tmp.38376.2a04599ade9f +361 -0
  148. package/pg/tree/tree.ts.tmp.38376.6cb2c663d476 +0 -0
  149. package/pg/tree/tree.ts.tmp.38376.ac5af1aff2b0 +393 -0
  150. package/pg/tree/tree.ts.tmp.38376.ac9acfc4f95f +324 -0
  151. package/pg/treeItem/treeItem.ts +536 -558
  152. package/pg/treeItem/treeItem.ts.tmp.38376.145d3121d648 +530 -0
  153. package/pg/treeItem/treeItem.ts.tmp.38376.b5224d48e5c0 +0 -0
@@ -0,0 +1,129 @@
1
+ export const nodeExamples = [{
2
+ "name": "stateGet",
3
+ "description": "Get",
4
+ "editor": null,
5
+ "async": false,
6
+ "args": [
7
+ {
8
+ "key": "key",
9
+ "label": "Key",
10
+ "editor": "Text",
11
+ "value": ""
12
+ }
13
+ ],
14
+ "nodes": [
15
+ {
16
+ "key": "nodes",
17
+ "label": "nodes"
18
+ }
19
+ ]
20
+ },
21
+ {
22
+ "name": "dialog",
23
+ "description": "Dialog",
24
+ "editor": null,
25
+ "async": true,
26
+ "args": [
27
+ {
28
+ "key": "character",
29
+ "label": "Character",
30
+ "editor": "Character"
31
+ },
32
+ {
33
+ "key": "text",
34
+ "label": "Text",
35
+ "editor": "Text"
36
+ }
37
+ ],
38
+ "nodes": [
39
+ {
40
+ "key": "nodes",
41
+ "label": "nodes"
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "name": "dialogChoice",
47
+ "description": "Choices",
48
+ "editor": null,
49
+ "async": false,
50
+ "args": [
51
+ {
52
+ "key": "text",
53
+ "label": "text",
54
+ "editor": null,
55
+ "value": ""
56
+ }
57
+ ],
58
+ "nodes": [
59
+ {
60
+ "key": "nodes",
61
+ "label": "nodes"
62
+ }
63
+ ]
64
+ }, {
65
+ "name": "greaterThan",
66
+ "description": "Greater Than",
67
+ "editor": null,
68
+ "async": false,
69
+ "args": [
70
+ {
71
+ "key": "value",
72
+ "label": "Value",
73
+ "editor": "Number",
74
+ "value": 0
75
+ }
76
+ ],
77
+ "nodes": [
78
+ {
79
+ "key": "t",
80
+ "label": "t"
81
+ },
82
+ {
83
+ "key": "f",
84
+ "label": "f"
85
+ }
86
+ ]
87
+ }, {
88
+ "name": "lessThan",
89
+ "description": "Less Than",
90
+ "editor": null,
91
+ "async": false,
92
+ "args": [
93
+ {
94
+ "key": "value",
95
+ "label": "Value",
96
+ "editor": "Number",
97
+ "value": 0
98
+ }
99
+ ],
100
+ "nodes": [
101
+ {
102
+ "key": "t",
103
+ "label": "t"
104
+ },
105
+ {
106
+ "key": "f",
107
+ "label": "f"
108
+ }
109
+ ]
110
+ }, {
111
+ "name": "stateAdd",
112
+ "description": "Add",
113
+ "editor": null,
114
+ "async": false,
115
+ "args": [
116
+ {
117
+ "key": "value",
118
+ "label": "Value",
119
+ "editor": "Number",
120
+ "value": 0
121
+ }
122
+ ],
123
+ "nodes": [
124
+ {
125
+ "key": "nodes",
126
+ "label": "nodes"
127
+ }
128
+ ]
129
+ }];
@@ -0,0 +1,129 @@
1
+ export const nodeExamples = [{
2
+ "name": "stateGet",
3
+ "description": "Get",
4
+ "editor": null,
5
+ "async": false,
6
+ "args": [
7
+ {
8
+ "key": "key",
9
+ "label": "Key",
10
+ "editor": "Text",
11
+ "value": ""
12
+ }
13
+ ],
14
+ "nodes": [
15
+ {
16
+ "key": "nodes",
17
+ "label": "nodes"
18
+ }
19
+ ]
20
+ },
21
+ {
22
+ "name": "dialog",
23
+ "description": "Dialog",
24
+ "editor": null,
25
+ "async": true,
26
+ "args": [
27
+ {
28
+ "key": "character",
29
+ "label": "Character",
30
+ "editor": "Character"
31
+ },
32
+ {
33
+ "key": "text",
34
+ "label": "Text",
35
+ "editor": "Text"
36
+ }
37
+ ],
38
+ "nodes": [
39
+ {
40
+ "key": "nodes",
41
+ "label": "nodes"
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "name": "dialogChoice",
47
+ "description": "Choices",
48
+ "editor": null,
49
+ "async": false,
50
+ "args": [
51
+ {
52
+ "key": "text",
53
+ "label": "text",
54
+ "editor": null,
55
+ "value": ""
56
+ }
57
+ ],
58
+ "nodes": [
59
+ {
60
+ "key": "nodes",
61
+ "label": "nodes"
62
+ }
63
+ ]
64
+ }, {
65
+ "name": "greaterThan",
66
+ "description": "Greater Than",
67
+ "editor": null,
68
+ "async": false,
69
+ "args": [
70
+ {
71
+ "key": "value",
72
+ "label": "Value",
73
+ "editor": "Number",
74
+ "value": 0
75
+ }
76
+ ],
77
+ "nodes": [
78
+ {
79
+ "key": "t",
80
+ "label": "t"
81
+ },
82
+ {
83
+ "key": "f",
84
+ "label": "f"
85
+ }
86
+ ]
87
+ }, {
88
+ "name": "lessThan",
89
+ "description": "Less Than",
90
+ "editor": null,
91
+ "async": false,
92
+ "args": [
93
+ {
94
+ "key": "value",
95
+ "label": "Value",
96
+ "editor": "Number",
97
+ "value": 0
98
+ }
99
+ ],
100
+ "nodes": [
101
+ {
102
+ "key": "t",
103
+ "label": "t"
104
+ },
105
+ {
106
+ "key": "f",
107
+ "label": "f"
108
+ }
109
+ ]
110
+ }, {
111
+ "name": "stateAdd",
112
+ "description": "Add",
113
+ "editor": null,
114
+ "async": false,
115
+ "args": [
116
+ {
117
+ "key": "value",
118
+ "label": "Value",
119
+ "editor": "Number",
120
+ "value": 0
121
+ }
122
+ ],
123
+ "nodes": [
124
+ {
125
+ "key": "nodes",
126
+ "label": "nodes"
127
+ }
128
+ ]
129
+ }];
@@ -0,0 +1,38 @@
1
+ export class KeyStore {
2
+ map;
3
+
4
+ constructor() {
5
+ this.map = new Map();
6
+ }
7
+
8
+ // Generates a random 32-bit unsigned integer
9
+ #generateKey() {
10
+ return Math.floor(Math.random() * 0x100000000); // 0 to 2^32 - 1
11
+ }
12
+
13
+ // Adds a value, returns the key used
14
+ add(value) {
15
+ let key = this.#generateKey();
16
+ while (this.map.has(key)) {
17
+ key = this.#generateKey();
18
+ }
19
+ this.map.set(key, value);
20
+ return key;
21
+ }
22
+
23
+ set(key, value) {
24
+ this.map.set(key, value);
25
+ }
26
+
27
+ get(key) {
28
+ return this.map.get(key);
29
+ }
30
+
31
+ delete(key) {
32
+ return this.map.delete(key);
33
+ }
34
+
35
+ has(key) {
36
+ return this.map.has(key);
37
+ }
38
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Safely runs a function with a completely custom global scope.
3
+ * @param {Function} userCode - The function to sandbox.
4
+ * @param {Object} customGlobals - The custom global variables to expose.
5
+ */
6
+ export function executeInSandbox(userCode, customGlobals) {
7
+ // 1. Create a proxy to handle missing variables safely
8
+ const proxyScope = new Proxy(customGlobals, {
9
+ has(target, prop) {
10
+ // By returning true, we force the 'with' statement to look up
11
+ // variables inside our customGlobals object first.
12
+ return true;
13
+ },
14
+ get(target, prop, receiver) {
15
+ // If the property exists in our custom globals, return it.
16
+ if (prop in target) {
17
+ return Reflect.get(target, prop, receiver);
18
+ }
19
+ // If a property is not in our custom environment, throw an error
20
+ // instead of leaking out to the browser's global scope.
21
+ throw new ReferenceError(`${String(prop)} is not defined in the sandbox`);
22
+ }
23
+ });
24
+
25
+ // 2. Wrap the code in a 'with' block and a new Function() to drop outer lexical scope
26
+ const sandboxedFunction = new Function('sandbox',
27
+ 'with (sandbox) { (' + userCode.toString() + ')(); }'
28
+ );
29
+
30
+ // 3. Execute with our proxied custom globals
31
+ sandboxedFunction(proxyScope);
32
+ }
@@ -0,0 +1,3 @@
1
+ import PgNodes from './nodes';
2
+
3
+ export default PgNodes;
@@ -0,0 +1,69 @@
1
+ :host {
2
+ display: flex;
3
+ flex: 1;
4
+ }
5
+
6
+ [part=grid] {
7
+ position: relative;
8
+ flex: 1;
9
+ overflow: auto;
10
+ background: #0a0c14;
11
+ background-image: linear-gradient(#1a1d2e 1px, transparent 1px), linear-gradient(90deg, #1a1d2e 1px, transparent 1px);
12
+ background-size: 1rem 1rem;
13
+ background-attachment: local;
14
+ user-select: none;
15
+ }
16
+
17
+ [part=grid].debug {
18
+ background-image: linear-gradient(rgba(74, 222, 128, 0.2) 1px, transparent 1px), linear-gradient(90deg, rgba(74, 222, 128, 0.2) 1px, transparent 1px);
19
+ }
20
+ [part=grid].debug:hover {
21
+ background-image: linear-gradient(rgba(74, 222, 128, 0.25) 1px, transparent 1px), linear-gradient(90deg, rgba(74, 222, 128, 0.25) 1px, transparent 1px);
22
+ }
23
+
24
+ [part=grid].selecting {
25
+ cursor: default;
26
+ }
27
+
28
+ [part=grid]:hover {
29
+ background-image: linear-gradient(#262b44 1px, transparent 1px), linear-gradient(90deg, #262b44 1px, transparent 1px);
30
+ }
31
+
32
+ [part=forceScroll] {
33
+ position: absolute;
34
+ left: var(--pg-nodes-max-x, 60rem);
35
+ top: var(--pg-nodes-max-y, 40rem);
36
+ width: 1rem;
37
+ height: 1rem;
38
+ }
39
+
40
+ [part=svg] {
41
+ position: absolute;
42
+ pointer-events: none;
43
+ top: 0;
44
+ left: 0;
45
+ width: var(--pg-nodes-max-x, 60rem);
46
+ height: var(--pg-nodes-max-y, 40rem);
47
+ }
48
+
49
+ [part=svg] path {
50
+ pointer-events: stroke;
51
+ }
52
+
53
+ [part=svg] circle {
54
+ pointer-events: all;
55
+ }
56
+
57
+ [part=selection] {
58
+ position: absolute;
59
+ display: none;
60
+ border: 1px solid #248BE5;
61
+ background: rgba(36, 139, 229, 0.1);
62
+ pointer-events: none;
63
+ box-sizing: border-box;
64
+ z-index: 1;
65
+ }
66
+
67
+ [part=selection].active {
68
+ display: block;
69
+ }
@@ -0,0 +1,6 @@
1
+ <div part="grid">
2
+ <div part="items"></div>
3
+ <div part="forceScroll"></div>
4
+ <div part="selection"></div>
5
+ <svg part="svg"></svg>
6
+ </div>