blueprintsjs 0.0.0-stage → 0.2.0

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 (85) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE +21 -0
  3. package/README.md +165 -2
  4. package/dist/blueprintsjs.umd.cjs +325 -0
  5. package/dist/blueprintsjs.umd.cjs.map +1 -0
  6. package/dist/chunks/validate-DHOIGyop.js +860 -0
  7. package/dist/chunks/validate-DHOIGyop.js.map +1 -0
  8. package/dist/chunks/validate-Ddbqd8bD.cjs +859 -0
  9. package/dist/chunks/validate-Ddbqd8bD.cjs.map +1 -0
  10. package/dist/core/build.d.cts +33 -0
  11. package/dist/core/build.d.ts +33 -0
  12. package/dist/core/compile.d.cts +27 -0
  13. package/dist/core/compile.d.ts +27 -0
  14. package/dist/core/helpers.d.cts +13 -0
  15. package/dist/core/helpers.d.ts +13 -0
  16. package/dist/core/layout.d.cts +19 -0
  17. package/dist/core/layout.d.ts +19 -0
  18. package/dist/core/registry.d.cts +23 -0
  19. package/dist/core/registry.d.ts +23 -0
  20. package/dist/core/schema.d.cts +14 -0
  21. package/dist/core/schema.d.ts +14 -0
  22. package/dist/core/types.d.cts +215 -0
  23. package/dist/core/types.d.ts +215 -0
  24. package/dist/core/validate.d.cts +9 -0
  25. package/dist/core/validate.d.ts +9 -0
  26. package/dist/editor/GraphEditor.d.cts +181 -0
  27. package/dist/editor/GraphEditor.d.ts +181 -0
  28. package/dist/editor/details.d.cts +23 -0
  29. package/dist/editor/details.d.ts +23 -0
  30. package/dist/editor/dom.d.cts +20 -0
  31. package/dist/editor/dom.d.ts +20 -0
  32. package/dist/editor/highlight.d.cts +7 -0
  33. package/dist/editor/highlight.d.ts +7 -0
  34. package/dist/editor/index.d.cts +13 -0
  35. package/dist/editor/index.d.ts +13 -0
  36. package/dist/editor/state.d.cts +113 -0
  37. package/dist/editor/state.d.ts +113 -0
  38. package/dist/editor/styles.d.cts +7 -0
  39. package/dist/editor/styles.d.ts +7 -0
  40. package/dist/editor.cjs +2196 -0
  41. package/dist/editor.cjs.map +1 -0
  42. package/dist/editor.js +2196 -0
  43. package/dist/editor.js.map +1 -0
  44. package/dist/index.cjs +1251 -0
  45. package/dist/index.cjs.map +1 -0
  46. package/dist/index.d.cts +21 -0
  47. package/dist/index.d.ts +21 -0
  48. package/dist/index.js +1252 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/locales/index.d.cts +15 -0
  51. package/dist/locales/index.d.ts +15 -0
  52. package/dist/locales/ru.d.cts +3 -0
  53. package/dist/locales/ru.d.ts +3 -0
  54. package/dist/locales/uk.d.cts +3 -0
  55. package/dist/locales/uk.d.ts +3 -0
  56. package/dist/locales.cjs +579 -0
  57. package/dist/locales.cjs.map +1 -0
  58. package/dist/locales.js +579 -0
  59. package/dist/locales.js.map +1 -0
  60. package/dist/nodes/data.d.cts +26 -0
  61. package/dist/nodes/data.d.ts +26 -0
  62. package/dist/nodes/dom.d.cts +27 -0
  63. package/dist/nodes/dom.d.ts +27 -0
  64. package/dist/nodes/events.d.cts +11 -0
  65. package/dist/nodes/events.d.ts +11 -0
  66. package/dist/nodes/flow.d.cts +10 -0
  67. package/dist/nodes/flow.d.ts +10 -0
  68. package/dist/nodes/index.d.cts +11 -0
  69. package/dist/nodes/index.d.ts +11 -0
  70. package/dist/nodes/lib.d.cts +7 -0
  71. package/dist/nodes/lib.d.ts +7 -0
  72. package/dist/umd.d.cts +5 -0
  73. package/dist/umd.d.ts +5 -0
  74. package/dist/version.d.cts +2 -0
  75. package/dist/version.d.ts +2 -0
  76. package/docs/compiler.md +149 -0
  77. package/docs/custom-nodes.md +119 -0
  78. package/docs/editor.md +166 -0
  79. package/docs/guide.md +79 -0
  80. package/docs/nodes.md +494 -0
  81. package/docs/nodes.ru.md +494 -0
  82. package/docs/schema.md +64 -0
  83. package/examples/index.html +110 -0
  84. package/package.json +107 -4
  85. package/schema/blueprint.schema.json +102 -0
package/docs/nodes.md ADDED
@@ -0,0 +1,494 @@
1
+ # Blocks reference
2
+
3
+ Generated from the node registry (`scripts/gen-nodes.mjs`). Pin types: `exec` (order of execution), `string`, `number`, `boolean`, `element`, `elements`, `event`, `object`, `any`. A text value on an element pin is a CSS selector.
4
+
5
+ ## Events
6
+
7
+ ### On element event — `event.element`
8
+
9
+ Runs when an event happens on an element matching the selector — on every page, also for elements added later (the listener is delegated to the document). Without a selector: the blueprint root itself (the component element).
10
+
11
+ - **Inputs:** —
12
+ - **Outputs:** `exec`, `element` Element, `event` Event
13
+ - **Settings:** Selector (`selector`), Event (`event` = `"click"`; `click` `dblclick` `contextmenu` `mousedown` `mouseup` `mouseenter` `mouseleave` `pointerdown` `pointerup` `touchstart` `touchend` `input` `change` `submit` `reset` `focus` `blur` `keydown` `keyup` `animationend` `transitionend`), Prevent default (`preventDefault` = `false`), Stop propagation (`stopPropagation` = `false`), Only once (`once` = `false`)
14
+
15
+ ### On start — `event.start`
16
+
17
+ Runs once when the blueprint starts: when the page is ready, or when a component instance appears.
18
+
19
+ - **Inputs:** —
20
+ - **Outputs:** `exec`, `element` Root
21
+
22
+ ### On page event — `event.page`
23
+
24
+ Window / document events: load, scroll, resize, hash change, tab visibility…
25
+
26
+ - **Inputs:** —
27
+ - **Outputs:** `exec`, `event` Event
28
+ - **Settings:** Event (`event` = `"scroll"`; `load` `scroll` `resize` `hashchange` `popstate` `visibilitychange` `online` `offline` `beforeunload`), Throttle, ms (`throttle` = `0`)
29
+
30
+ ### On timer — `event.timer`
31
+
32
+ Runs after a delay, or every N milliseconds when "Repeat" is on.
33
+
34
+ - **Inputs:** —
35
+ - **Outputs:** `exec`
36
+ - **Settings:** Milliseconds (`ms` = `1000`), Repeat (`repeat` = `false`)
37
+
38
+ ### On key — `event.key`
39
+
40
+ Runs when a key is pressed anywhere on the page (for example Escape). Empty key = any key.
41
+
42
+ - **Inputs:** —
43
+ - **Outputs:** `exec`, `event` Event
44
+ - **Settings:** Key (`key` = `"Escape"`; `Escape` `Enter` ` ` `ArrowLeft` `ArrowRight` `ArrowUp` `ArrowDown` `Tab`), Event (`event` = `"keydown"`; `keydown` `keyup`), Ctrl / ⌘ (`ctrl` = `false`), Shift (`shift` = `false`), Alt (`alt` = `false`), Prevent default (`preventDefault` = `false`)
45
+
46
+ ### On custom event — `event.custom`
47
+
48
+ Runs when a custom event with this name reaches the blueprint root (see "Send event"). Lets blueprints talk to each other.
49
+
50
+ - **Inputs:** —
51
+ - **Outputs:** `exec`, `any` Data, `element` Sender
52
+ - **Settings:** Event name (`name` = `"my-event"`)
53
+
54
+ ## Flow
55
+
56
+ ### Branch — `flow.branch`
57
+
58
+ If the condition is true, runs "True", otherwise "False".
59
+
60
+ - **Inputs:** `exec`, `boolean` Condition = `false`
61
+ - **Outputs:** `exec` True, `exec` False
62
+
63
+ ### Sequence — `flow.sequence`
64
+
65
+ Runs the outputs one after another, top to bottom.
66
+
67
+ *pins depend on the settings*
68
+
69
+ - **Inputs:** `exec`
70
+ - **Outputs:** `exec` Then 0, `exec` Then 1
71
+ - **Settings:** Outputs (`count` = `2`)
72
+
73
+ ### Delay — `flow.delay`
74
+
75
+ Waits, then continues.
76
+
77
+ - **Inputs:** `exec`, `number` Milliseconds = `300`
78
+ - **Outputs:** `exec`
79
+
80
+ ### Debounce — `flow.debounce`
81
+
82
+ Continues only after calls stop for the given time (typing, resizing).
83
+
84
+ - **Inputs:** `exec`, `number` Milliseconds = `300`
85
+ - **Outputs:** `exec`
86
+
87
+ ### Throttle — `flow.throttle`
88
+
89
+ Continues at most once per the given time.
90
+
91
+ - **Inputs:** `exec`, `number` Milliseconds = `200`
92
+ - **Outputs:** `exec`
93
+
94
+ ### Do once — `flow.doOnce`
95
+
96
+ Continues only the first time, until "Reset" is run.
97
+
98
+ - **Inputs:** `exec`, `exec` Reset
99
+ - **Outputs:** `exec`
100
+
101
+ ### For each — `flow.forEach`
102
+
103
+ Runs "Loop body" for every item (elements found by a selector, an array…), then "Completed".
104
+
105
+ - **Inputs:** `exec`, `any` Items
106
+ - **Outputs:** `exec` Loop body, `any` Item, `number` Index, `exec` Completed
107
+
108
+ ### Switch — `flow.switch`
109
+
110
+ Runs the output whose case equals the value, otherwise "Default". Cases are comma-separated.
111
+
112
+ *pins depend on the settings*
113
+
114
+ - **Inputs:** `exec`, `any` Value
115
+ - **Outputs:** `exec` a, `exec` b, `exec` Default
116
+ - **Settings:** Cases (`cases` = `"a, b"`)
117
+
118
+ ## DOM
119
+
120
+ ### Find elements — `dom.query`
121
+
122
+ Finds elements by a CSS selector: in the whole document (or component), inside the given elements, or the closest ancestor of them.
123
+
124
+ - **Inputs:** `string` Selector, `elements` From
125
+ - **Outputs:** `elements` Elements, `element` First, `number` Count
126
+ - **Settings:** Where (`mode` = `"all"`; `all` `within` `closest`)
127
+
128
+ ### Root element — `dom.root`
129
+
130
+ The component element (component blueprints) or <html> (page blueprints).
131
+
132
+ - **Inputs:** —
133
+ - **Outputs:** `element` Element
134
+
135
+ ### Add class — `dom.addClass`
136
+
137
+ Adds class(es) to the elements. Several classes: separate with spaces.
138
+
139
+ - **Inputs:** `exec`, `elements` Target, `string` Class
140
+ - **Outputs:** `exec`
141
+
142
+ ### Remove class — `dom.removeClass`
143
+
144
+ Removes class(es) from the elements.
145
+
146
+ - **Inputs:** `exec`, `elements` Target, `string` Class
147
+ - **Outputs:** `exec`
148
+
149
+ ### Toggle class — `dom.toggleClass`
150
+
151
+ Adds the class if it is missing, removes it otherwise.
152
+
153
+ - **Inputs:** `exec`, `elements` Target, `string` Class
154
+ - **Outputs:** `exec`
155
+
156
+ ### Has class — `dom.hasClass`
157
+
158
+ True if any of the elements has the class.
159
+
160
+ - **Inputs:** `elements` Target, `string` Class
161
+ - **Outputs:** `boolean` Result
162
+
163
+ ### Matches selector — `dom.matches`
164
+
165
+ True if the element matches the CSS selector (e.g. the click was on the backdrop itself).
166
+
167
+ - **Inputs:** `element` Element, `string` Selector
168
+ - **Outputs:** `boolean` Result
169
+
170
+ ### Set attribute — `dom.setAttribute`
171
+
172
+ Sets an attribute (aria-expanded, data-state…).
173
+
174
+ - **Inputs:** `exec`, `elements` Target, `string` Name, `string` Value
175
+ - **Outputs:** `exec`
176
+
177
+ ### Remove attribute — `dom.removeAttribute`
178
+
179
+ Removes an attribute.
180
+
181
+ - **Inputs:** `exec`, `elements` Target, `string` Name
182
+ - **Outputs:** `exec`
183
+
184
+ ### Get attribute — `dom.getAttribute`
185
+
186
+ Attribute of the first element (empty string if missing).
187
+
188
+ - **Inputs:** `elements` Target, `string` Name
189
+ - **Outputs:** `string` Value
190
+
191
+ ### Set style — `dom.setStyle`
192
+
193
+ Sets an inline CSS property (empty value removes it).
194
+
195
+ - **Inputs:** `exec`, `elements` Target, `string` Property, `string` Value
196
+ - **Outputs:** `exec`
197
+
198
+ ### Set text — `dom.setText`
199
+
200
+ Replaces the text of the elements (safe: no HTML is parsed).
201
+
202
+ - **Inputs:** `exec`, `elements` Target, `string` Text
203
+ - **Outputs:** `exec`
204
+
205
+ ### Get text — `dom.getText`
206
+
207
+ Text of the first element.
208
+
209
+ - **Inputs:** `elements` Target
210
+ - **Outputs:** `string` Text
211
+
212
+ ### Set HTML (unsafe) — `dom.setHtml`
213
+
214
+ Replaces the inner HTML. Never pass user input here: it can run scripts (XSS). Prefer "Set text".
215
+
216
+ - **Inputs:** `exec`, `elements` Target, `string` HTML
217
+ - **Outputs:** `exec`
218
+
219
+ ### Get value — `dom.getValue`
220
+
221
+ Value of the first form field (checkbox: checked or not).
222
+
223
+ - **Inputs:** `elements` Target
224
+ - **Outputs:** `any` Value
225
+
226
+ ### Set value — `dom.setValue`
227
+
228
+ Sets the value of form fields (checkbox: checks when the value is truthy).
229
+
230
+ - **Inputs:** `exec`, `elements` Target, `any` Value
231
+ - **Outputs:** `exec`
232
+
233
+ ### Show — `dom.show`
234
+
235
+ Makes hidden elements visible (removes display: none / hidden).
236
+
237
+ - **Inputs:** `exec`, `elements` Target
238
+ - **Outputs:** `exec`
239
+
240
+ ### Hide — `dom.hide`
241
+
242
+ Hides the elements (display: none).
243
+
244
+ - **Inputs:** `exec`, `elements` Target
245
+ - **Outputs:** `exec`
246
+
247
+ ### Show / hide — `dom.toggleVisible`
248
+
249
+ Shows hidden elements and hides visible ones.
250
+
251
+ - **Inputs:** `exec`, `elements` Target
252
+ - **Outputs:** `exec`
253
+
254
+ ### Is visible — `dom.isVisible`
255
+
256
+ True if the first element is displayed.
257
+
258
+ - **Inputs:** `elements` Target
259
+ - **Outputs:** `boolean` Result
260
+
261
+ ### Focus — `dom.focus`
262
+
263
+ Moves keyboard focus to the element.
264
+
265
+ - **Inputs:** `exec`, `elements` Target
266
+ - **Outputs:** `exec`
267
+
268
+ ### Scroll to — `dom.scrollIntoView`
269
+
270
+ Scrolls the page to the element.
271
+
272
+ - **Inputs:** `exec`, `elements` Target, `boolean` Smooth = `true`
273
+ - **Outputs:** `exec`
274
+
275
+ ### Send event — `dom.dispatch`
276
+
277
+ Sends a custom event from the elements (bubbles). Other blueprints catch it with "On custom event". Empty target = blueprint root.
278
+
279
+ - **Inputs:** `exec`, `elements` Target, `string` Event name = `"my-event"`, `any` Data
280
+ - **Outputs:** `exec`
281
+
282
+ ### Prevent default — `event.preventDefault`
283
+
284
+ Stops the browser action of the event (following a link, submitting a form).
285
+
286
+ - **Inputs:** `exec`, `event` Event
287
+ - **Outputs:** `exec`
288
+
289
+ ### Event target — `event.target`
290
+
291
+ The element the event actually happened on (may be a child of the listened element).
292
+
293
+ - **Inputs:** `event` Event
294
+ - **Outputs:** `element` Target
295
+
296
+ ## Data
297
+
298
+ ### Text — `data.string`
299
+
300
+ A string value.
301
+
302
+ - **Inputs:** `string` Value
303
+ - **Outputs:** `string` Value
304
+
305
+ ### Number — `data.number`
306
+
307
+ A number value.
308
+
309
+ - **Inputs:** `number` Value = `0`
310
+ - **Outputs:** `number` Value
311
+
312
+ ### Boolean — `data.boolean`
313
+
314
+ A boolean value.
315
+
316
+ - **Inputs:** `boolean` Value = `false`
317
+ - **Outputs:** `boolean` Value
318
+
319
+ ### Join text — `string.concat`
320
+
321
+ Joins two texts with an optional separator.
322
+
323
+ - **Inputs:** `string` A, `string` B, `string` Separator
324
+ - **Outputs:** `string` Result
325
+
326
+ ### To number — `convert.number`
327
+
328
+ Converts a value to a number (0 if it is not a number).
329
+
330
+ - **Inputs:** `any` Value
331
+ - **Outputs:** `number` Number
332
+
333
+ ### To text — `convert.string`
334
+
335
+ Converts a value to text (objects as JSON).
336
+
337
+ - **Inputs:** `any` Value
338
+ - **Outputs:** `string` Text
339
+
340
+ ### Read from storage — `storage.get`
341
+
342
+ Value saved in the browser (localStorage) under the key; empty text if none.
343
+
344
+ - **Inputs:** `string` Key
345
+ - **Outputs:** `string` Value
346
+
347
+ ### Save to storage — `storage.set`
348
+
349
+ Saves a value in the browser (localStorage); it survives reloads.
350
+
351
+ - **Inputs:** `exec`, `string` Key, `string` Value
352
+ - **Outputs:** `exec`
353
+
354
+ ### Object (JSON) — `data.object`
355
+
356
+ An object or array written as JSON — for library options: `{ "loop": true, "speed": 600 }`.
357
+
358
+ - **Inputs:** —
359
+ - **Outputs:** `object` Object
360
+ - **Settings:** JSON (`json`)
361
+
362
+ ## Variables
363
+
364
+ ### Get variable — `var.get`
365
+
366
+ Value of a blueprint variable.
367
+
368
+ - **Inputs:** —
369
+ - **Outputs:** `any` Value
370
+ - **Settings:** Variable (`variable`)
371
+
372
+ ### Set variable — `var.set`
373
+
374
+ Stores a value in a blueprint variable (kept while the page is open).
375
+
376
+ - **Inputs:** `exec`, `any` Value
377
+ - **Outputs:** `exec`, `any` Value
378
+ - **Settings:** Variable (`variable`)
379
+
380
+ ### Component parameter — `component.param`
381
+
382
+ Value of a component parameter (set in the component traits). Component blueprints only.
383
+
384
+ - **Inputs:** —
385
+ - **Outputs:** `any` Value
386
+ - **Settings:** Parameter (`param`)
387
+
388
+ ## Math
389
+
390
+ ### Math — `math.op`
391
+
392
+ Arithmetic on two numbers. Division by zero gives 0.
393
+
394
+ - **Inputs:** `number` A = `0`, `number` B = `0`
395
+ - **Outputs:** `number` Result
396
+ - **Settings:** Operation (`op` = `"+"`; `+` `-` `*` `/` `%` `min` `max` `pow`)
397
+
398
+ ## Logic
399
+
400
+ ### Compare — `logic.compare`
401
+
402
+ Compares two values. "==" compares loosely ("1" equals 1).
403
+
404
+ - **Inputs:** `any` A, `any` B
405
+ - **Outputs:** `boolean` Result
406
+ - **Settings:** Operator (`op` = `"=="`; `==` `!=` `<` `>` `<=` `>=`)
407
+
408
+ ### AND — `logic.and`
409
+
410
+ True if both are true.
411
+
412
+ - **Inputs:** `boolean` A = `false`, `boolean` B = `false`
413
+ - **Outputs:** `boolean` Result
414
+
415
+ ### OR — `logic.or`
416
+
417
+ True if at least one is true.
418
+
419
+ - **Inputs:** `boolean` A = `false`, `boolean` B = `false`
420
+ - **Outputs:** `boolean` Result
421
+
422
+ ### NOT — `logic.not`
423
+
424
+ Inverts a boolean.
425
+
426
+ - **Inputs:** `boolean` Value = `false`
427
+ - **Outputs:** `boolean` Result
428
+
429
+ ## Code
430
+
431
+ ### JavaScript — `code.js`
432
+
433
+ Your own code. Inputs come in `inputs`, return an object with the outputs (`return { result: 42 };`). `ctx` has `root`, `document`, `window`, `params`. With "Async", return a Promise: the chain continues when it resolves.
434
+
435
+ *pins depend on the settings*
436
+
437
+ - **Inputs:** `exec`, `any` value
438
+ - **Outputs:** `exec`, `any` result
439
+ - **Settings:** Code (`code`), Inputs (`inputs` = `[{"id":"value","type":"any"}]`), Outputs (`outputs` = `[{"id":"result","type":"any"}]`), Async (`async` = `false`)
440
+
441
+ ### Expression — `code.expression`
442
+
443
+ A JavaScript expression of `a` and `b`, e.g. `a * 2 + b` or `a.trim()`.
444
+
445
+ - **Inputs:** `any` a, `any` b
446
+ - **Outputs:** `any` Result
447
+ - **Settings:** Expression (`expression`)
448
+
449
+ ### Call function — `lib.call`
450
+
451
+ Calls a global function, e.g. a library one: `gsap.to`, `AOS.init`, `alert`. Arguments are passed in order.
452
+
453
+ *pins depend on the settings*
454
+
455
+ - **Inputs:** `exec`, `any` Argument 1
456
+ - **Outputs:** `exec`, `any` Result
457
+ - **Settings:** Function (`fn` = `"console.log"`), Arguments (`args` = `1`)
458
+
459
+ ### Create object — `lib.new`
460
+
461
+ Creates an object of a library class: `new Swiper(element, options)`, `new Chart(canvas, config)`.
462
+
463
+ *pins depend on the settings*
464
+
465
+ - **Inputs:** `exec`, `any` Argument 1, `any` Argument 2
466
+ - **Outputs:** `exec`, `object` Object
467
+ - **Settings:** Class (`cls` = `"Swiper"`), Arguments (`args` = `2`)
468
+
469
+ ### Call method — `lib.method`
470
+
471
+ Calls a method of an object, e.g. `slideNext` of a Swiper, `play` of a video element.
472
+
473
+ *pins depend on the settings*
474
+
475
+ - **Inputs:** `exec`, `any` Object
476
+ - **Outputs:** `exec`, `any` Result
477
+ - **Settings:** Method (`method`), Arguments (`args` = `0`)
478
+
479
+ ### Global value — `lib.get`
480
+
481
+ Reads a global value: `location.pathname`, `innerWidth`, a library object.
482
+
483
+ - **Inputs:** —
484
+ - **Outputs:** `any` Value
485
+ - **Settings:** Name (`name` = `"location.pathname"`)
486
+
487
+ ## Debug
488
+
489
+ ### Print to console — `debug.log`
490
+
491
+ Writes a value to the browser console.
492
+
493
+ - **Inputs:** `exec`, `string` Label, `any` Value
494
+ - **Outputs:** `exec`