@api-client/ui 0.5.2 → 0.5.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.
Files changed (34) hide show
  1. package/build/src/elements/highlight/MarkdownStyles.d.ts.map +1 -1
  2. package/build/src/elements/highlight/MarkdownStyles.js +7 -11
  3. package/build/src/elements/highlight/MarkdownStyles.js.map +1 -1
  4. package/build/src/md/dialog/internals/ConfirmDialog.d.ts +39 -0
  5. package/build/src/md/dialog/internals/ConfirmDialog.d.ts.map +1 -0
  6. package/build/src/md/dialog/internals/ConfirmDialog.js +75 -0
  7. package/build/src/md/dialog/internals/ConfirmDialog.js.map +1 -0
  8. package/build/src/md/dialog/internals/Dialog.d.ts +6 -0
  9. package/build/src/md/dialog/internals/Dialog.d.ts.map +1 -1
  10. package/build/src/md/dialog/internals/Dialog.js +43 -5
  11. package/build/src/md/dialog/internals/Dialog.js.map +1 -1
  12. package/build/src/md/dialog/internals/Dialog.styles.d.ts.map +1 -1
  13. package/build/src/md/dialog/internals/Dialog.styles.js +39 -1
  14. package/build/src/md/dialog/internals/Dialog.styles.js.map +1 -1
  15. package/build/src/md/dialog/ui-confirm-dialog.d.ts +48 -0
  16. package/build/src/md/dialog/ui-confirm-dialog.d.ts.map +1 -0
  17. package/build/src/md/dialog/ui-confirm-dialog.js +64 -0
  18. package/build/src/md/dialog/ui-confirm-dialog.js.map +1 -0
  19. package/demo/md/dialog/confirm-dialog.html +49 -0
  20. package/demo/md/dialog/confirm-dialog.ts +121 -0
  21. package/demo/md/dialog/dialog.ts +76 -1
  22. package/demo/md/index.html +2 -0
  23. package/eslint.config.js +6 -6
  24. package/package.json +7 -2
  25. package/scripts/release.js +66 -0
  26. package/src/elements/highlight/MarkdownStyles.ts +7 -11
  27. package/src/md/dialog/README.md +212 -0
  28. package/src/md/dialog/internals/ConfirmDialog.ts +79 -0
  29. package/src/md/dialog/internals/Dialog.styles.ts +39 -1
  30. package/src/md/dialog/internals/Dialog.ts +17 -4
  31. package/src/md/dialog/ui-confirm-dialog.ts +52 -0
  32. package/test/README.md +2 -0
  33. package/test/md/dialog/UiConfirmDialog.test.ts +131 -0
  34. package/test/md/dialog/UiDialog.test.ts +42 -0
@@ -0,0 +1,48 @@
1
+ import type { CSSResultOrNative } from 'lit';
2
+ import Element from './internals/ConfirmDialog.js';
3
+ /**
4
+ * A simple Material Design 3 styled confirm dialog component.
5
+ *
6
+ * This dialog is designed specifically for confirmation workflows where users
7
+ * need to confirm or dismiss an action. It provides a clean, accessible interface
8
+ * with customizable button labels and content.
9
+ *
10
+ * **Features:**
11
+ * - Material Design 3 styling
12
+ * - Customizable confirm and dismiss button labels
13
+ * - Modal by default
14
+ * - Accessible keyboard navigation
15
+ * - Slot-based content structure
16
+ *
17
+ * **Usage:**
18
+ * ```html
19
+ * <ui-confirm-dialog .open="${showDialog}" @close="${handleClose}">
20
+ * <span slot="title">Confirm Action</span>
21
+ * <p>Are you sure you want to proceed with this action?</p>
22
+ * </ui-confirm-dialog>
23
+ * ```
24
+ *
25
+ * **Customizing Button Labels:**
26
+ * ```html
27
+ * <ui-confirm-dialog
28
+ * confirmLabel="Delete"
29
+ * dismissLabel="Keep"
30
+ * .open="${showDialog}"
31
+ * >
32
+ * <span slot="title">Delete Item</span>
33
+ * <p>This action cannot be undone.</p>
34
+ * </ui-confirm-dialog>
35
+ * ```
36
+ *
37
+ * @slot title - The dialog title
38
+ * @slot - The main content body
39
+ */
40
+ export declare class UiConfirmDialogElement extends Element {
41
+ static styles: CSSResultOrNative[];
42
+ }
43
+ declare global {
44
+ interface HTMLElementTagNameMap {
45
+ 'ui-confirm-dialog': UiConfirmDialogElement;
46
+ }
47
+ }
48
+ //# sourceMappingURL=ui-confirm-dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-confirm-dialog.d.ts","sourceRoot":"","sources":["../../../../src/md/dialog/ui-confirm-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAA;AAE5C,OAAO,OAAO,MAAM,8BAA8B,CAAA;AAGlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBACa,sBAAuB,SAAQ,OAAO;IACjD,OAAgB,MAAM,EAAE,iBAAiB,EAAE,CAAiB;CAC7D;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,mBAAmB,EAAE,sBAAsB,CAAA;KAC5C;CACF"}
@@ -0,0 +1,64 @@
1
+ import { __esDecorate, __runInitializers } from "tslib";
2
+ import { customElement } from 'lit/decorators.js';
3
+ import Element from './internals/ConfirmDialog.js';
4
+ import dialogStyles from './internals/Dialog.styles.js';
5
+ /**
6
+ * A simple Material Design 3 styled confirm dialog component.
7
+ *
8
+ * This dialog is designed specifically for confirmation workflows where users
9
+ * need to confirm or dismiss an action. It provides a clean, accessible interface
10
+ * with customizable button labels and content.
11
+ *
12
+ * **Features:**
13
+ * - Material Design 3 styling
14
+ * - Customizable confirm and dismiss button labels
15
+ * - Modal by default
16
+ * - Accessible keyboard navigation
17
+ * - Slot-based content structure
18
+ *
19
+ * **Usage:**
20
+ * ```html
21
+ * <ui-confirm-dialog .open="${showDialog}" @close="${handleClose}">
22
+ * <span slot="title">Confirm Action</span>
23
+ * <p>Are you sure you want to proceed with this action?</p>
24
+ * </ui-confirm-dialog>
25
+ * ```
26
+ *
27
+ * **Customizing Button Labels:**
28
+ * ```html
29
+ * <ui-confirm-dialog
30
+ * confirmLabel="Delete"
31
+ * dismissLabel="Keep"
32
+ * .open="${showDialog}"
33
+ * >
34
+ * <span slot="title">Delete Item</span>
35
+ * <p>This action cannot be undone.</p>
36
+ * </ui-confirm-dialog>
37
+ * ```
38
+ *
39
+ * @slot title - The dialog title
40
+ * @slot - The main content body
41
+ */
42
+ let UiConfirmDialogElement = (() => {
43
+ let _classDecorators = [customElement('ui-confirm-dialog')];
44
+ let _classDescriptor;
45
+ let _classExtraInitializers = [];
46
+ let _classThis;
47
+ let _classSuper = Element;
48
+ var UiConfirmDialogElement = class extends _classSuper {
49
+ static { _classThis = this; }
50
+ static {
51
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
52
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
53
+ UiConfirmDialogElement = _classThis = _classDescriptor.value;
54
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
55
+ }
56
+ static styles = [dialogStyles];
57
+ static {
58
+ __runInitializers(_classThis, _classExtraInitializers);
59
+ }
60
+ };
61
+ return UiConfirmDialogElement = _classThis;
62
+ })();
63
+ export { UiConfirmDialogElement };
64
+ //# sourceMappingURL=ui-confirm-dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-confirm-dialog.js","sourceRoot":"","sources":["../../../../src/md/dialog/ui-confirm-dialog.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,OAAO,MAAM,8BAA8B,CAAA;AAClD,OAAO,YAAY,MAAM,8BAA8B,CAAA;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;IAEU,sBAAsB;4BADlC,aAAa,CAAC,mBAAmB,CAAC;;;;sBACS,OAAO;sCAAf,SAAQ,WAAO;;;;YAAnD,6KAEC;;;;QADC,MAAM,CAAU,MAAM,GAAwB,CAAC,YAAY,CAAC,CAAA;;YADjD,uDAAsB;;;;;SAAtB,sBAAsB","sourcesContent":["import type { CSSResultOrNative } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport Element from './internals/ConfirmDialog.js'\nimport dialogStyles from './internals/Dialog.styles.js'\n\n/**\n * A simple Material Design 3 styled confirm dialog component.\n *\n * This dialog is designed specifically for confirmation workflows where users\n * need to confirm or dismiss an action. It provides a clean, accessible interface\n * with customizable button labels and content.\n *\n * **Features:**\n * - Material Design 3 styling\n * - Customizable confirm and dismiss button labels\n * - Modal by default\n * - Accessible keyboard navigation\n * - Slot-based content structure\n *\n * **Usage:**\n * ```html\n * <ui-confirm-dialog .open=\"${showDialog}\" @close=\"${handleClose}\">\n * <span slot=\"title\">Confirm Action</span>\n * <p>Are you sure you want to proceed with this action?</p>\n * </ui-confirm-dialog>\n * ```\n *\n * **Customizing Button Labels:**\n * ```html\n * <ui-confirm-dialog\n * confirmLabel=\"Delete\"\n * dismissLabel=\"Keep\"\n * .open=\"${showDialog}\"\n * >\n * <span slot=\"title\">Delete Item</span>\n * <p>This action cannot be undone.</p>\n * </ui-confirm-dialog>\n * ```\n *\n * @slot title - The dialog title\n * @slot - The main content body\n */\n@customElement('ui-confirm-dialog')\nexport class UiConfirmDialogElement extends Element {\n static override styles: CSSResultOrNative[] = [dialogStyles]\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ui-confirm-dialog': UiConfirmDialogElement\n }\n}\n"]}
@@ -0,0 +1,49 @@
1
+ <!doctype html>
2
+ <html lang="en-GB">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>UI Confirm Dialog Demo</title>
6
+ <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0">
7
+ <link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
8
+ <link href="../../../src/styles/m3/tokens.css" rel="stylesheet" type="text/css" />
9
+ <link href="../../../src/styles/m3/theme.css" rel="stylesheet" type="text/css" />
10
+ <style>
11
+ .demo-section {
12
+ margin: 40px 0;
13
+ padding: 24px;
14
+ border: 1px solid var(--md-sys-color-outline);
15
+ border-radius: 8px;
16
+ }
17
+
18
+ .demo-section h2 {
19
+ margin-top: 0;
20
+ color: var(--md-sys-color-on-surface);
21
+ }
22
+
23
+ .demo-section p {
24
+ margin-bottom: 20px;
25
+ color: var(--md-sys-color-on-surface-variant);
26
+ }
27
+
28
+ .button-group {
29
+ display: flex;
30
+ gap: 12px;
31
+ flex-wrap: wrap;
32
+ }
33
+
34
+ .result {
35
+ margin-top: 20px;
36
+ padding: 12px;
37
+ background: var(--md-sys-color-surface-variant);
38
+ border-radius: 4px;
39
+ font-family: monospace;
40
+ color: var(--md-sys-color-on-surface-variant);
41
+ }
42
+ </style>
43
+ </head>
44
+ <body>
45
+ <div id="app"></div>
46
+
47
+ <script type="module" src="/.tmp/demo/md/dialog/confirm-dialog.js"></script>
48
+ </body>
49
+ </html>
@@ -0,0 +1,121 @@
1
+ import { html, TemplateResult } from 'lit'
2
+ import { DemoPage } from '../../../src/demo/DemoPage.js'
3
+ import { UiDialogClosingReason } from '../../../src/md/dialog/internals/Dialog.js'
4
+ import { reactive } from '../../../src/decorators/index.js'
5
+ import '../../../src/md/dialog/ui-confirm-dialog.js'
6
+ import '../../../src/md/button/ui-button.js'
7
+
8
+ class ConfirmDialogDemo extends DemoPage {
9
+ override accessor componentName = 'UI Confirm Dialog'
10
+
11
+ @reactive() accessor basicDialogOpen = false
12
+
13
+ @reactive() accessor deleteDialogOpen = false
14
+
15
+ @reactive() accessor customDialogOpen = false
16
+
17
+ @reactive() accessor lastResult = ''
18
+
19
+ protected openBasicDialog(): void {
20
+ this.basicDialogOpen = true
21
+ }
22
+
23
+ protected openDeleteDialog(): void {
24
+ this.deleteDialogOpen = true
25
+ }
26
+
27
+ protected openCustomDialog(): void {
28
+ this.customDialogOpen = true
29
+ }
30
+
31
+ protected handleBasicClose(e: CustomEvent<UiDialogClosingReason>): void {
32
+ this.basicDialogOpen = false
33
+ this.updateResult('Basic Dialog', e.detail)
34
+ }
35
+
36
+ protected handleDeleteClose(e: CustomEvent<UiDialogClosingReason>): void {
37
+ this.deleteDialogOpen = false
38
+ this.updateResult('Delete Dialog', e.detail)
39
+ }
40
+
41
+ protected handleCustomClose(e: CustomEvent<UiDialogClosingReason>): void {
42
+ this.customDialogOpen = false
43
+ this.updateResult('Custom Dialog', e.detail)
44
+ }
45
+
46
+ private updateResult(dialogType: string, detail: UiDialogClosingReason): void {
47
+ const action = detail.cancelled ? 'dismissed' : 'confirmed'
48
+ this.lastResult = `${dialogType} was ${action}`
49
+ }
50
+
51
+ contentTemplate(): TemplateResult {
52
+ return html`
53
+ <a href="../">Back</a>
54
+ <h1>Confirm Dialog Demo</h1>
55
+
56
+ <section class="demo-section">
57
+ <h2>Basic Confirm Dialog</h2>
58
+ <p>A simple confirmation dialog with default button labels.</p>
59
+ <div class="button-group">
60
+ <ui-button color="filled" @click="${this.openBasicDialog}">Open Basic Dialog</ui-button>
61
+ </div>
62
+
63
+ <ui-confirm-dialog .open="${this.basicDialogOpen}" @close="${this.handleBasicClose}">
64
+ <span slot="title">Confirm Action</span>
65
+ <p>Are you sure you want to proceed with this action?</p>
66
+ </ui-confirm-dialog>
67
+ </section>
68
+
69
+ <section class="demo-section">
70
+ <h2>Delete Confirmation Dialog</h2>
71
+ <p>A confirmation dialog with custom button labels for a destructive action.</p>
72
+ <div class="button-group">
73
+ <ui-button color="filled" @click="${this.openDeleteDialog}">Delete Item</ui-button>
74
+ </div>
75
+
76
+ <ui-confirm-dialog
77
+ confirmLabel="Delete"
78
+ dismissLabel="Keep"
79
+ destructive
80
+ .open="${this.deleteDialogOpen}"
81
+ @close="${this.handleDeleteClose}"
82
+ >
83
+ <span slot="title">Delete Item</span>
84
+ <p>Are you sure you want to delete this item? This action cannot be undone.</p>
85
+ <p><strong>This will permanently remove the item from your account.</strong></p>
86
+ </ui-confirm-dialog>
87
+ </section>
88
+
89
+ <section class="demo-section">
90
+ <h2>Custom Styled Dialog</h2>
91
+ <p>A confirmation dialog with custom button labels for a specific workflow.</p>
92
+ <div class="button-group">
93
+ <ui-button color="filled" @click="${this.openCustomDialog}">Save & Exit</ui-button>
94
+ </div>
95
+
96
+ <ui-confirm-dialog
97
+ confirmLabel="Save & Exit"
98
+ dismissLabel="Continue Editing"
99
+ .open="${this.customDialogOpen}"
100
+ @close="${this.handleCustomClose}"
101
+ >
102
+ <span slot="title">Save Changes</span>
103
+ <p>You have unsaved changes in your document.</p>
104
+ <p>Would you like to save your changes before exiting?</p>
105
+ </ui-confirm-dialog>
106
+ </section>
107
+
108
+ ${this.lastResult
109
+ ? html`
110
+ <section class="demo-section">
111
+ <h2>Last Action Result</h2>
112
+ <div class="result">${this.lastResult}</div>
113
+ </section>
114
+ `
115
+ : ''}
116
+ `
117
+ }
118
+ }
119
+
120
+ const instance = new ConfirmDialogDemo()
121
+ instance.render()
@@ -20,6 +20,10 @@ class ComponentDemoPage extends DemoPage {
20
20
 
21
21
  @reactive() accessor formOpened = false
22
22
 
23
+ @reactive() accessor destructiveOpened = false
24
+
25
+ @reactive() accessor nonModalOpened = false
26
+
23
27
  protected openSimple(): void {
24
28
  this.simpleOpened = true
25
29
  }
@@ -56,6 +60,24 @@ class ComponentDemoPage extends DemoPage {
56
60
  this.reportClosingReason(e.detail)
57
61
  }
58
62
 
63
+ protected openDestructive(): void {
64
+ this.destructiveOpened = true
65
+ }
66
+
67
+ protected destructiveClosed(e: CustomEvent<UiDialogClosingReason>): void {
68
+ this.destructiveOpened = false
69
+ this.reportClosingReason(e.detail)
70
+ }
71
+
72
+ protected openNonModal(): void {
73
+ this.nonModalOpened = true
74
+ }
75
+
76
+ protected nonModalClosed(e: CustomEvent<UiDialogClosingReason>): void {
77
+ this.nonModalOpened = false
78
+ this.reportClosingReason(e.detail)
79
+ }
80
+
59
81
  imperativeDialog: UiDialog | null = null
60
82
 
61
83
  protected openImperative(): void {
@@ -72,6 +94,7 @@ class ComponentDemoPage extends DemoPage {
72
94
  this.imperativeDialog = dialog
73
95
  dialog.addEventListener('close', (e: Event): void => {
74
96
  document.body.removeChild(dialog)
97
+ this.imperativeDialog = null
75
98
  const event = e as CustomEvent<UiDialogClosingReason>
76
99
  this.reportClosingReason(event.detail)
77
100
  })
@@ -93,7 +116,7 @@ class ComponentDemoPage extends DemoPage {
93
116
  return html`
94
117
  <a href="../">Back</a>
95
118
  ${this.simpleDialog()} ${this.fullDialog()} ${this.overflowDialog()} ${this.formDialog()}
96
- ${this.renderImperativeDialog()}
119
+ ${this.destructiveDialog()} ${this.nonModalDialog()} ${this.renderImperativeDialog()}
97
120
  `
98
121
  }
99
122
 
@@ -387,6 +410,58 @@ class ComponentDemoPage extends DemoPage {
387
410
  </section>
388
411
  `
389
412
  }
413
+
414
+ destructiveDialog(): TemplateResult {
415
+ return html`
416
+ <section class="demo-section">
417
+ <h2 class="title-large">Destructive dialog</h2>
418
+ <p>This dialog demonstrates the destructive attribute for dangerous actions.</p>
419
+ <ui-button color="filled" @click="${this.openDestructive}">Open destructive dialog</ui-button>
420
+ <ui-dialog
421
+ ?open="${this.destructiveOpened}"
422
+ @close="${this.destructiveClosed}"
423
+ modal
424
+ confirmLabel="Delete"
425
+ dismissLabel="Cancel"
426
+ destructive
427
+ >
428
+ <ui-icon slot="icon" icon="warning"></ui-icon>
429
+ <span slot="title">Delete Account</span>
430
+ <p>
431
+ Are you sure you want to permanently delete your account? This action cannot be undone and all your data
432
+ will be lost.
433
+ </p>
434
+ </ui-dialog>
435
+ </section>
436
+ `
437
+ }
438
+
439
+ nonModalDialog(): TemplateResult {
440
+ return html`
441
+ <section class="demo-section">
442
+ <h2 class="title-large">Non-modal dialog</h2>
443
+ <p>This dialog demonstrates a non-modal dialog that is centered in the viewport.</p>
444
+ <ui-button color="filled" @click="${this.openNonModal}">Open non-modal dialog</ui-button>
445
+ <ui-dialog
446
+ ?open="${this.nonModalOpened}"
447
+ @close="${this.nonModalClosed}"
448
+ confirmLabel="Got it"
449
+ dismissLabel="Close"
450
+ >
451
+ <ui-icon slot="icon" icon="info"></ui-icon>
452
+ <span slot="title">Non-Modal Information</span>
453
+ <p>
454
+ This is a non-modal dialog. Unlike modal dialogs, you can still interact with the content behind this
455
+ dialog. The dialog is automatically centered in the viewport and maintains the smooth opening animation.
456
+ </p>
457
+ <p>
458
+ Non-modal dialogs are useful for displaying information that doesn't require the user's full attention or
459
+ when you want to allow interaction with the background content.
460
+ </p>
461
+ </ui-dialog>
462
+ </section>
463
+ `
464
+ }
390
465
  }
391
466
 
392
467
  const instance = new ComponentDemoPage()
@@ -31,6 +31,8 @@
31
31
  <dd>An animated collapse element.</dd>
32
32
  <dt><a href="dialog/dialog.html">dialog</a></dt>
33
33
  <dd>A Material 3 dialog element.</dd>
34
+ <dt><a href="dialog/confirm-dialog.html">confirm-dialog</a></dt>
35
+ <dd>A Material 3 confirm-dialog element.</dd>
34
36
  <dt><a href="dropdown-list/index.html">dropdown-list</a></dt>
35
37
  <dd>A Material 3 dropdown-list.</dd>
36
38
  <dt><a href="icon-button/index.html">icon-button</a></dt>
package/eslint.config.js CHANGED
@@ -14,13 +14,13 @@ const gitignorePath = fileURLToPath(new URL(".gitignore", import.meta.url));
14
14
  export const GLOBAL_IGNORE_LIST = [
15
15
  '.github/',
16
16
  '.husky/',
17
- '.tmp/',
18
- '.vscode/',
19
- '.wireit/',
20
- 'build/',
21
- 'coverage/',
17
+ '.tmp/**/*',
18
+ '.vscode/*',
19
+ '.wireit/*',
20
+ 'build/*',
21
+ 'coverage/*',
22
22
  'node_modules',
23
- 'scripts/',
23
+ 'scripts/*',
24
24
  'eslint.config.js',
25
25
  '*.min.*',
26
26
  '*.d.ts',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@api-client/ui",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "Internal UI component library for the API Client ecosystem.",
5
5
  "license": "UNLICENSED",
6
6
  "main": "build/src/index.js",
@@ -71,7 +71,11 @@
71
71
  "prepare": "husky",
72
72
  "tsc": "wireit",
73
73
  "dev": "wireit",
74
- "tsc:all": "wireit"
74
+ "tsc:all": "wireit",
75
+ "release": "node scripts/release.js",
76
+ "release:patch": "node scripts/release.js patch",
77
+ "release:minor": "node scripts/release.js minor",
78
+ "release:major": "node scripts/release.js major"
75
79
  },
76
80
  "wireit": {
77
81
  "build": {
@@ -205,6 +209,7 @@
205
209
  "@web/test-runner-commands": "^0.9.0",
206
210
  "@web/test-runner-playwright": "^0.11.0",
207
211
  "concurrently": "^9.1.2",
212
+ "conventional-changelog-cli": "^5.0.0",
208
213
  "eslint": "^9.26.0",
209
214
  "eslint-config-prettier": "^10.1.2",
210
215
  "eslint-plugin-no-only-tests": "^3.3.0",
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execSync } from 'child_process'
4
+ import { readFileSync, writeFileSync } from 'fs'
5
+ import { fileURLToPath } from 'url'
6
+ import { dirname, join } from 'path'
7
+ import SemVer from '@pawel-up/semver/classes/semver.js'
8
+
9
+ const __filename = fileURLToPath(import.meta.url)
10
+ const __dirname = dirname(__filename)
11
+ const packageJsonPath = join(__dirname, '..', 'package.json')
12
+
13
+ function updateVersion(type) {
14
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'))
15
+ const currentVersion = packageJson.version
16
+ const ver = new SemVer(currentVersion)
17
+ ver.inc(type)
18
+
19
+ packageJson.version = ver.format()
20
+ writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n')
21
+
22
+ return packageJson.version
23
+ }
24
+
25
+ function main() {
26
+ const type = process.argv[2] || 'patch'
27
+
28
+ if (!['major', 'minor', 'patch'].includes(type)) {
29
+ console.error('Usage: node scripts/release.js [major|minor|patch]')
30
+ process.exit(1)
31
+ }
32
+
33
+ try {
34
+ // Check if working directory is clean
35
+ const status = execSync('git status --porcelain', { encoding: 'utf8' })
36
+ if (status.trim()) {
37
+ console.error('Working directory is not clean. Please commit or stash your changes.')
38
+ process.exit(1)
39
+ }
40
+
41
+ // Update version
42
+ const newVersion = updateVersion(type)
43
+ console.log(`Updated version to ${newVersion}`)
44
+
45
+ // Build the project
46
+ console.log('Building project...')
47
+ execSync('npm run build', { stdio: 'inherit' })
48
+
49
+ // Commit version bump
50
+ execSync('git add package.json', { stdio: 'inherit' })
51
+ execSync(`git commit -m "chore: bump version to ${newVersion}"`, { stdio: 'inherit' })
52
+
53
+ // Create and push tag
54
+ execSync(`git tag v${newVersion}`, { stdio: 'inherit' })
55
+ execSync('git push origin main', { stdio: 'inherit' })
56
+ execSync(`git push origin v${newVersion}`, { stdio: 'inherit' })
57
+
58
+ console.log(`\nšŸŽ‰ Release ${newVersion} created and pushed!`)
59
+ console.log('The GitHub Actions workflow will now create a release with changelog.')
60
+ } catch (error) {
61
+ console.error('Error during release:', error.message)
62
+ process.exit(1)
63
+ }
64
+ }
65
+
66
+ main()
@@ -272,7 +272,7 @@ export default css`
272
272
 
273
273
  [slot='markdown-html'] code,
274
274
  [slot='markdown-html'] tt {
275
- font-family: var(--markdown-styles-code-font-family, 'Roboto Mono, Consolas, Menlo, monospace');
275
+ font-family: var(--markdown-styles-code-font-family, Roboto Mono, Consolas, Menlo, monospace);
276
276
  padding: 0;
277
277
  padding-top: 0.2em;
278
278
  padding-bottom: 0.2em;
@@ -286,13 +286,13 @@ export default css`
286
286
  }
287
287
 
288
288
  /**
289
- * prism.js default theme for JavaScript, CSS and HTML
290
- * Based on dabblet (http://dabblet.com)
291
- * @author Lea Verou
292
- */
289
+ * prism.js default theme for JavaScript, CSS and HTML
290
+ * Based on dabblet (http://dabblet.com)
291
+ * @author Lea Verou
292
+ */
293
293
  [slot='markdown-html'] code,
294
294
  [slot='markdown-html'] pre {
295
- font-family: var(--markdown-styles-code-font-family, 'Roboto Mono, Consolas, Menlo, monospace');
295
+ font-family: var(--markdown-styles-code-font-family, Roboto Mono, Consolas, Menlo, monospace);
296
296
  color: var(--code-color, black);
297
297
  background-color: var(--code-background-color);
298
298
  text-shadow: var(--markdown-styles-code-text-shadow, 0 1px white);
@@ -314,11 +314,7 @@ export default css`
314
314
  [slot='markdown-html'] pre::-moz-selection,
315
315
  [slot='markdown-html'] pre ::-moz-selection,
316
316
  [slot='markdown-html'] code::-moz-selection,
317
- [slot='markdown-html'] code ::-moz-selection {
318
- text-shadow: none;
319
- background: var(--markdown-styles-code-selection-background-color, #b3d4fc);
320
- }
321
-
317
+ [slot='markdown-html'] code ::-moz-selection,
322
318
  [slot='markdown-html'] pre::selection,
323
319
  [slot='markdown-html'] pre ::selection,
324
320
  [slot='markdown-html'] code::selection,