@nsis/dent-ui 0.3.1 → 0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @nsis/dent-ui
2
2
 
3
+ ## 0.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 700ed2a: add commentStyle option
8
+ - Updated dependencies [700ed2a]
9
+ - @nsis/dent@0.16.0
10
+
11
+ ## 0.3.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [3772875]
16
+ - @nsis/dent@0.15.0
17
+
3
18
  ## 0.3.1
4
19
 
5
20
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsis/dent-ui",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Web UI for the Dent NSIS code formatter",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,23 +25,23 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@codemirror/commands": "^6.10.4",
28
+ "@codemirror/commands": "^6.11.0",
29
29
  "@codemirror/language": "^6.12.4",
30
30
  "@codemirror/state": "^6.7.1",
31
- "@codemirror/view": "^6.43.8",
31
+ "@codemirror/view": "^6.43.9",
32
32
  "@lezer/highlight": "^1.2.3",
33
33
  "@nsis/codemirror": "0.14.5",
34
- "@nsis/dent": "0.14.1",
35
- "svelte": "^5.56.9"
34
+ "@nsis/dent": "0.16.0",
35
+ "svelte": "^5.56.10"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@sveltejs/vite-plugin-svelte": "^7.3.0",
39
- "@vitest/browser": "^4.1.10",
40
- "@vitest/browser-playwright": "^4.1.10",
39
+ "@vitest/browser": "^4.1.11",
40
+ "@vitest/browser-playwright": "^4.1.11",
41
41
  "playwright": "^1.62.1",
42
42
  "svelte-check": "^4.7.6",
43
- "vite": "^8.2.1",
44
- "vitest": "^4.1.10",
43
+ "vite": "^8.2.2",
44
+ "vitest": "^4.1.11",
45
45
  "vitest-browser-svelte": "^3.0.0"
46
46
  },
47
47
  "scripts": {
package/src/App.svelte CHANGED
@@ -18,6 +18,7 @@ let trimEmptyLines = $state(true);
18
18
  let indentSize = $state(2);
19
19
  let printWidth = $state(120);
20
20
  let endOfLine = $state<'lf' | 'crlf'>('lf');
21
+ let commentStyle = $state<'preserve' | 'hash' | 'semi'>('preserve');
21
22
  let autoFormat = $state(true);
22
23
 
23
24
  let status = $state('');
@@ -85,6 +86,7 @@ function formatInput() {
85
86
  indentSize,
86
87
  printWidth,
87
88
  endOfLine,
89
+ commentStyle: commentStyle === 'preserve' ? undefined : commentStyle,
88
90
  });
89
91
  setOutput(format(source));
90
92
  clearTimeout(statusTimer);
@@ -191,6 +193,14 @@ const outputExtensions = [EditorState.readOnly.of(true), EditorView.lineWrapping
191
193
  <option value="crlf">CRLF</option>
192
194
  </select>
193
195
  </label>
196
+ <label>
197
+ Comments
198
+ <select bind:value={commentStyle} onchange={scheduleAutoFormat}>
199
+ <option value="preserve">Preserve</option>
200
+ <option value="hash">Hash</option>
201
+ <option value="semi">Semicolon</option>
202
+ </select>
203
+ </label>
194
204
  </fieldset>
195
205
  <select
196
206
  class="theme-select"
package/test/App.test.ts CHANGED
@@ -54,6 +54,20 @@ describe('App', () => {
54
54
  await expect.element(page.getByRole('button', { name: 'Copy' })).toBeEnabled();
55
55
  });
56
56
 
57
+ it('renders the comment style selector defaulting to preserve', async () => {
58
+ render(App);
59
+
60
+ await expect.element(page.getByRole('combobox', { name: 'Comments' })).toHaveValue('preserve');
61
+ });
62
+
63
+ it('rewrites comment markers when a comment style is picked', async () => {
64
+ render(App, { props: { sample: '; hello\nSection\nnop\nSectionEnd\n' } });
65
+
66
+ await page.getByRole('combobox', { name: 'Comments' }).selectOptions('hash');
67
+
68
+ await expect.element(page.getByLabelText('Formatted output editor')).toHaveTextContent('# hello');
69
+ });
70
+
57
71
  it('renders both editor panes', async () => {
58
72
  render(App);
59
73