create-mendix-widget-gleam 2.0.19 → 3.0.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 (71) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/src/i18n.mjs +394 -334
  4. package/src/index.mjs +284 -231
  5. package/src/licenses.mjs +147 -0
  6. package/src/prompts.mjs +247 -142
  7. package/src/scaffold.mjs +108 -97
  8. package/src/templates/claude_md.mjs +7 -6
  9. package/src/templates/readme_md.mjs +88 -76
  10. package/src/templates/widgets_readme.mjs +18 -15
  11. package/template/docs/glendix_guide.md +1050 -2538
  12. package/template/gleam.toml +5 -2
  13. package/template/package.json +10 -7
  14. package/template/src/__WidgetName__.xml +1 -1
  15. package/template/src/__widget_name__.gleam +3 -3
  16. package/template/src/components/hello_world.gleam +5 -5
  17. package/template/src/editor_config.gleam +4 -8
  18. package/template/src/editor_preview.gleam +3 -3
  19. package/template/src/package.xml +2 -2
  20. package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@command.cache +0 -0
  21. package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@cursor.cache +0 -0
  22. package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@cursor.cache_meta +0 -0
  23. package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@event.cache +0 -0
  24. package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@internal@consts.cache +0 -0
  25. package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@stdout.cache +0 -0
  26. package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@style.cache +0 -0
  27. package/tui/build/dev/javascript/etch/_gleam_artefacts/etch@terminal.cache +0 -0
  28. package/tui/build/dev/javascript/etch/etch/event.mjs +36 -30
  29. package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@application.cache +0 -0
  30. package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@atom.cache +0 -0
  31. package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@charlist.cache +0 -0
  32. package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@node.cache +0 -0
  33. package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@port.cache +0 -0
  34. package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@process.cache +0 -0
  35. package/tui/build/dev/javascript/gleam_erlang/_gleam_artefacts/gleam@erlang@reference.cache +0 -0
  36. package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@array.cache +0 -0
  37. package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@promise.cache +0 -0
  38. package/tui/build/dev/javascript/gleam_javascript/_gleam_artefacts/gleam@javascript@symbol.cache +0 -0
  39. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bit_array.cache +0 -0
  40. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bool.cache +0 -0
  41. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bool.cache_inline +0 -0
  42. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@bytes_tree.cache +0 -0
  43. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dict.cache +0 -0
  44. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic.cache +0 -0
  45. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic@decode.cache +0 -0
  46. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@dynamic@decode.cache_meta +0 -0
  47. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@float.cache +0 -0
  48. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@function.cache +0 -0
  49. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@int.cache +0 -0
  50. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@io.cache +0 -0
  51. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@list.cache +0 -0
  52. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@option.cache +0 -0
  53. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@order.cache +0 -0
  54. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@pair.cache +0 -0
  55. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@result.cache +0 -0
  56. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@result.cache_inline +0 -0
  57. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@set.cache +0 -0
  58. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string.cache +0 -0
  59. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string.cache_meta +0 -0
  60. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@string_tree.cache +0 -0
  61. package/tui/build/dev/javascript/gleam_stdlib/_gleam_artefacts/gleam@uri.cache +0 -0
  62. package/tui/build/dev/javascript/gleam_version +1 -1
  63. package/tui/build/dev/javascript/prelude.mjs +10 -26
  64. package/tui/build/dev/javascript/tui/_gleam_artefacts/tui.cache +0 -0
  65. package/tui/build/dev/javascript/tui/_gleam_artefacts/tui.cache_meta +0 -0
  66. package/tui/build/dev/javascript/tui/_gleam_artefacts/tui@prompt.cache +0 -0
  67. package/tui/build/dev/javascript/tui/_gleam_artefacts/tui@prompt.cache_meta +0 -0
  68. package/tui/build/dev/javascript/tui/tui/prompt.mjs +713 -52
  69. package/tui/build/dev/javascript/tui/tui.mjs +438 -51
  70. package/tui/build/dev/javascript/tui/tui_ffi.mjs +12 -0
  71. package/template/LICENSE +0 -15
@@ -1,5 +1,5 @@
1
1
  name = "{{SNAKE_CASE}}"
2
- version = "1.0.0"
2
+ version = "{{VERSION}}"
3
3
  target = "javascript"
4
4
 
5
5
  [javascript]
@@ -8,4 +8,7 @@ runtime = "node"
8
8
 
9
9
  [dependencies]
10
10
  gleam_stdlib = ">= 0.44.0 and < 2.0.0"
11
- glendix = ">= 2.0.19 and < 3.0.0"
11
+ glendix = ">= 3.0.0 and < 4.0.0"
12
+ redraw = ">= 19.2.2 and < 20.0.0"
13
+ redraw_dom = ">= 19.2.2 and < 20.0.0"
14
+ lustre = ">= 5.6.0 and < 6.0.0"
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "{{LOWERCASE}}",
3
3
  "widgetName": "{{PASCAL_CASE}}",
4
- "version": "1.0.0",
4
+ "version": "{{VERSION}}",
5
5
  "description": "My widget description",
6
- "copyright": "© Mendix Technology BV 2026. All rights reserved.",
7
- "author": "",
6
+ "copyright": "{{COPYRIGHT}}",
7
+ "author": "{{AUTHOR}}",
8
8
  "engines": {
9
9
  "node": ">=16"
10
10
  },
11
- "license": "Apache-2.0",
11
+ "license": "{{LICENSE_ID}}",
12
12
  "config": {
13
- "projectPath": "./tests/testProject",
13
+ "projectPath": "{{PROJECT_PATH}}",
14
14
  "mendixHost": "http://localhost:8080",
15
15
  "developmentPort": 3000
16
16
  },
17
- "packagePath": "mendix",
17
+ "packagePath": "{{ORGANIZATION}}",
18
18
  "scripts": {
19
19
  "prerelease": "echo skipping lint"
20
20
  },
@@ -23,7 +23,10 @@
23
23
  "playwright": "^1.58.2"
24
24
  },
25
25
  "dependencies": {
26
- "classnames": "^2.5.1"
26
+ "classnames": "^2.5.1",
27
+ "react": "^19.0.0",
28
+ "react-dom": "^19.0.0",
29
+ "big.js": "^6.0.0"
27
30
  },
28
31
  "resolutions": {
29
32
  "react": "^19.0.0",
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <widget id="mendix.{{LOWERCASE}}.{{PASCAL_CASE}}" pluginWidget="true" needsEntityContext="true" offlineCapable="true"
2
+ <widget id="{{ORGANIZATION}}.{{LOWERCASE}}.{{PASCAL_CASE}}" pluginWidget="true" needsEntityContext="true" offlineCapable="true"
3
3
  supportedPlatform="Web"
4
4
  xmlns="http://www.mendix.com/widget/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
5
  xsi:schemaLocation="http://www.mendix.com/widget/1.0/ ../node_modules/mendix/custom_widget.xsd">
@@ -2,11 +2,11 @@
2
2
  {{I18N:widget_main_2}}
3
3
 
4
4
  import components/hello_world
5
- import glendix/mendix
6
- import glendix/react.{type JsProps, type ReactElement}
5
+ import glendix/mendix.{type JsProps}
6
+ import redraw.{type Element}
7
7
 
8
8
  {{I18N:widget_main_doc}}
9
- pub fn widget(props: JsProps) -> ReactElement {
9
+ pub fn widget(props: JsProps) -> Element {
10
10
  let sample_text = mendix.get_string_prop(props, "sampleText")
11
11
  hello_world.render(sample_text)
12
12
  }
@@ -1,13 +1,13 @@
1
1
  {{I18N:hello_world_1}}
2
2
  {{I18N:hello_world_2}}
3
3
 
4
- import glendix/react.{type ReactElement}
5
- import glendix/react/attribute
6
- import glendix/react/html
4
+ import redraw.{type Element}
5
+ import redraw/dom/attribute
6
+ import redraw/dom/html
7
7
 
8
8
  {{I18N:hello_world_doc}}
9
- pub fn render(sample_text: String) -> ReactElement {
9
+ pub fn render(sample_text: String) -> Element {
10
10
  html.div([attribute.class("widget-hello-world")], [
11
- react.text("Hello " <> sample_text),
11
+ html.text("Hello " <> sample_text),
12
12
  ])
13
13
  }
@@ -1,18 +1,14 @@
1
1
  {{I18N:editor_config_1}}
2
2
  {{I18N:editor_config_2}}
3
3
 
4
- {{I18N:editor_config_3}}
5
- pub type Values
6
-
7
- pub type Properties
8
-
9
- pub type Target
4
+ import glendix/editor_config.{type Properties}
5
+ import glendix/mendix.{type JsProps}
10
6
 
11
7
  {{I18N:editor_config_doc}}
12
8
  pub fn get_properties(
13
- _values: Values,
9
+ _values: JsProps,
14
10
  default_properties: Properties,
15
- _target: Target,
11
+ _platform: String,
16
12
  ) -> Properties {
17
13
  default_properties
18
14
  }
@@ -2,11 +2,11 @@
2
2
  {{I18N:editor_preview_2}}
3
3
 
4
4
  import components/hello_world
5
- import glendix/mendix
6
- import glendix/react.{type JsProps, type ReactElement}
5
+ import glendix/mendix.{type JsProps}
6
+ import redraw.{type Element}
7
7
 
8
8
  {{I18N:editor_preview_doc}}
9
- pub fn preview(props: JsProps) -> ReactElement {
9
+ pub fn preview(props: JsProps) -> Element {
10
10
  let sample_text = mendix.get_string_prop(props, "sampleText")
11
11
  hello_world.render(sample_text)
12
12
  }
@@ -1,11 +1,11 @@
1
1
  <?xml version="1.0" encoding="utf-8" ?>
2
2
  <package xmlns="http://www.mendix.com/package/1.0/">
3
- <clientModule name="{{PASCAL_CASE}}" version="1.0.0" xmlns="http://www.mendix.com/clientModule/1.0/">
3
+ <clientModule name="{{PASCAL_CASE}}" version="{{VERSION}}" xmlns="http://www.mendix.com/clientModule/1.0/">
4
4
  <widgetFiles>
5
5
  <widgetFile path="{{PASCAL_CASE}}.xml"/>
6
6
  </widgetFiles>
7
7
  <files>
8
- <file path="mendix/{{LOWERCASE}}"/>
8
+ <file path="{{ORGANIZATION}}/{{LOWERCASE}}"/>
9
9
  </files>
10
10
  </clientModule>
11
11
  </package>
@@ -953,11 +953,13 @@ export function parse_modifier_to_state(modifier_mask) {
953
953
  let state = new KeyEventState(false, false, false);
954
954
  let _block;
955
955
  let $ = modifier_mask - 1;
956
- let n = $;
957
- if (n < 0) {
958
- _block = 0;
959
- } else {
960
- _block = $;
956
+ {
957
+ let n = $;
958
+ if (n < 0) {
959
+ _block = 0;
960
+ } else {
961
+ _block = $;
962
+ }
961
963
  }
962
964
  let mask = _block;
963
965
  let _block$1;
@@ -1123,7 +1125,7 @@ export function parse_cb(code) {
1123
1125
  _block = $result.unwrap(_pipe, 0);
1124
1126
  let code$1 = _block;
1125
1127
  let _block$1;
1126
- let _pipe$1 = $int.bitwise_and(code$1, 0b0011);
1128
+ let _pipe$1 = $int.bitwise_and(code$1, 0b11);
1127
1129
  _block$1 = $int.bitwise_or(
1128
1130
  _pipe$1,
1129
1131
  (() => {
@@ -1411,11 +1413,13 @@ export function parse_sgr_mouse(s) {
1411
1413
  export function parse_modifiers(code) {
1412
1414
  let _block;
1413
1415
  let $ = code - 1;
1414
- let x = $;
1415
- if (x < 0) {
1416
- _block = 0;
1417
- } else {
1418
- _block = $;
1416
+ {
1417
+ let x = $;
1418
+ if (x < 0) {
1419
+ _block = 0;
1420
+ } else {
1421
+ _block = $;
1422
+ }
1419
1423
  }
1420
1424
  let mask = _block;
1421
1425
  return new Modifiers(
@@ -1848,31 +1852,33 @@ export function parse_special_key_code(code) {
1848
1852
  _block$2 = new Ok(new PageDown());
1849
1853
  } else {
1850
1854
  let k = key$1;
1851
- let k$1 = k;
1852
- if ((k$1 >= 11) && (k$1 <= 15)) {
1853
- _block$2 = new Ok(new F(k$1 - 10));
1854
- } else {
1855
+ {
1855
1856
  let k$1 = k;
1856
- if ((k$1 >= 17) && (k$1 <= 21)) {
1857
- _block$2 = new Ok(new F(k$1 - 11));
1857
+ if ((k$1 >= 11) && (k$1 <= 15)) {
1858
+ _block$2 = new Ok(new F(k$1 - 10));
1858
1859
  } else {
1859
1860
  let k$1 = k;
1860
- if ((k$1 >= 23) && (k$1 <= 26)) {
1861
- _block$2 = new Ok(new F(k$1 - 12));
1862
- } else if (k === 28) {
1863
- _block$2 = new Ok(new F(k - 15));
1864
- } else if (k === 29) {
1865
- _block$2 = new Ok(new F(k - 15));
1861
+ if ((k$1 >= 17) && (k$1 <= 21)) {
1862
+ _block$2 = new Ok(new F(k$1 - 11));
1866
1863
  } else {
1867
1864
  let k$1 = k;
1868
- if ((k$1 >= 31) && (k$1 <= 34)) {
1869
- _block$2 = new Ok(new F(k$1 - 17));
1865
+ if ((k$1 >= 23) && (k$1 <= 26)) {
1866
+ _block$2 = new Ok(new F(k$1 - 12));
1867
+ } else if (k === 28) {
1868
+ _block$2 = new Ok(new F(k - 15));
1869
+ } else if (k === 29) {
1870
+ _block$2 = new Ok(new F(k - 15));
1870
1871
  } else {
1871
- _block$2 = new Error(
1872
- new FailedToParseEvent(
1873
- "Failed to parse special key code (CSI <..> ~)",
1874
- ),
1875
- );
1872
+ let k$1 = k;
1873
+ if ((k$1 >= 31) && (k$1 <= 34)) {
1874
+ _block$2 = new Ok(new F(k$1 - 17));
1875
+ } else {
1876
+ _block$2 = new Error(
1877
+ new FailedToParseEvent(
1878
+ "Failed to parse special key code (CSI <..> ~)",
1879
+ ),
1880
+ );
1881
+ }
1876
1882
  }
1877
1883
  }
1878
1884
  }
@@ -1 +1 @@
1
- 1.14.0
1
+ 1.15.1
@@ -262,16 +262,11 @@ export class BitArray {
262
262
  /**
263
263
  * Returns this bit array's internal buffer.
264
264
  *
265
- * @deprecated Use `BitArray.byteAt()` or `BitArray.rawBuffer` instead.
265
+ * @deprecated
266
266
  *
267
267
  * @returns {Uint8Array}
268
268
  */
269
269
  get buffer() {
270
- bitArrayPrintDeprecationWarning(
271
- "buffer",
272
- "Use BitArray.byteAt() or BitArray.rawBuffer instead",
273
- );
274
-
275
270
  if (this.bitOffset !== 0 || this.bitSize % 8 !== 0) {
276
271
  throw new globalThis.Error(
277
272
  "BitArray.buffer does not support unaligned bit arrays",
@@ -284,16 +279,11 @@ export class BitArray {
284
279
  /**
285
280
  * Returns the length in bytes of this bit array's internal buffer.
286
281
  *
287
- * @deprecated Use `BitArray.bitSize` or `BitArray.byteSize` instead.
282
+ * @deprecated
288
283
  *
289
284
  * @returns {number}
290
285
  */
291
286
  get length() {
292
- bitArrayPrintDeprecationWarning(
293
- "length",
294
- "Use BitArray.bitSize or BitArray.byteSize instead",
295
- );
296
-
297
287
  if (this.bitOffset !== 0 || this.bitSize % 8 !== 0) {
298
288
  throw new globalThis.Error(
299
289
  "BitArray.length does not support unaligned bit arrays",
@@ -306,6 +296,13 @@ export class BitArray {
306
296
 
307
297
  export const BitArray$BitArray = (buffer, bitSize, bitOffset) =>
308
298
  new BitArray(buffer, bitSize, bitOffset);
299
+ export const BitArray$isBitArray = (value) => value instanceof BitArray;
300
+ export const BitArray$BitArray$data = (bitArray) => {
301
+ if (bitArray.bitSize % 8 !== 0)
302
+ throw new Error("BitArray$BitArray$data called on un-aligned bit array");
303
+ const array = bitArray.rawBuffer;
304
+ return new DataView(array.buffer, array.byteOffset, bitArray.byteLength);
305
+ };
309
306
 
310
307
  /**
311
308
  * Returns the nth byte in the given buffer, after applying the specified bit
@@ -333,19 +330,6 @@ export class UtfCodepoint {
333
330
  }
334
331
  }
335
332
 
336
- const isBitArrayDeprecationMessagePrinted = {};
337
- function bitArrayPrintDeprecationWarning(name, message) {
338
- if (isBitArrayDeprecationMessagePrinted[name]) {
339
- return;
340
- }
341
-
342
- console.warn(
343
- `Deprecated BitArray.${name} property used in JavaScript FFI code. ${message}.`,
344
- );
345
-
346
- isBitArrayDeprecationMessagePrinted[name] = true;
347
- }
348
-
349
333
  /**
350
334
  * Slices a bit array to produce a new bit array. If `end` is not supplied then
351
335
  * all bits from `start` onward are returned.
@@ -514,7 +498,7 @@ export function bitArraySliceToInt(
514
498
 
515
499
  // Handle the case of the slice being completely contained in a single byte
516
500
  if (startByteIndex == endByteIndex) {
517
- const mask = 0xff >> start % 8;
501
+ const mask = 0xff >> (start % 8);
518
502
  const unusedLowBitCount = (8 - (end % 8)) % 8;
519
503
 
520
504
  let value =