├── .editorconfig
├── .eslintrc.js
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── config.yml
│ └── feature_request.md
└── workflows
│ ├── codeql-analysis.yml
│ ├── counter-style.yml
│ └── react-native-li.yml
├── .gitignore
├── .prettierrc.js
├── .yarn
├── plugins
│ └── @yarnpkg
│ │ └── plugin-interactive-tools.cjs
└── releases
│ └── yarn-2.4.1.cjs
├── .yarnrc.yml
├── LICENSE
├── MAINTAINING.md
├── README.md
├── babel-config-base.js
├── codecov.yml
├── commitlint.config.js
├── demo
├── .expo-shared
│ └── assets.json
├── .gitignore
├── App.tsx
├── app.config.js
├── assets
│ ├── favicon.png
│ └── icon.png
├── babel.config.js
├── index.js
├── metro.config.js
├── package.json
└── tsconfig.json
├── images
├── TableStyleSpecs.png
├── TableStyleSpecs.svg
├── adaptative.jpeg
├── android.gif
├── expo-example.png
└── scalesPageToFit.jpg
├── jest-config-base.js
├── package.json
├── packages
├── counter-style
│ ├── .eslintignore
│ ├── .gitignore
│ ├── .prettierignore
│ ├── .release-it.js
│ ├── CHANGELOG.md
│ ├── MAINTAINING.md
│ ├── README.md
│ ├── api-extractor.json
│ ├── babel.config.js
│ ├── docs
│ │ ├── counter-style.counterstyle.md
│ │ ├── counter-style.counterstylerenderer.maxcounterleninrange.md
│ │ ├── counter-style.counterstylerenderer.maxmarkerleninrange.md
│ │ ├── counter-style.counterstylerenderer.md
│ │ ├── counter-style.counterstylerenderer.rendercounter.md
│ │ ├── counter-style.counterstylerenderer.rendermarker.md
│ │ ├── counter-style.counterstylerenderer.renderprefix.md
│ │ ├── counter-style.counterstylerenderer.rendersuffix.md
│ │ ├── counter-style.counterstylerenderer.withfallback.md
│ │ ├── counter-style.counterstylerenderer.withmaxlengthcomputer.md
│ │ ├── counter-style.counterstylerenderer.withnegative.md
│ │ ├── counter-style.counterstylerenderer.withpadleft.md
│ │ ├── counter-style.counterstylerenderer.withpadright.md
│ │ ├── counter-style.counterstylerenderer.withprefix.md
│ │ ├── counter-style.counterstylerenderer.withrange.md
│ │ ├── counter-style.counterstylerenderer.withrtl.md
│ │ ├── counter-style.counterstylerenderer.withsuffix.md
│ │ ├── counter-style.counterstylestatic.additive.md
│ │ ├── counter-style.counterstylestatic.alphabetic.md
│ │ ├── counter-style.counterstylestatic.alphabeticfromunicoderange.md
│ │ ├── counter-style.counterstylestatic.cyclic.md
│ │ ├── counter-style.counterstylestatic.fixed.md
│ │ ├── counter-style.counterstylestatic.md
│ │ ├── counter-style.counterstylestatic.numeric.md
│ │ ├── counter-style.counterstylestatic.numericfromunicoderange.md
│ │ ├── counter-style.counterstylestatic.raw.md
│ │ ├── counter-style.counterstylestatic.symbolic.md
│ │ ├── counter-style.fallbackrenderer.md
│ │ ├── counter-style.initialcounterformatter.md
│ │ ├── counter-style.maxcodepointlengthinrangecomputer.md
│ │ ├── counter-style.md
│ │ ├── counter-style.rtloptions.md
│ │ ├── counter-style.rtloptions.reversecounter.md
│ │ ├── counter-style.rtloptions.reverseprefix.md
│ │ ├── counter-style.rtloptions.reversesuffix.md
│ │ └── index.md
│ ├── etc
│ │ ├── .gitignore
│ │ └── counter-style.api.md
│ ├── package.json
│ ├── scripts
│ │ ├── build.js
│ │ ├── generatePresets.js
│ │ ├── generatePresetsIndex.js
│ │ └── utils.js
│ ├── src
│ │ ├── CounterStyle.ts
│ │ ├── __tests__
│ │ │ ├── CounterStyle.test.ts
│ │ │ ├── CounterStyleRenderer.test.ts
│ │ │ ├── arabicIndic.test.ts
│ │ │ ├── chinese.test.ts
│ │ │ ├── codepointLength.test.ts
│ │ │ ├── getAlphanumFromUnicodeRange.test.ts
│ │ │ ├── japaneseFormal.test.ts
│ │ │ ├── lowerAlpha.test.ts
│ │ │ └── makeAlphanumMaxlenComputer.test.ts
│ │ ├── constants.ts
│ │ ├── getAlphanumFromUnicodeRange.ts
│ │ ├── index.tsx
│ │ ├── internal-types.ts
│ │ ├── makeAlphanumMaxlenComputer.ts
│ │ ├── makeCSEngine.ts
│ │ ├── makeCSRenderer.ts
│ │ ├── presets
│ │ │ ├── arabicIndic.ts
│ │ │ ├── armenian.ts
│ │ │ ├── bengali.ts
│ │ │ ├── cambodian.ts
│ │ │ ├── chinese.ts
│ │ │ ├── circle.ts
│ │ │ ├── cjkDecimal.ts
│ │ │ ├── cjkEarthlyBranch.ts
│ │ │ ├── cjkHeavenlyStem.ts
│ │ │ ├── decimal.ts
│ │ │ ├── decimalLeadingZero.ts
│ │ │ ├── devanagari.ts
│ │ │ ├── disc.ts
│ │ │ ├── georgian.ts
│ │ │ ├── gujarati.ts
│ │ │ ├── gurmukhi.ts
│ │ │ ├── hebrew.ts
│ │ │ ├── hiragana.ts
│ │ │ ├── hiraganaIroha.ts
│ │ │ ├── index.ts
│ │ │ ├── japaneseFormal.ts
│ │ │ ├── japaneseInformal.ts
│ │ │ ├── kannada.ts
│ │ │ ├── katana.ts
│ │ │ ├── katanaIroha.ts
│ │ │ ├── khmer.ts
│ │ │ ├── koreanHangulFormal.ts
│ │ │ ├── koreanHanjaFormal.ts
│ │ │ ├── koreanHanjaInformal.ts
│ │ │ ├── lao.ts
│ │ │ ├── lowerAlpha.ts
│ │ │ ├── lowerArmenian.ts
│ │ │ ├── lowerGreek.ts
│ │ │ ├── lowerLatin.ts
│ │ │ ├── lowerRoman.ts
│ │ │ ├── malayalam.ts
│ │ │ ├── mongolian.ts
│ │ │ ├── myanmar.ts
│ │ │ ├── oriya.ts
│ │ │ ├── persian.ts
│ │ │ ├── square.ts
│ │ │ ├── tamil.ts
│ │ │ ├── telugu.ts
│ │ │ ├── thai.ts
│ │ │ ├── tibetan.ts
│ │ │ ├── upperAlpha.ts
│ │ │ ├── upperArmenian.ts
│ │ │ ├── upperLatin.ts
│ │ │ └── upperRoman.ts
│ │ ├── public-types.ts
│ │ └── utils
│ │ │ ├── codepointLength.ts
│ │ │ ├── codeunitLength.ts
│ │ │ └── reverseString.ts
│ ├── tsconfig.build-cjs.json
│ ├── tsconfig.build-es.json
│ └── tsconfig.json
├── react-native-li
│ ├── .eslintignore
│ ├── .gitignore
│ ├── .release-it.js
│ ├── CHANGELOG.md
│ ├── README.md
│ ├── api-extractor.json
│ ├── babel.config.js
│ ├── docs
│ │ ├── index.md
│ │ ├── react-native-li.markedlist.md
│ │ ├── react-native-li.markedlistitem.md
│ │ ├── react-native-li.markedlistitemprops.md
│ │ ├── react-native-li.markedlistprops.computemarkerboxwidth.md
│ │ ├── react-native-li.markedlistprops.container.md
│ │ ├── react-native-li.markedlistprops.counterrenderer.md
│ │ ├── react-native-li.markedlistprops.dynamicmarkerboxwidth.md
│ │ ├── react-native-li.markedlistprops.enablemarkerclipping.md
│ │ ├── react-native-li.markedlistprops.linestyle.md
│ │ ├── react-native-li.markedlistprops.markerboxstyle.md
│ │ ├── react-native-li.markedlistprops.markertextstyle.md
│ │ ├── react-native-li.markedlistprops.md
│ │ ├── react-native-li.markedlistprops.rendermarker.md
│ │ ├── react-native-li.markedlistprops.rtllinereversed.md
│ │ ├── react-native-li.markedlistprops.rtlmarkerreversed.md
│ │ ├── react-native-li.markedlistprops.startindex.md
│ │ ├── react-native-li.markerbox.md
│ │ ├── react-native-li.markerboxprops.counterindex.md
│ │ ├── react-native-li.markerboxprops.counterrenderer.md
│ │ ├── react-native-li.markerboxprops.enablemarkerclipping.md
│ │ ├── react-native-li.markerboxprops.markertextstyle.md
│ │ ├── react-native-li.markerboxprops.markertextwidth.md
│ │ ├── react-native-li.markerboxprops.maxnumofcodepoints.md
│ │ ├── react-native-li.markerboxprops.md
│ │ ├── react-native-li.markerboxprops.rtlmarkerreversed.md
│ │ ├── react-native-li.markerboxprops.style.md
│ │ ├── react-native-li.md
│ │ └── react-native-li.usemarkedlist.md
│ ├── etc
│ │ ├── .gitignore
│ │ └── react-native-li.api.md
│ ├── jest.config.js
│ ├── package.json
│ ├── screenshots
│ │ ├── arabic-indic-rtl.png
│ │ ├── disc-ltr.png
│ │ ├── disc-rtl.png
│ │ └── lower-roman-ltr.png
│ ├── src
│ │ ├── MarkedList.tsx
│ │ ├── MarkedListItem.tsx
│ │ ├── MarkerBox.tsx
│ │ ├── __tests__
│ │ │ ├── MarkedList.test.tsx
│ │ │ └── useMarkedList.test.ts
│ │ ├── index.ts
│ │ ├── shared-types.ts
│ │ └── useMarkedList.ts
│ ├── tsconfig.build.json
│ └── tsconfig.json
└── release-config
│ ├── index.js
│ └── package.json
├── patches
├── @release-it-conventional-changelog.patch
└── release-it.patch
├── tsconfig-base.json
└── yarn.lock
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig helps developers define and maintain consistent
2 | # coding styles between different editors and IDEs
3 | # editorconfig.org
4 |
5 | root = true
6 |
7 | [*]
8 |
9 | indent_style = space
10 | indent_size = 2
11 |
12 | end_of_line = lf
13 | charset = utf-8
14 | trim_trailing_whitespace = true
15 | insert_final_newline = true
16 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: ['@react-native-community', 'plugin:compat/recommended'],
4 | parser: '@typescript-eslint/parser',
5 | plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
6 | rules: {
7 | 'comma-dangle': ['error', 'never'],
8 | '@typescript-eslint/no-unused-vars': [
9 | 'error',
10 | { vars: 'all', args: 'after-used', ignoreRestSiblings: true }
11 | ]
12 | }
13 | };
14 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug Report
3 | about: If you have found a bug, you should chose this template.
4 | title: ''
5 | labels: bug
6 | ---
7 |
8 |
12 |
13 | ### Oath
14 |
15 | I swear that I have completed these tasks before submitting:
16 |
17 | - [ ] I have read the README
18 | - [ ] I have checked that the issue has not been reported yet
19 |
20 | ### Bug Report
21 |
22 | #### Libraries
23 |
24 |
28 |
29 |
32 |
33 | - react-native:
34 | - react-native-li:
35 |
36 | #### Devices
37 |
38 |
41 |
42 | - Device 1
43 | * OS:
44 | * Environment:
45 |
46 | ### Reproduction
47 |
48 | #### Description
49 |
50 |
58 |
59 | (Write your steps here:)
60 |
61 | 1.
62 | 2.
63 | 3.
64 |
65 | (A little description of what is expected and / or screenshots. Not required
66 | for obvious outcomes such as crashes or graphical glitches.)
67 |
68 | #### Reproducible Demo
69 |
70 |
86 |
87 | (Paste the link to an example project or paste the entirety of the relevant
88 | source code. When deemed appropriate, provide instructions to reproduce the
89 | issue.)
90 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: true
2 | # contact_links:
3 | # - name: Getting Help
4 | # url: *
5 | # about: Visit *
6 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature Request
3 | about: Describe a new feature for this library.
4 | title: ''
5 | labels: 'new feature'
6 | ---
7 |
8 | ### Feature
9 |
10 |
15 |
16 | (Describe the feature here.)
17 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | name: "CodeQL"
7 |
8 | on:
9 | push:
10 | branches: [master]
11 | pull_request:
12 | # The branches below must be a subset of the branches above
13 | branches: [master]
14 | schedule:
15 | - cron: '0 3 * * 3'
16 |
17 | jobs:
18 | analyze:
19 | name: Analyze
20 | runs-on: ubuntu-latest
21 |
22 | strategy:
23 | fail-fast: false
24 | matrix:
25 | # Override automatic language detection by changing the below list
26 | # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
27 | language: ['javascript']
28 | # Learn more...
29 | # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
30 |
31 | steps:
32 | - name: Checkout repository
33 | uses: actions/checkout@v2
34 | with:
35 | # We must fetch at least the immediate parents so that if this is
36 | # a pull request then we can checkout the head.
37 | fetch-depth: 2
38 |
39 | # If this run was triggered by a pull request event, then checkout
40 | # the head of the pull request instead of the merge commit.
41 | - run: git checkout HEAD^2
42 | if: ${{ github.event_name == 'pull_request' }}
43 |
44 | # Initializes the CodeQL tools for scanning.
45 | - name: Initialize CodeQL
46 | uses: github/codeql-action/init@v1
47 | with:
48 | languages: ${{ matrix.language }}
49 | # If you wish to specify custom queries, you can do so here or in a config file.
50 | # By default, queries listed here will override any specified in a config file.
51 | # Prefix the list here with "+" to use these queries and those in the config file.
52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main
53 |
54 | # ℹ️ Command-line programs to run using the OS shell.
55 | # 📚 https://git.io/JvXDl
56 |
57 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
58 | # and modify them (or add more) to build your code if your project
59 | # uses a compiled language
60 |
61 | #- run: |
62 | # make bootstrap
63 | # make release
64 |
65 | - name: Perform CodeQL Analysis
66 | uses: github/codeql-action/analyze@v1
67 |
--------------------------------------------------------------------------------
/.github/workflows/counter-style.yml:
--------------------------------------------------------------------------------
1 | # This workflow will do a clean install of node dependencies, run JS and Typescript tests.
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3 |
4 | name: counter-style
5 |
6 | on: [push, pull_request]
7 |
8 | jobs:
9 | test:
10 | name: Testing
11 | runs-on: ubuntu-latest
12 |
13 | strategy:
14 | matrix:
15 | node-version: [14.x]
16 |
17 | steps:
18 | - uses: actions/checkout@v2
19 | - name: Use Node.js ${{ matrix.node-version }}
20 | uses: actions/setup-node@v1
21 | with:
22 | node-version: ${{ matrix.node-version }}
23 | - run: yarn install --immutable
24 | - run: yarn workspace @jsamr/counter-style test:ts
25 | name: Typescript Tests
26 | - run: yarn workspace @jsamr/counter-style test:lint
27 | name: Linting Tests
28 | - run: yarn workspace @jsamr/counter-style test:jest --coverage
29 | name: Behavior Tests
30 | - run: yarn workspace @jsamr/counter-style build
31 | name: Build
32 | - uses: codecov/codecov-action@v1
33 | with:
34 | flags: counter-style
35 | fail_ci_if_error: true
36 |
--------------------------------------------------------------------------------
/.github/workflows/react-native-li.yml:
--------------------------------------------------------------------------------
1 | # This workflow will do a clean install of node dependencies, run JS and Typescript tests.
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3 |
4 | name: react-native-li
5 |
6 | on: [push, pull_request]
7 |
8 | jobs:
9 | test:
10 | name: Testing
11 | runs-on: ubuntu-latest
12 |
13 | strategy:
14 | matrix:
15 | node-version: [14.x]
16 |
17 | steps:
18 | - uses: actions/checkout@v2
19 | - name: Use Node.js ${{ matrix.node-version }}
20 | uses: actions/setup-node@v1
21 | with:
22 | node-version: ${{ matrix.node-version }}
23 | - run: yarn install --immutable
24 | - run: yarn workspace @jsamr/counter-style build
25 | name: Build counter-style
26 | - run: yarn workspace @jsamr/react-native-li test:ts
27 | name: Typescript Tests
28 | - run: yarn workspace @jsamr/react-native-li test:lint
29 | name: Linting Tests
30 | - run: yarn workspace @jsamr/react-native-li test:jest --coverage
31 | name: Behavior Tests
32 | - run: yarn workspace @jsamr/react-native-li build
33 | name: Build
34 | - uses: codecov/codecov-action@v1
35 | with:
36 | flags: react-native-li
37 | fail_ci_if_error: true
38 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 |
24 | # Android/IntelliJ
25 | #
26 | build/
27 | .idea
28 | .gradle
29 | local.properties
30 | *.iml
31 |
32 | # Visual Studio Code
33 | #
34 | .vscode/
35 |
36 | # node.js
37 | #
38 | node_modules/
39 | npm-debug.log
40 | yarn-error.log
41 |
42 | # BUCK
43 | buck-out/
44 | \.buckd/
45 | *.keystore
46 | !debug.keystore
47 |
48 | # fastlane
49 | #
50 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
51 | # screenshots whenever they are needed.
52 | # For more information about the recommended setup visit:
53 | # https://docs.fastlane.tools/best-practices/source-control/
54 |
55 | */fastlane/report.xml
56 | */fastlane/Preview.html
57 | */fastlane/screenshots
58 |
59 | # Bundle artifact
60 | *.jsbundle
61 |
62 | *.todos
63 |
64 | # yarn berry
65 | .yarn/*
66 | !.yarn/releases
67 | !.yarn/plugins
68 | !.yarn/sdks
69 | !.yarn/versions
70 |
--------------------------------------------------------------------------------
/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | bracketSpacing: true,
3 | jsxBracketSameLine: true,
4 | singleQuote: true,
5 | trailingComma: 'none',
6 | };
7 |
--------------------------------------------------------------------------------
/.yarnrc.yml:
--------------------------------------------------------------------------------
1 | enableGlobalCache: true
2 |
3 | nodeLinker: node-modules
4 |
5 | plugins:
6 | - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
7 | spec: "@yarnpkg/plugin-interactive-tools"
8 |
9 | yarnPath: .yarn/releases/yarn-2.4.1.cjs
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | (The MIT License)
2 |
3 | Copyright (c) 2019-2020 Jules Sam. Randolph.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining
6 | a copy of this software and associated documentation files (the
7 | 'Software'), to deal in the Software without restriction, including
8 | without limitation the rights to use, copy, modify, merge, publish,
9 | distribute, sublicense, and/or sell copies of the Software, and to
10 | permit persons to whom the Software is furnished to do so, subject to
11 | the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/MAINTAINING.md:
--------------------------------------------------------------------------------
1 | jsamr's template for react-native libraries
2 |
3 | ## Creating a new package
4 |
5 | 1. Copy `packages/example-path` to the new package;
6 | 2. Create a new workflow from `.github/workflows/example-path.yml`. The name of
7 | the workflow must match the name of the folder for that package in
8 | `packages/` directory.
9 | 3. Add a new entry + flag in `codecov.yml`. The flag must match the name of the
10 | package in `packages/` directory.
11 | 4. In the new package folder, go to the `README.md`, `example-path` and `package.json` and do:
12 | * Replace any instance of `example-project` with the github path;
13 | * Replace any instance of `example-npm` with the npm package name.
14 | * Replace any instance of `example-path` with the folder name hosting the
15 | package in `packages` directory.
16 | 5. In the new package folder, go to the `package.json`
17 | * Fill the `description`
18 | * Fill the `keywords`
19 | 6. Repeat the steps from point 4. to the new workflow file you created in step 2.
20 |
21 | ## Upgrading expo
22 |
23 | Run
24 |
25 | ```bash
26 | yarn demo expo upgrade
27 | ```
28 |
29 | After that step, go to the root `package.json` and in the `resolutions` field, update any dependency used by the demo.
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | | Package | Release | Build Status | Coverage |
2 | | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
3 | | [@jsamr/counter-style](packages/counter-style#readme) | [](https://www.npmjs.com/package/@jsamr/counter-style) | [](https://github.com/jsamr/react-native-li/actions?query=branch%3Amaster+workflow%3Acounter-style) | [](https://codecov.io/gh/jsamr/react-native-li?flag=counter-style) |
4 | | [@jsamr/react-native-li](packages/react-native-li#readme) | [](https://www.npmjs.com/package/@jsamr/react-native-li) | [](https://github.com/jsamr/react-native-li/actions?query=branch%3Amaster+workflow%3Areact-native-li) | [](https://codecov.io/gh/jsamr/react-native-li?flag=react-native-li) |
5 |
--------------------------------------------------------------------------------
/babel-config-base.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | 'module:metro-react-native-babel-preset',
4 | '@babel/preset-typescript'
5 | ],
6 | plugins: ['@babel/plugin-transform-react-jsx'],
7 | env: {}
8 | };
9 |
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 | coverage:
2 | precision: 2
3 | round: down
4 | range: '80...100'
5 | status:
6 | project:
7 | default:
8 | target: auto
9 | counter-style:
10 | target: auto
11 | flags:
12 | - counter-style
13 | react-native-li:
14 | target: auto
15 | flags:
16 | - react-native-li
17 |
18 | flags:
19 | counter-style:
20 | paths:
21 | - packages/counter-style/
22 | react-native-li:
23 | paths:
24 | - packages/react-native-li/
25 |
--------------------------------------------------------------------------------
/commitlint.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ['@commitlint/config-conventional']
3 | };
4 |
--------------------------------------------------------------------------------
/demo/.expo-shared/assets.json:
--------------------------------------------------------------------------------
1 | {
2 | "12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true,
3 | "40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true
4 | }
5 |
--------------------------------------------------------------------------------
/demo/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/**/*
2 | .expo/*
3 | npm-debug.*
4 | *.jks
5 | *.p8
6 | *.p12
7 | *.key
8 | *.mobileprovision
9 | *.orig.*
10 | web-build/
11 |
12 | # macOS
13 | .DS_Store
14 |
--------------------------------------------------------------------------------
/demo/App.tsx:
--------------------------------------------------------------------------------
1 | /* eslint-disable react-native/no-inline-styles */
2 | import React from 'react';
3 | import { StatusBar } from 'expo-status-bar';
4 | import { ScrollView, StyleSheet, Text } from 'react-native';
5 | import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
6 | import { LoremIpsum } from 'lorem-ipsum';
7 | import * as presets from '@jsamr/counter-style/presets';
8 | import MarkedList from '@jsamr/react-native-li';
9 |
10 | const lorem = new LoremIpsum({});
11 |
12 | export default function App() {
13 | return (
14 |
15 |
16 |
19 |
20 | {[...Array(100).keys()].map((index) => (
21 |
22 | {lorem.generateSentences(1)}
23 |
24 | ))}
25 |
26 |
27 |
28 |
29 |
30 | );
31 | }
32 |
33 | const styles = StyleSheet.create({
34 | grow: { flexGrow: 1 },
35 | container: {
36 | flexGrow: 1,
37 | alignItems: 'flex-start'
38 | }
39 | });
40 |
--------------------------------------------------------------------------------
/demo/app.config.js:
--------------------------------------------------------------------------------
1 | export default {
2 | name: 'Demo',
3 | displayName: 'Demo',
4 | expo: {
5 | name: 'Demo',
6 | slug: 'demo',
7 | version: '0.0.0',
8 | orientation: 'default',
9 | description: '*',
10 | icon: './assets/icon.png',
11 | splash: {
12 | backgroundColor: '#ffffff'
13 | },
14 | updates: {
15 | fallbackToCacheTimeout: 0
16 | },
17 | assetBundlePatterns: ['**/*'],
18 | ios: {
19 | supportsTablet: true
20 | },
21 | web: {
22 | favicon: './assets/favicon.png'
23 | }
24 | }
25 | };
26 |
--------------------------------------------------------------------------------
/demo/assets/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jsamr/react-native-li/f326122929cbe4a034140aef697e1522731f2a3d/demo/assets/favicon.png
--------------------------------------------------------------------------------
/demo/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jsamr/react-native-li/f326122929cbe4a034140aef697e1522731f2a3d/demo/assets/icon.png
--------------------------------------------------------------------------------
/demo/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = function(api) {
2 | api.cache(true);
3 | return {
4 | presets: ['babel-preset-expo'],
5 | };
6 | };
7 |
--------------------------------------------------------------------------------
/demo/index.js:
--------------------------------------------------------------------------------
1 | import 'react-native-gesture-handler';
2 | import { enableScreens } from 'react-native-screens';
3 | import { AppRegistry } from 'react-native';
4 | import App from './App';
5 | import { name as appName } from './app.json';
6 |
7 | enableScreens();
8 |
9 | AppRegistry.registerComponent(appName, () => App);
10 |
--------------------------------------------------------------------------------
/demo/metro.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const fs = require('fs');
3 | // We must use @expo/metro-config for icons in @expo/vector-icons to work properly.
4 | const { getDefaultConfig } = require('@expo/metro-config');
5 |
6 | const packagesRoot = path.resolve(__dirname, '../packages');
7 |
8 | const localPkgs = fs.readdirSync(packagesRoot);
9 |
10 | module.exports = (async () => {
11 | const { resolver, ...other } = await getDefaultConfig(__dirname);
12 | return {
13 | ...other,
14 | watchFolders: localPkgs.map((f) => path.join(packagesRoot, f)),
15 | resolver: {
16 | ...resolver,
17 | extraNodeModules: new Proxy(
18 | {},
19 | {
20 | get: (target, name) => path.join(__dirname, `node_modules/${name}`)
21 | }
22 | )
23 | }
24 | };
25 | })();
26 |
--------------------------------------------------------------------------------
/demo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "demo",
3 | "main": "node_modules/expo/AppEntry.js",
4 | "scripts": {
5 | "start": "expo start",
6 | "android": "expo start --android",
7 | "ios": "expo start --ios",
8 | "web": "expo start --web",
9 | "eject": "expo eject"
10 | },
11 | "dependencies": {
12 | "@jsamr/counter-style": "workspace:*",
13 | "@jsamr/react-native-li": "workspace:*",
14 | "expo": "^40.0.1",
15 | "expo-status-bar": "~1.0.3",
16 | "lorem-ipsum": "^2.0.3",
17 | "react": "16.13.1",
18 | "react-dom": "16.13.1",
19 | "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
20 | "react-native-safe-area-context": "3.1.9",
21 | "react-native-web": "~0.13.12"
22 | },
23 | "devDependencies": {
24 | "@babel/core": "~7.9.0",
25 | "@expo/metro-config": "^0.1.60"
26 | },
27 | "private": true,
28 | "installConfig": {
29 | "hoistingLimits": "workspaces"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/demo/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig-base.json",
3 | "compilerOptions": {
4 | "outDir": "./lib",
5 | "jsx": "react-native"
6 | },
7 | "exclude": ["node_modules"]
8 | }
9 |
--------------------------------------------------------------------------------
/images/TableStyleSpecs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jsamr/react-native-li/f326122929cbe4a034140aef697e1522731f2a3d/images/TableStyleSpecs.png
--------------------------------------------------------------------------------
/images/adaptative.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jsamr/react-native-li/f326122929cbe4a034140aef697e1522731f2a3d/images/adaptative.jpeg
--------------------------------------------------------------------------------
/images/android.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jsamr/react-native-li/f326122929cbe4a034140aef697e1522731f2a3d/images/android.gif
--------------------------------------------------------------------------------
/images/expo-example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jsamr/react-native-li/f326122929cbe4a034140aef697e1522731f2a3d/images/expo-example.png
--------------------------------------------------------------------------------
/images/scalesPageToFit.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jsamr/react-native-li/f326122929cbe4a034140aef697e1522731f2a3d/images/scalesPageToFit.jpg
--------------------------------------------------------------------------------
/jest-config-base.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'react-native',
3 | moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'node'],
4 | testRegex: 'src/.*\\.test\\.tsx?$',
5 | coveragePathIgnorePatterns: ['/node_modules/', '__tests__'],
6 | transformIgnorePatterns: [
7 | 'node_modules/(?!(react-native|react-native-webview|ramda|react-native-render-html)/)'
8 | ]
9 | };
10 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-li-project",
3 | "private": true,
4 | "scripts": {
5 | "demo": "yarn workspace demo",
6 | "react-native-li": "yarn workspace @jsamr/react-native-li",
7 | "counter-style": "yarn workspace @jsamr/counter-style"
8 | },
9 | "devDependencies": {
10 | "@commitlint/cli": "^12.1.1",
11 | "@commitlint/config-conventional": "^12.1.1",
12 | "@formidable-webview/eslint-config-webjs": "^1.0.0",
13 | "@react-native-community/eslint-config": "^2.0.0",
14 | "@typescript-eslint/eslint-plugin": "^4.21.0",
15 | "@typescript-eslint/parser": "^4.21.0",
16 | "eslint": "^7.23.0",
17 | "eslint-plugin-compat": "^3.9.0",
18 | "eslint-plugin-tsdoc": "^0.2.11",
19 | "husky": "^6.0.0",
20 | "prettier": "^2.2.1"
21 | },
22 | "resolutions": {
23 | "react": "16.13.1",
24 | "react-dom": "16.13.1",
25 | "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
26 | "react-test-renderer": "16.13.1",
27 | "@release-it/conventional-changelog": "patch:@release-it/conventional-changelog@2.0.0#patches/@release-it-conventional-changelog.patch",
28 | "release-it": "patch:release-it@14.6.0#patches/release-it.patch"
29 | },
30 | "author": "Jules Sam. Randolph (https://github.com/jsamr)",
31 | "license": "MIT",
32 | "husky": {
33 | "hooks": {
34 | "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
35 | }
36 | },
37 | "workspaces": [
38 | "packages/*",
39 | "demo"
40 | ]
41 | }
42 |
--------------------------------------------------------------------------------
/packages/counter-style/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | /lib
3 | /types
4 |
--------------------------------------------------------------------------------
/packages/counter-style/.gitignore:
--------------------------------------------------------------------------------
1 | # CocoaPods
2 | /ios/Pods/
3 |
4 | # Jest code coverage
5 | /coverage
6 |
7 | # This library
8 | /lib/
9 |
10 | # api-extractor
11 | /temp
12 |
13 | # Types must be bundled with api-extractor, not included in the repo
14 | /types
15 |
16 | # Auto-generated presets modules
17 | /presets
18 |
19 |
--------------------------------------------------------------------------------
/packages/counter-style/.prettierignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | /lib
3 | /types
4 |
--------------------------------------------------------------------------------
/packages/counter-style/.release-it.js:
--------------------------------------------------------------------------------
1 | const name = require('./package.json').name;
2 | const configureRelease = require("release-config");
3 | module.exports = configureRelease(name);
4 |
--------------------------------------------------------------------------------
/packages/counter-style/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## [2.0.2](https://github.com/jsamr/react-native-li/compare/@jsamr/counter-style@2.0.1...@jsamr/counter-style@2.0.2) (2022-01-28)
2 |
3 | ## [2.0.1](https://github.com/jsamr/react-native-li/compare/@jsamr/counter-style@2.0.0...@jsamr/counter-style@2.0.1) (2021-06-04)
4 |
5 | # [2.0.0](https://github.com/jsamr/react-native-li/compare/@jsamr/counter-style@1.1.1...@jsamr/counter-style@2.0.0) (2021-04-14)
6 |
7 |
8 | ### Code Refactoring
9 |
10 | * **counter-style:** remove second "maxLenComputer" arg of raw ([335d523](https://github.com/jsamr/react-native-li/commit/335d52311384c325302fc0008840a4f59cd921ca))
11 |
12 |
13 | ### Features
14 |
15 | * **counter-style:** pass default computer to withMaxLenComputer callback ([dd9f032](https://github.com/jsamr/react-native-li/commit/dd9f0321e344603db59363da782ef55cd3617a4d))
16 |
17 |
18 | ### Performance Improvements
19 |
20 | * **counter-style:** optimize fixed maxCounterLen computer ([318cb6d](https://github.com/jsamr/react-native-li/commit/318cb6d716a32988932b7d500f7f9be6e37ea697))
21 | * **counter-style:** optimize symbolic maxLenComputer ([2b2b980](https://github.com/jsamr/react-native-li/commit/2b2b9800779266aa8caaf0f7b8d0be0783e7ab7f))
22 | * **counter-style:** optimized cyclic maxLenComputer ([4e2c7ae](https://github.com/jsamr/react-native-li/commit/4e2c7aeb15f5b2f43f602a23c144223283e2d4b4))
23 |
24 |
25 | ### BREAKING CHANGES
26 |
27 | * **counter-style:** CounterStyle.raw does not accept a second argument
28 | anymore. Replace with a chained "withMaxLengthComputer".
29 |
30 | ## [1.1.1](https://github.com/jsamr/react-native-li/compare/@jsamr/counter-style@1.1.0...@jsamr/counter-style@1.1.1) (2021-04-14)
31 |
32 |
33 | ### Bug Fixes
34 |
35 | * **counter-style:** additive systems with only one symbol mapped to 0 ([5c23c27](https://github.com/jsamr/react-native-li/commit/5c23c273e5e9580610501ab63faf2f1ba94c32d4))
36 |
37 | # [1.1.0](https://github.com/jsamr/react-native-li/compare/@jsamr/counter-style@1.0.4...@jsamr/counter-style@1.1.0) (2021-04-14)
38 |
39 |
40 | ### Features
41 |
42 | * **counter-style:** stricter additive range extrapolation ([fa72954](https://github.com/jsamr/react-native-li/commit/fa7295483aac1e447feab0232cecafc95c076b75))
43 |
44 | ## [1.0.4](https://github.com/jsamr/react-native-li/compare/@jsamr/counter-style@1.0.3...@jsamr/counter-style@1.0.4) (2021-04-13)
45 |
46 |
47 | ### Bug Fixes
48 |
49 | * **counter-style:** handle decreasing ranges properly ([2315975](https://github.com/jsamr/react-native-li/commit/2315975034ab369e80f449907b983c1a4ac3e86b))
50 |
51 | ## [1.0.3](https://github.com/jsamr/react-native-li/compare/@jsamr/counter-style@1.0.2...@jsamr/counter-style@1.0.3) (2021-04-13)
52 |
53 | ## [1.0.2](https://github.com/jsamr/react-native-li/compare/@jsamr/counter-style@1.0.1...@jsamr/counter-style@1.0.2) (2021-04-13)
54 |
55 |
56 | ### Bug Fixes
57 |
58 | * **counter-style:** remove support for functional formatters in types ([d445553](https://github.com/jsamr/react-native-li/commit/d4455532cac89bac6dca6b5bbb20d0add0be1a44))
59 |
60 | ## [1.0.1](https://github.com/jsamr/react-native-li/compare/@jsamr/counter-style@1.0.0...@jsamr/counter-style@1.0.1) (2021-04-13)
61 |
62 |
63 | ### Bug Fixes
64 |
65 | * wrong homepage link ([901b80f](https://github.com/jsamr/react-native-li/commit/901b80fdc01c34a659b0cc890cbe017590078b04))
66 |
67 | # 1.0.0 (2021-04-13)
68 |
69 |
70 | ### Features
71 |
72 | * **counter-style:** be strict with UTF-16 support ([91a4e18](https://github.com/jsamr/react-native-li/commit/91a4e1804d78b14b35dfef8a8ee46b69f6fb8700))
73 | * **counter-style:** export all presets in barrel module ([fe43005](https://github.com/jsamr/react-native-li/commit/fe43005020349caf4e80dc422464cae4b6c161a3))
74 | * **counter-style:** separation between marker string and counter repr. ([e294944](https://github.com/jsamr/react-native-li/commit/e294944e6539213d027c1c71dfdf414795d0472d))
75 | * **counter-style:** support RTL rendering ([31151ce](https://github.com/jsamr/react-native-li/commit/31151ce961bbbf3de7a4fa609ca075b2b832cbd9))
76 | * add counter-style package ([f9171e3](https://github.com/jsamr/react-native-li/commit/f9171e376020abcea07c82d651a3376a58ea64bf))
77 |
78 |
--------------------------------------------------------------------------------
/packages/counter-style/MAINTAINING.md:
--------------------------------------------------------------------------------
1 | ## Adding a new preset
2 |
3 | 1. Add the preset in `src/presets` folder.
4 | 2. Run `yarn autogen-presets-index`.
5 | 3. Run `yarn build`.
6 |
--------------------------------------------------------------------------------
/packages/counter-style/README.md:
--------------------------------------------------------------------------------
1 | @jsamr/counter-style
2 |
3 |
4 |
9 |
14 |
19 |
25 |
26 |
30 |
31 |
32 |
33 |
34 | A slim CSS Counter Styles Level 3 compliant library with 47 presets including
Arabic, Persian, Thai, Hebrew, Roman, Katana...
35 | The core is less than 1.7kB minified and gzipped.
36 | Each preset is distributed as a separate module.
37 | Available in both CommonJS and ECMAScript modules.
38 | Targets ECMAScript 2015.
39 | Optimized for metro (React Native) and Webpack bundlers.
40 | Based on prior work from Whang Shuwei.
41 |
42 |
43 |
44 |
45 | ### Install
46 |
47 | ```sh
48 | npm add --save @jsamr/counter-style
49 | ```
50 |
51 | ```sh
52 | yarn add @jsamr/counter-style
53 | ```
54 |
55 | ### Using presets
56 |
57 | **This library exports 47 presets. [Find your preset here.](./src/presets)** Each preset is accessible in a separate module to limit bundle size.
58 |
59 | ```js
60 | import arabicIndic from '@jsamr/counter-style/presets/arabicIndic';
61 |
62 | expect(arabicIndic.renderMarker(78)).toBe('٧٨. ');
63 | ```
64 |
65 | > PRs are welcomed to support other presets. Very easy to implement thanks to [this W3C resource](https://www.w3.org/TR/predefined-counter-styles/).
66 |
67 |
68 |
69 |
70 | ### Creating custom style renderers
71 |
72 | The API follows closely the specs for CSS `@counter-style` at rule. The default export ([CounterStyle](./docs/counter-style.counterstyle.md)) is a static object with methods to build [CounterStyleRenderer](./docs/counter-style.counterstylerenderer.md).
73 |
74 | #### Example 1: a lower Russian alphabet renderer
75 |
76 | In the
77 | below example, we're using [the alphabetic counter system](https://www.w3.org/TR/css-counter-styles-3/#alphabetic-system) and `alphabeticFromUnicodeRange` builder which allows to specify a contiguous unicode range. For non-contiguous ranges, use the `alphabetic` builder.
78 |
79 | ```js
80 | import CounterStyle from '@jsamr/counter-style';
81 |
82 | const lowerRussian = CounterStyle.alphabeticFromUnicodeRange(
83 | 0x430, // а
84 | 28
85 | ).withSuffix(') ');
86 |
87 | // Expect comes from jest testing framework.
88 | // Just a showcase of expected returned values.
89 | expect(lowerRussian.renderCounter(1)).toBe('а');
90 | expect(lowerRussian.renderMarker(1)).toBe('а) ');
91 | expect(lowerRussian.renderCounter(2)).toBe('б');
92 | expect(lowerRussian.renderCounter(3)).toBe('в');
93 | expect(lowerRussian.renderMarker(4)).toBe('г) ');
94 | expect(lowerRussian.renderMarker(5)).toBe('д) ');
95 | expect(lowerRussian.renderCounter(29)).toBe('аа');
96 | expect(lowerRussian.maxMarkerLenInRange(1, 5)).toBe(3);
97 | expect(lowerRussian.maxCounterLenInRange(1, 5)).toBe(1);
98 | ```
99 | Reference: [W3C Ready-made Counter Styles: Cyrillic styles](https://www.w3.org/TR/predefined-counter-styles/#cyrillic-styles).
100 |
101 | #### Example 2: a "Funky" symbolic renderer
102 |
103 | In the
104 | below example, we're using [the symbolic counter system](https://www.w3.org/TR/css-counter-styles-3/#symbolic-system).
105 | Note that `withSuffix(null)` removes default suffix.
106 |
107 | ```js
108 | import CounterStyle from '@jsamr/counter-style';
109 |
110 | // Default suffix is ". ", as per the specs.
111 | const funky = CounterStyle.symbolic('*', '&').withSuffix(null);
112 |
113 | // Expect comes from jest testing framework.
114 | // Just a showcase of expected returned values.
115 | expect(funky.renderMarker(1)).toBe('*');
116 | expect(funky.renderMarker(2)).toBe('&');
117 | expect(funky.renderMarker(3)).toBe('**');
118 | expect(funky.renderMarker(4)).toBe('&&');
119 | expect(funky.renderMarker(5)).toBe('***');
120 | expect(funky.maxMarkerLenInRange(1, 5)).toBe(3);
121 | expect(funky.maxCounterLenInRange(1, 5)).toBe(3);
122 | ```
123 |
124 | All renderers can be chained to create variants, such as `withSuffix`,
125 | `withPaddingLeft`, ... See [available methods in the docs.](./docs/counter-style.counterstylerenderer.md)
126 |
127 | ### API reference
128 |
129 | **The API reference [is available here](./docs/counter-style.md).**
130 |
131 | ### Caveats
132 |
133 | - Instead of a normal space character, a non-breaking space is used for default
134 | prefixes. This is because this library primary usage is for React Native. On
135 | iOS, `Text` elements get trimmed of normal space characters.
136 | - In **numeric** and **alphabetic** systems , one UTF-16 code unit per symbol
137 | must be used. Otherwise, length computation will be erroneous. If you really
138 | need multi code units per symbol however, you can still set a custom length
139 | computer via `withMaxLenComputer`.
140 | - When using padding (`withPadding`) and negative (`withNegative`) symbols, one
141 | UTF-16 code unit per symbol must be used. Otherwise, length computation will
142 | be erroneous.
143 | - Never use combining characters. [Grapheme
144 | clusters](https://www.w3.org/TR/css-text-3/#grapheme-cluster) will be
145 | considered distinct characters. Beware that is the case for some emojis, see
146 | [this SO thread](https://stackoverflow.com/q/54369513/2779871).
147 | - Don't define incomplete additive systems which have holes in their range
148 | coverage. For example, an additive system which has no representation for "1"
149 | will not translate odd indexes.
150 |
151 | ### Limitations
152 |
153 | - `speakAs` hasn't been implemented yet.
154 | - Only textual symbols are supported. Images are not.
155 |
--------------------------------------------------------------------------------
/packages/counter-style/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = require('../../babel-config-base');
2 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstyle.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyle](./counter-style.counterstyle.md)
4 |
5 | ## CounterStyle variable
6 |
7 | A static object to build counter style renderers. See [CounterStyleStatic](./counter-style.counterstylestatic.md).
8 |
9 | Signature:
10 |
11 | ```typescript
12 | CounterStyle: Readonly
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.maxcounterleninrange.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md) > [maxCounterLenInRange](./counter-style.counterstylerenderer.maxcounterleninrange.md)
4 |
5 | ## CounterStyleRenderer.maxCounterLenInRange() method
6 |
7 | Get the maximum counter representation length given an index range. If a fallback is defined, it will be used for values outside the range boundaries of this renderer.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | maxCounterLenInRange(min: number, max: number): number;
13 | ```
14 |
15 | ## Parameters
16 |
17 | | Parameter | Type | Description |
18 | | --- | --- | --- |
19 | | min | number | The minimum inclusive value. |
20 | | max | number | The maximum inclusive value. |
21 |
22 | Returns:
23 |
24 | number
25 |
26 | ## Remarks
27 |
28 | This method doesn't take into account [unicode grapheme clusters](https://www.w3.org/TR/css-text-3/#grapheme-cluster).
29 |
30 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.maxmarkerleninrange.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md) > [maxMarkerLenInRange](./counter-style.counterstylerenderer.maxmarkerleninrange.md)
4 |
5 | ## CounterStyleRenderer.maxMarkerLenInRange() method
6 |
7 | Get the maximum marker string length given an index range. If a fallback is defined, it will be used for values outside the range boundaries of this renderer.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | maxMarkerLenInRange(min: number, max: number): number;
13 | ```
14 |
15 | ## Parameters
16 |
17 | | Parameter | Type | Description |
18 | | --- | --- | --- |
19 | | min | number | The minimum inclusive value. |
20 | | max | number | The maximum inclusive value. |
21 |
22 | Returns:
23 |
24 | number
25 |
26 | ## Remarks
27 |
28 | This method doesn't take into account [unicode grapheme clusters](https://www.w3.org/TR/css-text-3/#grapheme-cluster).
29 |
30 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md)
4 |
5 | ## CounterStyleRenderer interface
6 |
7 | An object to render counters.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | export interface CounterStyleRenderer
13 | ```
14 |
15 | ## Methods
16 |
17 | | Method | Description |
18 | | --- | --- |
19 | | [maxCounterLenInRange(min, max)](./counter-style.counterstylerenderer.maxcounterleninrange.md) | Get the maximum counter representation length given an index range. If a fallback is defined, it will be used for values outside the range boundaries of this renderer. |
20 | | [maxMarkerLenInRange(min, max)](./counter-style.counterstylerenderer.maxmarkerleninrange.md) | Get the maximum marker string length given an index range. If a fallback is defined, it will be used for values outside the range boundaries of this renderer. |
21 | | [renderCounter(index)](./counter-style.counterstylerenderer.rendercounter.md) | Render an index into its counter representation, equivalent to CSS counter
function. See [CSS Counter Styles Level 3, Counter Styles](https://www.w3.org/TR/css-counter-styles-3/#generate-a-counter). |
22 | | [renderMarker(index)](./counter-style.counterstylerenderer.rendermarker.md) | Render an index into its corresponding marker string. See [CSS Lists Level 3, Text-based Markers](https://www.w3.org/TR/css-lists-3/#text-markers). |
23 | | [renderPrefix()](./counter-style.counterstylerenderer.renderprefix.md) | Render this renderer's prefix. |
24 | | [renderSuffix()](./counter-style.counterstylerenderer.rendersuffix.md) | Render this renderer's suffix. |
25 | | [withFallback(fallback)](./counter-style.counterstylerenderer.withfallback.md) | Create a new renderer with a fallback used when the index is out of bounds.See [CSS Counter Styles Level 3, Defining fallback: the fallback descriptor](https://www.w3.org/TR/css-counter-styles-3/#counter-style-fallback). |
26 | | [withMaxLengthComputer(computer)](./counter-style.counterstylerenderer.withmaxlengthcomputer.md) | Create a new renderer with a (hopefuly) cost-effective max codepoint length computer. |
27 | | [withNegative(prefix, suffix)](./counter-style.counterstylerenderer.withnegative.md) | Create a new renderer which will render negative values by prefixing and suffixing the provided characters to the renderer function.See [CSS Counter Styles Level 3, Formatting negative values: the negative descriptor](https://www.w3.org/TR/css-counter-styles-3/#counter-style-negative). |
28 | | [withPadLeft(length, pad)](./counter-style.counterstylerenderer.withpadleft.md) | Create a new renderer which adds padding to the left.See [CSS Counter Styles Level 3, Zero-Padding and Constant-Width Representations: the pad descriptor](https://www.w3.org/TR/css-counter-styles-3/#counter-style-pad). |
29 | | [withPadRight(length, pad)](./counter-style.counterstylerenderer.withpadright.md) | Create a new renderer which adds padding to the right.See [CSS Counter Styles Level 3, Zero-Padding and Constant-Width Representations: the pad descriptor](https://www.w3.org/TR/css-counter-styles-3/#counter-style-pad). |
30 | | [withPrefix(prefix)](./counter-style.counterstylerenderer.withprefix.md) | Create a new renderer which replaces or removes this renderer prefix.See [CSS Counter Styles Level 3, Symbols before the marker: the prefix descriptor](https://www.w3.org/TR/css-counter-styles-3/#counter-style-prefix). |
31 | | [withRange(min, max, fallback)](./counter-style.counterstylerenderer.withrange.md) | Create a new renderer with a constrained range. When the index is out of bounds, the counter representation is rendered with the provided fallback, or the default fallback if none was provided.See [CSS Counter Styles Level 3, Limiting the counter scope: the range descriptor](https://www.w3.org/TR/css-counter-styles-3/#counter-style-range). |
32 | | [withRtl(options)](./counter-style.counterstylerenderer.withrtl.md) | Create a new renderer which renders Right-to-left. |
33 | | [withSuffix(suffix)](./counter-style.counterstylerenderer.withsuffix.md) | Create a new renderer which replaces or removes this renderer suffix.See [CSS Counter Styles Level 3, Symbols after the marker: the suffix descriptor](https://www.w3.org/TR/css-counter-styles-3/#counter-style-suffix). |
34 |
35 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.rendercounter.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md) > [renderCounter](./counter-style.counterstylerenderer.rendercounter.md)
4 |
5 | ## CounterStyleRenderer.renderCounter() method
6 |
7 | Render an index into its counter representation, equivalent to CSS `counter` function. See [CSS Counter Styles Level 3, Counter Styles](https://www.w3.org/TR/css-counter-styles-3/#generate-a-counter).
8 |
9 | Signature:
10 |
11 | ```typescript
12 | renderCounter(index: number): string;
13 | ```
14 |
15 | ## Parameters
16 |
17 | | Parameter | Type | Description |
18 | | --- | --- | --- |
19 | | index | number | The counter value to render. |
20 |
21 | Returns:
22 |
23 | string
24 |
25 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.rendermarker.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md) > [renderMarker](./counter-style.counterstylerenderer.rendermarker.md)
4 |
5 | ## CounterStyleRenderer.renderMarker() method
6 |
7 | Render an index into its corresponding marker string. See [CSS Lists Level 3, Text-based Markers](https://www.w3.org/TR/css-lists-3/#text-markers).
8 |
9 | Signature:
10 |
11 | ```typescript
12 | renderMarker(index: number): string;
13 | ```
14 |
15 | ## Parameters
16 |
17 | | Parameter | Type | Description |
18 | | --- | --- | --- |
19 | | index | number | The counter value to render. |
20 |
21 | Returns:
22 |
23 | string
24 |
25 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.renderprefix.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md) > [renderPrefix](./counter-style.counterstylerenderer.renderprefix.md)
4 |
5 | ## CounterStyleRenderer.renderPrefix() method
6 |
7 | Render this renderer's prefix.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | renderPrefix(): string;
13 | ```
14 | Returns:
15 |
16 | string
17 |
18 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.rendersuffix.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md) > [renderSuffix](./counter-style.counterstylerenderer.rendersuffix.md)
4 |
5 | ## CounterStyleRenderer.renderSuffix() method
6 |
7 | Render this renderer's suffix.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | renderSuffix(): string;
13 | ```
14 | Returns:
15 |
16 | string
17 |
18 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.withfallback.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md) > [withFallback](./counter-style.counterstylerenderer.withfallback.md)
4 |
5 | ## CounterStyleRenderer.withFallback() method
6 |
7 | Create a new renderer with a fallback used when the index is out of bounds.
8 |
9 | See [CSS Counter Styles Level 3, Defining fallback: the fallback descriptor](https://www.w3.org/TR/css-counter-styles-3/#counter-style-fallback).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | withFallback(fallback: FallbackRenderer): CounterStyleRenderer;
15 | ```
16 |
17 | ## Parameters
18 |
19 | | Parameter | Type | Description |
20 | | --- | --- | --- |
21 | | fallback | [FallbackRenderer](./counter-style.fallbackrenderer.md) | A fallback CounterStyleRenderer. |
22 |
23 | Returns:
24 |
25 | [CounterStyleRenderer](./counter-style.counterstylerenderer.md)
26 |
27 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.withmaxlengthcomputer.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md) > [withMaxLengthComputer](./counter-style.counterstylerenderer.withmaxlengthcomputer.md)
4 |
5 | ## CounterStyleRenderer.withMaxLengthComputer() method
6 |
7 | Create a new renderer with a (hopefuly) cost-effective max codepoint length computer.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | withMaxLengthComputer(computer: (min: number, max: number, defaultComputer: MaxCodepointLengthInRangeComputer) => number): CounterStyleRenderer;
13 | ```
14 |
15 | ## Parameters
16 |
17 | | Parameter | Type | Description |
18 | | --- | --- | --- |
19 | | computer | (min: number, max: number, defaultComputer: [MaxCodepointLengthInRangeComputer](./counter-style.maxcodepointlengthinrangecomputer.md)) => number | A function to compute the max codepoints length produced by the underlying formatter given a range. |
20 |
21 | Returns:
22 |
23 | [CounterStyleRenderer](./counter-style.counterstylerenderer.md)
24 |
25 | ## Remarks
26 |
27 | The computer function must not handle negative numbers.
28 |
29 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.withnegative.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md) > [withNegative](./counter-style.counterstylerenderer.withnegative.md)
4 |
5 | ## CounterStyleRenderer.withNegative() method
6 |
7 | Create a new renderer which will render negative values by prefixing and suffixing the provided characters to the renderer function.
8 |
9 | See [CSS Counter Styles Level 3, Formatting negative values: the negative descriptor](https://www.w3.org/TR/css-counter-styles-3/#counter-style-negative).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | withNegative(prefix: string, suffix?: string): CounterStyleRenderer;
15 | ```
16 |
17 | ## Parameters
18 |
19 | | Parameter | Type | Description |
20 | | --- | --- | --- |
21 | | prefix | string | String prepended to counter representation. |
22 | | suffix | string | String appended to counter representation. |
23 |
24 | Returns:
25 |
26 | [CounterStyleRenderer](./counter-style.counterstylerenderer.md)
27 |
28 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.withpadleft.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md) > [withPadLeft](./counter-style.counterstylerenderer.withpadleft.md)
4 |
5 | ## CounterStyleRenderer.withPadLeft() method
6 |
7 | Create a new renderer which adds padding to the left.
8 |
9 | See [CSS Counter Styles Level 3, Zero-Padding and Constant-Width Representations: the pad descriptor](https://www.w3.org/TR/css-counter-styles-3/#counter-style-pad).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | withPadLeft(length: number, pad: string): CounterStyleRenderer;
15 | ```
16 |
17 | ## Parameters
18 |
19 | | Parameter | Type | Description |
20 | | --- | --- | --- |
21 | | length | number | The total length to which padding should be added. |
22 | | pad | string | The character to pad. |
23 |
24 | Returns:
25 |
26 | [CounterStyleRenderer](./counter-style.counterstylerenderer.md)
27 |
28 | ## Remarks
29 |
30 | If you need to pad with spaces, beware on React Native you should use non-breaking spaces on iOS (\\u00A0) or the padding might get trimmed.
31 |
32 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.withpadright.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md) > [withPadRight](./counter-style.counterstylerenderer.withpadright.md)
4 |
5 | ## CounterStyleRenderer.withPadRight() method
6 |
7 | Create a new renderer which adds padding to the right.
8 |
9 | See [CSS Counter Styles Level 3, Zero-Padding and Constant-Width Representations: the pad descriptor](https://www.w3.org/TR/css-counter-styles-3/#counter-style-pad).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | withPadRight(length: number, pad: string): CounterStyleRenderer;
15 | ```
16 |
17 | ## Parameters
18 |
19 | | Parameter | Type | Description |
20 | | --- | --- | --- |
21 | | length | number | The total length to which padding should be added. |
22 | | pad | string | The character to pad. |
23 |
24 | Returns:
25 |
26 | [CounterStyleRenderer](./counter-style.counterstylerenderer.md)
27 |
28 | ## Remarks
29 |
30 | If you need to pad with spaces, beware on React Native you should use non-breaking spaces on iOS (\\u00A0) or the padding might get trimmed.
31 |
32 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.withprefix.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md) > [withPrefix](./counter-style.counterstylerenderer.withprefix.md)
4 |
5 | ## CounterStyleRenderer.withPrefix() method
6 |
7 | Create a new renderer which replaces or removes this renderer prefix.
8 |
9 | See [CSS Counter Styles Level 3, Symbols before the marker: the prefix descriptor](https://www.w3.org/TR/css-counter-styles-3/#counter-style-prefix).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | withPrefix(prefix: string | null): CounterStyleRenderer;
15 | ```
16 |
17 | ## Parameters
18 |
19 | | Parameter | Type | Description |
20 | | --- | --- | --- |
21 | | prefix | string \| null | A prefix, or null
to remove this renderer suffix. |
22 |
23 | Returns:
24 |
25 | [CounterStyleRenderer](./counter-style.counterstylerenderer.md)
26 |
27 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.withrange.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md) > [withRange](./counter-style.counterstylerenderer.withrange.md)
4 |
5 | ## CounterStyleRenderer.withRange() method
6 |
7 | Create a new renderer with a constrained range. When the index is out of bounds, the counter representation is rendered with the provided fallback, or the default fallback if none was provided.
8 |
9 | See [CSS Counter Styles Level 3, Limiting the counter scope: the range descriptor](https://www.w3.org/TR/css-counter-styles-3/#counter-style-range).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | withRange(min: number, max: number, fallback?: FallbackRenderer): CounterStyleRenderer;
15 | ```
16 |
17 | ## Parameters
18 |
19 | | Parameter | Type | Description |
20 | | --- | --- | --- |
21 | | min | number | Minimum value (inclusive) |
22 | | max | number | Maximum value (inclusive) |
23 | | fallback | [FallbackRenderer](./counter-style.fallbackrenderer.md) | A fallback renderer to apply when the index is out of bounds. |
24 |
25 | Returns:
26 |
27 | [CounterStyleRenderer](./counter-style.counterstylerenderer.md)
28 |
29 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.withrtl.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md) > [withRtl](./counter-style.counterstylerenderer.withrtl.md)
4 |
5 | ## CounterStyleRenderer.withRtl() method
6 |
7 | Create a new renderer which renders Right-to-left.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | withRtl(options?: RtlOptions): CounterStyleRenderer;
13 | ```
14 |
15 | ## Parameters
16 |
17 | | Parameter | Type | Description |
18 | | --- | --- | --- |
19 | | options | [RtlOptions](./counter-style.rtloptions.md) | |
20 |
21 | Returns:
22 |
23 | [CounterStyleRenderer](./counter-style.counterstylerenderer.md)
24 |
25 | ## Remarks
26 |
27 | By default: - The order of prefix, counter representation and suffix will be reversed when rendering marker. - The letter ordering of prefix and suffix will be reversed when rendering marker, prefix and suffix. - The letter ordering of counter representation will not be reversed when rendering marker and counter.
28 |
29 | See [RtlOptions](./counter-style.rtloptions.md).
30 |
31 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylerenderer.withsuffix.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleRenderer](./counter-style.counterstylerenderer.md) > [withSuffix](./counter-style.counterstylerenderer.withsuffix.md)
4 |
5 | ## CounterStyleRenderer.withSuffix() method
6 |
7 | Create a new renderer which replaces or removes this renderer suffix.
8 |
9 | See [CSS Counter Styles Level 3, Symbols after the marker: the suffix descriptor](https://www.w3.org/TR/css-counter-styles-3/#counter-style-suffix).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | withSuffix(suffix: string | null): CounterStyleRenderer;
15 | ```
16 |
17 | ## Parameters
18 |
19 | | Parameter | Type | Description |
20 | | --- | --- | --- |
21 | | suffix | string \| null | A suffix, or null
to remove the default suffix. |
22 |
23 | Returns:
24 |
25 | [CounterStyleRenderer](./counter-style.counterstylerenderer.md)
26 |
27 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylestatic.additive.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleStatic](./counter-style.counterstylestatic.md) > [additive](./counter-style.counterstylestatic.additive.md)
4 |
5 | ## CounterStyleStatic.additive property
6 |
7 | Create an additive system renderer.
8 |
9 | See [CSS Counter Styles Level 3, Accumulating Numerals: the additive system](https://www.w3.org/TR/css-counter-styles-3/#additive-system).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | additive: (symbols: Record) => CounterStyleRenderer;
15 | ```
16 |
17 | ## Remarks
18 |
19 | Additive systems might have "holes" in their range coverage. For example, an additive system which has no representation for "1" will not translate odd indexes. \*\*The behavior of this renderer for incomplete additive systems is unspecified.\*\*
20 |
21 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylestatic.alphabetic.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleStatic](./counter-style.counterstylestatic.md) > [alphabetic](./counter-style.counterstylestatic.alphabetic.md)
4 |
5 | ## CounterStyleStatic.alphabetic property
6 |
7 | Create an alphabetic system renderer.
8 |
9 | See [CSS Counter Styles Level 3, Bijective Numerals: the alphabetic system](https://www.w3.org/TR/css-counter-styles-3/#alphabetic-system).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | alphabetic: (...symbols: string[]) => CounterStyleRenderer;
15 | ```
16 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylestatic.alphabeticfromunicoderange.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleStatic](./counter-style.counterstylestatic.md) > [alphabeticFromUnicodeRange](./counter-style.counterstylestatic.alphabeticfromunicoderange.md)
4 |
5 | ## CounterStyleStatic.alphabeticFromUnicodeRange property
6 |
7 | Create an alphabetic system renderer from a UTF-16 code unit and an alphabet length. The set of symbols for this alphabetic system will be generated by incrementing `originUnicode` with every integer in range \[0, `alphabetLength` - 1\].
8 |
9 | See [CSS Counter Styles Level 3, Bijective Numerals: the alphabetic system](https://www.w3.org/TR/css-counter-styles-3/#alphabetic-system).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | alphabeticFromUnicodeRange: (originUnicode: number, alphabetLength: number) => CounterStyleRenderer;
15 | ```
16 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylestatic.cyclic.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleStatic](./counter-style.counterstylestatic.md) > [cyclic](./counter-style.counterstylestatic.cyclic.md)
4 |
5 | ## CounterStyleStatic.cyclic property
6 |
7 | Create a cyclic system renderer.
8 |
9 | See [CSS Counter Styles Level 3, Cycling Symbols: the cyclic system](https://www.w3.org/TR/css-counter-styles-3/#cyclic-system).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | cyclic: (...symbols: string[]) => CounterStyleRenderer;
15 | ```
16 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylestatic.fixed.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleStatic](./counter-style.counterstylestatic.md) > [fixed](./counter-style.counterstylestatic.fixed.md)
4 |
5 | ## CounterStyleStatic.fixed property
6 |
7 | Create a fixed system renderer.
8 |
9 | See [CSS Counter Styles Level 3, Exhaustible Symbols: the fixed system](https://www.w3.org/TR/css-counter-styles-3/#fixed-system).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | fixed: (...symbols: string[]) => CounterStyleRenderer;
15 | ```
16 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylestatic.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleStatic](./counter-style.counterstylestatic.md)
4 |
5 | ## CounterStyleStatic interface
6 |
7 | An object to build counter style renderers.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | export interface CounterStyleStatic
13 | ```
14 |
15 | ## Properties
16 |
17 | | Property | Type | Description |
18 | | --- | --- | --- |
19 | | [additive](./counter-style.counterstylestatic.additive.md) | (symbols: Record<number, string>) => [CounterStyleRenderer](./counter-style.counterstylerenderer.md) | Create an additive system renderer.See [CSS Counter Styles Level 3, Accumulating Numerals: the additive system](https://www.w3.org/TR/css-counter-styles-3/#additive-system). |
20 | | [alphabetic](./counter-style.counterstylestatic.alphabetic.md) | (...symbols: string\[\]) => [CounterStyleRenderer](./counter-style.counterstylerenderer.md) | Create an alphabetic system renderer.See [CSS Counter Styles Level 3, Bijective Numerals: the alphabetic system](https://www.w3.org/TR/css-counter-styles-3/#alphabetic-system). |
21 | | [alphabeticFromUnicodeRange](./counter-style.counterstylestatic.alphabeticfromunicoderange.md) | (originUnicode: number, alphabetLength: number) => [CounterStyleRenderer](./counter-style.counterstylerenderer.md) | Create an alphabetic system renderer from a UTF-16 code unit and an alphabet length. The set of symbols for this alphabetic system will be generated by incrementing originUnicode
with every integer in range \[0, alphabetLength
- 1\].See [CSS Counter Styles Level 3, Bijective Numerals: the alphabetic system](https://www.w3.org/TR/css-counter-styles-3/#alphabetic-system). |
22 | | [cyclic](./counter-style.counterstylestatic.cyclic.md) | (...symbols: string\[\]) => [CounterStyleRenderer](./counter-style.counterstylerenderer.md) | Create a cyclic system renderer.See [CSS Counter Styles Level 3, Cycling Symbols: the cyclic system](https://www.w3.org/TR/css-counter-styles-3/#cyclic-system). |
23 | | [fixed](./counter-style.counterstylestatic.fixed.md) | (...symbols: string\[\]) => [CounterStyleRenderer](./counter-style.counterstylerenderer.md) | Create a fixed system renderer.See [CSS Counter Styles Level 3, Exhaustible Symbols: the fixed system](https://www.w3.org/TR/css-counter-styles-3/#fixed-system). |
24 | | [numeric](./counter-style.counterstylestatic.numeric.md) | (...symbols: string\[\]) => [CounterStyleRenderer](./counter-style.counterstylerenderer.md) | Create a numeric system renderer.See [CSS Counter Styles Level 3, Positional Numerals: the numeric system](https://www.w3.org/TR/css-counter-styles-3/#numeric-system). |
25 | | [numericFromUnicodeRange](./counter-style.counterstylestatic.numericfromunicoderange.md) | (originUnicode: number, base: number) => [CounterStyleRenderer](./counter-style.counterstylerenderer.md) | Create a numeric system renderer from a UTF-16 code unit and a base. The set of numerals for this range will be generated by incrementing originUnicode
with every integer in range \[0, base
- 1\].See [CSS Counter Styles Level 3, Positional Numerals: the numeric system](https://www.w3.org/TR/css-counter-styles-3/#numeric-system). |
26 | | [raw](./counter-style.counterstylestatic.raw.md) | (initialCounterFormatter: [InitialCounterFormatter](./counter-style.initialcounterformatter.md)) => [CounterStyleRenderer](./counter-style.counterstylerenderer.md) | Create a renderer from a formatter function. |
27 | | [symbolic](./counter-style.counterstylestatic.symbolic.md) | (...symbols: string\[\]) => [CounterStyleRenderer](./counter-style.counterstylerenderer.md) | Create a symbolic system renderer.See [CSS Counter Styles Level 3, Repeating Symbols: the symbolic system](https://www.w3.org/TR/css-counter-styles-3/#symbolic-system). |
28 |
29 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylestatic.numeric.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleStatic](./counter-style.counterstylestatic.md) > [numeric](./counter-style.counterstylestatic.numeric.md)
4 |
5 | ## CounterStyleStatic.numeric property
6 |
7 | Create a numeric system renderer.
8 |
9 | See [CSS Counter Styles Level 3, Positional Numerals: the numeric system](https://www.w3.org/TR/css-counter-styles-3/#numeric-system).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | numeric: (...symbols: string[]) => CounterStyleRenderer;
15 | ```
16 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylestatic.numericfromunicoderange.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleStatic](./counter-style.counterstylestatic.md) > [numericFromUnicodeRange](./counter-style.counterstylestatic.numericfromunicoderange.md)
4 |
5 | ## CounterStyleStatic.numericFromUnicodeRange property
6 |
7 | Create a numeric system renderer from a UTF-16 code unit and a base. The set of numerals for this range will be generated by incrementing `originUnicode` with every integer in range \[0, `base` - 1\].
8 |
9 | See [CSS Counter Styles Level 3, Positional Numerals: the numeric system](https://www.w3.org/TR/css-counter-styles-3/#numeric-system).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | numericFromUnicodeRange: (originUnicode: number, base: number) => CounterStyleRenderer;
15 | ```
16 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylestatic.raw.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleStatic](./counter-style.counterstylestatic.md) > [raw](./counter-style.counterstylestatic.raw.md)
4 |
5 | ## CounterStyleStatic.raw property
6 |
7 | Create a renderer from a formatter function.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | raw: (initialCounterFormatter: InitialCounterFormatter) => CounterStyleRenderer;
13 | ```
14 |
15 | ## Remarks
16 |
17 | The formatter function should not add decorations. Especially:
18 |
19 | - should not add negative signs. Use [CounterStyleRenderer.withNegative()](./counter-style.counterstylerenderer.withnegative.md) instead. - should not add padding. Use [CounterStyleRenderer.withPadLeft()](./counter-style.counterstylerenderer.withpadleft.md) and [CounterStyleRenderer.withPadRight()](./counter-style.counterstylerenderer.withpadright.md) instead. - should not add prefixes or suffixes. Use [CounterStyleRenderer.withPrefix()](./counter-style.counterstylerenderer.withprefix.md) and [CounterStyleRenderer.withSuffix()](./counter-style.counterstylerenderer.withsuffix.md) instead.
20 |
21 | If the formatter function doesn't cover the \[-Infinity, Infinity\] range, you must specify the scope via [CounterStyleRenderer.withRange()](./counter-style.counterstylerenderer.withrange.md).
22 |
23 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.counterstylestatic.symbolic.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [CounterStyleStatic](./counter-style.counterstylestatic.md) > [symbolic](./counter-style.counterstylestatic.symbolic.md)
4 |
5 | ## CounterStyleStatic.symbolic property
6 |
7 | Create a symbolic system renderer.
8 |
9 | See [CSS Counter Styles Level 3, Repeating Symbols: the symbolic system](https://www.w3.org/TR/css-counter-styles-3/#symbolic-system).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | symbolic: (...symbols: string[]) => CounterStyleRenderer;
15 | ```
16 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.fallbackrenderer.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [FallbackRenderer](./counter-style.fallbackrenderer.md)
4 |
5 | ## FallbackRenderer type
6 |
7 | Minimal API for a fallback.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | export declare type FallbackRenderer = Pick;
13 | ```
14 | References: [CounterStyleRenderer](./counter-style.counterstylerenderer.md)
15 |
16 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.initialcounterformatter.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [InitialCounterFormatter](./counter-style.initialcounterformatter.md)
4 |
5 | ## InitialCounterFormatter type
6 |
7 | A function that renders an index into its [initial counter representation](https://www.w3.org/TR/css-counter-styles-3/#initial-representation-for-the-counter-value).
8 |
9 | As specified in CSS, this function must not render negative signs, add padding or prefixes and suffixes.
10 |
11 | Signature:
12 |
13 | ```typescript
14 | export declare type InitialCounterFormatter = (index: number) => string | undefined;
15 | ```
16 |
17 | ## Remarks
18 |
19 | It can return undefined to signal a fallback should be used instead.
20 |
21 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.maxcodepointlengthinrangecomputer.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [MaxCodepointLengthInRangeComputer](./counter-style.maxcodepointlengthinrangecomputer.md)
4 |
5 | ## MaxCodepointLengthInRangeComputer type
6 |
7 | A function which compute the maximum codepoint length of a formatter in a given range.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | export declare type MaxCodepointLengthInRangeComputer = (min: number, max: number) => number;
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md)
4 |
5 | ## counter-style package
6 |
7 | ## Interfaces
8 |
9 | | Interface | Description |
10 | | --- | --- |
11 | | [CounterStyleRenderer](./counter-style.counterstylerenderer.md) | An object to render counters. |
12 | | [CounterStyleStatic](./counter-style.counterstylestatic.md) | An object to build counter style renderers. |
13 | | [RtlOptions](./counter-style.rtloptions.md) | An object to specify RTL rendering. |
14 |
15 | ## Variables
16 |
17 | | Variable | Description |
18 | | --- | --- |
19 | | [CounterStyle](./counter-style.counterstyle.md) | A static object to build counter style renderers. See [CounterStyleStatic](./counter-style.counterstylestatic.md). |
20 |
21 | ## Type Aliases
22 |
23 | | Type Alias | Description |
24 | | --- | --- |
25 | | [FallbackRenderer](./counter-style.fallbackrenderer.md) | Minimal API for a fallback. |
26 | | [InitialCounterFormatter](./counter-style.initialcounterformatter.md) | A function that renders an index into its [initial counter representation](https://www.w3.org/TR/css-counter-styles-3/#initial-representation-for-the-counter-value).As specified in CSS, this function must not render negative signs, add padding or prefixes and suffixes. |
27 | | [MaxCodepointLengthInRangeComputer](./counter-style.maxcodepointlengthinrangecomputer.md) | A function which compute the maximum codepoint length of a formatter in a given range. |
28 |
29 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.rtloptions.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [RtlOptions](./counter-style.rtloptions.md)
4 |
5 | ## RtlOptions interface
6 |
7 | An object to specify RTL rendering.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | export interface RtlOptions
13 | ```
14 |
15 | ## Properties
16 |
17 | | Property | Type | Description |
18 | | --- | --- | --- |
19 | | [reverseCounter?](./counter-style.rtloptions.reversecounter.md) | boolean | (Optional) Reverse the order of characters in the counter. |
20 | | [reversePrefix?](./counter-style.rtloptions.reverseprefix.md) | boolean | (Optional) Reverse the order of characters in the prefix. |
21 | | [reverseSuffix?](./counter-style.rtloptions.reversesuffix.md) | boolean | (Optional) Reverse the order of characters in the suffix. |
22 |
23 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.rtloptions.reversecounter.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [RtlOptions](./counter-style.rtloptions.md) > [reverseCounter](./counter-style.rtloptions.reversecounter.md)
4 |
5 | ## RtlOptions.reverseCounter property
6 |
7 | Reverse the order of characters in the counter.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | reverseCounter?: boolean;
13 | ```
14 |
15 | ## Example
16 |
17 | `abc` becomes `cba`
18 |
19 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.rtloptions.reverseprefix.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [RtlOptions](./counter-style.rtloptions.md) > [reversePrefix](./counter-style.rtloptions.reverseprefix.md)
4 |
5 | ## RtlOptions.reversePrefix property
6 |
7 | Reverse the order of characters in the prefix.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | reversePrefix?: boolean;
13 | ```
14 |
15 | ## Example
16 |
17 | `-|` becomes `|-`
18 |
19 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/counter-style.rtloptions.reversesuffix.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/counter-style](./counter-style.md) > [RtlOptions](./counter-style.rtloptions.md) > [reverseSuffix](./counter-style.rtloptions.reversesuffix.md)
4 |
5 | ## RtlOptions.reverseSuffix property
6 |
7 | Reverse the order of characters in the suffix.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | reverseSuffix?: boolean;
13 | ```
14 |
15 | ## Example
16 |
17 | `. ` becomes ` .`
18 |
19 |
--------------------------------------------------------------------------------
/packages/counter-style/docs/index.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md)
4 |
5 | ## API Reference
6 |
7 | ## Packages
8 |
9 | | Package | Description |
10 | | --- | --- |
11 | | [@jsamr/counter-style](./counter-style.md) | |
12 |
13 |
--------------------------------------------------------------------------------
/packages/counter-style/etc/.gitignore:
--------------------------------------------------------------------------------
1 | example-npm.api.md
2 |
--------------------------------------------------------------------------------
/packages/counter-style/etc/counter-style.api.md:
--------------------------------------------------------------------------------
1 | ## API Report File for "@jsamr/counter-style"
2 |
3 | > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4 |
5 | ```ts
6 |
7 | // @public
8 | const CounterStyle: Readonly;
9 |
10 | export default CounterStyle;
11 |
12 | // @public
13 | export interface CounterStyleRenderer {
14 | maxCounterLenInRange(min: number, max: number): number;
15 | maxMarkerLenInRange(min: number, max: number): number;
16 | renderCounter(index: number): string;
17 | renderMarker(index: number): string;
18 | renderPrefix(): string;
19 | renderSuffix(): string;
20 | withFallback(fallback: FallbackRenderer): CounterStyleRenderer;
21 | withMaxLengthComputer(computer: (min: number, max: number, defaultComputer: MaxCodepointLengthInRangeComputer) => number): CounterStyleRenderer;
22 | withNegative(prefix: string, suffix?: string): CounterStyleRenderer;
23 | withPadLeft(length: number, pad: string): CounterStyleRenderer;
24 | withPadRight(length: number, pad: string): CounterStyleRenderer;
25 | withPrefix(prefix: string | null): CounterStyleRenderer;
26 | withRange(min: number, max: number, fallback?: FallbackRenderer): CounterStyleRenderer;
27 | withRtl(options?: RtlOptions): CounterStyleRenderer;
28 | withSuffix(suffix: string | null): CounterStyleRenderer;
29 | }
30 |
31 | // @public
32 | export interface CounterStyleStatic {
33 | additive: (symbols: Record) => CounterStyleRenderer;
34 | alphabetic: (...symbols: string[]) => CounterStyleRenderer;
35 | alphabeticFromUnicodeRange: (originUnicode: number, alphabetLength: number) => CounterStyleRenderer;
36 | cyclic: (...symbols: string[]) => CounterStyleRenderer;
37 | fixed: (...symbols: string[]) => CounterStyleRenderer;
38 | numeric: (...symbols: string[]) => CounterStyleRenderer;
39 | numericFromUnicodeRange: (originUnicode: number, base: number) => CounterStyleRenderer;
40 | raw: (initialCounterFormatter: InitialCounterFormatter) => CounterStyleRenderer;
41 | symbolic: (...symbols: string[]) => CounterStyleRenderer;
42 | }
43 |
44 | // @public
45 | export type FallbackRenderer = Pick;
46 |
47 | // @public
48 | export type InitialCounterFormatter = (index: number) => string | undefined;
49 |
50 | // @public
51 | export type MaxCodepointLengthInRangeComputer = (min: number, max: number) => number;
52 |
53 | // @public
54 | export interface RtlOptions {
55 | reverseCounter?: boolean;
56 | reversePrefix?: boolean;
57 | reverseSuffix?: boolean;
58 | }
59 |
60 |
61 | // (No @packageDocumentation comment for this package)
62 |
63 | ```
64 |
--------------------------------------------------------------------------------
/packages/counter-style/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@jsamr/counter-style",
3 | "version": "2.0.2",
4 | "description": "CSS Counter Styles Level 3 and presets",
5 | "main": "lib/cjs/index.js",
6 | "module": "lib/es/index.js",
7 | "react-native": "lib/es/index.js",
8 | "types": "types/counter-style/index.d.ts",
9 | "sideEffects": false,
10 | "files": [
11 | "lib",
12 | "src",
13 | "types",
14 | "docs",
15 | "presets"
16 | ],
17 | "scripts": {
18 | "autogen-presets-index": "node scripts/generatePresetsIndex.js",
19 | "test": "yarn test:ts && yarn test:lint && yarn test:jest && yarn test:size",
20 | "test:jest": "jest src/",
21 | "test:ts": "tsc --noEmit",
22 | "test:lint": "eslint --ext ts,tsx src/",
23 | "test:size": "size-limit",
24 | "build": "node scripts/build.js",
25 | "build:clean": "rimraf ./lib",
26 | "build:es": "tsc -p tsconfig.build-es.json",
27 | "build:cjs": "tsc -p tsconfig.build-cjs.json",
28 | "build:presets": "node scripts/generatePresets.js",
29 | "build:defs": "api-extractor run --local --verbose",
30 | "build:doc": "api-documenter markdown --input-folder temp --output-folder ./docs",
31 | "prepack": "yarn run build"
32 | },
33 | "keywords": [
34 | "CSS Counter Styles Level 3",
35 | "lists",
36 | "ol",
37 | "ul",
38 | "li"
39 | ],
40 | "devDependencies": {
41 | "@babel/cli": "^7.13.14",
42 | "@babel/core": "^7.13.15",
43 | "@babel/preset-typescript": "^7.13.0",
44 | "@babel/runtime": "^7.13.10",
45 | "@microsoft/api-documenter": "^7.12.20",
46 | "@microsoft/api-extractor": "7.13.4",
47 | "@release-it/conventional-changelog": "^2.0.0",
48 | "@size-limit/preset-small-lib": "^4.10.2",
49 | "@types/jest": "^26.0.22",
50 | "babel-jest": "^26.6.3",
51 | "eslint": "^7.23.0",
52 | "jest": "^26.6.3",
53 | "prettier": "^2.2.1",
54 | "react-native-builder-bob": "^0.18.1",
55 | "release-it": "^14.3.0",
56 | "rimraf": "^3.0.2",
57 | "size-limit": "^4.10.2",
58 | "typescript": "~4.2.4"
59 | },
60 | "author": "Jules Sam. Randolph (https://github.com/jsamr)",
61 | "homepage": "https://github.com/jsamr/react-native-li/tree/master/packages/react-native-li#readme",
62 | "license": "MIT",
63 | "repository": {
64 | "type": "git",
65 | "directory": "packages/counter-style",
66 | "url": "git+ssh://git@github.com/jsamr/react-native-li.git"
67 | },
68 | "publishConfig": {
69 | "access": "public"
70 | },
71 | "size-limit": [
72 | {
73 | "path": "lib/es/index.js",
74 | "limit": "1.70 KB",
75 | "gzip": true
76 | },
77 | {
78 | "path": "lib/cjs/index.js",
79 | "limit": "2.00 KB",
80 | "gzip": true
81 | }
82 | ],
83 | "react-native-builder-bob": {
84 | "source": "src",
85 | "output": "lib",
86 | "targets": [
87 | [
88 | "module",
89 | {
90 | "babelrc": false
91 | }
92 | ],
93 | [
94 | "commonjs",
95 | {
96 | "babelrc": false
97 | }
98 | ],
99 | [
100 | "typescript",
101 | {
102 | "project": "tsconfig.build.json"
103 | }
104 | ]
105 | ]
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/packages/counter-style/scripts/build.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable compat/compat */
2 | /*
3 | * This build script spawns processes to shorten execution time.
4 | */
5 | const childProcess = require('child_process');
6 |
7 | function promiseFromChildProcess(child) {
8 | return new Promise(function (resolve, reject) {
9 | child.on('error', reject);
10 | child.on('exit', () => {
11 | resolve();
12 | });
13 | });
14 | }
15 |
16 | function exec(command) {
17 | const child = childProcess.exec(command);
18 | child.stdout.on('data', (data) => console.log(data));
19 | child.stderr.on('data', (data) => console.error(data));
20 | return child;
21 | }
22 |
23 | async function build() {
24 | const buildPresetProcess = exec('yarn build:presets');
25 | const cleanProcess = exec('yarn build:clean');
26 | await promiseFromChildProcess(cleanProcess);
27 | const buildEsProcess = exec('yarn build:es');
28 | const buildCjsProcess = exec('yarn build:cjs');
29 | await Promise.all([
30 | promiseFromChildProcess(buildEsProcess),
31 | promiseFromChildProcess(buildCjsProcess)
32 | ]);
33 | const buildDefsProcess = exec('yarn build:defs');
34 | await promiseFromChildProcess(buildDefsProcess);
35 | const buildDocProcess = exec('yarn build:doc');
36 | await Promise.all([
37 | promiseFromChildProcess(buildDocProcess),
38 | promiseFromChildProcess(buildPresetProcess)
39 | ]);
40 | }
41 |
42 | build().catch((e) => {
43 | console.error(e);
44 | process.exit(1);
45 | });
46 |
--------------------------------------------------------------------------------
/packages/counter-style/scripts/generatePresets.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs/promises');
2 | const rimraf = require('rimraf');
3 | const path = require('path');
4 | const util = require('util');
5 | const { presetsPath, getPresets } = require('./utils');
6 |
7 | const rimrafAsync = util.promisify(rimraf);
8 |
9 | async function clean() {
10 | try {
11 | await fs.lstat(presetsPath);
12 | } catch (e) {
13 | return;
14 | }
15 | try {
16 | await rimrafAsync(presetsPath);
17 | } catch (e) {
18 | console.info('Could not remove dir', e);
19 | throw e;
20 | }
21 | }
22 |
23 | async function run() {
24 | const presets = await getPresets();
25 | await clean();
26 | await fs.mkdir(presetsPath);
27 | for (const counter of presets) {
28 | const baseName = counter.replace('.ts', '');
29 | const sourcePath = path.join(presetsPath, baseName);
30 | await fs.mkdir(sourcePath);
31 | await fs.writeFile(
32 | path.join(sourcePath, 'package.json'),
33 | JSON.stringify({
34 | module: `../../lib/es/presets/${baseName}.js`,
35 | main: `../../lib/cjs/presets/${baseName}.js`,
36 | types: `../../lib/es/presets/${baseName}.d.ts`,
37 | 'react-native': `../../lib/es/presets/${baseName}.js`,
38 | sideEffects: false
39 | })
40 | );
41 | }
42 | // Add a barrel for all presets for easy presets discoverability.
43 | await fs.writeFile(
44 | path.join(presetsPath, 'package.json'),
45 | JSON.stringify({
46 | module: '../lib/es/presets/index.js',
47 | main: '../lib/cjs/presets/index.js',
48 | types: '../lib/es/presets/index.d.ts',
49 | 'react-native': '../lib/es/presets/index.js',
50 | sideEffects: false
51 | })
52 | );
53 | console.info(
54 | `Done. Wrote ${presets.length} modules in ${presetsPath} folder.`
55 | );
56 | }
57 |
58 | run().catch((e) => {
59 | console.error(e);
60 | process.exit(1);
61 | });
62 |
--------------------------------------------------------------------------------
/packages/counter-style/scripts/generatePresetsIndex.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs/promises');
2 | const path = require('path');
3 |
4 | const { presetsSrcPath, getPresets } = require('./utils.js');
5 |
6 | async function run() {
7 | const presets = await getPresets();
8 | const content = `${presets
9 | .map((name) => {
10 | const baseName = name.replace('.ts', '');
11 | return `export { default as ${baseName} } from './${baseName}';`;
12 | })
13 | .join('\n')}\n`;
14 | await fs.writeFile(path.join(presetsSrcPath, 'index.ts'), content);
15 | }
16 |
17 | run().catch((e) => {
18 | console.error(e);
19 | process.exit(1);
20 | });
21 |
--------------------------------------------------------------------------------
/packages/counter-style/scripts/utils.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs/promises');
2 | const path = require('path');
3 | const presetsSrcPath = path.join(__dirname, '../src/presets');
4 | const presetsPath = path.join(__dirname, '../presets');
5 |
6 | async function getPresets() {
7 | return (await fs.readdir(presetsSrcPath)).filter(
8 | (name) => name !== 'index.ts'
9 | );
10 | }
11 |
12 | module.exports = {
13 | getPresets,
14 | presetsPath,
15 | presetsSrcPath
16 | };
17 |
--------------------------------------------------------------------------------
/packages/counter-style/src/CounterStyle.ts:
--------------------------------------------------------------------------------
1 | import getAlphanumFromUnicodeRange from './getAlphanumFromUnicodeRange';
2 | import makeAlphanumMaxlenComputer from './makeAlphanumMaxlenComputer';
3 | import makeCSEngine from './makeCSEngine';
4 | import makeCSRenderer from './makeCSRenderer';
5 | import type {
6 | InitialCounterFormatter,
7 | CounterStyleStatic,
8 | CounterStyleRenderer
9 | } from './public-types';
10 | import codepointLength from './utils/codepointLength';
11 |
12 | const mod = (value: number, divisor: number) =>
13 | ((value % divisor) + divisor) % divisor;
14 |
15 | function makeCSRendererFromFormatter(formatter: InitialCounterFormatter) {
16 | return makeCSRenderer(makeCSEngine(formatter));
17 | }
18 |
19 | function getMaxLenInSymbols(lens: number[], from = 0, to?: number) {
20 | to = typeof to === 'number' ? to : lens.length;
21 | return lens.slice(from, to + 1).reduce((p, c) => Math.max(p, c), 0);
22 | }
23 |
24 | function numeric(renderer: CounterStyleRenderer, length: number) {
25 | return renderer
26 | .withMaxLengthComputer(makeAlphanumMaxlenComputer(length, false))
27 | .withNegative('-');
28 | }
29 |
30 | function alphabetic(renderer: CounterStyleRenderer, length: number) {
31 | return renderer
32 | .withMaxLengthComputer(makeAlphanumMaxlenComputer(length, true))
33 | .withRange(1, Infinity);
34 | }
35 |
36 | /**
37 | * A static object to build counter style renderers.
38 | * See {@link CounterStyleStatic}.
39 | *
40 | * @public
41 | */
42 | const CounterStyle: Readonly = Object.freeze({
43 | raw: (formatter) => {
44 | return makeCSRendererFromFormatter(formatter);
45 | },
46 | cyclic: (...symbols) => {
47 | const symbolLenghts = symbols.map(codepointLength);
48 | const maxLen = getMaxLenInSymbols(symbolLenghts);
49 | const renderer =
50 | symbols.length === 1
51 | ? makeCSRendererFromFormatter(() => symbols[0])
52 | : makeCSRendererFromFormatter(
53 | (index) => symbols[mod(index - 1, symbols.length)]
54 | );
55 | return renderer.withMaxLengthComputer((min, max) => {
56 | return maxLen === 1 || max - min + 1 >= symbols.length
57 | ? maxLen
58 | : getMaxLenInSymbols(symbolLenghts, min - 1, max - 1);
59 | });
60 | },
61 | fixed: (...symbols) => {
62 | const symbolLenghts = symbols.map(codepointLength);
63 | const maxLen = getMaxLenInSymbols(symbolLenghts);
64 | return makeCSRendererFromFormatter((index) => symbols[index - 1])
65 | .withRange(1, symbols.length)
66 | .withMaxLengthComputer((min, max) => {
67 | return maxLen === 1
68 | ? maxLen
69 | : getMaxLenInSymbols(symbolLenghts, min - 1, max - 1);
70 | });
71 | },
72 | symbolic: (...symbols) =>
73 | makeCSRendererFromFormatter((index) =>
74 | symbols[mod(index - 1, symbols.length)].repeat(
75 | Math.ceil(index / symbols.length)
76 | )
77 | )
78 | .withRange(1, Infinity)
79 | .withMaxLengthComputer((min, max, defaultCmp) => {
80 | // Just iterate over the last n elements until max, with n the number
81 | // of symbols.
82 | return defaultCmp(
83 | max < symbols.length ? min : max - symbols.length,
84 | max
85 | );
86 | }),
87 | alphabetic: (...symbols) => {
88 | return alphabetic(
89 | makeCSRendererFromFormatter((index) => {
90 | let result = '';
91 | while (index > 0) {
92 | index--;
93 | result = symbols[mod(index, symbols.length)] + result;
94 | index = Math.floor(index / symbols.length);
95 | }
96 | return result;
97 | }),
98 | symbols.length
99 | );
100 | },
101 | numeric: (...symbols) => {
102 | return numeric(
103 | makeCSRendererFromFormatter((index) => {
104 | if (index === 0) {
105 | return symbols[0];
106 | } else {
107 | let result = '';
108 | while (index > 0) {
109 | result = symbols[mod(index, symbols.length)] + result;
110 | index = Math.floor(index / symbols.length);
111 | }
112 | return result;
113 | }
114 | }),
115 | symbols.length
116 | );
117 | },
118 | numericFromUnicodeRange: (originUnicode: number, base: number) => {
119 | return numeric(
120 | makeCSRendererFromFormatter(
121 | (index) =>
122 | getAlphanumFromUnicodeRange(
123 | index,
124 | originUnicode,
125 | base,
126 | false
127 | ) as string
128 | ),
129 | base
130 | );
131 | },
132 | alphabeticFromUnicodeRange: (originUnicode: number, alphabetLen: number) => {
133 | return alphabetic(
134 | makeCSRendererFromFormatter((index) => {
135 | return getAlphanumFromUnicodeRange(
136 | index,
137 | originUnicode,
138 | alphabetLen,
139 | true
140 | );
141 | }),
142 | alphabetLen
143 | );
144 | },
145 | additive: (symbols: { [value: number]: string }) => {
146 | const values = Object.keys(symbols)
147 | .map((value) => parseInt(value, 10))
148 | .sort((a, b) => b - a);
149 | return makeCSRendererFromFormatter((index) => {
150 | if (index === 0) {
151 | return symbols[0];
152 | }
153 | let result = '';
154 | for (const value of values) {
155 | if (index >= value && value > 0) {
156 | const repeat = Math.floor(index / value);
157 | result += symbols[value].repeat(repeat);
158 | index -= repeat * value;
159 | }
160 | }
161 | return index === 0 ? result : undefined;
162 | }).withRange(
163 | values.length ? values[values.length - 1] : 0,
164 | 0 in symbols && values.length === 1 ? 0 : values.length ? Infinity : -1
165 | );
166 | }
167 | });
168 |
169 | export default CounterStyle;
170 |
--------------------------------------------------------------------------------
/packages/counter-style/src/__tests__/arabicIndic.test.ts:
--------------------------------------------------------------------------------
1 | import { DEFAULT_SUFFIX } from '../constants';
2 | import arabicIndic from '../presets/arabicIndic';
3 |
4 | test('arabic indic', () => {
5 | const counter = arabicIndic;
6 | expect(counter.renderCounter(0)).toBe('٠');
7 | expect(counter.renderCounter(10)).toBe('١٠');
8 | expect(counter.renderCounter(20)).toBe('٢٠');
9 | expect(counter.renderCounter(300)).toBe('٣٠٠');
10 | expect(counter.renderCounter(4000)).toBe('٤٠٠٠');
11 | expect(counter.renderCounter(-5)).toBe('-٥');
12 | expect(counter.renderMarker(20)).toBe('٢٠' + DEFAULT_SUFFIX);
13 | });
14 |
--------------------------------------------------------------------------------
/packages/counter-style/src/__tests__/codepointLength.test.ts:
--------------------------------------------------------------------------------
1 | import codepointLength from '../utils/codepointLength';
2 |
3 | describe('getAlphanumFromUnicodeRange', () => {
4 | it('should handle null and undefined values', () => {
5 | expect(codepointLength(null)).toBe(0);
6 | });
7 | it('should handle multi-units UTF-16 codepoints', () => {
8 | expect(codepointLength('👍')).toBe(1);
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/packages/counter-style/src/__tests__/getAlphanumFromUnicodeRange.test.ts:
--------------------------------------------------------------------------------
1 | import getAlphanumFromUnicodeRange from '../getAlphanumFromUnicodeRange';
2 |
3 | describe('getAlphanumFromUnicodeRange', () => {
4 | it('should support alphabetic mode', () => {
5 | expect(getAlphanumFromUnicodeRange(1, 97, 26, true)).toEqual('a');
6 | expect(getAlphanumFromUnicodeRange(2, 97, 26, true)).toEqual('b');
7 | expect(getAlphanumFromUnicodeRange(1 + 26, 97, 26, true)).toEqual('aa');
8 | expect(getAlphanumFromUnicodeRange(1 + 26 * 8, 97, 26, true)).toEqual('ha');
9 | expect(getAlphanumFromUnicodeRange(1 + 27, 97, 26, true)).toEqual('ab');
10 | expect(getAlphanumFromUnicodeRange(1 + 26 * 2 + 2, 97, 26, true)).toEqual(
11 | 'bc'
12 | );
13 | expect(getAlphanumFromUnicodeRange(1 + 26 * 27, 97, 26, true)).toEqual(
14 | 'aaa'
15 | );
16 | });
17 | it('should support numeric mode', () => {
18 | expect(getAlphanumFromUnicodeRange(0, 48, 10, false)).toEqual('0');
19 | expect(getAlphanumFromUnicodeRange(1, 48, 10, false)).toEqual('1');
20 | expect(getAlphanumFromUnicodeRange(2, 48, 10, false)).toEqual('2');
21 | expect(getAlphanumFromUnicodeRange(10000, 48, 10, false)).toEqual('10000');
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/packages/counter-style/src/__tests__/japaneseFormal.test.ts:
--------------------------------------------------------------------------------
1 | import { CJK_SUFFIX } from '../constants';
2 | import japaneseFormal from '../presets/japaneseFormal';
3 |
4 | test('Japanese formal', () => {
5 | const counter = japaneseFormal;
6 | expect(counter.renderMarker(0)).toBe('零' + CJK_SUFFIX);
7 | expect(counter.renderMarker(9000)).toBe('九阡' + CJK_SUFFIX);
8 | expect(counter.maxCounterLenInRange(9000, 9000)).toBe(2);
9 | expect(counter.renderMarker(10000)).toBe('一〇〇〇〇' + CJK_SUFFIX);
10 | });
11 |
--------------------------------------------------------------------------------
/packages/counter-style/src/__tests__/lowerAlpha.test.ts:
--------------------------------------------------------------------------------
1 | import lowerAlpha from '../presets/lowerAlpha';
2 |
3 | test('lowerAlpha', () => {
4 | const counter = lowerAlpha.withSuffix(null);
5 | expect(counter.renderMarker(1)).toBe('a');
6 | expect(counter.renderMarker(27)).toBe('aa');
7 | expect(counter.renderMarker(0)).toBe('0');
8 | });
9 |
--------------------------------------------------------------------------------
/packages/counter-style/src/__tests__/makeAlphanumMaxlenComputer.test.ts:
--------------------------------------------------------------------------------
1 | import makeAlphanumMaxlenComputer from '../makeAlphanumMaxlenComputer';
2 |
3 | describe('makeAlphanumMaxlenComputer', () => {
4 | it('should work in numeric mode', () => {
5 | const base10MaxLenComputer = makeAlphanumMaxlenComputer(10, false);
6 | expect(base10MaxLenComputer(0, 9)).toBe(1);
7 | expect(base10MaxLenComputer(0, 10)).toBe(2);
8 | expect(base10MaxLenComputer(0, 1000)).toBe(4);
9 | });
10 | it('should work in alphabetic mode', () => {
11 | // "A, B, C"
12 | const base3MaxLenComputer = makeAlphanumMaxlenComputer(3, true);
13 | expect(base3MaxLenComputer(0, 1)).toBe(1);
14 | expect(base3MaxLenComputer(0, 2)).toBe(1);
15 | expect(base3MaxLenComputer(0, 3)).toBe(1);
16 | expect(base3MaxLenComputer(0, 4)).toBe(2);
17 | expect(base3MaxLenComputer(0, 3 * 3 + 1)).toBe(3);
18 | expect(base3MaxLenComputer(0, 3 * 3 * 3 + 1)).toBe(4);
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/packages/counter-style/src/constants.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * See https://www.w3.org/TR/css-counter-styles-3/#counter-style-suffix
3 | *
4 | * @remarks We are using non-breaking space, otherwise iOS text elements get trimmed.
5 | */
6 | export const DEFAULT_SUFFIX = '\u002E\u00A0';
7 | export const CJK_SUFFIX = '\u3001';
8 |
--------------------------------------------------------------------------------
/packages/counter-style/src/getAlphanumFromUnicodeRange.ts:
--------------------------------------------------------------------------------
1 | function getAlphanumFromUnicodeRange(
2 | index: number,
3 | baseCharcode: number,
4 | modulo: number,
5 | alpha: true
6 | ): string | undefined;
7 | function getAlphanumFromUnicodeRange(
8 | index: number,
9 | baseCharcode: number,
10 | modulo: number,
11 | alpha: false
12 | ): string;
13 | /**
14 | * Create an alphabetic initial counter representation from an UTF-16 unicode
15 | * and a range.
16 | *
17 | * @param index - The index to render.
18 | * @param baseCharcode - The original UTF-16 unicode.
19 | * @param modulo - The number of symbols in the set.
20 | * @param alpha - In alpha mode, index starts at 1 instead of 0.
21 | * @returns
22 | */
23 | function getAlphanumFromUnicodeRange(
24 | index: number,
25 | baseCharcode: number,
26 | modulo: number,
27 | alpha: boolean
28 | ): string | undefined {
29 | const reindex = index - Number(alpha);
30 | if (reindex < 0) {
31 | return undefined;
32 | }
33 | if (reindex < modulo) {
34 | return String.fromCharCode(baseCharcode + reindex);
35 | }
36 | const rest = reindex % modulo;
37 | const next = (reindex - rest - modulo) / modulo + 1;
38 | return (
39 | getAlphanumFromUnicodeRange(next, baseCharcode, modulo, alpha as true) +
40 | String.fromCharCode(baseCharcode + rest)
41 | );
42 | }
43 |
44 | export default getAlphanumFromUnicodeRange;
45 |
--------------------------------------------------------------------------------
/packages/counter-style/src/index.tsx:
--------------------------------------------------------------------------------
1 | import CounterStyle from './CounterStyle';
2 |
3 | export * from './CounterStyle';
4 | export * from './public-types';
5 |
6 | export default CounterStyle;
7 |
--------------------------------------------------------------------------------
/packages/counter-style/src/internal-types.ts:
--------------------------------------------------------------------------------
1 | import type {
2 | InitialCounterFormatter,
3 | MaxCodepointLengthInRangeComputer,
4 | FallbackRenderer,
5 | CounterStyleRenderer
6 | } from './public-types';
7 |
8 | export interface Engine {
9 | specs: Specifications;
10 | formatter: InitialCounterFormatter;
11 | maxLengthInRange: MaxCodepointLengthInRangeComputer;
12 | withSpecs: (spToMerge: Partial) => Engine;
13 | withMaxLengthInRange: (cp: MaxCodepointLengthInRangeComputer) => Engine;
14 | }
15 |
16 | export interface Specifications {
17 | reversedMarker: boolean;
18 | reversedCounter: boolean;
19 | suffix: string | null;
20 | prefix: string | null;
21 | fallback: FallbackRenderer;
22 | negative: null | {
23 | prefix: string;
24 | suffix: string;
25 | };
26 | range: {
27 | min: number;
28 | max: number;
29 | };
30 | padding: null | {
31 | right: boolean;
32 | char: string;
33 | length: number;
34 | };
35 | }
36 |
37 | /**
38 | * Internal implementation of CounterStyleRenderer
39 | */
40 | export interface CounterStyleRendererInt extends CounterStyleRenderer {
41 | engine: Engine;
42 | getAbsoluteMaxLenInRange(min: number, max: number, negative: boolean): number;
43 | }
44 |
--------------------------------------------------------------------------------
/packages/counter-style/src/makeAlphanumMaxlenComputer.ts:
--------------------------------------------------------------------------------
1 | export default function makeAlphanumMaxlenComputer(
2 | base: number,
3 | alpha: boolean
4 | ) {
5 | return function alphanumericMaxLenComputer(_min: number, max: number) {
6 | let remax = max - Number(alpha);
7 | let digits: number = 1;
8 | while (remax >= base) {
9 | remax /= base;
10 | digits++;
11 | }
12 | return digits;
13 | };
14 | }
15 |
--------------------------------------------------------------------------------
/packages/counter-style/src/makeCSEngine.ts:
--------------------------------------------------------------------------------
1 | import codepointLength from './utils/codepointLength';
2 | import { DEFAULT_SUFFIX } from './constants';
3 | import { Specifications, Engine } from './internal-types';
4 | import { InitialCounterFormatter } from './public-types';
5 |
6 | const DEFAULT_SPECS: Specifications = {
7 | suffix: DEFAULT_SUFFIX,
8 | prefix: null,
9 | reversedMarker: false,
10 | reversedCounter: false,
11 | fallback: {
12 | renderCounter: (index) => index.toString(),
13 | maxCounterLenInRange(min, max) {
14 | return Math.max(
15 | this.renderCounter(min).length,
16 | this.renderCounter(max).length
17 | );
18 | }
19 | },
20 | negative: null,
21 | range: {
22 | min: -Infinity,
23 | max: Infinity
24 | },
25 | padding: null
26 | };
27 |
28 | const styleEngineProto: Pick<
29 | Engine,
30 | 'maxLengthInRange' | 'withSpecs' | 'withMaxLengthInRange'
31 | > = {
32 | // Cost-inefficient since it requires iterating over the whole range.
33 | maxLengthInRange(this: Engine, min, max) {
34 | let len = 0;
35 | for (let i = Math.max(0, min); i <= max; i++) {
36 | const val = this.formatter(i);
37 | len = Math.max(codepointLength(val), len);
38 | }
39 | return len;
40 | },
41 | withSpecs(this: Engine, spToMerge) {
42 | const next = Object.create(this) as Engine;
43 | next.specs = Object.assign({}, this.specs, spToMerge);
44 | return next;
45 | },
46 | withMaxLengthInRange(this: Engine, cp) {
47 | const next = Object.create(this) as Engine;
48 | next.maxLengthInRange = cp;
49 | return next;
50 | }
51 | };
52 |
53 | export default function makeCSEngine(
54 | formatter: InitialCounterFormatter,
55 | specs: Specifications = DEFAULT_SPECS
56 | ): Engine {
57 | const eng = Object.create(styleEngineProto) as Engine;
58 | eng.specs = specs;
59 | eng.formatter = formatter;
60 | return eng;
61 | }
62 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/arabicIndic.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const arabicIndic = CounterStyle.numericFromUnicodeRange(
4 | /* ٠ ١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩ */
5 | 0x0660,
6 | 10
7 | );
8 |
9 | export default arabicIndic;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/armenian.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const armenian = CounterStyle.additive({
4 | /* 9000 Ք, 8000 Փ, 7000 Ւ, 6000 Ց, 5000 Ր, 4000 Տ, 3000 Վ, 2000 Ս, 1000 Ռ,
5 | 900 Ջ, 800 Պ, 700 Չ, 600 Ո, 500 Շ, 400 Ն, 300 Յ, 200 Մ, 100 Ճ,
6 | 90 Ղ, 80 Ձ, 70 Հ, 60 Կ, 50 Ծ, 40 Խ, 30 Լ, 20 Ի, 10 Ժ,
7 | 9 Թ, 8 Ը, 7 Է, 6 Զ, 5 Ե, 4 Դ, 3 Գ, 2 Բ, 1 Ա */
8 | 9000: '\u0554',
9 | 8000: '\u0553',
10 | 7000: '\u0552',
11 | 6000: '\u0551',
12 | 5000: '\u0550',
13 | 4000: '\u054F',
14 | 3000: '\u054E',
15 | 2000: '\u054D',
16 | 1000: '\u054C',
17 | 900: '\u054B',
18 | 800: '\u054A',
19 | 700: '\u0549',
20 | 600: '\u0548',
21 | 500: '\u0547',
22 | 400: '\u0546',
23 | 300: '\u0545',
24 | 200: '\u0544',
25 | 100: '\u0543',
26 | 90: '\u0542',
27 | 80: '\u0541',
28 | 70: '\u0540',
29 | 60: '\u053F',
30 | 50: '\u053E',
31 | 40: '\u053D',
32 | 30: '\u053C',
33 | 20: '\u053B',
34 | 10: '\u053A',
35 | 9: '\u0539',
36 | 8: '\u0538',
37 | 7: '\u0537',
38 | 6: '\u0536',
39 | 5: '\u0535',
40 | 4: '\u0534',
41 | 3: '\u0533',
42 | 2: '\u0532',
43 | 1: '\u0531'
44 | }).withRange(1, 9999);
45 |
46 | export default armenian;
47 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/bengali.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const bengali = CounterStyle.numericFromUnicodeRange(
4 | /* ০ ১ ২ ৩ ৪ ৫ ৬ ৭ ৮ ৯ */
5 | 0x9e6,
6 | 10
7 | );
8 |
9 | export default bengali;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/cambodian.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const cambodian = CounterStyle.numericFromUnicodeRange(
4 | /* ០ ១ ២ ៣ ៤ ៥ ៦ ៧ ៨ ៩ */
5 | 0x17e0,
6 | 10
7 | );
8 |
9 | export default cambodian;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/chinese.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 | import { CJK_SUFFIX } from '../constants';
3 |
4 | // REF: https://www.w3.org/TR/css-counter-styles-3/#limited-chinese
5 | const constructor = (preset: number) =>
6 | ((markers: string[], informal: boolean) => {
7 | const ZERO = markers[0];
8 | const handler = (digits: string[], i: number = 0): string => {
9 | if (digits.length > 4) {
10 | return (
11 | handler(digits.slice(0, -4), i + 1) + handler(digits.slice(-4), i)
12 | );
13 | }
14 |
15 | // 1. If the counter value is 0, the representation is the character for 0 specified for the given counter style. Skip the rest of this algorithm.
16 | if (digits[0] === '0' && !digits[1]) {
17 | return ZERO;
18 | }
19 |
20 | // 2. Initially represent the counter value as a decimal number. For each digit that is not 0, append the appropriate digit marker to the digit. The ones digit has no marker.
21 | digits = digits.map((digit, j, arr) =>
22 | +digit
23 | ? // 3. For the informal styles, if the counter value is between ten and nineteen, remove the tens digit (leave the digit marker).
24 | (informal && digits.length === 2 && digits[0] === '1' && !j
25 | ? ''
26 | : markers[+digit]) +
27 | // 5. Replace the digits 0-9 with the appropriate character for the given counter style.
28 | ((j < arr.length - 1 && markers[arr.length - 1 + 9 - j]) || '')
29 | : digit
30 | );
31 |
32 | // 4. Drop any trailing zeros and collapse any remaining zeros into a single zero digit.
33 | digits = digits.join('').replace(/0+$/, '').replace(/0+/, ZERO).split('');
34 | // 5. Return the resultant string as the representation of the counter value.
35 | return digits
36 | .join('')
37 | .replace(/(.)$/, `$1${(i && markers[12 + i]) || ''}`);
38 | };
39 |
40 | return CounterStyle.raw((index) => handler(`${index}`.split('')))
41 | .withNegative(markers[markers.length - 1])
42 | .withRange(-2147483647, 2147483647)
43 | .withSuffix(CJK_SUFFIX);
44 | })(
45 | PRESETS.map((i) => i[preset]),
46 | !(preset % 2)
47 | );
48 |
49 | const PRESETS = [
50 | [/* 零 */ '\u96F6', /* 零 */ '\u96F6', /* 零 */ '\u96F6', /* 零 */ '\u96F6'],
51 | [/* 一 */ '\u4e00', /* 壹 */ '\u58f9', /* 一 */ '\u4e00', /* 壹 */ '\u58f9'],
52 | [/* 二 */ '\u4e8c', /* 贰 */ '\u8d30', /* 二 */ '\u4e8c', /* 貳 */ '\u8cb3'],
53 | [/* 三 */ '\u4e09', /* 叁 */ '\u53c1', /* 三 */ '\u4e09', /* 參 */ '\u53c3'],
54 | [/* 四 */ '\u56db', /* 肆 */ '\u8086', /* 四 */ '\u56db', /* 肆 */ '\u8086'],
55 | [/* 五 */ '\u4e94', /* 伍 */ '\u4f0d', /* 五 */ '\u4e94', /* 伍 */ '\u4f0d'],
56 | [/* 六 */ '\u516d', /* 陆 */ '\u9646', /* 六 */ '\u516d', /* 陸 */ '\u9678'],
57 | [/* 七 */ '\u4e03', /* 柒 */ '\u67d2', /* 七 */ '\u4e03', /* 柒 */ '\u67d2'],
58 | [/* 八 */ '\u516b', /* 捌 */ '\u634c', /* 八 */ '\u516b', /* 捌 */ '\u634c'],
59 | [/* 九 */ '\u4e5d', /* 玖 */ '\u7396', /* 九 */ '\u4e5d', /* 玖 */ '\u7396'],
60 | [/* 十 */ '\u5341', /* 拾 */ '\u62fe', /* 十 */ '\u5341', /* 拾 */ '\u62fe'],
61 | [/* 百 */ '\u767e', /* 佰 */ '\u4f70', /* 百 */ '\u767e', /* 佰 */ '\u4f70'],
62 | [/* 千 */ '\u5343', /* 仟 */ '\u4edf', /* 千 */ '\u5343', /* 仟 */ '\u4edf'],
63 | [/* 万 */ '\u4e07', /* 万 */ '\u4e07', /* 萬 */ '\u842c', /* 萬 */ '\u842c'],
64 | [/* 亿 */ '\u4ebf', /* 亿 */ '\u4ebf', /* 億 */ '\u5104', /* 億 */ '\u5104'],
65 | [/* 负 */ '\u8d1f', /* 负 */ '\u8d1f', /* 負 */ '\u8ca0', /* 負 */ '\u8ca0']
66 | ];
67 |
68 | export const simpleChineseInformal = constructor(0);
69 | export const simpleChineseFormal = constructor(1);
70 | export const traditionalChineseInformal = constructor(2);
71 | export const traditionalChineseFormal = constructor(3);
72 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/circle.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const circle = CounterStyle.cyclic('\u25E6').withSuffix('\u00A0'); /* ◦ */
4 |
5 | export default circle;
6 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/cjkDecimal.ts:
--------------------------------------------------------------------------------
1 | import { CJK_SUFFIX } from '../constants';
2 | import CounterStyle from '../CounterStyle';
3 |
4 | const cjkDecimal = CounterStyle.numeric(
5 | /* 〇 一 二 三 四 五 六 七 八 九 */
6 | '\u3007',
7 | '\u4E00',
8 | '\u4E8C',
9 | '\u4E09',
10 | '\u56DB',
11 | '\u4E94',
12 | '\u516D',
13 | '\u4E03',
14 | '\u516B',
15 | '\u4E5D'
16 | ).withSuffix(CJK_SUFFIX);
17 |
18 | export default cjkDecimal;
19 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/cjkEarthlyBranch.ts:
--------------------------------------------------------------------------------
1 | import { CJK_SUFFIX } from '../constants';
2 | import CounterStyle from '../CounterStyle';
3 |
4 | const cjkEarthlyBranch = CounterStyle.fixed(
5 | /* 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥 */
6 | '\u5B50',
7 | '\u4E11',
8 | '\u5BC5',
9 | '\u536F',
10 | '\u8FB0',
11 | '\u5DF3',
12 | '\u5348',
13 | '\u672A',
14 | '\u7533',
15 | '\u9149',
16 | '\u620C',
17 | '\u4EA5'
18 | ).withSuffix(CJK_SUFFIX);
19 |
20 | export default cjkEarthlyBranch;
21 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/cjkHeavenlyStem.ts:
--------------------------------------------------------------------------------
1 | import { CJK_SUFFIX } from '../constants';
2 | import CounterStyle from '../CounterStyle';
3 |
4 | const cjkHeavenlyStem = CounterStyle.fixed(
5 | /* 甲 乙 丙 丁 戊 己 庚 辛 壬 癸 */
6 | '\u7532',
7 | '\u4E59',
8 | '\u4E19',
9 | '\u4E01',
10 | '\u620A',
11 | '\u5DF1',
12 | '\u5E9A',
13 | '\u8F9B',
14 | '\u58EC',
15 | '\u7678'
16 | ).withSuffix(CJK_SUFFIX);
17 |
18 | export default cjkHeavenlyStem;
19 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/decimal.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 | import makeAlphanumMaxlenComputer from '../makeAlphanumMaxlenComputer';
3 |
4 | // Default implementation is faster than invoking CounterStyle.numeric
5 | const decimal = CounterStyle.raw((index) => index.toString())
6 | .withMaxLengthComputer(makeAlphanumMaxlenComputer(10, false))
7 | .withNegative('-');
8 |
9 | export default decimal;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/decimalLeadingZero.ts:
--------------------------------------------------------------------------------
1 | import decimal from './decimal';
2 |
3 | const decimalLeadingZero = decimal.withPadLeft(2, '0');
4 |
5 | export default decimalLeadingZero;
6 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/devanagari.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const devanagari = CounterStyle.numericFromUnicodeRange(
4 | /* ० १ २ ३ ४ ५ ६ ७ ८ ९ */
5 | 0x0966,
6 | 10
7 | );
8 |
9 | export default devanagari;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/disc.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const disc = CounterStyle.cyclic('\u2022').withSuffix('\u00A0'); /* • */
4 |
5 | export default disc;
6 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/georgian.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const georgian = CounterStyle.additive({
4 | /* 10000 ჵ, 9000 ჰ, 8000 ჯ, 7000 ჴ, 6000 ხ, 5000 ჭ, 4000 წ, 3000 ძ,
5 | 2000 ც, 1000 ჩ, 900 შ, 800 ყ, 700 ღ, 600 ქ, 500 ფ, 400 ჳ, 300 ტ,
6 | 200 ს, 100 რ, 90 ჟ, 80 პ, 70 ო, 60 ჲ, 50 ნ, 40 მ, 30 ლ,
7 | 20 კ, 10 ი, 9 თ, 8 ჱ, 7 ზ, 6 ვ, 5 ე, 4 დ, 3 გ, 2 ბ, 1 ა */
8 | 10000: '\u10F5',
9 | 9000: '\u10F0',
10 | 8000: '\u10EF',
11 | 7000: '\u10F4',
12 | 6000: '\u10EE',
13 | 5000: '\u10ED',
14 | 4000: '\u10EC',
15 | 3000: '\u10EB',
16 | 2000: '\u10EA',
17 | 1000: '\u10E9',
18 | 900: '\u10E8',
19 | 800: '\u10E7',
20 | 700: '\u10E6',
21 | 600: '\u10E5',
22 | 500: '\u10E4',
23 | 400: '\u10F3',
24 | 300: '\u10E2',
25 | 200: '\u10E1',
26 | 100: '\u10E0',
27 | 90: '\u10DF',
28 | 80: '\u10DE',
29 | 70: '\u10DD',
30 | 60: '\u10F2',
31 | 50: '\u10DC',
32 | 40: '\u10DB',
33 | 30: '\u10DA',
34 | 20: '\u10D9',
35 | 10: '\u10D8',
36 | 9: '\u10D7',
37 | 8: '\u10F1',
38 | 7: '\u10D6',
39 | 6: '\u10D5',
40 | 5: '\u10D4',
41 | 4: '\u10D3',
42 | 3: '\u10D2',
43 | 2: '\u10D1',
44 | 1: '\u10D0'
45 | }).withRange(1, 19999);
46 |
47 | export default georgian;
48 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/gujarati.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const gujarati = CounterStyle.numericFromUnicodeRange(
4 | /* ૦ ૧ ૨ ૩ ૪ ૫ ૬ ૭ ૮ ૯ */
5 | 0xae6,
6 | 10
7 | );
8 |
9 | export default gujarati;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/gurmukhi.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const gurmukhi = CounterStyle.numericFromUnicodeRange(
4 | /* ੦ ੧ ੨ ੩ ੪ ੫ ੬ ੭ ੮ ੯ */
5 | 0x0a66,
6 | 10
7 | );
8 |
9 | export default gurmukhi;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/hebrew.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const hebrew = CounterStyle.additive({
4 | /* 10000 י׳,
5 | 9000 ט׳,
6 | 8000 ח׳,
7 | 7000 ז׳,
8 | 6000 ו׳,
9 | 5000 ה׳,
10 | 4000 ד׳,
11 | 3000 ג׳,
12 | 2000 ב׳,
13 | 1000 א׳,
14 | 400 ת,
15 | 300 ש,
16 | 200 ר,
17 | 100 ק,
18 | 90 צ,
19 | 80 פ,
20 | 70 ע,
21 | 60 ס,
22 | 50 נ,
23 | 40 מ,
24 | 30 ל,
25 | 20 כ,
26 | 19 יט,
27 | 18 יח,
28 | 17 יז,
29 | 16 טז,
30 | 15 טו,
31 | 10 י,
32 | 9 ט,
33 | 8 ח,
34 | 7 ז,
35 | 6 ו,
36 | 5 ה,
37 | 4 ד,
38 | 3 ג,
39 | 2 ב,
40 | 1 א
41 |
42 | This system manually specifies the values for 19-15 to force
43 | the correct display of 15 and 16, which are commonly rewritten
44 | to avoid a close resemblance to the Tetragrammaton. */
45 | 10000: '\u05D9\u05F3',
46 | 9000: '\u05D8\u05F3',
47 | 8000: '\u05D7\u05F3',
48 | 7000: '\u05D6\u05F3',
49 | 6000: '\u05D5\u05F3',
50 | 5000: '\u05D4\u05F3',
51 | 4000: '\u05D3\u05F3',
52 | 3000: '\u05D2\u05F3',
53 | 2000: '\u05D1\u05F3',
54 | 1000: '\u05D0\u05F3',
55 | 900: '\u05E5',
56 | 800: '\u05E3',
57 | 700: '\u05DF',
58 | 600: '\u05DD',
59 | 500: '\u05DA',
60 | 400: '\u05EA',
61 | 300: '\u05E9',
62 | 200: '\u05E8',
63 | 100: '\u05E7',
64 | 90: '\u05E6',
65 | 80: '\u05E4',
66 | 70: '\u05E2',
67 | 60: '\u05E1',
68 | 50: '\u05E0',
69 | 40: '\u05DE',
70 | 30: '\u05DC',
71 | 20: '\u05DB',
72 | 19: '\u05D9\u05D8',
73 | 18: '\u05D9\u05D7',
74 | 17: '\u05D9\u05D6',
75 | 16: '\u05D8\u05D6',
76 | 15: '\u05D8\u05D5',
77 | 10: '\u05D9',
78 | 9: '\u05D8',
79 | 8: '\u05D7',
80 | 7: '\u05D6',
81 | 6: '\u05D5',
82 | 5: '\u05D4',
83 | 4: '\u05D3',
84 | 3: '\u05D2',
85 | 2: '\u05D1',
86 | 1: '\u05D0'
87 | }).withRange(1, 10999);
88 |
89 | export default hebrew;
90 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/hiragana.ts:
--------------------------------------------------------------------------------
1 | import { CJK_SUFFIX } from '../constants';
2 | import CounterStyle from '../CounterStyle';
3 |
4 | const hiragana = CounterStyle.alphabetic(
5 | /* あ い う え お か き く け こ さ し す せ そ た ち つ て と
6 | な に ぬ ね の は ひ ふ へ ほ ま み む め も や ゆ よ
7 | ら り る れ ろ わ ゐ ゑ を ん */
8 | '\u3042',
9 | '\u3044',
10 | '\u3046',
11 | '\u3048',
12 | '\u304A',
13 | '\u304B',
14 | '\u304D',
15 | '\u304F',
16 | '\u3051',
17 | '\u3053',
18 | '\u3055',
19 | '\u3057',
20 | '\u3059',
21 | '\u305B',
22 | '\u305D',
23 | '\u305F',
24 | '\u3061',
25 | '\u3064',
26 | '\u3066',
27 | '\u3068',
28 | '\u306A',
29 | '\u306B',
30 | '\u306C',
31 | '\u306D',
32 | '\u306E',
33 | '\u306F',
34 | '\u3072',
35 | '\u3075',
36 | '\u3078',
37 | '\u307B',
38 | '\u307E',
39 | '\u307F',
40 | '\u3080',
41 | '\u3081',
42 | '\u3082',
43 | '\u3084',
44 | '\u3086',
45 | '\u3088',
46 | '\u3089',
47 | '\u308A',
48 | '\u308B',
49 | '\u308C',
50 | '\u308D',
51 | '\u308F',
52 | '\u3090',
53 | '\u3091',
54 | '\u3092',
55 | '\u3093'
56 | ).withSuffix(CJK_SUFFIX);
57 |
58 | export default hiragana;
59 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/hiraganaIroha.ts:
--------------------------------------------------------------------------------
1 | import { CJK_SUFFIX } from '../constants';
2 | import CounterStyle from '../CounterStyle';
3 |
4 | const hiraganaIroha = CounterStyle.alphabetic(
5 | /* い ろ は に ほ へ と ち り ぬ る を わ か よ た れ そ
6 | つ ね な ら む う ゐ の お く や ま け ふ こ え て
7 | あ さ き ゆ め み し ゑ ひ も せ す */
8 | '\u3044',
9 | '\u308D',
10 | '\u306F',
11 | '\u306B',
12 | '\u307B',
13 | '\u3078',
14 | '\u3068',
15 | '\u3061',
16 | '\u308A',
17 | '\u306C',
18 | '\u308B',
19 | '\u3092',
20 | '\u308F',
21 | '\u304B',
22 | '\u3088',
23 | '\u305F',
24 | '\u308C',
25 | '\u305D',
26 | '\u3064',
27 | '\u306D',
28 | '\u306A',
29 | '\u3089',
30 | '\u3080',
31 | '\u3046',
32 | '\u3090',
33 | '\u306E',
34 | '\u304A',
35 | '\u304F',
36 | '\u3084',
37 | '\u307E',
38 | '\u3051',
39 | '\u3075',
40 | '\u3053',
41 | '\u3048',
42 | '\u3066',
43 | '\u3042',
44 | '\u3055',
45 | '\u304D',
46 | '\u3086',
47 | '\u3081',
48 | '\u307F',
49 | '\u3057',
50 | '\u3091',
51 | '\u3072',
52 | '\u3082',
53 | '\u305B',
54 | '\u3059'
55 | ).withSuffix(CJK_SUFFIX);
56 |
57 | export default hiraganaIroha;
58 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/index.ts:
--------------------------------------------------------------------------------
1 | export { default as arabicIndic } from './arabicIndic';
2 | export { default as armenian } from './armenian';
3 | export { default as bengali } from './bengali';
4 | export { default as cambodian } from './cambodian';
5 | export { default as circle } from './circle';
6 | export { default as cjkDecimal } from './cjkDecimal';
7 | export { default as cjkEarthlyBranch } from './cjkEarthlyBranch';
8 | export { default as cjkHeavenlyStem } from './cjkHeavenlyStem';
9 | export { default as decimal } from './decimal';
10 | export { default as decimalLeadingZero } from './decimalLeadingZero';
11 | export { default as devanagari } from './devanagari';
12 | export { default as disc } from './disc';
13 | export { default as georgian } from './georgian';
14 | export { default as gujarati } from './gujarati';
15 | export { default as gurmukhi } from './gurmukhi';
16 | export { default as hebrew } from './hebrew';
17 | export { default as hiragana } from './hiragana';
18 | export { default as hiraganaIroha } from './hiraganaIroha';
19 | export { default as japaneseFormal } from './japaneseFormal';
20 | export { default as japaneseInformal } from './japaneseInformal';
21 | export { default as kannada } from './kannada';
22 | export { default as katana } from './katana';
23 | export { default as katanaIroha } from './katanaIroha';
24 | export { default as khmer } from './khmer';
25 | export { default as koreanHangulFormal } from './koreanHangulFormal';
26 | export { default as koreanHanjaFormal } from './koreanHanjaFormal';
27 | export { default as koreanHanjaInformal } from './koreanHanjaInformal';
28 | export { default as lao } from './lao';
29 | export { default as lowerAlpha } from './lowerAlpha';
30 | export { default as lowerArmenian } from './lowerArmenian';
31 | export { default as lowerGreek } from './lowerGreek';
32 | export { default as lowerLatin } from './lowerLatin';
33 | export { default as lowerRoman } from './lowerRoman';
34 | export { default as malayalam } from './malayalam';
35 | export { default as mongolian } from './mongolian';
36 | export { default as myanmar } from './myanmar';
37 | export { default as oriya } from './oriya';
38 | export { default as persian } from './persian';
39 | export { default as square } from './square';
40 | export { default as tamil } from './tamil';
41 | export { default as telugu } from './telugu';
42 | export { default as thai } from './thai';
43 | export { default as tibetan } from './tibetan';
44 | export { default as upperAlpha } from './upperAlpha';
45 | export { default as upperArmenian } from './upperArmenian';
46 | export { default as upperLatin } from './upperLatin';
47 | export { default as upperRoman } from './upperRoman';
48 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/japaneseFormal.ts:
--------------------------------------------------------------------------------
1 | import { CJK_SUFFIX } from '../constants';
2 | import CounterStyle from '../CounterStyle';
3 | import cjkDecimal from './cjkDecimal';
4 |
5 | const japaneseFormal = CounterStyle.additive({
6 | /* 9000 九阡, 8000 八阡, 7000 七阡, 6000 六阡, 5000 伍阡, 4000 四阡,
7 | 3000 参阡, 2000 弐阡, 1000 壱阡, 900 九百, 800 八百, 700 七百,
8 | 600 六百, 500 伍百, 400 四百, 300 参百, 200 弐百, 100 壱百, 90 九拾,
9 | 80 八拾, 70 七拾, 60 六拾, 50 伍拾, 40 四拾, 30 参拾, 20 弐拾, 10 壱拾,
10 | 9 九, 8 八, 7 七, 6 六, 5 伍, 4 四, 3 参, 2 弐, 1 壱, 0 零 */
11 | 9000: '\u4E5D\u9621',
12 | 8000: '\u516B\u9621',
13 | 7000: '\u4E03\u9621',
14 | 6000: '\u516D\u9621',
15 | 5000: '\u4F0D\u9621',
16 | 4000: '\u56DB\u9621',
17 | 3000: '\u53C2\u9621',
18 | 2000: '\u5F10\u9621',
19 | 1000: '\u58F1\u9621',
20 | 900: '\u4E5D\u767E',
21 | 800: '\u516B\u767E',
22 | 700: '\u4E03\u767E',
23 | 600: '\u516D\u767E',
24 | 500: '\u4F0D\u767E',
25 | 400: '\u56DB\u767E',
26 | 300: '\u53C2\u767E',
27 | 200: '\u5F10\u767E',
28 | 100: '\u58F1\u767E',
29 | 90: '\u4E5D\u62FE',
30 | 80: '\u516B\u62FE',
31 | 70: '\u4E03\u62FE',
32 | 60: '\u516D\u62FE',
33 | 50: '\u4F0D\u62FE',
34 | 40: '\u56DB\u62FE',
35 | 30: '\u53C2\u62FE',
36 | 20: '\u5F10\u62FE',
37 | 10: '\u58F1\u62FE',
38 | 9: '\u4E5D',
39 | 8: '\u516B',
40 | 7: '\u4E03',
41 | 6: '\u516D',
42 | 5: '\u4F0D',
43 | 4: '\u56DB',
44 | 3: '\u53C2',
45 | 2: '\u5F10',
46 | 1: '\u58F1',
47 | 0: '\u96F6'
48 | })
49 | .withNegative('\u30DE\u30A4\u30CA\u30B9' /* マイナス */)
50 | .withRange(-9999, 9999)
51 | .withFallback(
52 | cjkDecimal.withNegative('\u30DE\u30A4\u30CA\u30B9' /* マイナス */)
53 | )
54 | .withSuffix(CJK_SUFFIX);
55 |
56 | export default japaneseFormal;
57 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/japaneseInformal.ts:
--------------------------------------------------------------------------------
1 | import { CJK_SUFFIX } from '../constants';
2 | import CounterStyle from '../CounterStyle';
3 | import cjkDecimal from './cjkDecimal';
4 |
5 | const japaneseInformal = CounterStyle.additive({
6 | /* 9000 九千, 8000 八千, 7000 七千, 6000 六千, 5000 五千, 4000 四千,
7 | 3000 三千, 2000 二千, 1000 千, 900 九百, 800 八百, 700 七百,
8 | 600 六百, 500 五百, 400 四百, 300 三百, 200 二百, 100 百, 90 九十,
9 | 80 八十, 70 七十, 60 六十, 50 五十, 40 四十, 30 三十, 20 二十, 10 十,
10 | 9 九, 8 八, 7 七, 6 六, 5 五, 4 四, 3 三, 2 二, 1 一, 0 〇 */
11 | 9000: '\u4E5D\u5343',
12 | 8000: '\u516B\u5343',
13 | 7000: '\u4E03\u5343',
14 | 6000: '\u516D\u5343',
15 | 5000: '\u4E94\u5343',
16 | 4000: '\u56DB\u5343',
17 | 3000: '\u4E09\u5343',
18 | 2000: '\u4E8C\u5343',
19 | 1000: '\u5343',
20 | 900: '\u4E5D\u767E',
21 | 800: '\u516B\u767E',
22 | 700: '\u4E03\u767E',
23 | 600: '\u516D\u767E',
24 | 500: '\u4E94\u767E',
25 | 400: '\u56DB\u767E',
26 | 300: '\u4E09\u767E',
27 | 200: '\u4E8C\u767E',
28 | 100: '\u767E',
29 | 90: '\u4E5D\u5341',
30 | 80: '\u516B\u5341',
31 | 70: '\u4E03\u5341',
32 | 60: '\u516D\u5341',
33 | 50: '\u4E94\u5341',
34 | 40: '\u56DB\u5341',
35 | 30: '\u4E09\u5341',
36 | 20: '\u4E8C\u5341',
37 | 10: '\u5341',
38 | 9: '\u4E5D',
39 | 8: '\u516B',
40 | 7: '\u4E03',
41 | 6: '\u516D',
42 | 5: '\u4E94',
43 | 4: '\u56DB',
44 | 3: '\u4E09',
45 | 2: '\u4E8C',
46 | 1: '\u4E00',
47 | 0: '\u3007'
48 | })
49 | .withNegative('\u30DE\u30A4\u30CA\u30B9' /* マイナス */)
50 | .withRange(-9999, 9999)
51 | .withFallback(
52 | cjkDecimal.withNegative('\u30DE\u30A4\u30CA\u30B9' /* マイナス */)
53 | )
54 | .withSuffix(CJK_SUFFIX);
55 |
56 | export default japaneseInformal;
57 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/kannada.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const kannada = CounterStyle.numericFromUnicodeRange(
4 | /* ೦ ೧ ೨ ೩ ೪ ೫ ೬ ೭ ೮ ೯ */
5 | 0x0ce6,
6 | 10
7 | );
8 |
9 | export default kannada;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/katana.ts:
--------------------------------------------------------------------------------
1 | import { CJK_SUFFIX } from '../constants';
2 | import CounterStyle from '../CounterStyle';
3 |
4 | const katakana = CounterStyle.alphabetic(
5 | /* ア イ ウ エ オ カ キ ク ケ コ サ シ ス セ ソ タ チ ツ テ ト
6 | ナ ニ ヌ ネ ノ ハ ヒ フ ヘ ホ マ ミ ム メ モ ヤ ユ ヨ
7 | ラ リ ル レ ロ ワ ヰ ヱ ヲ ン */
8 | '\u30A2',
9 | '\u30A4',
10 | '\u30A6',
11 | '\u30A8',
12 | '\u30AA',
13 | '\u30AB',
14 | '\u30AD',
15 | '\u30AF',
16 | '\u30B1',
17 | '\u30B3',
18 | '\u30B5',
19 | '\u30B7',
20 | '\u30B9',
21 | '\u30BB',
22 | '\u30BD',
23 | '\u30BF',
24 | '\u30C1',
25 | '\u30C4',
26 | '\u30C6',
27 | '\u30C8',
28 | '\u30CA',
29 | '\u30CB',
30 | '\u30CC',
31 | '\u30CD',
32 | '\u30CE',
33 | '\u30CF',
34 | '\u30D2',
35 | '\u30D5',
36 | '\u30D8',
37 | '\u30DB',
38 | '\u30DE',
39 | '\u30DF',
40 | '\u30E0',
41 | '\u30E1',
42 | '\u30E2',
43 | '\u30E4',
44 | '\u30E6',
45 | '\u30E8',
46 | '\u30E9',
47 | '\u30EA',
48 | '\u30EB',
49 | '\u30EC',
50 | '\u30ED',
51 | '\u30EF',
52 | '\u30F0',
53 | '\u30F1',
54 | '\u30F2',
55 | '\u30F3'
56 | ).withSuffix(CJK_SUFFIX);
57 |
58 | export default katakana;
59 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/katanaIroha.ts:
--------------------------------------------------------------------------------
1 | import { CJK_SUFFIX } from '../constants';
2 | import CounterStyle from '../CounterStyle';
3 |
4 | const katakanaIroha = CounterStyle.alphabetic(
5 | /* イ ロ ハ ニ ホ ヘ ト チ リ ヌ ル ヲ ワ カ ヨ タ レ ソ
6 | ツ ネ ナ ラ ム ウ ヰ ノ オ ク ヤ マ ケ フ コ エ テ
7 | ア サ キ ユ メ ミ シ ヱ ヒ モ セ ス */
8 | '\u30A4',
9 | '\u30ED',
10 | '\u30CF',
11 | '\u30CB',
12 | '\u30DB',
13 | '\u30D8',
14 | '\u30C8',
15 | '\u30C1',
16 | '\u30EA',
17 | '\u30CC',
18 | '\u30EB',
19 | '\u30F2',
20 | '\u30EF',
21 | '\u30AB',
22 | '\u30E8',
23 | '\u30BF',
24 | '\u30EC',
25 | '\u30BD',
26 | '\u30C4',
27 | '\u30CD',
28 | '\u30CA',
29 | '\u30E9',
30 | '\u30E0',
31 | '\u30A6',
32 | '\u30F0',
33 | '\u30CE',
34 | '\u30AA',
35 | '\u30AF',
36 | '\u30E4',
37 | '\u30DE',
38 | '\u30B1',
39 | '\u30D5',
40 | '\u30B3',
41 | '\u30A8',
42 | '\u30C6',
43 | '\u30A2',
44 | '\u30B5',
45 | '\u30AD',
46 | '\u30E6',
47 | '\u30E1',
48 | '\u30DF',
49 | '\u30B7',
50 | '\u30F1',
51 | '\u30D2',
52 | '\u30E2',
53 | '\u30BB',
54 | '\u30B9'
55 | ).withSuffix(CJK_SUFFIX);
56 |
57 | export default katakanaIroha;
58 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/khmer.ts:
--------------------------------------------------------------------------------
1 | import cambodian from './cambodian';
2 |
3 | const khmer = cambodian;
4 |
5 | export default khmer;
6 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/koreanHangulFormal.ts:
--------------------------------------------------------------------------------
1 | import { CJK_SUFFIX } from '../constants';
2 | import CounterStyle from '../CounterStyle';
3 |
4 | const koreanHangulFormal = CounterStyle.additive({
5 | /* 9000 구천, 8000 팔천, 7000 칠천, 6000 육천, 5000 오천, 4000 사천,
6 | 3000 삼천, 2000 이천, 1000 일천, 900 구백, 800 팔백, 700 칠백,
7 | 600 육백, 500 오백, 400 사백, 300 삼백, 200 이백, 100 일백, 90 구십,
8 | 80 팔십, 70 칠십, 60 육십, 50 오십, 40 사십, 30 삼십, 20 이십, 10 일십,
9 | 9 구, 8 팔, 7 칠, 6 육, 5 오, 4 사, 3 삼, 2 이, 1 일, 0 영 */
10 | 9000: '\u4E5D\u5343',
11 | 8000: '\u516B\u5343',
12 | 7000: '\u4E03\u5343',
13 | 6000: '\u516D\u5343',
14 | 5000: '\u4E94\u5343',
15 | 4000: '\u56DB\u5343',
16 | 3000: '\u4E09\u5343',
17 | 2000: '\u4E8C\u5343',
18 | 1000: '\u5343',
19 | 900: '\u4E5D\u767E',
20 | 800: '\u516B\u767E',
21 | 700: '\u4E03\u767E',
22 | 600: '\u516D\u767E',
23 | 500: '\u4E94\u767E',
24 | 400: '\u56DB\u767E',
25 | 300: '\u4E09\u767E',
26 | 200: '\u4E8C\u767E',
27 | 100: '\u767E',
28 | 90: '\u4E5D\u5341',
29 | 80: '\u516B\u5341',
30 | 70: '\u4E03\u5341',
31 | 60: '\u516D\u5341',
32 | 50: '\u4E94\u5341',
33 | 40: '\u56DB\u5341',
34 | 30: '\u4E09\u5341',
35 | 20: '\u4E8C\u5341',
36 | 10: '\u5341',
37 | 9: '\u4E5D',
38 | 8: '\u516B',
39 | 7: '\u4E03',
40 | 6: '\u516D',
41 | 5: '\u4E94',
42 | 4: '\u56DB',
43 | 3: '\u4E09',
44 | 2: '\u4E8C',
45 | 1: '\u4E00',
46 | 0: '\u96F6'
47 | })
48 | .withNegative('\uB9C8\uC774\uB108\uC2A4 ' /* 마이너스 (space) */)
49 | .withRange(-9999, 9999)
50 | .withSuffix(CJK_SUFFIX);
51 |
52 | export default koreanHangulFormal;
53 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/koreanHanjaFormal.ts:
--------------------------------------------------------------------------------
1 | import { CJK_SUFFIX } from '../constants';
2 | import CounterStyle from '../CounterStyle';
3 |
4 | const koreanHanjaFormal = CounterStyle.additive({
5 | /* 9000 九仟, 8000 八仟, 7000 七仟, 6000 六仟, 5000 五仟, 4000 四仟,
6 | 3000 參仟, 2000 貳仟, 1000 壹仟, 900 九百, 800 八百, 700 七百,
7 | 600 六百, 500 五百, 400 四百, 300 參百, 200 貳百, 100 壹百, 90 九拾,
8 | 80 八拾, 70 七拾, 60 六拾, 50 五拾, 40 四拾, 30 參拾, 20 貳拾, 10 壹拾,
9 | 9 九, 8 八, 7 七, 6 六, 5 五, 4 四, 3 參, 2 貳, 1 壹, 0 零 */
10 | 9000: '\u4E5D\u4EDF',
11 | 8000: '\u516B\u4EDF',
12 | 7000: '\u4E03\u4EDF',
13 | 6000: '\u516D\u4EDF',
14 | 5000: '\u4E94\u4EDF',
15 | 4000: '\u56DB\u4EDF',
16 | 3000: '\u53C3\u4EDF',
17 | 2000: '\u8CB3\u4EDF',
18 | 1000: '\u58F9\u4EDF',
19 | 900: '\u4E5D\u767E',
20 | 800: '\u516B\u767E',
21 | 700: '\u4E03\u767E',
22 | 600: '\u516D\u767E',
23 | 500: '\u4E94\u767E',
24 | 400: '\u56DB\u767E',
25 | 300: '\u53C3\u767E',
26 | 200: '\u8CB3\u767E',
27 | 100: '\u58F9\u767E',
28 | 90: '\u4E5D\u62FE',
29 | 80: '\u516B\u62FE',
30 | 70: '\u4E03\u62FE',
31 | 60: '\u516D\u62FE',
32 | 50: '\u4E94\u62FE',
33 | 40: '\u56DB\u62FE',
34 | 30: '\u53C3\u62FE',
35 | 20: '\u8CB3\u62FE',
36 | 10: '\u58F9\u62FE',
37 | 9: '\u4E5D',
38 | 8: '\u516B',
39 | 7: '\u4E03',
40 | 6: '\u516D',
41 | 5: '\u4E94',
42 | 4: '\u56DB',
43 | 3: '\u53C3',
44 | 2: '\u8CB3',
45 | 1: '\u58F9',
46 | 0: '\u96F6'
47 | })
48 | .withNegative('\uB9C8\uC774\uB108\uC2A4 ' /* 마이너스 (space) */)
49 | .withRange(-9999, 9999)
50 | .withSuffix(CJK_SUFFIX);
51 |
52 | export default koreanHanjaFormal;
53 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/koreanHanjaInformal.ts:
--------------------------------------------------------------------------------
1 | import { CJK_SUFFIX } from '../constants';
2 | import CounterStyle from '../CounterStyle';
3 |
4 | const koreanHanjaInformal = CounterStyle.additive({
5 | /* 9000 九千, 8000 八千, 7000 七千, 6000 六千, 5000 五千, 4000 四千,
6 | 3000 三千, 2000 二千, 1000 千, 900 九百, 800 八百, 700 七百,
7 | 600 六百, 500 五百, 400 四百, 300 三百, 200 二百, 100 百, 90 九十,
8 | 80 八十, 70 七十, 60 六十, 50 五十, 40 四十, 30 三十, 20 二十, 10 十,
9 | 9 九, 8 八, 7 七, 6 六, 5 五, 4 四, 3 三, 2 二, 1 一, 0 零 */
10 | 9000: '\u4E5D\u5343',
11 | 8000: '\u516B\u5343',
12 | 7000: '\u4E03\u5343',
13 | 6000: '\u516D\u5343',
14 | 5000: '\u4E94\u5343',
15 | 4000: '\u56DB\u5343',
16 | 3000: '\u4E09\u5343',
17 | 2000: '\u4E8C\u5343',
18 | 1000: '\u5343',
19 | 900: '\u4E5D\u767E',
20 | 800: '\u516B\u767E',
21 | 700: '\u4E03\u767E',
22 | 600: '\u516D\u767E',
23 | 500: '\u4E94\u767E',
24 | 400: '\u56DB\u767E',
25 | 300: '\u4E09\u767E',
26 | 200: '\u4E8C\u767E',
27 | 100: '\u767E',
28 | 90: '\u4E5D\u5341',
29 | 80: '\u516B\u5341',
30 | 70: '\u4E03\u5341',
31 | 60: '\u516D\u5341',
32 | 50: '\u4E94\u5341',
33 | 40: '\u56DB\u5341',
34 | 30: '\u4E09\u5341',
35 | 20: '\u4E8C\u5341',
36 | 10: '\u5341',
37 | 9: '\u4E5D',
38 | 8: '\u516B',
39 | 7: '\u4E03',
40 | 6: '\u516D',
41 | 5: '\u4E94',
42 | 4: '\u56DB',
43 | 3: '\u4E09',
44 | 2: '\u4E8C',
45 | 1: '\u4E00',
46 | 0: '\u96F6'
47 | })
48 | .withNegative('\uB9C8\uC774\uB108\uC2A4 ' /* 마이너스 (space) */)
49 | .withRange(-9999, 9999)
50 | .withSuffix(CJK_SUFFIX);
51 |
52 | export default koreanHanjaInformal;
53 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/lao.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const lao = CounterStyle.numericFromUnicodeRange(
4 | /* ໐ ໑ ໒ ໓ ໔ ໕ ໖ ໗ ໘ ໙ */
5 | 0xed0,
6 | 10
7 | );
8 |
9 | export default lao;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/lowerAlpha.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const lowerAlpha = CounterStyle.alphabeticFromUnicodeRange(97, 26);
4 |
5 | export default lowerAlpha;
6 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/lowerArmenian.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const lowerArmenian = CounterStyle.additive({
4 | /* 9000 ք, 8000 փ, 7000 ւ, 6000 ց, 5000 ր, 4000 տ, 3000 վ, 2000 ս,
5 | 1000 ռ, 900 ջ, 800 պ, 700 չ, 600 ո, 500 շ, 400 ն, 300 յ, 200 մ,
6 | 100 ճ, 90 ղ, 80 ձ, 70 հ, 60 կ, 50 ծ, 40 խ, 30 լ, 20 ի,
7 | 10 ժ, 9 թ, 8 ը, 7 է, 6 զ, 5 ե, 4 դ, 3 գ, 2 բ, 1 ա */
8 | 9000: '\u0584',
9 | 8000: '\u0583',
10 | 7000: '\u0582',
11 | 6000: '\u0581',
12 | 5000: '\u0580',
13 | 4000: '\u057F',
14 | 3000: '\u057E',
15 | 2000: '\u057D',
16 | 1000: '\u057C',
17 | 900: '\u057B',
18 | 800: '\u057A',
19 | 700: '\u0579',
20 | 600: '\u0578',
21 | 500: '\u0577',
22 | 400: '\u0576',
23 | 300: '\u0575',
24 | 200: '\u0574',
25 | 100: '\u0573',
26 | 90: '\u0572',
27 | 80: '\u0571',
28 | 70: '\u0570',
29 | 60: '\u056F',
30 | 50: '\u056E',
31 | 40: '\u056D',
32 | 30: '\u056C',
33 | 20: '\u056B',
34 | 10: '\u056A',
35 | 9: '\u0569',
36 | 8: '\u0568',
37 | 7: '\u0567',
38 | 6: '\u0566',
39 | 5: '\u0565',
40 | 4: '\u0564',
41 | 3: '\u0563',
42 | 2: '\u0562',
43 | 1: '\u0561'
44 | }).withRange(1, 9999);
45 |
46 | export default lowerArmenian;
47 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/lowerGreek.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const lowerGreek = CounterStyle.alphabeticFromUnicodeRange(
4 | /* α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ σ τ υ φ χ ψ ω */
5 | 0x3b1,
6 | 24
7 | );
8 |
9 | export default lowerGreek;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/lowerLatin.ts:
--------------------------------------------------------------------------------
1 | import lowerLatin from './lowerAlpha';
2 |
3 | export default lowerLatin;
4 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/lowerRoman.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const lowerRoman = CounterStyle.additive({
4 | 1000: 'm',
5 | 900: 'cm',
6 | 500: 'd',
7 | 400: 'cd',
8 | 100: 'c',
9 | 90: 'xc',
10 | 50: 'l',
11 | 40: 'xl',
12 | 10: 'x',
13 | 9: 'ix',
14 | 5: 'v',
15 | 4: 'iv',
16 | 1: 'i'
17 | }).withRange(1, 3999);
18 |
19 | export default lowerRoman;
20 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/malayalam.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const malayalam = CounterStyle.numericFromUnicodeRange(
4 | /* ൦ ൧ ൨ ൩ ൪ ൫ ൬ ൭ ൮ ൯ */
5 | 0xd66,
6 | 10
7 | );
8 |
9 | export default malayalam;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/mongolian.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const mongolian = CounterStyle.numericFromUnicodeRange(
4 | /* ᠐ ᠑ ᠒ ᠓ ᠔ ᠕ ᠖ ᠗ ᠘ ᠙ */
5 | 0x1810,
6 | 10
7 | );
8 |
9 | export default mongolian;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/myanmar.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const myanmar = CounterStyle.numericFromUnicodeRange(
4 | /* ၀ ၁ ၂ ၃ ၄ ၅ ၆ ၇ ၈ ၉ */
5 | 0x1040,
6 | 10
7 | );
8 |
9 | export default myanmar;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/oriya.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const oriya = CounterStyle.numericFromUnicodeRange(
4 | /* ୦ ୧ ୨ ୩ ୪ ୫ ୬ ୭ ୮ ୯ */
5 | 0xb66,
6 | 10
7 | );
8 |
9 | export default oriya;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/persian.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const persian = CounterStyle.numericFromUnicodeRange(
4 | /* ۰ ۱ ۲ ۳ ۴ ۵ ۶ ۷ ۸ ۹ */
5 | 0x6f0,
6 | 10
7 | );
8 |
9 | export default persian;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/square.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const square = CounterStyle.cyclic('\u25FE').withSuffix('\u00A0'); /* ◾ */
4 |
5 | export default square;
6 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/tamil.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const tamil = CounterStyle.numericFromUnicodeRange(
4 | /* ௦ ௧ ௨ ௩ ௪ ௫ ௬ ௭ ௮ ௯ */
5 | 0x0be6,
6 | 10
7 | );
8 |
9 | export default tamil;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/telugu.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const telugu = CounterStyle.numericFromUnicodeRange(
4 | /* ౦ ౧ ౨ ౩ ౪ ౫ ౬ ౭ ౮ ౯ */
5 | 0xc66,
6 | 10
7 | );
8 |
9 | export default telugu;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/thai.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const thai = CounterStyle.numericFromUnicodeRange(
4 | /* ๐ ๑ ๒ ๓ ๔ ๕ ๖ ๗ ๘ ๙ */
5 | 0xe50,
6 | 10
7 | );
8 |
9 | export default thai;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/tibetan.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const tibetan = CounterStyle.numericFromUnicodeRange(
4 | /* ༠ ༡ ༢ ༣ ༤ ༥ ༦ ༧ ༨ ༩ */
5 | 0xf20,
6 | 10
7 | );
8 |
9 | export default tibetan;
10 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/upperAlpha.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | export const upperAlpha = CounterStyle.alphabeticFromUnicodeRange(65, 26);
4 |
5 | export default upperAlpha;
6 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/upperArmenian.ts:
--------------------------------------------------------------------------------
1 | import armenian from './armenian';
2 |
3 | export default armenian;
4 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/upperLatin.ts:
--------------------------------------------------------------------------------
1 | import upperLatin from './upperAlpha';
2 |
3 | export default upperLatin;
4 |
--------------------------------------------------------------------------------
/packages/counter-style/src/presets/upperRoman.ts:
--------------------------------------------------------------------------------
1 | import CounterStyle from '../CounterStyle';
2 |
3 | const upperRoman = CounterStyle.additive({
4 | 1000: 'M',
5 | 900: 'CM',
6 | 500: 'D',
7 | 400: 'CD',
8 | 100: 'C',
9 | 90: 'XC',
10 | 50: 'L',
11 | 40: 'XL',
12 | 10: 'X',
13 | 9: 'IX',
14 | 5: 'V',
15 | 4: 'IV',
16 | 1: 'I'
17 | }).withRange(1, 3999);
18 |
19 | export default upperRoman;
20 |
--------------------------------------------------------------------------------
/packages/counter-style/src/utils/codepointLength.ts:
--------------------------------------------------------------------------------
1 | export default function codepointLength(source?: string | null) {
2 | // get codepoints length instead of UTF16 code units with the string Iterator.
3 | return (source && [...source].length) || 0;
4 | }
5 |
--------------------------------------------------------------------------------
/packages/counter-style/src/utils/codeunitLength.ts:
--------------------------------------------------------------------------------
1 | export default function codeunitLength(source?: string | null) {
2 | return (source && source.length) || 0;
3 | }
4 |
--------------------------------------------------------------------------------
/packages/counter-style/src/utils/reverseString.ts:
--------------------------------------------------------------------------------
1 | export default function reverseString(source: string) {
2 | return Array.from(source).reverse().join('');
3 | }
4 |
--------------------------------------------------------------------------------
/packages/counter-style/tsconfig.build-cjs.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src/"],
4 | "exclude": ["**/__tests__"],
5 | "compilerOptions": {
6 | "module": "CommonJS",
7 | "outDir": "lib/cjs",
8 | "esModuleInterop": true,
9 | "importHelpers": false,
10 | "noEmitHelpers": false
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/counter-style/tsconfig.build-es.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src/"],
4 | "exclude": ["**/__tests__"],
5 | "compilerOptions": {
6 | "outDir": "lib/es"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/counter-style/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "esnext",
4 | "lib": ["ES2015"],
5 | "target": "ES2015",
6 | "importHelpers": true,
7 | // output .d.ts declaration files for consumers
8 | "declaration": true,
9 | // output .js.map sourcemap files for consumers
10 | "sourceMap": true,
11 | // match output dir to input dir. e.g. dist/index instead of dist/src/index
12 | "rootDir": "./src",
13 | // stricter type-checking for stronger correctness. Recommended by TS
14 | "strict": true,
15 | // linter checks for common issues
16 | "noImplicitReturns": true,
17 | "noFallthroughCasesInSwitch": true,
18 | // noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative
19 | "noUnusedLocals": true,
20 | "noUnusedParameters": true,
21 | // use Node's module resolution algorithm, instead of the legacy TS one
22 | "moduleResolution": "node",
23 | // interop between ESM and CJS modules. Recommended by TS
24 | "esModuleInterop": false,
25 | // significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
26 | "skipLibCheck": true,
27 | // error out if import and file system have a casing mismatch. Recommended by TS
28 | "forceConsistentCasingInFileNames": true,
29 | "outDir": "./lib",
30 | "removeComments": false
31 | },
32 | "exclude": ["node_modules", "integration", "**/__tests__", "lib", "types"]
33 | }
34 |
--------------------------------------------------------------------------------
/packages/react-native-li/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | /lib
3 | /types
4 |
--------------------------------------------------------------------------------
/packages/react-native-li/.gitignore:
--------------------------------------------------------------------------------
1 | # CocoaPods
2 | /ios/Pods/
3 |
4 | # Jest code coverage
5 | /coverage
6 |
7 | # This library
8 | /lib/
9 |
10 | # api-extractor
11 | /temp
12 |
13 | # Types must be bundled with api-extractor, not included in the repo
14 | /types
15 |
16 |
--------------------------------------------------------------------------------
/packages/react-native-li/.release-it.js:
--------------------------------------------------------------------------------
1 | const name = require('./package.json').name;
2 | const configureRelease = require("release-config");
3 | module.exports = configureRelease(name);
4 |
--------------------------------------------------------------------------------
/packages/react-native-li/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## [2.3.1](https://github.com/jsamr/react-native-li/compare/@jsamr/react-native-li@2.3.0...@jsamr/react-native-li@2.3.1) (2022-01-28)
2 |
3 | # [2.3.0](https://github.com/jsamr/react-native-li/compare/@jsamr/react-native-li@2.2.1...@jsamr/react-native-li@2.3.0) (2021-08-29)
4 |
5 |
6 | ### Features
7 |
8 | * new `clipMarkerText` prop to prevent text wrapping ([1fa1a22](https://github.com/jsamr/react-native-li/commit/1fa1a2245e6fa6e3849a08741fe8c47894e1e526))
9 |
10 | ## [2.2.1](https://github.com/jsamr/react-native-li/compare/@jsamr/react-native-li@2.2.0...@jsamr/react-native-li@2.2.1) (2021-06-04)
11 |
12 |
13 | ### Bug Fixes
14 |
15 | * **react-native-li:** align text marker at the end of the marker box ([4973fe4](https://github.com/jsamr/react-native-li/commit/4973fe49cf2645c174bc7b18bd9d4034f963f039))
16 |
17 | # [2.2.0](https://github.com/jsamr/react-native-li/compare/@jsamr/react-native-li@2.1.0...@jsamr/react-native-li@2.2.0) (2021-06-04)
18 |
19 |
20 | ### Features
21 |
22 | * **react-native-li:** new `dynamicMarkerBoxWidth` prop ([6b6453c](https://github.com/jsamr/react-native-li/commit/6b6453c24de86b6fcbb921f0d66f1d1e28946c21))
23 |
24 | # [2.1.0](https://github.com/jsamr/react-native-li/compare/@jsamr/react-native-li@2.0.0...@jsamr/react-native-li@2.1.0) (2021-05-01)
25 |
26 |
27 | ### Features
28 |
29 | * **react-native-li:** new `Container` prop ([82648c0](https://github.com/jsamr/react-native-li/commit/82648c0ddef33a47bb19922cab41d8c9c735a8cc))
30 |
31 | # [2.0.0](https://github.com/jsamr/react-native-li/compare/@jsamr/react-native-li@2.0.0-alpha.0...@jsamr/react-native-li@2.0.0) (2021-04-15)
32 |
33 |
34 | ### Features
35 |
36 | * **react-native-li:** add `rtlMarkerReversed` prop to `MarkerBox` ([ee5d729](https://github.com/jsamr/react-native-li/commit/ee5d729ee658f8f78e7402c2fb5d17570946747b))
37 | * **react-native-li:** add `markerTextStyle` and `markerBoxStyle` props ([ff57162](https://github.com/jsamr/react-native-li/commit/ff571629be1b671dfe4cf5c80395410382aa6a77))
38 | * **react-native-li:** enrich API of `renderMarker` and `MarkerBox` ([8a2d851](https://github.com/jsamr/react-native-li/commit/8a2d851ba14223a94349ab6942da1fe6998441ed))
39 |
40 | ### BREAKING CHANGES
41 |
42 | * **react-native-li:** `renderMarker` and `MarkerBox` props have changed.
43 | Instead of letting the `MarkedListItem` generate the marker string, the
44 | `counterRenderer` and `counterIndex` are passed down to `renderMarker`.
45 | * **react-native-li:** `markerStyle` has been dropped. Use `markerBoxStyle` to
46 | style the marker container, and `markerTextStyle` to style the marker
47 | string.
48 |
49 | # [1.1.0](https://github.com/jsamr/react-native-li/compare/@jsamr/react-native-li@1.0.5...@jsamr/react-native-li@1.1.0) (2021-04-15)
50 |
51 |
52 | ### Bug Fixes
53 |
54 | * **react-native-li:** restrict versions of @jsamr/counter-style ([89cf7dc](https://github.com/jsamr/react-native-li/commit/89cf7dc3ab484f978e15465926cbfe74bfa0a8ca))
55 |
56 |
57 | ### Features
58 |
59 | * **react-native-li:** support @jsamr/counter-style v2 ([c122627](https://github.com/jsamr/react-native-li/commit/c1226274719ac052ba392dd83506c04c2eaf5b11))
60 |
61 | ## [1.0.5](https://github.com/jsamr/react-native-li/compare/@jsamr/react-native-li@1.0.4...@jsamr/react-native-li@1.0.5) (2021-04-14)
62 |
63 |
64 | ### Bug Fixes
65 |
66 | * **react-native-li:** lock @jsamr/counter-style peer dependency to v1.x ([6296bba](https://github.com/jsamr/react-native-li/commit/6296bbafe726fde10010c663c408a1e7c6f0c174))
67 |
68 | ## [1.0.4](https://github.com/jsamr/react-native-li/compare/@jsamr/react-native-li@1.0.3...@jsamr/react-native-li@1.0.4) (2021-04-13)
69 |
70 |
71 | ### Bug Fixes
72 |
73 | * **react-native-li:** account for startIndex when cp maxNumOfCodepoints ([397e76f](https://github.com/jsamr/react-native-li/commit/397e76fce203412924c85272ffd3659c931f711c))
74 |
75 | ## [1.0.3](https://github.com/jsamr/react-native-li/compare/@jsamr/react-native-li@1.0.2...@jsamr/react-native-li@1.0.3) (2021-04-13)
76 |
77 | ## [1.0.2](https://github.com/jsamr/react-native-li/compare/@jsamr/react-native-li@1.0.1...@jsamr/react-native-li@1.0.2) (2021-04-13)
78 |
79 | ## [1.0.1](https://github.com/jsamr/react-native-li/compare/@jsamr/react-native-li@1.0.0...@jsamr/react-native-li@1.0.1) (2021-04-13)
80 |
81 |
82 | ### Bug Fixes
83 |
84 | * wrong homepage link ([901b80f](https://github.com/jsamr/react-native-li/commit/901b80fdc01c34a659b0cc890cbe017590078b04))
85 |
86 | # 1.0.0 (2021-04-13)
87 |
88 |
89 | ### Features
90 |
91 | * **react-native-li:** render marked lists ([bcc1689](https://github.com/jsamr/react-native-li/commit/bcc1689821d1be6f7c516b561ceafeed88006031))
92 |
93 |
--------------------------------------------------------------------------------
/packages/react-native-li/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = require('../../babel-config-base');
2 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/index.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md)
4 |
5 | ## API Reference
6 |
7 | ## Packages
8 |
9 | | Package | Description |
10 | | --- | --- |
11 | | [@jsamr/react-native-li](./react-native-li.md) | |
12 |
13 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlist.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedList](./react-native-li.markedlist.md)
4 |
5 | ## MarkedList() function
6 |
7 | A component which given a counter style, wraps each of its children with a [MarkedListItem()](./react-native-li.markedlistitem.md). The latter prepends the child with a marker box containing a marker string representation for this child index.
8 |
9 | See [CSS Lists and Counters Module Level 3, Markers](https://www.w3.org/TR/css-lists-3/#markers).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | export default function MarkedList({ children, Container, ...props }: PropsWithChildren): React.ReactElement>;
15 | ```
16 |
17 | ## Parameters
18 |
19 | | Parameter | Type | Description |
20 | | --- | --- | --- |
21 | | { children, Container, ...props } | PropsWithChildren<[MarkedListProps](./react-native-li.markedlistprops.md)> | |
22 |
23 | Returns:
24 |
25 | React.ReactElement<any, string \| React.JSXElementConstructor<any>>
26 |
27 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlistitem.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedListItem](./react-native-li.markedlistitem.md)
4 |
5 | ## MarkedListItem() function
6 |
7 | A component which reproduces CSS3 `display: list-item;` behavior. It prepends its child with a marker box containing a marker string representation for this child index.
8 |
9 | See [CSS Lists and Counters Module Level 3, Markers](https://www.w3.org/TR/css-lists-3/#markers).
10 |
11 | Signature:
12 |
13 | ```typescript
14 | export default function MarkedListItem({ counterRenderer, index, startIndex, rtlLineReversed, rtlMarkerReversed, markerTextStyle, markerBoxStyle, maxNumOfCodepoints, markerTextWidth, style, renderMarker, enableMarkerClipping, children }: PropsWithChildren): JSX.Element;
15 | ```
16 |
17 | ## Parameters
18 |
19 | | Parameter | Type | Description |
20 | | --- | --- | --- |
21 | | { counterRenderer, index, startIndex, rtlLineReversed, rtlMarkerReversed, markerTextStyle, markerBoxStyle, maxNumOfCodepoints, markerTextWidth, style, renderMarker, enableMarkerClipping, children } | PropsWithChildren<[MarkedListItemProps](./react-native-li.markedlistitemprops.md)> | |
22 |
23 | Returns:
24 |
25 | JSX.Element
26 |
27 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlistitemprops.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedListItemProps](./react-native-li.markedlistitemprops.md)
4 |
5 | ## MarkedListItemProps type
6 |
7 | Props for the [MarkedListItem()](./react-native-li.markedlistitem.md) component.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | export declare type MarkedListItemProps = Required> & {
13 | index: number;
14 | markerTextWidth: number | false;
15 | maxNumOfCodepoints: number;
16 | enableMarkerClipping: boolean;
17 | style: StyleProp;
18 | };
19 | ```
20 | References: [MarkedListProps](./react-native-li.markedlistprops.md)
21 |
22 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlistprops.computemarkerboxwidth.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedListProps](./react-native-li.markedlistprops.md) > [computeMarkerBoxWidth](./react-native-li.markedlistprops.computemarkerboxwidth.md)
4 |
5 | ## MarkedListProps.computeMarkerBoxWidth property
6 |
7 | A function to compute marker box width depending on the maximum length of the marker string in range.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | computeMarkerBoxWidth?: (maxCodepointsLengthInRange: number, fontSize: number) => number;
13 | ```
14 |
15 | ## Remarks
16 |
17 | - Font size is derived from `markerStyle` prop. - Will be ignored when [MarkedListProps.dynamicMarkerBoxWidth](./react-native-li.markedlistprops.dynamicmarkerboxwidth.md) is set to `false`.
18 |
19 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlistprops.container.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedListProps](./react-native-li.markedlistprops.md) > [Container](./react-native-li.markedlistprops.container.md)
4 |
5 | ## MarkedListProps.Container property
6 |
7 | The component used to wrap list elements.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | Container?: ComponentType;
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlistprops.counterrenderer.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedListProps](./react-native-li.markedlistprops.md) > [counterRenderer](./react-native-li.markedlistprops.counterrenderer.md)
4 |
5 | ## MarkedListProps.counterRenderer property
6 |
7 | The counter renderer for this list.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | counterRenderer: CounterStyleRenderer;
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlistprops.dynamicmarkerboxwidth.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedListProps](./react-native-li.markedlistprops.md) > [dynamicMarkerBoxWidth](./react-native-li.markedlistprops.dynamicmarkerboxwidth.md)
4 |
5 | ## MarkedListProps.dynamicMarkerBoxWidth property
6 |
7 | Should the width of the marker box be computed dynamically, e.g. depend on the longest marker in the list?
8 |
9 | Signature:
10 |
11 | ```typescript
12 | dynamicMarkerBoxWidth?: boolean;
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlistprops.enablemarkerclipping.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedListProps](./react-native-li.markedlistprops.md) > [enableMarkerClipping](./react-native-li.markedlistprops.enablemarkerclipping.md)
4 |
5 | ## MarkedListProps.enableMarkerClipping property
6 |
7 | Clip the marker text when it overflows the marker box.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | enableMarkerClipping?: boolean;
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlistprops.linestyle.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedListProps](./react-native-li.markedlistprops.md) > [lineStyle](./react-native-li.markedlistprops.linestyle.md)
4 |
5 | ## MarkedListProps.lineStyle property
6 |
7 | Style for the line wrapper.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | lineStyle?: StyleProp;
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlistprops.markerboxstyle.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedListProps](./react-native-li.markedlistprops.md) > [markerBoxStyle](./react-native-li.markedlistprops.markerboxstyle.md)
4 |
5 | ## MarkedListProps.markerBoxStyle property
6 |
7 | Style for the marker box container.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | markerBoxStyle?: StyleProp;
13 | ```
14 |
15 | ## Remarks
16 |
17 | It is discouraged to set `(min,max)width` when [MarkedListProps.dynamicMarkerBoxWidth](./react-native-li.markedlistprops.dynamicmarkerboxwidth.md) is set to `true`. In that case, use [MarkedListProps.computeMarkerBoxWidth](./react-native-li.markedlistprops.computemarkerboxwidth.md) instead.
18 |
19 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlistprops.markertextstyle.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedListProps](./react-native-li.markedlistprops.md) > [markerTextStyle](./react-native-li.markedlistprops.markertextstyle.md)
4 |
5 | ## MarkedListProps.markerTextStyle property
6 |
7 | A plain JavaScript object text style for the marker string. It is advised to pass the same `fontSize` and `lineHeight` as the list content for perfect horizontal alignment.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | markerTextStyle?: TextStyle;
13 | ```
14 |
15 | ## Remarks
16 |
17 | It should not contain CSS box model properties and it should be a plain JavaScript object. \*\*Do not\*\* use StyleSheet or array styles.
18 |
19 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlistprops.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedListProps](./react-native-li.markedlistprops.md)
4 |
5 | ## MarkedListProps interface
6 |
7 | Props for the [MarkedList()](./react-native-li.markedlist.md) component.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | export interface MarkedListProps
13 | ```
14 |
15 | ## Properties
16 |
17 | | Property | Type | Description |
18 | | --- | --- | --- |
19 | | [computeMarkerBoxWidth?](./react-native-li.markedlistprops.computemarkerboxwidth.md) | (maxCodepointsLengthInRange: number, fontSize: number) => number | (Optional) A function to compute marker box width depending on the maximum length of the marker string in range. |
20 | | [Container?](./react-native-li.markedlistprops.container.md) | ComponentType<any> | (Optional) The component used to wrap list elements. |
21 | | [counterRenderer](./react-native-li.markedlistprops.counterrenderer.md) | CounterStyleRenderer | The counter renderer for this list. |
22 | | [dynamicMarkerBoxWidth?](./react-native-li.markedlistprops.dynamicmarkerboxwidth.md) | boolean | (Optional) Should the width of the marker box be computed dynamically, e.g. depend on the longest marker in the list? |
23 | | [enableMarkerClipping?](./react-native-li.markedlistprops.enablemarkerclipping.md) | boolean | (Optional) Clip the marker text when it overflows the marker box. |
24 | | [lineStyle?](./react-native-li.markedlistprops.linestyle.md) | StyleProp<ViewStyle> | (Optional) Style for the line wrapper. |
25 | | [markerBoxStyle?](./react-native-li.markedlistprops.markerboxstyle.md) | StyleProp<ViewStyle> | (Optional) Style for the marker box container. |
26 | | [markerTextStyle?](./react-native-li.markedlistprops.markertextstyle.md) | TextStyle | (Optional) A plain JavaScript object text style for the marker string. It is advised to pass the same fontSize
and lineHeight
as the list content for perfect horizontal alignment. |
27 | | [renderMarker?](./react-native-li.markedlistprops.rendermarker.md) | (props: [MarkerBoxProps](./react-native-li.markerboxprops.md)) => ReactNode | (Optional) A custom Marker render function. |
28 | | [rtlLineReversed?](./react-native-li.markedlistprops.rtllinereversed.md) | boolean | (Optional) Set the line layout in flexDirection: 'row-reverse'
and left-align the marker box. |
29 | | [rtlMarkerReversed?](./react-native-li.markedlistprops.rtlmarkerreversed.md) | true \| false \| RtlOptions | (Optional) Should the marker string be rendered in reverse order? |
30 | | [startIndex?](./react-native-li.markedlistprops.startindex.md) | number | (Optional) The index for the first item in the list. Negative indexes are supported. |
31 |
32 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlistprops.rendermarker.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedListProps](./react-native-li.markedlistprops.md) > [renderMarker](./react-native-li.markedlistprops.rendermarker.md)
4 |
5 | ## MarkedListProps.renderMarker property
6 |
7 | A custom Marker render function.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | renderMarker?: (props: MarkerBoxProps) => ReactNode;
13 | ```
14 |
15 | ## Remarks
16 |
17 | You are advised to use [MarkerBox()](./react-native-li.markerbox.md) component.
18 |
19 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlistprops.rtllinereversed.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedListProps](./react-native-li.markedlistprops.md) > [rtlLineReversed](./react-native-li.markedlistprops.rtllinereversed.md)
4 |
5 | ## MarkedListProps.rtlLineReversed property
6 |
7 | Set the line layout in `flexDirection: 'row-reverse'` and left-align the marker box.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | rtlLineReversed?: boolean;
13 | ```
14 |
15 | ## Remarks
16 |
17 | Will be ignored if `I18nManager.isRTL` is `true`.
18 |
19 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlistprops.rtlmarkerreversed.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedListProps](./react-native-li.markedlistprops.md) > [rtlMarkerReversed](./react-native-li.markedlistprops.rtlmarkerreversed.md)
4 |
5 | ## MarkedListProps.rtlMarkerReversed property
6 |
7 | Should the marker string be rendered in reverse order?
8 |
9 | Signature:
10 |
11 | ```typescript
12 | rtlMarkerReversed?: true | false | RtlOptions;
13 | ```
14 |
15 | ## Remarks
16 |
17 | Fine-grained options are available when you provide an option object. See `@jsamr/counter-style` documentation.
18 |
19 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markedlistprops.startindex.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkedListProps](./react-native-li.markedlistprops.md) > [startIndex](./react-native-li.markedlistprops.startindex.md)
4 |
5 | ## MarkedListProps.startIndex property
6 |
7 | The index for the first item in the list. Negative indexes are supported.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | startIndex?: number;
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markerbox.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkerBox](./react-native-li.markerbox.md)
4 |
5 | ## MarkerBox() function
6 |
7 | Default component to render the list marker.
8 |
9 | See [CSS Lists and Counters Module Level 3, Markers](https://www.w3.org/TR/css-lists-3/#marker-pseudo)
10 |
11 | Signature:
12 |
13 | ```typescript
14 | export default function MarkerBox({ style, counterRenderer, counterIndex, markerTextStyle, markerTextWidth, enableMarkerClipping }: MarkerBoxProps): JSX.Element;
15 | ```
16 |
17 | ## Parameters
18 |
19 | | Parameter | Type | Description |
20 | | --- | --- | --- |
21 | | { style, counterRenderer, counterIndex, markerTextStyle, markerTextWidth, enableMarkerClipping } | [MarkerBoxProps](./react-native-li.markerboxprops.md) | |
22 |
23 | Returns:
24 |
25 | JSX.Element
26 |
27 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markerboxprops.counterindex.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkerBoxProps](./react-native-li.markerboxprops.md) > [counterIndex](./react-native-li.markerboxprops.counterindex.md)
4 |
5 | ## MarkerBoxProps.counterIndex property
6 |
7 | The index to render.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | counterIndex: number;
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markerboxprops.counterrenderer.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkerBoxProps](./react-native-li.markerboxprops.md) > [counterRenderer](./react-native-li.markerboxprops.counterrenderer.md)
4 |
5 | ## MarkerBoxProps.counterRenderer property
6 |
7 | The renderer to generate the marker string.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | counterRenderer: CounterStyleRenderer;
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markerboxprops.enablemarkerclipping.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkerBoxProps](./react-native-li.markerboxprops.md) > [enableMarkerClipping](./react-native-li.markerboxprops.enablemarkerclipping.md)
4 |
5 | ## MarkerBoxProps.enableMarkerClipping property
6 |
7 | Clip the marker text when it overflows the marker box.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | enableMarkerClipping: boolean;
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markerboxprops.markertextstyle.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkerBoxProps](./react-native-li.markerboxprops.md) > [markerTextStyle](./react-native-li.markerboxprops.markertextstyle.md)
4 |
5 | ## MarkerBoxProps.markerTextStyle property
6 |
7 | Style for any text element. Should not contain CSS box model properties.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | markerTextStyle: TextStyle;
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markerboxprops.markertextwidth.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkerBoxProps](./react-native-li.markerboxprops.md) > [markerTextWidth](./react-native-li.markerboxprops.markertextwidth.md)
4 |
5 | ## MarkerBoxProps.markerTextWidth property
6 |
7 | The width for the marker text element.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | markerTextWidth: number | false;
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markerboxprops.maxnumofcodepoints.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkerBoxProps](./react-native-li.markerboxprops.md) > [maxNumOfCodepoints](./react-native-li.markerboxprops.maxnumofcodepoints.md)
4 |
5 | ## MarkerBoxProps.maxNumOfCodepoints property
6 |
7 | The maximum length of the `markerString` in range.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | maxNumOfCodepoints: number;
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markerboxprops.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkerBoxProps](./react-native-li.markerboxprops.md)
4 |
5 | ## MarkerBoxProps interface
6 |
7 | Props for the [MarkerBox()](./react-native-li.markerbox.md) component.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | export interface MarkerBoxProps
13 | ```
14 |
15 | ## Properties
16 |
17 | | Property | Type | Description |
18 | | --- | --- | --- |
19 | | [counterIndex](./react-native-li.markerboxprops.counterindex.md) | number | The index to render. |
20 | | [counterRenderer](./react-native-li.markerboxprops.counterrenderer.md) | CounterStyleRenderer | The renderer to generate the marker string. |
21 | | [enableMarkerClipping](./react-native-li.markerboxprops.enablemarkerclipping.md) | boolean | Clip the marker text when it overflows the marker box. |
22 | | [markerTextStyle](./react-native-li.markerboxprops.markertextstyle.md) | TextStyle | Style for any text element. Should not contain CSS box model properties. |
23 | | [markerTextWidth](./react-native-li.markerboxprops.markertextwidth.md) | number \| false | The width for the marker text element. |
24 | | [maxNumOfCodepoints](./react-native-li.markerboxprops.maxnumofcodepoints.md) | number | The maximum length of the markerString
in range. |
25 | | [rtlMarkerReversed](./react-native-li.markerboxprops.rtlmarkerreversed.md) | boolean | Whether to reverse or not the order of elements in marker (prefix, counter, suffix). |
26 | | [style](./react-native-li.markerboxprops.style.md) | StyleProp<TextStyle> | Style for the container Text
element. |
27 |
28 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markerboxprops.rtlmarkerreversed.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkerBoxProps](./react-native-li.markerboxprops.md) > [rtlMarkerReversed](./react-native-li.markerboxprops.rtlmarkerreversed.md)
4 |
5 | ## MarkerBoxProps.rtlMarkerReversed property
6 |
7 | Whether to reverse or not the order of elements in marker (prefix, counter, suffix).
8 |
9 | Signature:
10 |
11 | ```typescript
12 | rtlMarkerReversed: boolean;
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.markerboxprops.style.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [MarkerBoxProps](./react-native-li.markerboxprops.md) > [style](./react-native-li.markerboxprops.style.md)
4 |
5 | ## MarkerBoxProps.style property
6 |
7 | Style for the container `Text` element.
8 |
9 | Signature:
10 |
11 | ```typescript
12 | style: StyleProp;
13 | ```
14 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md)
4 |
5 | ## react-native-li package
6 |
7 | ## Functions
8 |
9 | | Function | Description |
10 | | --- | --- |
11 | | [MarkedList({ children, Container, ...props })](./react-native-li.markedlist.md) | A component which given a counter style, wraps each of its children with a [MarkedListItem()](./react-native-li.markedlistitem.md). The latter prepends the child with a marker box containing a marker string representation for this child index.See [CSS Lists and Counters Module Level 3, Markers](https://www.w3.org/TR/css-lists-3/#markers). |
12 | | [MarkedListItem({ counterRenderer, index, startIndex, rtlLineReversed, rtlMarkerReversed, markerTextStyle, markerBoxStyle, maxNumOfCodepoints, markerTextWidth, style, renderMarker, enableMarkerClipping, children })](./react-native-li.markedlistitem.md) | A component which reproduces CSS3 display: list-item;
behavior. It prepends its child with a marker box containing a marker string representation for this child index.See [CSS Lists and Counters Module Level 3, Markers](https://www.w3.org/TR/css-lists-3/#markers). |
13 | | [MarkerBox({ style, counterRenderer, counterIndex, markerTextStyle, markerTextWidth, enableMarkerClipping })](./react-native-li.markerbox.md) | Default component to render the list marker.See [CSS Lists and Counters Module Level 3, Markers](https://www.w3.org/TR/css-lists-3/#marker-pseudo) |
14 | | [useMarkedList({ counterRenderer, startIndex, lineStyle, rtlLineReversed, rtlMarkerReversed, markerTextStyle, markerBoxStyle, dynamicMarkerBoxWidth, length, renderMarker, enableMarkerClipping, computeMarkerBoxWidth })](./react-native-li.usemarkedlist.md) | A hook to reuse MarkedList logic to render custom lists components in combination with [MarkedListItem()](./react-native-li.markedlistitem.md). |
15 |
16 | ## Interfaces
17 |
18 | | Interface | Description |
19 | | --- | --- |
20 | | [MarkedListProps](./react-native-li.markedlistprops.md) | Props for the [MarkedList()](./react-native-li.markedlist.md) component. |
21 | | [MarkerBoxProps](./react-native-li.markerboxprops.md) | Props for the [MarkerBox()](./react-native-li.markerbox.md) component. |
22 |
23 | ## Type Aliases
24 |
25 | | Type Alias | Description |
26 | | --- | --- |
27 | | [MarkedListItemProps](./react-native-li.markedlistitemprops.md) | Props for the [MarkedListItem()](./react-native-li.markedlistitem.md) component. |
28 |
29 |
--------------------------------------------------------------------------------
/packages/react-native-li/docs/react-native-li.usemarkedlist.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [Home](./index.md) > [@jsamr/react-native-li](./react-native-li.md) > [useMarkedList](./react-native-li.usemarkedlist.md)
4 |
5 | ## useMarkedList() function
6 |
7 | A hook to reuse MarkedList logic to render custom lists components in combination with [MarkedListItem()](./react-native-li.markedlistitem.md).
8 |
9 | Signature:
10 |
11 | ```typescript
12 | export default function useMarkedList({ counterRenderer, startIndex, lineStyle, rtlLineReversed, rtlMarkerReversed, markerTextStyle, markerBoxStyle, dynamicMarkerBoxWidth, length, renderMarker, enableMarkerClipping, computeMarkerBoxWidth }: MarkedListProps & {
13 | length: number;
14 | }): Omit;
15 | ```
16 |
17 | ## Parameters
18 |
19 | | Parameter | Type | Description |
20 | | --- | --- | --- |
21 | | { counterRenderer, startIndex, lineStyle, rtlLineReversed, rtlMarkerReversed, markerTextStyle, markerBoxStyle, dynamicMarkerBoxWidth, length, renderMarker, enableMarkerClipping, computeMarkerBoxWidth } | [MarkedListProps](./react-native-li.markedlistprops.md) & { length: number; } | |
22 |
23 | Returns:
24 |
25 | Omit<[MarkedListItemProps](./react-native-li.markedlistitemprops.md), 'index'>
26 |
27 |
--------------------------------------------------------------------------------
/packages/react-native-li/etc/.gitignore:
--------------------------------------------------------------------------------
1 | example-npm.api.md
2 |
--------------------------------------------------------------------------------
/packages/react-native-li/etc/react-native-li.api.md:
--------------------------------------------------------------------------------
1 | ## API Report File for "@jsamr/react-native-li"
2 |
3 | > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4 |
5 | ```ts
6 |
7 | import type { ComponentType } from 'react';
8 | import type { CounterStyleRenderer } from '@jsamr/counter-style';
9 | import { PropsWithChildren } from 'react';
10 | import { default as React_2 } from 'react';
11 | import type { ReactNode } from 'react';
12 | import type { RtlOptions } from '@jsamr/counter-style';
13 | import { StyleProp } from 'react-native';
14 | import type { TextStyle } from 'react-native';
15 | import { ViewStyle } from 'react-native';
16 |
17 | // @public
18 | function MarkedList({ children, Container, ...props }: PropsWithChildren): React_2.ReactElement>;
19 |
20 | export { MarkedList }
21 |
22 | export default MarkedList;
23 |
24 | // @public
25 | export function MarkedListItem({ counterRenderer, index, startIndex, rtlLineReversed, rtlMarkerReversed, markerTextStyle, markerBoxStyle, maxNumOfCodepoints, markerTextWidth, style, renderMarker, enableMarkerClipping, children }: PropsWithChildren): JSX.Element;
26 |
27 | // @public
28 | export type MarkedListItemProps = Required> & {
29 | index: number;
30 | markerTextWidth: number | false;
31 | maxNumOfCodepoints: number;
32 | enableMarkerClipping: boolean;
33 | style: StyleProp;
34 | };
35 |
36 | // @public
37 | export interface MarkedListProps {
38 | computeMarkerBoxWidth?: (maxCodepointsLengthInRange: number, fontSize: number) => number;
39 | Container?: ComponentType;
40 | counterRenderer: CounterStyleRenderer;
41 | dynamicMarkerBoxWidth?: boolean;
42 | enableMarkerClipping?: boolean;
43 | lineStyle?: StyleProp;
44 | markerBoxStyle?: StyleProp;
45 | markerTextStyle?: TextStyle;
46 | renderMarker?: (props: MarkerBoxProps) => ReactNode;
47 | rtlLineReversed?: boolean;
48 | rtlMarkerReversed?: true | false | RtlOptions;
49 | startIndex?: number;
50 | }
51 |
52 | // @public
53 | export function MarkerBox({ style, counterRenderer, counterIndex, markerTextStyle, markerTextWidth, enableMarkerClipping }: MarkerBoxProps): JSX.Element;
54 |
55 | // @public
56 | export interface MarkerBoxProps {
57 | counterIndex: number;
58 | counterRenderer: CounterStyleRenderer;
59 | enableMarkerClipping: boolean;
60 | markerTextStyle: TextStyle;
61 | markerTextWidth: number | false;
62 | maxNumOfCodepoints: number;
63 | rtlMarkerReversed: boolean;
64 | style: StyleProp;
65 | }
66 |
67 | // @public
68 | export function useMarkedList({ counterRenderer, startIndex, lineStyle, rtlLineReversed, rtlMarkerReversed, markerTextStyle, markerBoxStyle, dynamicMarkerBoxWidth, length, renderMarker, enableMarkerClipping, computeMarkerBoxWidth }: MarkedListProps & {
69 | length: number;
70 | }): Omit;
71 |
72 |
73 | // (No @packageDocumentation comment for this package)
74 |
75 | ```
76 |
--------------------------------------------------------------------------------
/packages/react-native-li/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | ...require('../../jest-config-base')
3 | };
4 |
--------------------------------------------------------------------------------
/packages/react-native-li/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@jsamr/react-native-li",
3 | "version": "2.3.1",
4 | "description": "A pure JavaScript React Native component to render CSS3 compliant ordered and unordered lists.",
5 | "main": "lib/commonjs/index.js",
6 | "module": "lib/module/index.js",
7 | "react-native": "src/index.ts",
8 | "types": "types/react-native-li/index.d.ts",
9 | "files": [
10 | "lib",
11 | "src",
12 | "types",
13 | "docs"
14 | ],
15 | "scripts": {
16 | "test": "yarn test:ts && yarn test:lint && yarn test:jest",
17 | "test:jest": "jest src/",
18 | "test:ts": "tsc --noEmit",
19 | "test:lint": "eslint --ext ts,tsx src/",
20 | "build": "yarn build:source && yarn build:defs && yarn build:doc",
21 | "build:source": "bob build",
22 | "build:defs": "api-extractor run --local --verbose",
23 | "build:doc": "api-documenter markdown --input-folder temp --output-folder ./docs",
24 | "prepack": "yarn run build"
25 | },
26 | "keywords": [
27 | "react-native",
28 | "bullet list",
29 | "ordered list",
30 | "unordered list",
31 | "CSS counter styles"
32 | ],
33 | "devDependencies": {
34 | "@babel/cli": "^7.13.14",
35 | "@babel/core": "^7.13.15",
36 | "@babel/plugin-transform-react-jsx": "^7.13.12",
37 | "@babel/preset-typescript": "^7.13.0",
38 | "@babel/runtime": "^7.13.10",
39 | "@jsamr/counter-style": "workspace:*",
40 | "@microsoft/api-documenter": "^7.12.20",
41 | "@microsoft/api-extractor": "7.13.4",
42 | "@release-it/conventional-changelog": "^2.0.0",
43 | "@testing-library/react-hooks": "^5.1.1",
44 | "@testing-library/react-native": "^7.2.0",
45 | "@tsconfig/react-native": "^1.0.3",
46 | "@types/jest": "^26.0.22",
47 | "@types/react": "^17.0.3",
48 | "@types/react-native": "^0.64.2",
49 | "@types/react-test-renderer": "^17.0.1",
50 | "babel-jest": "^26.6.3",
51 | "eslint": "^7.23.0",
52 | "jest": "^26.6.3",
53 | "metro-react-native-babel-preset": "^0.65.2",
54 | "metro-react-native-babel-transformer": "^0.65.2",
55 | "react": "17.0.2",
56 | "react-native": "^0.64.0",
57 | "react-native-builder-bob": "^0.18.1",
58 | "react-test-renderer": "17.0.2",
59 | "release-it": "^14.3.0",
60 | "typescript": "~4.2.4"
61 | },
62 | "peerDependencies": {
63 | "@jsamr/counter-style": "^1.0.0 || ^2.0.0",
64 | "react": "*",
65 | "react-native": "*"
66 | },
67 | "author": "Jules Sam. Randolph (https://github.com/jsamr)",
68 | "homepage": "https://github.com/jsamr/react-native-li/tree/master/packages/react-native-li#readme",
69 | "license": "MIT",
70 | "repository": {
71 | "type": "git",
72 | "directory": "packages/react-native-li",
73 | "url": "git+ssh://git@github.com/jsamr/react-native-li.git"
74 | },
75 | "publishConfig": {
76 | "access": "public"
77 | },
78 | "react-native-builder-bob": {
79 | "source": "src",
80 | "output": "lib",
81 | "targets": [
82 | [
83 | "module",
84 | {
85 | "babelrc": false
86 | }
87 | ],
88 | [
89 | "commonjs",
90 | {
91 | "babelrc": false
92 | }
93 | ],
94 | [
95 | "typescript",
96 | {
97 | "project": "tsconfig.build.json"
98 | }
99 | ]
100 | ]
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/packages/react-native-li/screenshots/arabic-indic-rtl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jsamr/react-native-li/f326122929cbe4a034140aef697e1522731f2a3d/packages/react-native-li/screenshots/arabic-indic-rtl.png
--------------------------------------------------------------------------------
/packages/react-native-li/screenshots/disc-ltr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jsamr/react-native-li/f326122929cbe4a034140aef697e1522731f2a3d/packages/react-native-li/screenshots/disc-ltr.png
--------------------------------------------------------------------------------
/packages/react-native-li/screenshots/disc-rtl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jsamr/react-native-li/f326122929cbe4a034140aef697e1522731f2a3d/packages/react-native-li/screenshots/disc-rtl.png
--------------------------------------------------------------------------------
/packages/react-native-li/screenshots/lower-roman-ltr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jsamr/react-native-li/f326122929cbe4a034140aef697e1522731f2a3d/packages/react-native-li/screenshots/lower-roman-ltr.png
--------------------------------------------------------------------------------
/packages/react-native-li/src/MarkedList.tsx:
--------------------------------------------------------------------------------
1 | import React, { Children, Fragment, PropsWithChildren } from 'react';
2 | import MarkedListItem from './MarkedListItem';
3 | import { MarkedListProps } from './shared-types';
4 | import useMarkedList from './useMarkedList';
5 |
6 | /**
7 | * A component which given a counter style, wraps each of its children with a
8 | * {@link MarkedListItem}. The latter prepends the child with a marker
9 | * box containing a marker string representation for this child index.
10 | *
11 | * See {@link https://www.w3.org/TR/css-lists-3/#markers | CSS Lists and Counters Module Level 3, Markers}.
12 | *
13 | * @public
14 | */
15 | export default function MarkedList({
16 | children,
17 | Container = Fragment,
18 | ...props
19 | }: PropsWithChildren) {
20 | const normalChildren = Children.toArray(children);
21 | const listProps = useMarkedList({ ...props, length: normalChildren.length });
22 | return React.createElement(
23 | Container,
24 | {},
25 | normalChildren.map((child, index) => {
26 | return (
27 |
28 | {child}
29 |
30 | );
31 | })
32 | );
33 | }
34 |
--------------------------------------------------------------------------------
/packages/react-native-li/src/MarkedListItem.tsx:
--------------------------------------------------------------------------------
1 | import React, { PropsWithChildren } from 'react';
2 | import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
3 | import { MarkedListProps } from './shared-types';
4 |
5 | /**
6 | * Props for the {@link MarkedListItem} component.
7 | *
8 | * @public
9 | */
10 | export type MarkedListItemProps = Required<
11 | Pick<
12 | MarkedListProps,
13 | | 'counterRenderer'
14 | | 'renderMarker'
15 | | 'markerTextStyle'
16 | | 'markerBoxStyle'
17 | | 'rtlLineReversed'
18 | | 'rtlMarkerReversed'
19 | | 'startIndex'
20 | >
21 | > & {
22 | index: number;
23 | markerTextWidth: number | false;
24 | maxNumOfCodepoints: number;
25 | enableMarkerClipping: boolean;
26 | style: StyleProp;
27 | };
28 |
29 | /**
30 | * A component which reproduces CSS3 `display: list-item;` behavior. It
31 | * prepends its child with a marker box containing a marker string
32 | * representation for this child index.
33 | *
34 | * See {@link https://www.w3.org/TR/css-lists-3/#markers | CSS Lists and Counters Module Level 3, Markers}.
35 | *
36 | * @public
37 | */
38 | export default function MarkedListItem({
39 | counterRenderer,
40 | index,
41 | startIndex,
42 | rtlLineReversed,
43 | rtlMarkerReversed,
44 | markerTextStyle,
45 | markerBoxStyle,
46 | maxNumOfCodepoints,
47 | markerTextWidth,
48 | style,
49 | renderMarker,
50 | enableMarkerClipping,
51 | children
52 | }: PropsWithChildren) {
53 | return (
54 |
58 | {renderMarker({
59 | counterRenderer,
60 | rtlMarkerReversed:
61 | typeof rtlMarkerReversed === 'boolean' ? rtlMarkerReversed : true,
62 | counterIndex: index + startIndex,
63 | maxNumOfCodepoints,
64 | style: markerBoxStyle,
65 | markerTextStyle,
66 | markerTextWidth,
67 | enableMarkerClipping
68 | })}
69 | {children}
70 |
71 | );
72 | }
73 |
74 | const styles = StyleSheet.create({
75 | lineLtr: { flexWrap: 'nowrap', alignSelf: 'stretch', flexDirection: 'row' },
76 | lineRtl: {
77 | flexWrap: 'nowrap',
78 | alignSelf: 'stretch',
79 | flexDirection: 'row-reverse'
80 | }
81 | });
82 |
--------------------------------------------------------------------------------
/packages/react-native-li/src/MarkerBox.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Text, TextProps, View } from 'react-native';
3 | import { MarkerBoxProps } from './shared-types';
4 |
5 | const markerClipConfig: Partial = {
6 | numberOfLines: 1,
7 | ellipsizeMode: 'clip'
8 | };
9 |
10 | /**
11 | * Default component to render the list marker.
12 | *
13 | * See {@link https://www.w3.org/TR/css-lists-3/#marker-pseudo | CSS Lists and Counters Module Level 3, Markers}
14 | *
15 | * @public
16 | */
17 | export default function MarkerBox({
18 | style,
19 | counterRenderer,
20 | counterIndex,
21 | markerTextStyle,
22 | markerTextWidth,
23 | enableMarkerClipping
24 | }: MarkerBoxProps) {
25 | const markerStyle =
26 | typeof markerTextWidth === 'number'
27 | ? [markerTextStyle, { width: markerTextWidth }]
28 | : markerTextStyle;
29 | return (
30 |
31 |
35 | {counterRenderer.renderMarker(counterIndex)}
36 |
37 |
38 | );
39 | }
40 |
--------------------------------------------------------------------------------
/packages/react-native-li/src/__tests__/MarkedList.test.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from '@testing-library/react-native';
3 | import MarkedList from '../MarkedList';
4 | import { StyleSheet, Text } from 'react-native';
5 | import * as presets from '@jsamr/counter-style/presets';
6 |
7 | describe('MarkedList', () => {
8 | it('should render children', () => {
9 | const { UNSAFE_getByType } = render(
10 |
11 | {[...Array(100).keys()].map((index) => (
12 |
13 | Lorem
14 |
15 | ))}
16 |
17 | );
18 | const list = UNSAFE_getByType(MarkedList);
19 | expect(list.children.length).toBe(100);
20 | });
21 |
22 | it('should reverse list items with rtlLineReversed', () => {
23 | const { getByTestId } = render(
24 |
25 | Lorem
26 |
27 | );
28 | const li = getByTestId('marked-list-item');
29 | expect(StyleSheet.flatten(li.props.style)).toMatchObject({
30 | flexDirection: 'row-reverse'
31 | });
32 | });
33 | it('should reverse marker prefix, counter and suffix order with rtlMarkerReversed', () => {
34 | const { getByTestId } = render(
35 |
36 | Lorem
37 |
38 | );
39 | const mb = getByTestId('marker-box');
40 | expect(mb.props.children).toBe('\u00A0•');
41 | });
42 | it('should allow to customize rtlMarkerReversed', () => {
43 | const { getByTestId } = render(
44 |
48 | Lorem
49 |
50 | );
51 | const mb = getByTestId('marker-box');
52 | expect(mb.props.children).toBe('\u00A0.01');
53 | });
54 | });
55 |
--------------------------------------------------------------------------------
/packages/react-native-li/src/__tests__/useMarkedList.test.ts:
--------------------------------------------------------------------------------
1 | import { renderHook } from '@testing-library/react-hooks';
2 | import useMarkedList from '../useMarkedList';
3 | import decimal from '@jsamr/counter-style/presets/decimal';
4 |
5 | const counterRenderer = decimal;
6 | describe('useMarkedList', () => {
7 | it('should compute maxNumOfCodepoints correctly', () => {
8 | const expectedLen = counterRenderer.maxMarkerLenInRange(1, 9);
9 | const { result } = renderHook(() =>
10 | useMarkedList({ counterRenderer, length: 9 })
11 | );
12 | expect(result.current.maxNumOfCodepoints).toBe(expectedLen);
13 | });
14 | it('should account for startIndex when computing maxNumOfCodepoints', () => {
15 | const expectedLen = counterRenderer.maxMarkerLenInRange(2, 10);
16 | const { result } = renderHook(() =>
17 | useMarkedList({ counterRenderer, length: 9, startIndex: 2 })
18 | );
19 | expect(result.current.maxNumOfCodepoints).toBe(expectedLen);
20 | });
21 | it('should work with 0 lengths', () => {
22 | const expectedLen = counterRenderer.maxMarkerLenInRange(2, 1);
23 | const { result } = renderHook(() =>
24 | //@ts-expect-error
25 | useMarkedList({ counterRenderer, startIndex: 2 })
26 | );
27 | expect(result.current.maxNumOfCodepoints).toBe(expectedLen);
28 | });
29 | });
30 |
--------------------------------------------------------------------------------
/packages/react-native-li/src/index.ts:
--------------------------------------------------------------------------------
1 | import MarkedList from './MarkedList';
2 |
3 | export * from './shared-types';
4 | export * from './MarkerBox';
5 | export * from './MarkedList';
6 | export * from './MarkedListItem';
7 | export { default as MarkerBox } from './MarkerBox';
8 | export { default as MarkedListItem } from './MarkedListItem';
9 | export { default as useMarkedList } from './useMarkedList';
10 | export { MarkedList };
11 | export default MarkedList;
12 |
--------------------------------------------------------------------------------
/packages/react-native-li/src/shared-types.ts:
--------------------------------------------------------------------------------
1 | import type { CounterStyleRenderer, RtlOptions } from '@jsamr/counter-style';
2 | import type { ComponentType, ReactNode } from 'react';
3 | import type { StyleProp, ViewStyle, TextStyle } from 'react-native';
4 |
5 | /**
6 | * Props for the {@link MarkerBox} component.
7 | *
8 | * @public
9 | */
10 | export interface MarkerBoxProps {
11 | /**
12 | * Style for the container `Text` element.
13 | */
14 | style: StyleProp;
15 | /**
16 | * Style for any text element. Should not contain CSS box model properties.
17 | */
18 | markerTextStyle: TextStyle;
19 | /**
20 | * The width for the marker text element.
21 | */
22 | markerTextWidth: number | false;
23 | /**
24 | * The renderer to generate the marker string.
25 | */
26 | counterRenderer: CounterStyleRenderer;
27 | /**
28 | * The index to render.
29 | */
30 | counterIndex: number;
31 | /**
32 | * The maximum length of the `markerString` in range.
33 | */
34 | maxNumOfCodepoints: number;
35 | /**
36 | * Whether to reverse or not the order of elements in marker (prefix,
37 | * counter, suffix).
38 | */
39 | rtlMarkerReversed: boolean;
40 | /**
41 | * Clip the marker text when it overflows the marker box.
42 | */
43 | enableMarkerClipping: boolean;
44 | }
45 |
46 | /**
47 | * Props for the {@link MarkedList} component.
48 | *
49 | * @public
50 | */
51 | export interface MarkedListProps {
52 | /**
53 | * The counter renderer for this list.
54 | */
55 | counterRenderer: CounterStyleRenderer;
56 | /**
57 | * Set the line layout in `flexDirection: 'row-reverse'` and left-align the
58 | * marker box.
59 | *
60 | * @remarks Will be ignored if `I18nManager.isRTL` is `true`.
61 | *
62 | * @defaultValue false
63 | */
64 | rtlLineReversed?: boolean;
65 | /**
66 | * Should the marker string be rendered in reverse order?
67 | *
68 | * @remarks Fine-grained options are available when you provide an option
69 | * object. See `@jsamr/counter-style` documentation.
70 | *
71 | * @defaultValue false
72 | */
73 | rtlMarkerReversed?: true | false | RtlOptions;
74 | /**
75 | * Should the width of the marker box be computed dynamically, e.g. depend on
76 | * the longest marker in the list?
77 | *
78 | * @defaultValue true
79 | */
80 | dynamicMarkerBoxWidth?: boolean;
81 | /**
82 | * The index for the first item in the list. Negative indexes are supported.
83 | *
84 | * @defaultValue 1
85 | */
86 | startIndex?: number;
87 | /**
88 | * Style for the line wrapper.
89 | */
90 | lineStyle?: StyleProp;
91 | /**
92 | * A plain JavaScript object text style for the marker string. It is
93 | * advised to pass the same `fontSize` and `lineHeight` as the list content
94 | * for perfect horizontal alignment.
95 | *
96 | * @remarks It should not contain CSS box model properties and it should be a
97 | * plain JavaScript object. **Do not** use StyleSheet or array styles.
98 | */
99 | markerTextStyle?: TextStyle;
100 | /**
101 | * Style for the marker box container.
102 | *
103 | * @remarks It is discouraged to set
104 | * `(min,max)width` when {@link MarkedListProps.dynamicMarkerBoxWidth} is set
105 | * to `true`. In that case, use {@link MarkedListProps.computeMarkerBoxWidth}
106 | * instead.
107 | */
108 | markerBoxStyle?: StyleProp;
109 | /**
110 | * A function to compute marker box width depending on the maximum length of
111 | * the marker string in range.
112 | *
113 | * @remarks
114 | * - Font size is derived from `markerStyle` prop.
115 | * - Will be ignored when {@link MarkedListProps.dynamicMarkerBoxWidth} is
116 | * set to `false`.
117 | */
118 | computeMarkerBoxWidth?: (
119 | maxCodepointsLengthInRange: number,
120 | fontSize: number
121 | ) => number;
122 | /**
123 | * A custom Marker render function.
124 | *
125 | * @remarks You are advised to use {@link MarkerBox} component.
126 | */
127 | renderMarker?: (props: MarkerBoxProps) => ReactNode;
128 | /**
129 | * The component used to wrap list elements.
130 | *
131 | * @defaultValue Fragment
132 | */
133 | Container?: ComponentType;
134 | /**
135 | * Clip the marker text when it overflows the marker box.
136 | *
137 | * @defaultValue false
138 | */
139 | enableMarkerClipping?: boolean;
140 | }
141 |
--------------------------------------------------------------------------------
/packages/react-native-li/src/useMarkedList.ts:
--------------------------------------------------------------------------------
1 | import React, { useMemo } from 'react';
2 | import { I18nManager } from 'react-native';
3 | import MarkerBox from './MarkerBox';
4 | import { MarkedListItemProps } from './MarkedListItem';
5 | import { MarkedListProps } from './shared-types';
6 |
7 | const defaultRenderMarker: NonNullable = (
8 | props
9 | ) => React.createElement(MarkerBox, props);
10 |
11 | const defaultComputeMarkerBoxWidth: NonNullable<
12 | MarkedListProps['computeMarkerBoxWidth']
13 | > = (maxNumOfCodepoints, fontSize) => maxNumOfCodepoints * fontSize * 0.6;
14 |
15 | const DEFAULT_FONT_SIZE = 14;
16 |
17 | /**
18 | * A hook to reuse MarkedList logic to render custom lists components in
19 | * combination with {@link MarkedListItem}.
20 | *
21 | * @public
22 | */
23 | export default function useMarkedList({
24 | counterRenderer,
25 | startIndex = 1,
26 | lineStyle,
27 | rtlLineReversed = false,
28 | rtlMarkerReversed = false,
29 | markerTextStyle,
30 | markerBoxStyle,
31 | dynamicMarkerBoxWidth = true,
32 | length = 0,
33 | renderMarker = defaultRenderMarker,
34 | enableMarkerClipping = false,
35 | computeMarkerBoxWidth = defaultComputeMarkerBoxWidth
36 | }: MarkedListProps & { length: number }): Omit {
37 | const maxNumOfCodepoints = useMemo(
38 | () =>
39 | counterRenderer.maxMarkerLenInRange(startIndex, startIndex + length - 1),
40 | [counterRenderer, length, startIndex]
41 | );
42 | const syntheticRtlLineReversed = !I18nManager.isRTL && rtlLineReversed;
43 | const markerTextWidth = useMemo(
44 | () =>
45 | dynamicMarkerBoxWidth &&
46 | computeMarkerBoxWidth(
47 | maxNumOfCodepoints,
48 | markerTextStyle?.fontSize ?? DEFAULT_FONT_SIZE
49 | ),
50 | [
51 | computeMarkerBoxWidth,
52 | markerTextStyle?.fontSize,
53 | maxNumOfCodepoints,
54 | dynamicMarkerBoxWidth
55 | ]
56 | );
57 | const renderer = useMemo(
58 | () =>
59 | rtlMarkerReversed
60 | ? counterRenderer.withRtl(
61 | rtlMarkerReversed === true ? undefined : rtlMarkerReversed
62 | )
63 | : counterRenderer,
64 | [counterRenderer, rtlMarkerReversed]
65 | );
66 | const syntheticMarkerTextStyle = useMemo(
67 | () =>
68 | ({
69 | flexGrow: 0,
70 | flexShrink: 0,
71 | fontSize: DEFAULT_FONT_SIZE,
72 | textAlign: syntheticRtlLineReversed ? 'left' : 'right',
73 | alignSelf: syntheticRtlLineReversed ? 'flex-start' : 'flex-end',
74 | ...markerTextStyle
75 | } as const),
76 | [markerTextStyle, syntheticRtlLineReversed]
77 | );
78 | return {
79 | maxNumOfCodepoints,
80 | rtlMarkerReversed,
81 | markerTextWidth,
82 | renderMarker,
83 | startIndex,
84 | rtlLineReversed: syntheticRtlLineReversed,
85 | markerTextStyle: syntheticMarkerTextStyle,
86 | markerBoxStyle: markerBoxStyle as any,
87 | counterRenderer: renderer,
88 | style: lineStyle,
89 | enableMarkerClipping
90 | };
91 | }
92 |
--------------------------------------------------------------------------------
/packages/react-native-li/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "include": ["src/"],
4 | "exclude": ["**/__tests__"]
5 | }
6 |
--------------------------------------------------------------------------------
/packages/react-native-li/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig-base.json",
3 | "compilerOptions": {
4 | "outDir": "./lib"
5 | },
6 | "exclude": ["node_modules", "integration", "**/__tests__", "lib", "types"]
7 | }
8 |
--------------------------------------------------------------------------------
/packages/release-config/index.js:
--------------------------------------------------------------------------------
1 | module.exports = function (name) {
2 | const template = name + '@${version}';
3 | return {
4 | git: {
5 | commitMessage: 'chore: release ' + template,
6 | tagName: template
7 | },
8 | npm: {
9 | publish: true
10 | },
11 | github: {
12 | release: true,
13 | releaseName: template
14 | },
15 | plugins: {
16 | '@release-it/conventional-changelog': {
17 | preset: 'angular',
18 | infile: 'CHANGELOG.md'
19 | }
20 | }
21 | };
22 | };
23 |
--------------------------------------------------------------------------------
/packages/release-config/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "release-config",
3 | "version": "1.0.0",
4 | "private": true,
5 | "main": "index.js"
6 | }
7 |
--------------------------------------------------------------------------------
/patches/@release-it-conventional-changelog.patch:
--------------------------------------------------------------------------------
1 | diff --git a/index.js b/index.js
2 | index abbce1815895b044bac47588a327f1b049304b8d..e31f4ee93c6896fefb30552e8bf89f6c182610a4 100644
3 | --- a/index.js
4 | +++ b/index.js
5 | @@ -1,6 +1,7 @@
6 | const { EOL } = require('os');
7 | const fs = require('fs');
8 | const { Plugin } = require('release-it');
9 | +const { format } = require('release-it/lib/util');
10 | const conventionalRecommendedBump = require('conventional-recommended-bump');
11 | const conventionalChangelog = require('conventional-changelog');
12 | const semver = require('semver');
13 | @@ -14,7 +15,8 @@ class ConventionalChangelog extends Plugin {
14 |
15 | getInitialOptions(options, namespace) {
16 | options[namespace].tagName = options.git.tagName;
17 | - return options[namespace];
18 | + const tagPrefix = format(options.git.tagName || '${version}', { version: '' });
19 | + return {...options[namespace], path: './', tagPrefix};
20 | }
21 |
22 | async getChangelog(latestVersion) {
23 | @@ -68,7 +70,8 @@ class ConventionalChangelog extends Plugin {
24 | Object.assign(options, this.options),
25 | { version, previousTag, currentTag },
26 | {
27 | - debug: this.config.isDebug ? this.debug : null
28 | + debug: this.config.isDebug ? this.debug : null,
29 | + path: this.options.path
30 | }
31 | );
32 | }
33 |
--------------------------------------------------------------------------------
/patches/release-it.patch:
--------------------------------------------------------------------------------
1 | diff --git a/lib/plugin/npm/npm.js b/lib/plugin/npm/npm.js
2 | index 1400c8e9476854ba7843dee7ac751dd2f0aea4cb..edf190e473ceb1ef0fd026aec16b40a055702fed 100644
3 | --- a/lib/plugin/npm/npm.js
4 | +++ b/lib/plugin/npm/npm.js
5 | @@ -233,7 +233,7 @@ class npm extends Plugin {
6 | return false;
7 | }
8 | const args = [publishPath, `--tag ${tag}`, otpArg, dryRunArg, ...fixArgs(publishArgs)].filter(Boolean);
9 | - return this.exec(`npm publish ${args.join(' ')}`, { options })
10 | + return (this.config.isDryRun ? this.exec(`npm publish ${args.join(' ')}`, { options }) : this.exec(`yarn npm publish ${args.splice(1).join(' ')}`, { options }))
11 | .then(() => {
12 | this.setContext({ isReleased: true });
13 | })
14 |
--------------------------------------------------------------------------------
/tsconfig-base.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/tsconfig",
3 | "extends": "@tsconfig/react-native/tsconfig.json",
4 | "compilerOptions": {
5 | "allowJs": false,
6 | "composite": false,
7 | "noEmit": false,
8 | "declaration": true,
9 | "noImplicitAny": false,
10 | "isolatedModules": false
11 | }
12 | }
13 |
--------------------------------------------------------------------------------