Opt into explicit TypeScript index property access

Opt into a new feature of TypeScript that restores an old behavior
wherein accessing properties that match an index signature requires
using bracket syntax. With this change, TypeScript will catch dotted
attributed access that might be incorrect, but allow access with bracket
notation that may be useful in certain scenarios.
2 files changed
tree: 4f4bf1b7af0f6af2200baa87b544f6b7fe99d141
  1. packages/
  2. test/
  3. web/
  4. .asf.yaml
  5. .editorconfig
  6. .eslintignore
  7. .eslintrc.js
  8. .gitignore
  9. .lintstagedrc
  10. .mocharc.js
  11. .ratignore
  12. .travis.yml
  13. babel-register.js
  14. babel.config.js
  15. CODE_OF_CONDUCT.md
  16. DISCLAIMER-WIP
  17. husky.config.js
  18. lerna.json
  19. LICENSE
  20. Makefile
  21. NOTICE
  22. nyc.config.js
  23. package.json
  24. README.md
  25. repolinter.json
  26. SECURITY.md
  27. tsconfig.base.json
  28. tsconfig.json
  29. tsconfig.test.json
  30. typedoc.json
  31. yarn.lock
README.md

Apache Annotator (incubating) Build Status

Apache Annotator (incubating) provides libraries to enable annotation related software, with an initial focus on identification of textual fragments in browser environments.

Usage

The Apache Annotator project is written in TypeScript, but the project is compiled and distributed in CommonJS and ECMAScript Module formats.

The project is made up of multiple packages. Install the apache-annotator package, which includes all sub-packages, or install individual packages from the @apache-annotator scope.

Import packages from either apache-annotator/package or @apache-annotator/package.

Currently, the following sub-packages are part of the project:

@apache-annotator/dom

This package contains functions for creating and resolving Web Annotation Selectors in DOM environments.

@apache-annotator/selector

This package contains generic utilities for composing functions that create and resolve Web Annotation Selectors.

Getting Involved

issue tracker wiki

Requirements

We use Lerna to juggle the various Apache Annotator libraries. If you‘d like to contribute, you’ll need the following:

Setup

$ yarn install

Test

$ yarn test

Start a local test project

$ yarn start

Selectors

Many Annotations refer to part of a resource, rather than all of it, as the Target. We call that part of the resource a Segment (of Interest). A Selector is used to describe how to determine the Segment from within the Source resource.

The W3C Web Annotation Data Model outlines a number of different selectors. See table below for full list and status.

SelectorDescriptionImplementation Status
Text QuoteThis Selector describes a range of text, including some of the text immediately before (a prefix) and after (a suffix) it to distinguish between multiple copies of the same sequence of characters.Yes
CSSCSS Selectors allow for a wide variety of well supported ways to describe the path to an element in a web page.Yes
Text PositionThis Selector describes a range of text by recording the start and end positions of the selection in the stream.No
FragmentUses the fragment part of an IRI defined by the representation's media type.No
XPathImplements an XPath based selection.No
Data PostionSimilar to the Text Position Selector, the Data Position Selector uses the same properties but works at the byte in bitstream level rather than the character in text level.No
SVGAn SvgSelector defines an area through the use of the Scalable Vector Graphics standard.No
RangeA Range Selector can be used to identify the beginning and the end of the selection by using other Selectors.Yes
RefinementSelect a part of a selection, rather than as a selection of the complete resource.

Web Annotation Data Model Validation

If you have any Web Annotation Data Model JSON documents, you can validate them using the validate script:

$ yarn validate --url https://raw.githubusercontent.com/w3c/web-annotation-tests/master/tools/samples/correct/anno1.json

With the --url option you can pass in a URL or a local path to a JSON file.

Examples

Valid:

https://raw.githubusercontent.com/w3c/web-annotation-tests/master/tools/samples/correct/anno1.json

Invalid:

https://raw.githubusercontent.com/w3c/web-annotation-tests/master/tools/samples/incorrect/anno1.json

(More)

License

Apache License 2.0

Disclaimer

Apache Annotator is currently undergoing incubation at The Apache Software Foundation.

See the accompanying DISCLAIMER file for details.