@nsis/dent-ui 0.3.2 → 0.3.4

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,22 @@
1
1
  # @nsis/dent-ui
2
2
 
3
+ ## 0.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [8e7bb0a]
8
+ - Updated dependencies [271970b]
9
+ - @nsis/codemirror@0.14.6
10
+ - @nsis/dent@0.16.1
11
+
12
+ ## 0.3.3
13
+
14
+ ### Patch Changes
15
+
16
+ - 700ed2a: add commentStyle option
17
+ - Updated dependencies [700ed2a]
18
+ - @nsis/dent@0.16.0
19
+
3
20
  ## 0.3.2
4
21
 
5
22
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsis/dent-ui",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Web UI for the Dent NSIS code formatter",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,24 +25,24 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@codemirror/commands": "^6.10.4",
28
+ "@codemirror/commands": "^6.11.1",
29
29
  "@codemirror/language": "^6.12.4",
30
- "@codemirror/state": "^6.7.1",
31
- "@codemirror/view": "^6.43.8",
30
+ "@codemirror/state": "^6.7.5",
31
+ "@codemirror/view": "^6.43.12",
32
32
  "@lezer/highlight": "^1.2.3",
33
- "@nsis/codemirror": "0.14.5",
34
- "@nsis/dent": "0.15.0",
35
- "svelte": "^5.56.9"
33
+ "@nsis/codemirror": "0.14.6",
34
+ "@nsis/dent": "0.16.1",
35
+ "svelte": "^5.57.0"
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",
41
- "playwright": "^1.62.1",
39
+ "@vitest/browser": "^5.0.1",
40
+ "@vitest/browser-playwright": "^5.0.1",
41
+ "playwright": "^1.63.0",
42
42
  "svelte-check": "^4.7.6",
43
- "vite": "^8.2.1",
44
- "vitest": "^4.1.10",
45
- "vitest-browser-svelte": "^3.0.0"
43
+ "vite": "^8.3.0",
44
+ "vitest": "^5.0.1",
45
+ "vitest-browser-svelte": "^3.1.0"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "vite build",
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,21 @@ 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
+ // toHaveTextContent matches the whole normalized text, so assert on the substring ourselves
69
+ await expect.poll(() => page.getByLabelText('Formatted output editor').element().textContent).toContain('# hello');
70
+ });
71
+
57
72
  it('renders both editor panes', async () => {
58
73
  render(App);
59
74