Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

21 changes: 0 additions & 21 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.17.1
22.17.1
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ api-extractor/**/*
dist/**/*
docs/**/*
temp/**/*
types/**/*
9 changes: 5 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
"destructure",
"focusable",
"heaslip",
"packagehash",
"rushstack",
"tabindex",
"tsbuildinfo",
"tsdoc",
"unscoped"
"unscoped",
"yalc"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"eslint.validate": [
"javascript",
Expand All @@ -35,8 +37,7 @@
"CHANGELOG": true,
"docs/**/*": true,
"LICENSE": true,
"package-lock.json": true,
"types/**/*": true
"package-lock.json": true
},
"typescript.tsdk": "node_modules/typescript/lib",
"[javascript][json][jsonc][markdown][typescript][yaml]": {
Expand Down
6 changes: 3 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ This package is developed with Node.js 18 (the active LTS [release](https://node
In this folder:

```sh
# Watch src and build into dist/cjs and dist/esm on change
# Watch src and build into dist on change
npm run dev
```

If you add a new function or making a change to the arguments of an existing function (without this TypeScript won’t be aware of the changes, and the `build-lint-test` script will fail):

```sh
# Update api-extractor/* (metadata about code generated by api-extractor),
# Update api-extractor/* (metadata about code generated by api-extractor) and
# docs/* (Markdown documentation generated by api-documenter using api-extractor
# metadata), and types/js-dom-utils.d.ts (types generated by api-extractor)
# metadata)
npm run api-extractor-update
```

Expand Down
17 changes: 15 additions & 2 deletions api-extractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
*/
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@asl-19/shared-package-configs/api-extractor.json",
"mainEntryPointFilePath": "<projectFolder>/dist/esm/index.d.ts"
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts",
"apiReport": {
"enabled": true,
"reportFolder": "<projectFolder>/api-extractor"
},
"docModel": {
"enabled": true,
"apiJsonFilePath": "<projectFolder>/api-extractor/js-dom-utils.api.json"
},
"dtsRollup": {
"enabled": false
},
"tsdocMetadata": {
"enabled": false
}
}
98 changes: 69 additions & 29 deletions api-extractor/js-dom-utils.api.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"metadata": {
"toolPackage": "@microsoft/api-extractor",
"toolVersion": "7.36.4",
"toolVersion": "7.52.10",
"schemaVersion": 1011,
"oldestForwardsCompatibleVersion": 1001,
"tsdocConfig": {
Expand Down Expand Up @@ -173,40 +173,54 @@
"preserveMemberOrder": false,
"members": [
{
"kind": "Variable",
"canonicalReference": "@asl-19/js-dom-utils!announce:var",
"docComment": "/**\n * Trigger screen reader announcement using hidden `aria-live` region.\n *\n * @remarks\n *\n * See:\n *\n * - https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions\n *\n * Based on:\n *\n * - {@link https://a11y-guidelines.orange.com/en/web/components-examples/make-a-screen-reader-talk/}\n *\n * - {@link https://github.com/adobe/react-spectrum/blob/main/packages/\\@react-aria/live-announcer/src/LiveAnnouncer.tsx}\n */\n",
"kind": "Function",
"canonicalReference": "@asl-19/js-dom-utils!announce:function(1)",
"docComment": "/**\n * Trigger screen reader announcement using hidden `aria-live` region.\n *\n * @remarks\n *\n * See:\n *\n * - https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions\n *\n * Based on:\n *\n * - {@link https://a11y-guidelines.orange.com/en/web/components-examples/make-a-screen-reader-talk/}\n *\n * - {@link https://github.com/adobe/react-spectrum/blob/main/packages/\\@react-aria/live-announcer/src/LiveAnnouncer.tsx}\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "announce: "
"text": "announce: ({ priority, text, }: "
},
{
"kind": "Content",
"text": "({ priority, text, }: {\n priority: \"assertive\" | \"polite\";\n text: string;\n}) => void"
"text": "{\n priority: \"assertive\" | \"polite\";\n text: string;\n}"
},
{
"kind": "Content",
"text": ") => "
},
{
"kind": "Content",
"text": "void"
}
],
"fileUrlPath": "src/announce.ts",
"isReadonly": true,
"fileUrlPath": "dist/announce.d.ts",
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"releaseTag": "Public",
"name": "announce",
"variableTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
"overloadIndex": 1,
"parameters": [
{
"parameterName": "{ priority, text, }",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"name": "announce"
},
{
"kind": "Variable",
"canonicalReference": "@asl-19/js-dom-utils!focusElement:var",
"kind": "Function",
"canonicalReference": "@asl-19/js-dom-utils!focusElement:function(1)",
"docComment": "/**\n * Focus a DOM element.\n *\n * @remarks\n *\n * Adds tabindex=\"-1\" to element to make it focusable (removed on blur).\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "focusElement: "
},
{
"kind": "Content",
"text": "(element: "
"text": "focusElement: (element: "
},
{
"kind": "Reference",
Expand All @@ -215,7 +229,11 @@
},
{
"kind": "Content",
"text": " | null, options?: "
"text": " | null"
},
{
"kind": "Content",
"text": ", options?: "
},
{
"kind": "Reference",
Expand All @@ -224,17 +242,39 @@
},
{
"kind": "Content",
"text": ") => void"
"text": ") => "
},
{
"kind": "Content",
"text": "void"
}
],
"fileUrlPath": "src/focusElement.ts",
"isReadonly": true,
"fileUrlPath": "dist/focusElement.d.ts",
"returnTypeTokenRange": {
"startIndex": 6,
"endIndex": 7
},
"releaseTag": "Public",
"name": "focusElement",
"variableTypeTokenRange": {
"startIndex": 1,
"endIndex": 6
}
"overloadIndex": 1,
"parameters": [
{
"parameterName": "element",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"isOptional": false
},
{
"parameterName": "options",
"parameterTypeTokenRange": {
"startIndex": 4,
"endIndex": 5
},
"isOptional": true
}
],
"name": "focusElement"
}
]
}
Expand Down
28 changes: 25 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,29 @@

## Packages

| Package | Description |
| --- | --- |
| [@asl-19/js-dom-utils](./js-dom-utils.md) | <p>A collection of plain JavaScript DOM utility functions.</p><p>These functions don’t rely on React, or React Native APIs.</p> |
<table><thead><tr><th>

Package


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[@asl-19/js-dom-utils](./js-dom-utils.md)


</td><td>

A collection of plain JavaScript DOM utility functions.

These functions don’t rely on React, or React Native APIs.


</td></tr>
</tbody></table>

40 changes: 39 additions & 1 deletion docs/js-dom-utils.announce.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[Home](./index.md) &gt; [@asl-19/js-dom-utils](./js-dom-utils.md) &gt; [announce](./js-dom-utils.announce.md)

## announce variable
## announce() function

Trigger screen reader announcement using hidden `aria-live` region.

Expand All @@ -15,6 +15,44 @@ announce: ({ priority, text, }: {
}) => void
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

{ priority, text, }


</td><td>

{ priority: "assertive" \| "polite"; text: string; }


</td><td>


</td></tr>
</tbody></table>

**Returns:**

void

## Remarks

See:
Expand Down
Loading