@punica/components 2.1.0 → 2.1.1

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,13 @@
1
1
  # @punica/components
2
2
 
3
+ ## 2.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 602f7ef: `toast`, `confirm` and `qrMatrix` are in the type declarations. They were exported and described in the guide, but an `import { toast } from '@punica/components'` did not compile in TypeScript. Imports from `@punica/components/components/*` are typed as well.
8
+
9
+ The guide says how to find the elements in tests: their roles come from `ElementInternals`, which Playwright's and Testing Library's `getByRole` and some rules of axe-core do not read yet.
10
+
3
11
  ## 2.1.0
4
12
 
5
13
  ### Minor Changes
@@ -1,4 +1,4 @@
1
- <!-- @punica/components 2.1.0: 163 elements. Generated from custom-elements.json; https://components.punicalab.com -->
1
+ <!-- @punica/components 2.1.1: 163 elements. Generated from custom-elements.json; https://components.punicalab.com -->
2
2
 
3
3
  # @punica/components 2.0: how to use it
4
4
 
@@ -99,6 +99,19 @@ properties. Right-to-left works with `dir="rtl"` on any ancestor.
99
99
  elements (`compilerOptions.isCustomElement`).
100
100
  - **Angular**: `CUSTOM_ELEMENTS_SCHEMA`, `(punica-change)="…"`, `[value]="…"`.
101
101
 
102
+ ## Testing
103
+
104
+ Elements carry their role through `ElementInternals`: a `punica-heading` is
105
+ a heading and a `punica-table-row` a row to a screen reader, with no `role`
106
+ attribute in the markup. Tools that read the markup instead of the
107
+ accessibility tree do not see those roles yet: Playwright's `getByRole`,
108
+ Testing Library's `getByRole`, and rules of axe-core such as
109
+ `page-has-heading-one`. In tests, find such an element by its tag
110
+ (`page.locator('punica-table-row')`); for the one heading of a page that an
111
+ audit has to find, use a native `<h1>`. Roles of native elements inside an
112
+ element (the `button` in a `punica-button`, the `dialog` in a
113
+ `punica-alert-dialog`) are found as usual.
114
+
102
115
  ## Check your work
103
116
 
104
117
  `npx punica-components validate <files>` checks tags, attributes, values,
package/dist/llms.txt CHANGED
@@ -1,4 +1,4 @@
1
- <!-- @punica/components 2.1.0: 163 elements. Generated from custom-elements.json; https://components.punicalab.com -->
1
+ <!-- @punica/components 2.1.1: 163 elements. Generated from custom-elements.json; https://components.punicalab.com -->
2
2
 
3
3
  # @punica/components 2.0: how to use it
4
4
 
@@ -99,6 +99,19 @@ properties. Right-to-left works with `dir="rtl"` on any ancestor.
99
99
  elements (`compilerOptions.isCustomElement`).
100
100
  - **Angular**: `CUSTOM_ELEMENTS_SCHEMA`, `(punica-change)="…"`, `[value]="…"`.
101
101
 
102
+ ## Testing
103
+
104
+ Elements carry their role through `ElementInternals`: a `punica-heading` is
105
+ a heading and a `punica-table-row` a row to a screen reader, with no `role`
106
+ attribute in the markup. Tools that read the markup instead of the
107
+ accessibility tree do not see those roles yet: Playwright's `getByRole`,
108
+ Testing Library's `getByRole`, and rules of axe-core such as
109
+ `page-has-heading-one`. In tests, find such an element by its tag
110
+ (`page.locator('punica-table-row')`); for the one heading of a page that an
111
+ audit has to find, use a native `<h1>`. Roles of native elements inside an
112
+ element (the `button` in a `punica-button`, the `dialog` in a
113
+ `punica-alert-dialog`) are found as usual.
114
+
102
115
  ## Check your work
103
116
 
104
117
  `npx punica-components validate <files>` checks tags, attributes, values,
@@ -6584,6 +6584,15 @@ export interface PunicaVisuallyHidden extends HTMLElement {
6584
6584
  addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
6585
6585
  }
6586
6586
 
6587
+ /** Asks the user to confirm, in an alert dialog made for the question. The dialog is appended to `<body>` (or to `container`), opened, and removed once it closes. Text is set as text, never parsed as markup. */
6588
+ export function confirm(options?: { heading?: string, message?: string, confirmLabel?: string, cancelLabel?: string, color?: string, container?: Element }): Promise<boolean>;
6589
+
6590
+ /** Encodes text as a QR Code symbol. */
6591
+ export function qrMatrix(text: string, level?: 'L' | 'M' | 'Q' | 'H'): boolean[][] | null;
6592
+
6593
+ /** Shows a toast in the page's toaster. The toaster is the first `punica-toaster` in the document; when the page has none, one is created and appended to `<body>`. That element is the one thing this library ever adds to the body, and only on this call. */
6594
+ export function toast(message: string, options?: { color?: string, duration?: number, labelClose?: string, noCloseButton?: boolean, toaster?: HTMLElement }): HTMLElement;
6595
+
6587
6596
  declare global {
6588
6597
  interface HTMLElementTagNameMap {
6589
6598
  'punica-accordion': PunicaAccordion;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@punica/components",
4
- "version": "2.1.0",
4
+ "version": "2.1.1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@punica/components",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Punica web components: framework-free custom elements on platform standards.",
5
5
  "keywords": [
6
6
  "web-components",
@@ -38,7 +38,10 @@
38
38
  "types": "./dist/types/index.d.ts",
39
39
  "default": "./dist/esm/index.js"
40
40
  },
41
- "./components/*": "./dist/esm/components/*",
41
+ "./components/*": {
42
+ "types": "./dist/types/index.d.ts",
43
+ "default": "./dist/esm/components/*"
44
+ },
42
45
  "./core/*": "./dist/esm/core/*",
43
46
  "./tokens.css": "./dist/tokens.css",
44
47
  "./react": {
@@ -81,7 +84,8 @@
81
84
  "audit": "node scripts/audit.mjs",
82
85
  "lint": "eslint src scripts test bin packages/mcp/src packages/mcp/test packages/mcp/build.mjs eval",
83
86
  "format": "prettier --write \"./**/*.{ts,js,mjs,json,md}\"",
84
- "test": "vitest run",
87
+ "test": "vitest run && npm run test:types",
88
+ "test:types": "node --test test/types.test.mjs",
85
89
  "test:watch": "vitest",
86
90
  "changeset": "changeset",
87
91
  "version": "changeset version",