@flickfyi/flkr 0.0.140 → 0.0.146
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@flickfyi/attestation/.turbo/turbo-build.log +7 -7
- package/node_modules/@flickfyi/biscuit/.turbo/turbo-build.log +7 -7
- package/node_modules/@flickfyi/core/.oxlintrc.json +2 -1
- package/node_modules/@flickfyi/core/.turbo/turbo-build.log +502 -95
- package/node_modules/@flickfyi/core/README.md +58 -4
- package/node_modules/@flickfyi/core/dist/index.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/index.js +35 -24
- package/node_modules/@flickfyi/core/dist/kowalski/calculations.d.ts +17 -0
- package/node_modules/@flickfyi/core/dist/kowalski/calculator.d.ts +13 -0
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.cjs +1 -0
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.d.cts +962 -0
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.d.ts +962 -0
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.js +639 -0
- package/node_modules/@flickfyi/core/dist/kowalski/clocks.d.ts +4 -0
- package/node_modules/@flickfyi/core/dist/kowalski/date-time.d.ts +22 -0
- package/node_modules/@flickfyi/core/dist/kowalski/details.d.ts +7 -0
- package/node_modules/@flickfyi/core/dist/kowalski/everyday.d.ts +8 -0
- package/node_modules/@flickfyi/core/dist/kowalski/format.d.ts +4 -0
- package/node_modules/@flickfyi/core/dist/kowalski/frame.d.ts +161 -0
- package/node_modules/@flickfyi/core/dist/kowalski/index.cjs +21 -0
- package/node_modules/@flickfyi/core/dist/kowalski/index.d.cts +8 -0
- package/node_modules/@flickfyi/core/dist/kowalski/index.d.ts +8 -0
- package/node_modules/@flickfyi/core/dist/kowalski/index.js +7496 -0
- package/node_modules/@flickfyi/core/dist/kowalski/productivity.d.ts +5 -0
- package/node_modules/@flickfyi/core/dist/kowalski/recipe.d.ts +8 -0
- package/node_modules/@flickfyi/core/dist/kowalski/tools.d.ts +7 -0
- package/node_modules/@flickfyi/core/dist/kowalski/use-clock.d.ts +6 -0
- package/node_modules/@flickfyi/core/dist/kowalski/use-configured-feature.d.ts +19 -0
- package/node_modules/@flickfyi/core/dist/kowalski/use-feature-store.d.ts +15 -0
- package/node_modules/@flickfyi/core/dist/kowalski.css +506 -0
- package/node_modules/@flickfyi/core/dist/molecules/field/field.d.ts +8 -0
- package/node_modules/@flickfyi/core/dist/molecules/index.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/molecules/index.d.cts +3 -0
- package/node_modules/@flickfyi/core/dist/molecules/index.d.ts +3 -0
- package/node_modules/@flickfyi/core/dist/molecules/index.js +88 -27
- package/node_modules/@flickfyi/core/dist/molecules/segmented/segmented.d.ts +10 -0
- package/node_modules/@flickfyi/core/dist/molecules/stepper/stepper.d.ts +10 -0
- package/node_modules/@flickfyi/core/dist/quantum/use-store.d.ts +7 -1
- package/node_modules/@flickfyi/core/dist/themes.css +2 -0
- package/node_modules/@flickfyi/core/examples/kowalski/bill-split/bill-split.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/bill-split/bill-split.tsx +17 -0
- package/node_modules/@flickfyi/core/examples/kowalski/bookmark/bookmark.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/bookmark/bookmark.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/budget/budget.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/budget/budget.tsx +26 -0
- package/node_modules/@flickfyi/core/examples/kowalski/calculator/calculator.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/calculator/calculator.tsx +24 -0
- package/node_modules/@flickfyi/core/examples/kowalski/checklist/checklist.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/checklist/checklist.tsx +26 -0
- package/node_modules/@flickfyi/core/examples/kowalski/color-palette/color-palette.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/color-palette/color-palette.tsx +22 -0
- package/node_modules/@flickfyi/core/examples/kowalski/contact/contact.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/contact/contact.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/countdown/countdown.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/countdown/countdown.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/event/event.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/event/event.tsx +24 -0
- package/node_modules/@flickfyi/core/examples/kowalski/expense/expense.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/expense/expense.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/goal/goal.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/goal/goal.tsx +24 -0
- package/node_modules/@flickfyi/core/examples/kowalski/habit/habit.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/habit/habit.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/ledger/ledger.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/ledger/ledger.tsx +25 -0
- package/node_modules/@flickfyi/core/examples/kowalski/note/note.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/note/note.tsx +22 -0
- package/node_modules/@flickfyi/core/examples/kowalski/poll/poll.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/poll/poll.tsx +26 -0
- package/node_modules/@flickfyi/core/examples/kowalski/random-picker/random-picker.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/random-picker/random-picker.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/rating/rating.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/rating/rating.tsx +19 -0
- package/node_modules/@flickfyi/core/examples/kowalski/recipe/recipe.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/recipe/recipe.tsx +120 -0
- package/node_modules/@flickfyi/core/examples/kowalski/reminder/reminder.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/reminder/reminder.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/rotation/rotation.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/rotation/rotation.tsx +27 -0
- package/node_modules/@flickfyi/core/examples/kowalski/scoreboard/scoreboard.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/scoreboard/scoreboard.tsx +26 -0
- package/node_modules/@flickfyi/core/examples/kowalski/shopping-list/shopping-list.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/shopping-list/shopping-list.tsx +27 -0
- package/node_modules/@flickfyi/core/examples/kowalski/task-board/task-board.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/task-board/task-board.tsx +27 -0
- package/node_modules/@flickfyi/core/examples/kowalski/theme.ts +3 -0
- package/node_modules/@flickfyi/core/examples/kowalski/time-zone/time-zone.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/time-zone/time-zone.tsx +22 -0
- package/node_modules/@flickfyi/core/examples/kowalski/timer/timer.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/timer/timer.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/trip/trip.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/trip/trip.tsx +26 -0
- package/node_modules/@flickfyi/core/examples/kowalski/unit-converter/unit-converter.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/unit-converter/unit-converter.tsx +24 -0
- package/node_modules/@flickfyi/core/examples/parrott/calculator/calculator.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/checklist/checklist.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/countdown/countdown.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/counter/counter.stories.tsx +1 -0
- package/node_modules/@flickfyi/core/examples/parrott/fortune/fortune.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/grid/grid.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/kale-smoothie/kale-smoothie.stories.tsx +1 -0
- package/node_modules/@flickfyi/core/examples/parrott/list/list.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/log/log.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/timed-task/timed-task.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/timer/timer.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/fixtures/native/host/project.yml +3 -0
- package/node_modules/@flickfyi/core/fixtures/native/src/catalog-features.tsx +88 -0
- package/node_modules/@flickfyi/core/package.json +35 -5
- package/node_modules/@flickfyi/core/package.tsgo.json +19 -1
- package/node_modules/@flickfyi/core/scripts/vite-globals.d.ts +2 -0
- package/node_modules/@flickfyi/core/src/generated-types.d.ts +1 -0
- package/node_modules/@flickfyi/core/src/kowalski/README.md +9 -0
- package/node_modules/@flickfyi/core/src/kowalski/calculations.ts +106 -0
- package/node_modules/@flickfyi/core/src/kowalski/calculator.ts +243 -0
- package/node_modules/@flickfyi/core/src/kowalski/catalog.ts +787 -0
- package/node_modules/@flickfyi/core/src/kowalski/clocks.tsx +464 -0
- package/node_modules/@flickfyi/core/src/kowalski/date-time.tsx +469 -0
- package/node_modules/@flickfyi/core/src/kowalski/details.tsx +1387 -0
- package/node_modules/@flickfyi/core/src/kowalski/everyday.tsx +652 -0
- package/node_modules/@flickfyi/core/src/kowalski/format.ts +48 -0
- package/node_modules/@flickfyi/core/src/kowalski/frame.tsx +351 -0
- package/node_modules/@flickfyi/core/src/kowalski/index.ts +23 -0
- package/node_modules/@flickfyi/core/src/kowalski/productivity.tsx +575 -0
- package/node_modules/@flickfyi/core/src/kowalski/recipe.tsx +555 -0
- package/node_modules/@flickfyi/core/src/kowalski/stories/composition.stories.tsx +47 -0
- package/node_modules/@flickfyi/core/src/kowalski/stories/composition.tsx +100 -0
- package/node_modules/@flickfyi/core/src/kowalski/tools.tsx +1213 -0
- package/node_modules/@flickfyi/core/src/kowalski/use-clock.ts +19 -0
- package/node_modules/@flickfyi/core/src/kowalski/use-configured-feature.ts +85 -0
- package/node_modules/@flickfyi/core/src/kowalski/use-feature-store.ts +119 -0
- package/node_modules/@flickfyi/core/src/molecules/field/field.tsx +34 -0
- package/node_modules/@flickfyi/core/src/molecules/index.ts +3 -0
- package/node_modules/@flickfyi/core/src/molecules/segmented/segmented.tsx +48 -0
- package/node_modules/@flickfyi/core/src/molecules/stepper/stepper.tsx +54 -0
- package/node_modules/@flickfyi/core/src/quantum/use-store.ts +41 -16
- package/node_modules/@flickfyi/core/tests/fly.test.ts +34 -7
- package/node_modules/@flickfyi/core/tests/kowalski-calculations.test.ts +60 -0
- package/node_modules/@flickfyi/core/tests/kowalski-calculator.test.ts +142 -0
- package/node_modules/@flickfyi/core/tests/kowalski-contracts.test.ts +223 -0
- package/node_modules/@flickfyi/core/tests/kowalski-date-time.test.tsx +462 -0
- package/node_modules/@flickfyi/core/tests/kowalski-features.test.tsx +2158 -0
- package/node_modules/@flickfyi/core/tests/kowalski-store.test.tsx +514 -0
- package/node_modules/@flickfyi/core/tests/preview-build.test.ts +1 -1
- package/node_modules/@flickfyi/core/tests/quantum-use-store.test.ts +53 -1
- package/node_modules/@flickfyi/core/tests/verify-tsgo-assets.test.ts +1 -1
- package/node_modules/@flickfyi/core/tsconfig.vite-dts.json +2 -1
- package/node_modules/@flickfyi/core/tsgo.bun.lock +111 -9
- package/node_modules/@flickfyi/core/tsgo.package.json +21 -3
- package/node_modules/@flickfyi/core/vite.config.ts +9 -5
- package/node_modules/@flickfyi/core/vitest.config.ts +1 -1
- package/node_modules/@flickfyi/http-message-sig/.turbo/turbo-build.log +7 -7
- package/node_modules/@flickfyi/identity/.turbo/turbo-build.log +8 -9
- package/node_modules/@flickfyi/lens/.turbo/turbo-build.log +7 -7
- package/node_modules/@flickfyi/photon/.turbo/turbo-build.log +9 -9
- package/node_modules/@flickfyi/photon/Sources/Photon/Components/Button.swift +29 -2
- package/node_modules/@flickfyi/photon/Sources/PhotonVersion/Resources/photon-version.json +1 -1
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Components/ButtonHostTests.swift +26 -0
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-features.styles.json +1 -0
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-native.styles.json +1 -1
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-scale.styles.json +1 -1
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-theme.styles.json +1 -1
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-typography.styles.json +1 -1
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/stylex-calculator.styles.json +1 -1
- package/node_modules/@flickfyi/photon/dist/globals.d.ts +5 -0
- package/node_modules/@flickfyi/photon/dist/version.cjs +1 -1
- package/node_modules/@flickfyi/photon/dist/version.js +1 -1
- package/node_modules/@flickfyi/photon/generated/react-swiftui.d.ts +1 -0
- package/node_modules/@flickfyi/photon/package.json +1 -1
- package/node_modules/@flickfyi/photon/src/globals.d.ts +5 -0
- package/node_modules/@flickfyi/rwsdk-extensions/.turbo/turbo-build.log +7 -7
- package/node_modules/@formatjs/fast-memoize/LICENSE.md +9 -0
- package/node_modules/@formatjs/fast-memoize/README.md +3 -0
- package/node_modules/@formatjs/fast-memoize/index.d.ts +35 -0
- package/node_modules/@formatjs/fast-memoize/index.js +69 -0
- package/node_modules/@formatjs/fast-memoize/index.js.map +1 -0
- package/node_modules/@formatjs/fast-memoize/package.json +25 -0
- package/node_modules/@formatjs/icu-messageformat-parser/LICENSE.md +9 -0
- package/node_modules/@formatjs/icu-messageformat-parser/README.md +38 -0
- package/node_modules/@formatjs/icu-messageformat-parser/index.d.ts +393 -0
- package/node_modules/@formatjs/icu-messageformat-parser/index.js +2187 -0
- package/node_modules/@formatjs/icu-messageformat-parser/index.js.map +1 -0
- package/node_modules/@formatjs/icu-messageformat-parser/manipulator.d.ts +175 -0
- package/node_modules/@formatjs/icu-messageformat-parser/manipulator.js +209 -0
- package/node_modules/@formatjs/icu-messageformat-parser/manipulator.js.map +1 -0
- package/node_modules/@formatjs/icu-messageformat-parser/no-parser.d.ts +183 -0
- package/node_modules/@formatjs/icu-messageformat-parser/no-parser.js +162 -0
- package/node_modules/@formatjs/icu-messageformat-parser/no-parser.js.map +1 -0
- package/node_modules/@formatjs/icu-messageformat-parser/package.json +21 -0
- package/node_modules/@formatjs/icu-messageformat-parser/printer.d.ts +154 -0
- package/node_modules/@formatjs/icu-messageformat-parser/printer.js +224 -0
- package/node_modules/@formatjs/icu-messageformat-parser/printer.js.map +1 -0
- package/node_modules/@formatjs/icu-skeleton-parser/LICENSE.md +9 -0
- package/node_modules/@formatjs/icu-skeleton-parser/README.md +1 -0
- package/node_modules/@formatjs/icu-skeleton-parser/index.d.ts +67 -0
- package/node_modules/@formatjs/icu-skeleton-parser/index.js +380 -0
- package/node_modules/@formatjs/icu-skeleton-parser/index.js.map +1 -0
- package/node_modules/@formatjs/icu-skeleton-parser/package.json +15 -0
- package/node_modules/@formatjs/intl/LICENSE.md +9 -0
- package/node_modules/@formatjs/intl/README.md +3 -0
- package/node_modules/@formatjs/intl/index.d.ts +499 -0
- package/node_modules/@formatjs/intl/index.js +595 -0
- package/node_modules/@formatjs/intl/index.js.map +1 -0
- package/node_modules/@formatjs/intl/package.json +37 -0
- package/node_modules/decimal.js/LICENCE.md +23 -0
- package/node_modules/decimal.js/README.md +246 -0
- package/node_modules/decimal.js/decimal.d.ts +301 -0
- package/node_modules/decimal.js/decimal.js +4951 -0
- package/node_modules/decimal.js/decimal.mjs +4914 -0
- package/node_modules/decimal.js/package.json +55 -0
- package/node_modules/format-quantity/LICENSE +21 -0
- package/node_modules/format-quantity/README.md +181 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.development.d.ts +131 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.development.js +214 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.development.js.map +1 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.production.d.ts +131 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.production.js +2 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.production.js.map +1 -0
- package/node_modules/format-quantity/dist/cjs/index.d.ts +1 -0
- package/node_modules/format-quantity/dist/cjs/index.js +6 -0
- package/node_modules/format-quantity/dist/format-quantity.d.mts +131 -0
- package/node_modules/format-quantity/dist/format-quantity.legacy-esm.d.ts +131 -0
- package/node_modules/format-quantity/dist/format-quantity.legacy-esm.js +268 -0
- package/node_modules/format-quantity/dist/format-quantity.legacy-esm.js.map +1 -0
- package/node_modules/format-quantity/dist/format-quantity.mjs +208 -0
- package/node_modules/format-quantity/dist/format-quantity.mjs.map +1 -0
- package/node_modules/format-quantity/dist/format-quantity.production.d.mts +131 -0
- package/node_modules/format-quantity/dist/format-quantity.production.mjs +2 -0
- package/node_modules/format-quantity/dist/format-quantity.production.mjs.map +1 -0
- package/node_modules/format-quantity/dist/format-quantity.umd.min.js +3 -0
- package/node_modules/format-quantity/dist/format-quantity.umd.min.js.map +1 -0
- package/node_modules/format-quantity/package.json +81 -0
- package/node_modules/intl-messageformat/LICENSE.md +33 -0
- package/node_modules/intl-messageformat/README.md +3 -0
- package/node_modules/intl-messageformat/index.d.ts +177 -0
- package/node_modules/intl-messageformat/index.js +327 -0
- package/node_modules/intl-messageformat/index.js.map +1 -0
- package/node_modules/intl-messageformat/intl-messageformat.iife.js +2819 -0
- package/node_modules/intl-messageformat/package.json +40 -0
- package/node_modules/numeric-quantity/LICENSE +21 -0
- package/node_modules/numeric-quantity/README.md +306 -0
- package/node_modules/numeric-quantity/dist/cjs/index.d.ts +1 -0
- package/node_modules/numeric-quantity/dist/cjs/index.js +6 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.development.d.ts +293 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.development.js +579 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.development.js.map +1 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.production.d.ts +293 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.production.js +2 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.production.js.map +1 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.d.mts +293 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.iife.umd.min.js +2 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.iife.umd.min.js.map +1 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.legacy-esm.d.ts +293 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.legacy-esm.js +622 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.legacy-esm.js.map +1 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.mjs +564 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.mjs.map +1 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.production.d.mts +293 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.production.mjs +2 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.production.mjs.map +1 -0
- package/node_modules/numeric-quantity/package.json +72 -0
- package/node_modules/validator/LICENSE +20 -0
- package/node_modules/validator/README.md +269 -0
- package/node_modules/validator/es/index.js +218 -0
- package/node_modules/validator/es/lib/alpha.js +151 -0
- package/node_modules/validator/es/lib/blacklist.js +5 -0
- package/node_modules/validator/es/lib/contains.js +15 -0
- package/node_modules/validator/es/lib/equals.js +5 -0
- package/node_modules/validator/es/lib/escape.js +5 -0
- package/node_modules/validator/es/lib/isAbaRouting.js +15 -0
- package/node_modules/validator/es/lib/isAfter.js +10 -0
- package/node_modules/validator/es/lib/isAlpha.js +23 -0
- package/node_modules/validator/es/lib/isAlphanumeric.js +23 -0
- package/node_modules/validator/es/lib/isAscii.js +10 -0
- package/node_modules/validator/es/lib/isBIC.js +16 -0
- package/node_modules/validator/es/lib/isBase32.js +15 -0
- package/node_modules/validator/es/lib/isBase58.js +8 -0
- package/node_modules/validator/es/lib/isBase64.js +23 -0
- package/node_modules/validator/es/lib/isBefore.js +10 -0
- package/node_modules/validator/es/lib/isBoolean.js +15 -0
- package/node_modules/validator/es/lib/isBtcAddress.js +7 -0
- package/node_modules/validator/es/lib/isByteLength.js +19 -0
- package/node_modules/validator/es/lib/isCreditCard.js +43 -0
- package/node_modules/validator/es/lib/isCurrency.js +74 -0
- package/node_modules/validator/es/lib/isDataURI.js +31 -0
- package/node_modules/validator/es/lib/isDate.js +93 -0
- package/node_modules/validator/es/lib/isDecimal.js +22 -0
- package/node_modules/validator/es/lib/isDivisibleBy.js +6 -0
- package/node_modules/validator/es/lib/isEAN.js +70 -0
- package/node_modules/validator/es/lib/isEmail.js +165 -0
- package/node_modules/validator/es/lib/isEmpty.js +10 -0
- package/node_modules/validator/es/lib/isEthereumAddress.js +6 -0
- package/node_modules/validator/es/lib/isFQDN.js +67 -0
- package/node_modules/validator/es/lib/isFloat.js +14 -0
- package/node_modules/validator/es/lib/isFullWidth.js +6 -0
- package/node_modules/validator/es/lib/isHSL.js +13 -0
- package/node_modules/validator/es/lib/isHalfWidth.js +6 -0
- package/node_modules/validator/es/lib/isHash.js +21 -0
- package/node_modules/validator/es/lib/isHexColor.js +13 -0
- package/node_modules/validator/es/lib/isHexadecimal.js +6 -0
- package/node_modules/validator/es/lib/isIBAN.js +171 -0
- package/node_modules/validator/es/lib/isIMEI.js +40 -0
- package/node_modules/validator/es/lib/isIP.js +58 -0
- package/node_modules/validator/es/lib/isIPRange.js +41 -0
- package/node_modules/validator/es/lib/isISBN.js +47 -0
- package/node_modules/validator/es/lib/isISIN.js +55 -0
- package/node_modules/validator/es/lib/isISO15924.js +9 -0
- package/node_modules/validator/es/lib/isISO31661Alpha2.js +21 -0
- package/node_modules/validator/es/lib/isISO31661Alpha3.js +20 -0
- package/node_modules/validator/es/lib/isISO31661Numeric.js +8 -0
- package/node_modules/validator/es/lib/isISO4217.js +9 -0
- package/node_modules/validator/es/lib/isISO6346.js +28 -0
- package/node_modules/validator/es/lib/isISO6391.js +6 -0
- package/node_modules/validator/es/lib/isISO8601.js +42 -0
- package/node_modules/validator/es/lib/isISRC.js +8 -0
- package/node_modules/validator/es/lib/isISSN.js +19 -0
- package/node_modules/validator/es/lib/isIdentityCard.js +407 -0
- package/node_modules/validator/es/lib/isIn.js +23 -0
- package/node_modules/validator/es/lib/isInt.js +19 -0
- package/node_modules/validator/es/lib/isJSON.js +26 -0
- package/node_modules/validator/es/lib/isJWT.js +15 -0
- package/node_modules/validator/es/lib/isLatLong.js +21 -0
- package/node_modules/validator/es/lib/isLength.js +27 -0
- package/node_modules/validator/es/lib/isLicensePlate.js +58 -0
- package/node_modules/validator/es/lib/isLocale.js +107 -0
- package/node_modules/validator/es/lib/isLowercase.js +5 -0
- package/node_modules/validator/es/lib/isLuhnNumber.js +25 -0
- package/node_modules/validator/es/lib/isMACAddress.js +36 -0
- package/node_modules/validator/es/lib/isMD5.js +6 -0
- package/node_modules/validator/es/lib/isMagnetURI.js +9 -0
- package/node_modules/validator/es/lib/isMailtoURI.js +75 -0
- package/node_modules/validator/es/lib/isMimeType.js +40 -0
- package/node_modules/validator/es/lib/isMobilePhone.js +212 -0
- package/node_modules/validator/es/lib/isMongoId.js +6 -0
- package/node_modules/validator/es/lib/isMultibyte.js +10 -0
- package/node_modules/validator/es/lib/isNumeric.js +10 -0
- package/node_modules/validator/es/lib/isOctal.js +6 -0
- package/node_modules/validator/es/lib/isPassportNumber.js +145 -0
- package/node_modules/validator/es/lib/isPort.js +8 -0
- package/node_modules/validator/es/lib/isPostalCode.js +100 -0
- package/node_modules/validator/es/lib/isRFC3339.js +21 -0
- package/node_modules/validator/es/lib/isRgbColor.js +34 -0
- package/node_modules/validator/es/lib/isSemVer.js +14 -0
- package/node_modules/validator/es/lib/isSlug.js +6 -0
- package/node_modules/validator/es/lib/isStrongPassword.js +90 -0
- package/node_modules/validator/es/lib/isSurrogatePair.js +6 -0
- package/node_modules/validator/es/lib/isTaxID.js +1407 -0
- package/node_modules/validator/es/lib/isTime.js +22 -0
- package/node_modules/validator/es/lib/isULID.js +5 -0
- package/node_modules/validator/es/lib/isURL.js +241 -0
- package/node_modules/validator/es/lib/isUUID.js +23 -0
- package/node_modules/validator/es/lib/isUppercase.js +5 -0
- package/node_modules/validator/es/lib/isVAT.js +264 -0
- package/node_modules/validator/es/lib/isVariableWidth.js +7 -0
- package/node_modules/validator/es/lib/isWhitelisted.js +10 -0
- package/node_modules/validator/es/lib/ltrim.js +7 -0
- package/node_modules/validator/es/lib/matches.js +8 -0
- package/node_modules/validator/es/lib/normalizeEmail.js +131 -0
- package/node_modules/validator/es/lib/rtrim.js +15 -0
- package/node_modules/validator/es/lib/stripLow.js +7 -0
- package/node_modules/validator/es/lib/toBoolean.js +8 -0
- package/node_modules/validator/es/lib/toDate.js +6 -0
- package/node_modules/validator/es/lib/toFloat.js +5 -0
- package/node_modules/validator/es/lib/toInt.js +5 -0
- package/node_modules/validator/es/lib/trim.js +5 -0
- package/node_modules/validator/es/lib/unescape.js +8 -0
- package/node_modules/validator/es/lib/util/algorithms.js +79 -0
- package/node_modules/validator/es/lib/util/assertString.js +4 -0
- package/node_modules/validator/es/lib/util/checkHost.js +12 -0
- package/node_modules/validator/es/lib/util/includesArray.js +6 -0
- package/node_modules/validator/es/lib/util/includesString.js +4 -0
- package/node_modules/validator/es/lib/util/merge.js +14 -0
- package/node_modules/validator/es/lib/util/multilineRegex.js +12 -0
- package/node_modules/validator/es/lib/util/nullUndefinedCheck.js +3 -0
- package/node_modules/validator/es/lib/util/toString.js +13 -0
- package/node_modules/validator/es/lib/util/typeOf.js +10 -0
- package/node_modules/validator/es/lib/whitelist.js +5 -0
- package/node_modules/validator/index.js +229 -0
- package/node_modules/validator/lib/alpha.js +157 -0
- package/node_modules/validator/lib/blacklist.js +14 -0
- package/node_modules/validator/lib/contains.js +24 -0
- package/node_modules/validator/lib/equals.js +14 -0
- package/node_modules/validator/lib/escape.js +14 -0
- package/node_modules/validator/lib/isAbaRouting.js +23 -0
- package/node_modules/validator/lib/isAfter.js +19 -0
- package/node_modules/validator/lib/isAlpha.js +31 -0
- package/node_modules/validator/lib/isAlphanumeric.js +31 -0
- package/node_modules/validator/lib/isAscii.js +18 -0
- package/node_modules/validator/lib/isBIC.js +24 -0
- package/node_modules/validator/lib/isBase32.js +24 -0
- package/node_modules/validator/lib/isBase58.js +16 -0
- package/node_modules/validator/lib/isBase64.js +32 -0
- package/node_modules/validator/lib/isBefore.js +19 -0
- package/node_modules/validator/lib/isBoolean.js +24 -0
- package/node_modules/validator/lib/isBtcAddress.js +16 -0
- package/node_modules/validator/lib/isByteLength.js +27 -0
- package/node_modules/validator/lib/isCreditCard.js +52 -0
- package/node_modules/validator/lib/isCurrency.js +83 -0
- package/node_modules/validator/lib/isDataURI.js +40 -0
- package/node_modules/validator/lib/isDate.js +102 -0
- package/node_modules/validator/lib/isDecimal.js +31 -0
- package/node_modules/validator/lib/isDivisibleBy.js +15 -0
- package/node_modules/validator/lib/isEAN.js +78 -0
- package/node_modules/validator/lib/isEmail.js +174 -0
- package/node_modules/validator/lib/isEmpty.js +19 -0
- package/node_modules/validator/lib/isEthereumAddress.js +15 -0
- package/node_modules/validator/lib/isFQDN.js +76 -0
- package/node_modules/validator/lib/isFloat.js +22 -0
- package/node_modules/validator/lib/isFullWidth.js +14 -0
- package/node_modules/validator/lib/isHSL.js +22 -0
- package/node_modules/validator/lib/isHalfWidth.js +14 -0
- package/node_modules/validator/lib/isHash.js +30 -0
- package/node_modules/validator/lib/isHexColor.js +22 -0
- package/node_modules/validator/lib/isHexadecimal.js +15 -0
- package/node_modules/validator/lib/isIBAN.js +178 -0
- package/node_modules/validator/lib/isIMEI.js +49 -0
- package/node_modules/validator/lib/isIP.js +67 -0
- package/node_modules/validator/lib/isIPRange.js +50 -0
- package/node_modules/validator/lib/isISBN.js +56 -0
- package/node_modules/validator/lib/isISIN.js +64 -0
- package/node_modules/validator/lib/isISO15924.js +16 -0
- package/node_modules/validator/lib/isISO31661Alpha2.js +28 -0
- package/node_modules/validator/lib/isISO31661Alpha3.js +28 -0
- package/node_modules/validator/lib/isISO31661Numeric.js +16 -0
- package/node_modules/validator/lib/isISO4217.js +16 -0
- package/node_modules/validator/lib/isISO6346.js +35 -0
- package/node_modules/validator/lib/isISO6391.js +15 -0
- package/node_modules/validator/lib/isISO8601.js +50 -0
- package/node_modules/validator/lib/isISRC.js +16 -0
- package/node_modules/validator/lib/isISSN.js +28 -0
- package/node_modules/validator/lib/isIdentityCard.js +416 -0
- package/node_modules/validator/lib/isIn.js +32 -0
- package/node_modules/validator/lib/isInt.js +28 -0
- package/node_modules/validator/lib/isJSON.js +35 -0
- package/node_modules/validator/lib/isJWT.js +24 -0
- package/node_modules/validator/lib/isLatLong.js +30 -0
- package/node_modules/validator/lib/isLength.js +35 -0
- package/node_modules/validator/lib/isLicensePlate.js +67 -0
- package/node_modules/validator/lib/isLocale.js +115 -0
- package/node_modules/validator/lib/isLowercase.js +14 -0
- package/node_modules/validator/lib/isLuhnNumber.js +34 -0
- package/node_modules/validator/lib/isMACAddress.js +45 -0
- package/node_modules/validator/lib/isMD5.js +15 -0
- package/node_modules/validator/lib/isMagnetURI.js +18 -0
- package/node_modules/validator/lib/isMailtoURI.js +84 -0
- package/node_modules/validator/lib/isMimeType.js +48 -0
- package/node_modules/validator/lib/isMobilePhone.js +219 -0
- package/node_modules/validator/lib/isMongoId.js +15 -0
- package/node_modules/validator/lib/isMultibyte.js +18 -0
- package/node_modules/validator/lib/isNumeric.js +19 -0
- package/node_modules/validator/lib/isOctal.js +15 -0
- package/node_modules/validator/lib/isPassportNumber.js +152 -0
- package/node_modules/validator/lib/isPort.js +17 -0
- package/node_modules/validator/lib/isPostalCode.js +107 -0
- package/node_modules/validator/lib/isRFC3339.js +29 -0
- package/node_modules/validator/lib/isRgbColor.js +42 -0
- package/node_modules/validator/lib/isSemVer.js +22 -0
- package/node_modules/validator/lib/isSlug.js +15 -0
- package/node_modules/validator/lib/isStrongPassword.js +99 -0
- package/node_modules/validator/lib/isSurrogatePair.js +15 -0
- package/node_modules/validator/lib/isTaxID.js +1417 -0
- package/node_modules/validator/lib/isTime.js +31 -0
- package/node_modules/validator/lib/isULID.js +14 -0
- package/node_modules/validator/lib/isURL.js +249 -0
- package/node_modules/validator/lib/isUUID.js +32 -0
- package/node_modules/validator/lib/isUppercase.js +14 -0
- package/node_modules/validator/lib/isVAT.js +274 -0
- package/node_modules/validator/lib/isVariableWidth.js +16 -0
- package/node_modules/validator/lib/isWhitelisted.js +19 -0
- package/node_modules/validator/lib/ltrim.js +16 -0
- package/node_modules/validator/lib/matches.js +17 -0
- package/node_modules/validator/lib/normalizeEmail.js +140 -0
- package/node_modules/validator/lib/rtrim.js +24 -0
- package/node_modules/validator/lib/stripLow.js +16 -0
- package/node_modules/validator/lib/toBoolean.js +17 -0
- package/node_modules/validator/lib/toDate.js +15 -0
- package/node_modules/validator/lib/toFloat.js +14 -0
- package/node_modules/validator/lib/toInt.js +14 -0
- package/node_modules/validator/lib/trim.js +14 -0
- package/node_modules/validator/lib/unescape.js +17 -0
- package/node_modules/validator/lib/util/algorithms.js +88 -0
- package/node_modules/validator/lib/util/assertString.js +12 -0
- package/node_modules/validator/lib/util/checkHost.js +20 -0
- package/node_modules/validator/lib/util/includesArray.js +14 -0
- package/node_modules/validator/lib/util/includesString.js +12 -0
- package/node_modules/validator/lib/util/merge.js +22 -0
- package/node_modules/validator/lib/util/multilineRegex.js +20 -0
- package/node_modules/validator/lib/util/nullUndefinedCheck.js +11 -0
- package/node_modules/validator/lib/util/toString.js +21 -0
- package/node_modules/validator/lib/util/typeOf.js +18 -0
- package/node_modules/validator/lib/whitelist.js +14 -0
- package/node_modules/validator/package.json +76 -0
- package/node_modules/validator/validator.js +5808 -0
- package/node_modules/validator/validator.min.js +23 -0
- package/package.json +3 -3
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { NumberSkeletonToken } from "@formatjs/icu-skeleton-parser";
|
|
2
|
+
//#region packages/ecma402-abstract/types/number.d.ts
|
|
3
|
+
type NumberFormatNotation = "standard" | "scientific" | "engineering" | "compact";
|
|
4
|
+
type RoundingPriorityType = "auto" | "morePrecision" | "lessPrecision";
|
|
5
|
+
type RoundingModeType = "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven";
|
|
6
|
+
type UseGroupingType = "min2" | "auto" | "always" | boolean;
|
|
7
|
+
interface NumberFormatDigitOptions {
|
|
8
|
+
minimumIntegerDigits?: number;
|
|
9
|
+
minimumSignificantDigits?: number;
|
|
10
|
+
maximumSignificantDigits?: number;
|
|
11
|
+
minimumFractionDigits?: number;
|
|
12
|
+
maximumFractionDigits?: number;
|
|
13
|
+
roundingPriority?: RoundingPriorityType;
|
|
14
|
+
roundingIncrement?: number;
|
|
15
|
+
roundingMode?: RoundingModeType;
|
|
16
|
+
trailingZeroDisplay?: TrailingZeroDisplay;
|
|
17
|
+
}
|
|
18
|
+
type NumberFormatOptionsLocaleMatcher = "lookup" | "best fit";
|
|
19
|
+
type NumberFormatOptionsStyle = "decimal" | "percent" | "currency" | "unit";
|
|
20
|
+
type NumberFormatOptionsCompactDisplay = "short" | "long";
|
|
21
|
+
type NumberFormatOptionsCurrencyDisplay = "symbol" | "code" | "name" | "narrowSymbol";
|
|
22
|
+
type NumberFormatOptionsCurrencySign = "standard" | "accounting";
|
|
23
|
+
type NumberFormatOptionsNotation = NumberFormatNotation;
|
|
24
|
+
type NumberFormatOptionsSignDisplay = "auto" | "always" | "never" | "exceptZero" | "negative";
|
|
25
|
+
type NumberFormatOptionsUnitDisplay = "long" | "short" | "narrow";
|
|
26
|
+
type TrailingZeroDisplay = "auto" | "stripIfInteger";
|
|
27
|
+
type NumberFormatOptions = Omit<Intl.NumberFormatOptions, "signDisplay" | "useGrouping"> & NumberFormatDigitOptions & {
|
|
28
|
+
localeMatcher?: NumberFormatOptionsLocaleMatcher;
|
|
29
|
+
style?: NumberFormatOptionsStyle;
|
|
30
|
+
compactDisplay?: NumberFormatOptionsCompactDisplay;
|
|
31
|
+
currencyDisplay?: NumberFormatOptionsCurrencyDisplay;
|
|
32
|
+
currencySign?: NumberFormatOptionsCurrencySign;
|
|
33
|
+
notation?: NumberFormatOptionsNotation;
|
|
34
|
+
signDisplay?: NumberFormatOptionsSignDisplay;
|
|
35
|
+
unit?: string;
|
|
36
|
+
unitDisplay?: NumberFormatOptionsUnitDisplay;
|
|
37
|
+
numberingSystem?: string;
|
|
38
|
+
trailingZeroDisplay?: TrailingZeroDisplay;
|
|
39
|
+
roundingPriority?: RoundingPriorityType;
|
|
40
|
+
roundingIncrement?: number;
|
|
41
|
+
roundingMode?: RoundingModeType;
|
|
42
|
+
useGrouping?: UseGroupingType;
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region packages/icu-messageformat-parser/types.d.ts
|
|
46
|
+
interface ExtendedNumberFormatOptions extends NumberFormatOptions {
|
|
47
|
+
scale?: number;
|
|
48
|
+
}
|
|
49
|
+
declare enum TYPE {
|
|
50
|
+
/**
|
|
51
|
+
* Raw text
|
|
52
|
+
*/
|
|
53
|
+
literal = 0,
|
|
54
|
+
/**
|
|
55
|
+
* Variable w/o any format, e.g `var` in `this is a {var}`
|
|
56
|
+
*/
|
|
57
|
+
argument = 1,
|
|
58
|
+
/**
|
|
59
|
+
* Variable w/ number format
|
|
60
|
+
*/
|
|
61
|
+
number = 2,
|
|
62
|
+
/**
|
|
63
|
+
* Variable w/ date format
|
|
64
|
+
*/
|
|
65
|
+
date = 3,
|
|
66
|
+
/**
|
|
67
|
+
* Variable w/ time format
|
|
68
|
+
*/
|
|
69
|
+
time = 4,
|
|
70
|
+
/**
|
|
71
|
+
* Variable w/ select format
|
|
72
|
+
*/
|
|
73
|
+
select = 5,
|
|
74
|
+
/**
|
|
75
|
+
* Variable w/ plural format
|
|
76
|
+
*/
|
|
77
|
+
plural = 6,
|
|
78
|
+
/**
|
|
79
|
+
* Only possible within plural argument.
|
|
80
|
+
* This is the `#` symbol that will be substituted with the count.
|
|
81
|
+
*/
|
|
82
|
+
pound = 7,
|
|
83
|
+
/**
|
|
84
|
+
* XML-like tag
|
|
85
|
+
*/
|
|
86
|
+
tag = 8
|
|
87
|
+
}
|
|
88
|
+
declare enum SKELETON_TYPE {
|
|
89
|
+
number = 0,
|
|
90
|
+
dateTime = 1
|
|
91
|
+
}
|
|
92
|
+
interface LocationDetails {
|
|
93
|
+
offset: number;
|
|
94
|
+
line: number;
|
|
95
|
+
column: number;
|
|
96
|
+
}
|
|
97
|
+
interface Location {
|
|
98
|
+
start: LocationDetails;
|
|
99
|
+
end: LocationDetails;
|
|
100
|
+
}
|
|
101
|
+
interface BaseElement<T extends TYPE> {
|
|
102
|
+
type: T;
|
|
103
|
+
value: string;
|
|
104
|
+
location?: Location;
|
|
105
|
+
}
|
|
106
|
+
type LiteralElement = BaseElement<TYPE.literal>;
|
|
107
|
+
type ArgumentElement = BaseElement<TYPE.argument>;
|
|
108
|
+
interface TagElement extends BaseElement<TYPE.tag> {
|
|
109
|
+
children: MessageFormatElement[];
|
|
110
|
+
}
|
|
111
|
+
interface SimpleFormatElement<T extends TYPE, S extends Skeleton> extends BaseElement<T> {
|
|
112
|
+
style?: string | S | null;
|
|
113
|
+
}
|
|
114
|
+
type NumberElement = SimpleFormatElement<TYPE.number, NumberSkeleton>;
|
|
115
|
+
type DateElement = SimpleFormatElement<TYPE.date, DateTimeSkeleton>;
|
|
116
|
+
type TimeElement = SimpleFormatElement<TYPE.time, DateTimeSkeleton>;
|
|
117
|
+
type ValidPluralRule = "zero" | "one" | "two" | "few" | "many" | "other" | string;
|
|
118
|
+
interface PluralOrSelectOption {
|
|
119
|
+
value: MessageFormatElement[];
|
|
120
|
+
location?: Location;
|
|
121
|
+
}
|
|
122
|
+
interface SelectElement extends BaseElement<TYPE.select> {
|
|
123
|
+
options: Record<string, PluralOrSelectOption>;
|
|
124
|
+
}
|
|
125
|
+
interface PluralElement extends BaseElement<TYPE.plural> {
|
|
126
|
+
options: Record<ValidPluralRule, PluralOrSelectOption>;
|
|
127
|
+
offset: number;
|
|
128
|
+
pluralType: Intl.PluralRulesOptions["type"];
|
|
129
|
+
}
|
|
130
|
+
interface PoundElement {
|
|
131
|
+
type: TYPE.pound;
|
|
132
|
+
location?: Location;
|
|
133
|
+
}
|
|
134
|
+
type MessageFormatElement = ArgumentElement | DateElement | LiteralElement | NumberElement | PluralElement | PoundElement | SelectElement | TagElement | TimeElement;
|
|
135
|
+
interface NumberSkeleton {
|
|
136
|
+
type: SKELETON_TYPE.number;
|
|
137
|
+
tokens: NumberSkeletonToken[];
|
|
138
|
+
location?: Location;
|
|
139
|
+
parsedOptions: ExtendedNumberFormatOptions;
|
|
140
|
+
}
|
|
141
|
+
interface DateTimeSkeleton {
|
|
142
|
+
type: SKELETON_TYPE.dateTime;
|
|
143
|
+
pattern: string;
|
|
144
|
+
location?: Location;
|
|
145
|
+
parsedOptions: Intl.DateTimeFormatOptions;
|
|
146
|
+
}
|
|
147
|
+
type Skeleton = NumberSkeleton | DateTimeSkeleton;
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region packages/icu-messageformat-parser/printer.d.ts
|
|
150
|
+
export declare function printAST(ast: MessageFormatElement[]): string;
|
|
151
|
+
export declare function doPrintAST(ast: MessageFormatElement[], isInPlural: boolean): string;
|
|
152
|
+
export declare function printDateTimeSkeleton(style: DateTimeSkeleton): string;
|
|
153
|
+
//#endregion
|
|
154
|
+
//# sourceMappingURL=printer.d.ts.map
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
//#region packages/icu-messageformat-parser/types.ts
|
|
2
|
+
let TYPE = /* @__PURE__ */ function(TYPE) {
|
|
3
|
+
/**
|
|
4
|
+
* Raw text
|
|
5
|
+
*/
|
|
6
|
+
TYPE[TYPE["literal"] = 0] = "literal";
|
|
7
|
+
/**
|
|
8
|
+
* Variable w/o any format, e.g `var` in `this is a {var}`
|
|
9
|
+
*/
|
|
10
|
+
TYPE[TYPE["argument"] = 1] = "argument";
|
|
11
|
+
/**
|
|
12
|
+
* Variable w/ number format
|
|
13
|
+
*/
|
|
14
|
+
TYPE[TYPE["number"] = 2] = "number";
|
|
15
|
+
/**
|
|
16
|
+
* Variable w/ date format
|
|
17
|
+
*/
|
|
18
|
+
TYPE[TYPE["date"] = 3] = "date";
|
|
19
|
+
/**
|
|
20
|
+
* Variable w/ time format
|
|
21
|
+
*/
|
|
22
|
+
TYPE[TYPE["time"] = 4] = "time";
|
|
23
|
+
/**
|
|
24
|
+
* Variable w/ select format
|
|
25
|
+
*/
|
|
26
|
+
TYPE[TYPE["select"] = 5] = "select";
|
|
27
|
+
/**
|
|
28
|
+
* Variable w/ plural format
|
|
29
|
+
*/
|
|
30
|
+
TYPE[TYPE["plural"] = 6] = "plural";
|
|
31
|
+
/**
|
|
32
|
+
* Only possible within plural argument.
|
|
33
|
+
* This is the `#` symbol that will be substituted with the count.
|
|
34
|
+
*/
|
|
35
|
+
TYPE[TYPE["pound"] = 7] = "pound";
|
|
36
|
+
/**
|
|
37
|
+
* XML-like tag
|
|
38
|
+
*/
|
|
39
|
+
TYPE[TYPE["tag"] = 8] = "tag";
|
|
40
|
+
return TYPE;
|
|
41
|
+
}({});
|
|
42
|
+
/**
|
|
43
|
+
* Type Guards
|
|
44
|
+
*/
|
|
45
|
+
function isLiteralElement(el) {
|
|
46
|
+
return el.type === 0;
|
|
47
|
+
}
|
|
48
|
+
function isArgumentElement(el) {
|
|
49
|
+
return el.type === 1;
|
|
50
|
+
}
|
|
51
|
+
function isNumberElement(el) {
|
|
52
|
+
return el.type === 2;
|
|
53
|
+
}
|
|
54
|
+
function isDateElement(el) {
|
|
55
|
+
return el.type === 3;
|
|
56
|
+
}
|
|
57
|
+
function isTimeElement(el) {
|
|
58
|
+
return el.type === 4;
|
|
59
|
+
}
|
|
60
|
+
function isSelectElement(el) {
|
|
61
|
+
return el.type === 5;
|
|
62
|
+
}
|
|
63
|
+
function isPluralElement(el) {
|
|
64
|
+
return el.type === 6;
|
|
65
|
+
}
|
|
66
|
+
function isPoundElement(el) {
|
|
67
|
+
return el.type === 7;
|
|
68
|
+
}
|
|
69
|
+
function isTagElement(el) {
|
|
70
|
+
return el.type === 8;
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region packages/icu-messageformat-parser/printer.ts
|
|
74
|
+
function printAST(ast) {
|
|
75
|
+
return doPrintAST(ast, false);
|
|
76
|
+
}
|
|
77
|
+
function doPrintAST(ast, isInPlural) {
|
|
78
|
+
return ast.map((el, i) => {
|
|
79
|
+
if (isLiteralElement(el)) return printLiteralElement(el, isInPlural, i === 0, i === ast.length - 1);
|
|
80
|
+
if (isArgumentElement(el)) return printArgumentElement(el);
|
|
81
|
+
if (isDateElement(el) || isTimeElement(el) || isNumberElement(el)) return printSimpleFormatElement(el);
|
|
82
|
+
if (isPluralElement(el)) return printPluralElement(el);
|
|
83
|
+
if (isSelectElement(el)) return printSelectElement(el);
|
|
84
|
+
if (isPoundElement(el)) return "#";
|
|
85
|
+
if (isTagElement(el)) return printTagElement(el, isInPlural);
|
|
86
|
+
}).join("");
|
|
87
|
+
}
|
|
88
|
+
function printTagElement(el, isInPlural) {
|
|
89
|
+
return `<${el.value}>${doPrintAST(el.children, isInPlural)}</${el.value}>`;
|
|
90
|
+
}
|
|
91
|
+
function quoteSyntaxToken(token) {
|
|
92
|
+
return `'${token.split("'").join("''")}'`;
|
|
93
|
+
}
|
|
94
|
+
function isAlpha(ch) {
|
|
95
|
+
if (!ch) return false;
|
|
96
|
+
const code = ch.charCodeAt(0);
|
|
97
|
+
return code >= 65 && code <= 90 || code >= 97 && code <= 122;
|
|
98
|
+
}
|
|
99
|
+
function isTagSyntaxStart(message, index) {
|
|
100
|
+
if (message[index] !== "<") return false;
|
|
101
|
+
const next = message[index + 1];
|
|
102
|
+
return next === "/" || isAlpha(next);
|
|
103
|
+
}
|
|
104
|
+
function findTagSyntaxEnd(message, index) {
|
|
105
|
+
const closingIndex = message.indexOf(">", index + 1);
|
|
106
|
+
return closingIndex === -1 ? message.length : closingIndex + 1;
|
|
107
|
+
}
|
|
108
|
+
function findBraceSyntaxEnd(message, index) {
|
|
109
|
+
const closingIndex = message.indexOf("}", index + 1);
|
|
110
|
+
return closingIndex === -1 ? index + 1 : closingIndex + 1;
|
|
111
|
+
}
|
|
112
|
+
function printEscapedMessage(message, isInPlural = false) {
|
|
113
|
+
let result = "";
|
|
114
|
+
let literalStart = 0;
|
|
115
|
+
let quotedStart = -1;
|
|
116
|
+
let quotedEnd = -1;
|
|
117
|
+
function flushQuotedToken() {
|
|
118
|
+
if (quotedStart === -1) return;
|
|
119
|
+
const literal = message.slice(literalStart, quotedStart);
|
|
120
|
+
result += literal;
|
|
121
|
+
if (literal.endsWith("'")) result += "'";
|
|
122
|
+
result += quoteSyntaxToken(message.slice(quotedStart, quotedEnd));
|
|
123
|
+
literalStart = quotedEnd;
|
|
124
|
+
quotedStart = -1;
|
|
125
|
+
}
|
|
126
|
+
function quoteToken(start, end) {
|
|
127
|
+
if (quotedStart !== -1 && start === quotedEnd) {
|
|
128
|
+
quotedEnd = end;
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
flushQuotedToken();
|
|
132
|
+
quotedStart = start;
|
|
133
|
+
quotedEnd = end;
|
|
134
|
+
}
|
|
135
|
+
for (let i = 0; i < message.length; i++) {
|
|
136
|
+
const ch = message[i];
|
|
137
|
+
if (ch === "{") {
|
|
138
|
+
const end = findBraceSyntaxEnd(message, i);
|
|
139
|
+
quoteToken(i, end);
|
|
140
|
+
i = end - 1;
|
|
141
|
+
} else if (ch === "}") quoteToken(i, i + 1);
|
|
142
|
+
else if (isTagSyntaxStart(message, i)) {
|
|
143
|
+
const end = findTagSyntaxEnd(message, i);
|
|
144
|
+
quoteToken(i, end);
|
|
145
|
+
i = end - 1;
|
|
146
|
+
} else if (isInPlural && ch === "#") quoteToken(i, i + 1);
|
|
147
|
+
}
|
|
148
|
+
flushQuotedToken();
|
|
149
|
+
return result + message.slice(literalStart);
|
|
150
|
+
}
|
|
151
|
+
function printLiteralElement({ value }, isInPlural, isFirstEl, isLastEl) {
|
|
152
|
+
let escaped = value;
|
|
153
|
+
if (!isFirstEl && escaped[0] === `'`) escaped = `''${escaped.slice(1)}`;
|
|
154
|
+
if (!isLastEl && escaped[escaped.length - 1] === `'`) escaped = `${escaped.slice(0, escaped.length - 1)}''`;
|
|
155
|
+
return printEscapedMessage(escaped, isInPlural);
|
|
156
|
+
}
|
|
157
|
+
function printArgumentElement({ value }) {
|
|
158
|
+
return `{${value}}`;
|
|
159
|
+
}
|
|
160
|
+
function printSimpleFormatElement(el) {
|
|
161
|
+
return `{${el.value}, ${TYPE[el.type]}${el.style ? `, ${printArgumentStyle(el.style)}` : ""}}`;
|
|
162
|
+
}
|
|
163
|
+
function printNumberSkeletonToken(token) {
|
|
164
|
+
const { stem, options } = token;
|
|
165
|
+
return options.length === 0 ? stem : `${stem}${options.map((o) => `/${o}`).join("")}`;
|
|
166
|
+
}
|
|
167
|
+
function printArgumentStyle(style) {
|
|
168
|
+
if (typeof style === "string") return printEscapedMessage(style);
|
|
169
|
+
else if (style.type === 1) return `::${printDateTimeSkeleton(style)}`;
|
|
170
|
+
else return `::${style.tokens.map(printNumberSkeletonToken).join(" ")}`;
|
|
171
|
+
}
|
|
172
|
+
function printDateTimeSkeleton(style) {
|
|
173
|
+
return style.pattern;
|
|
174
|
+
}
|
|
175
|
+
function compareCodePoints(a, b) {
|
|
176
|
+
const aIter = a[Symbol.iterator]();
|
|
177
|
+
const bIter = b[Symbol.iterator]();
|
|
178
|
+
while (true) {
|
|
179
|
+
const aNext = aIter.next();
|
|
180
|
+
const bNext = bIter.next();
|
|
181
|
+
if (aNext.done || bNext.done) return aNext.done === bNext.done ? 0 : aNext.done ? -1 : 1;
|
|
182
|
+
const diff = aNext.value.codePointAt(0) - bNext.value.codePointAt(0);
|
|
183
|
+
if (diff !== 0) return diff;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function printSelectElement(el) {
|
|
187
|
+
const keys = Object.keys(el.options).sort(compareCodePoints);
|
|
188
|
+
return `{${[
|
|
189
|
+
el.value,
|
|
190
|
+
"select",
|
|
191
|
+
keys.map((id) => `${id}{${doPrintAST(el.options[id].value, false)}}`).join(" ")
|
|
192
|
+
].join(",")}}`;
|
|
193
|
+
}
|
|
194
|
+
const PLURAL_RULE_ORDER = {
|
|
195
|
+
zero: 0,
|
|
196
|
+
one: 1,
|
|
197
|
+
two: 2,
|
|
198
|
+
few: 3,
|
|
199
|
+
many: 4,
|
|
200
|
+
other: 5
|
|
201
|
+
};
|
|
202
|
+
function getPluralRuleSortOrder(rule) {
|
|
203
|
+
const categoryOrder = PLURAL_RULE_ORDER[rule];
|
|
204
|
+
if (categoryOrder !== void 0) return [categoryOrder, 0];
|
|
205
|
+
const exactRule = rule.replace(/^=+/, "");
|
|
206
|
+
return [6, /^[+-]?\d+$/.test(exactRule) ? Number(exactRule) : 0];
|
|
207
|
+
}
|
|
208
|
+
function printPluralElement(el) {
|
|
209
|
+
const type = el.pluralType === "cardinal" ? "plural" : "selectordinal";
|
|
210
|
+
const keys = Object.keys(el.options).sort((a, b) => {
|
|
211
|
+
const [pa, sa] = getPluralRuleSortOrder(a);
|
|
212
|
+
const [pb, sb] = getPluralRuleSortOrder(b);
|
|
213
|
+
return pa - pb || sa - sb;
|
|
214
|
+
});
|
|
215
|
+
return `{${[
|
|
216
|
+
el.value,
|
|
217
|
+
type,
|
|
218
|
+
[el.offset ? `offset:${el.offset}` : "", ...keys.map((id) => `${id}{${doPrintAST(el.options[id].value, true)}}`)].filter(Boolean).join(" ")
|
|
219
|
+
].join(",")}}`;
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
222
|
+
export { doPrintAST, printAST, printDateTimeSkeleton };
|
|
223
|
+
|
|
224
|
+
//# sourceMappingURL=printer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"printer.js","names":[],"sources":["../types.ts","../printer.ts"],"sourcesContent":["import type {NumberFormatOptions} from '#packages/ecma402-abstract/types/number.js'\nimport {type NumberSkeletonToken} from '@formatjs/icu-skeleton-parser'\n\nexport interface ExtendedNumberFormatOptions extends NumberFormatOptions {\n scale?: number\n}\n\nexport enum TYPE {\n /**\n * Raw text\n */\n literal,\n /**\n * Variable w/o any format, e.g `var` in `this is a {var}`\n */\n argument,\n /**\n * Variable w/ number format\n */\n number,\n /**\n * Variable w/ date format\n */\n date,\n /**\n * Variable w/ time format\n */\n time,\n /**\n * Variable w/ select format\n */\n select,\n /**\n * Variable w/ plural format\n */\n plural,\n /**\n * Only possible within plural argument.\n * This is the `#` symbol that will be substituted with the count.\n */\n pound,\n /**\n * XML-like tag\n */\n tag,\n}\n\nexport enum SKELETON_TYPE {\n number,\n dateTime,\n}\n\nexport interface LocationDetails {\n offset: number\n line: number\n column: number\n}\nexport interface Location {\n start: LocationDetails\n end: LocationDetails\n}\n\nexport interface BaseElement<T extends TYPE> {\n type: T\n value: string\n location?: Location\n}\n\nexport type LiteralElement = BaseElement<TYPE.literal>\nexport type ArgumentElement = BaseElement<TYPE.argument>\nexport interface TagElement extends BaseElement<TYPE.tag> {\n children: MessageFormatElement[]\n}\n\nexport interface SimpleFormatElement<\n T extends TYPE,\n S extends Skeleton,\n> extends BaseElement<T> {\n style?: string | S | null\n}\n\nexport type NumberElement = SimpleFormatElement<TYPE.number, NumberSkeleton>\nexport type DateElement = SimpleFormatElement<TYPE.date, DateTimeSkeleton>\nexport type TimeElement = SimpleFormatElement<TYPE.time, DateTimeSkeleton>\n\nexport type ValidPluralRule =\n | 'zero'\n | 'one'\n | 'two'\n | 'few'\n | 'many'\n | 'other'\n | string\n\nexport interface PluralOrSelectOption {\n value: MessageFormatElement[]\n location?: Location\n}\n\nexport interface SelectElement extends BaseElement<TYPE.select> {\n options: Record<string, PluralOrSelectOption>\n}\n\nexport interface PluralElement extends BaseElement<TYPE.plural> {\n options: Record<ValidPluralRule, PluralOrSelectOption>\n offset: number\n pluralType: Intl.PluralRulesOptions['type']\n}\n\nexport interface PoundElement {\n type: TYPE.pound\n location?: Location\n}\n\nexport type MessageFormatElement =\n | ArgumentElement\n | DateElement\n | LiteralElement\n | NumberElement\n | PluralElement\n | PoundElement\n | SelectElement\n | TagElement\n | TimeElement\n\nexport interface NumberSkeleton {\n type: SKELETON_TYPE.number\n tokens: NumberSkeletonToken[]\n location?: Location\n parsedOptions: ExtendedNumberFormatOptions\n}\n\nexport interface DateTimeSkeleton {\n type: SKELETON_TYPE.dateTime\n pattern: string\n location?: Location\n parsedOptions: Intl.DateTimeFormatOptions\n}\n\nexport type Skeleton = NumberSkeleton | DateTimeSkeleton\n\n/**\n * Type Guards\n */\nexport function isLiteralElement(\n el: MessageFormatElement\n): el is LiteralElement {\n return el.type === TYPE.literal\n}\nexport function isArgumentElement(\n el: MessageFormatElement\n): el is ArgumentElement {\n return el.type === TYPE.argument\n}\nexport function isNumberElement(el: MessageFormatElement): el is NumberElement {\n return el.type === TYPE.number\n}\nexport function isDateElement(el: MessageFormatElement): el is DateElement {\n return el.type === TYPE.date\n}\nexport function isTimeElement(el: MessageFormatElement): el is TimeElement {\n return el.type === TYPE.time\n}\nexport function isSelectElement(el: MessageFormatElement): el is SelectElement {\n return el.type === TYPE.select\n}\nexport function isPluralElement(el: MessageFormatElement): el is PluralElement {\n return el.type === TYPE.plural\n}\nexport function isPoundElement(el: MessageFormatElement): el is PoundElement {\n return el.type === TYPE.pound\n}\nexport function isTagElement(el: MessageFormatElement): el is TagElement {\n return el.type === TYPE.tag\n}\nexport function isNumberSkeleton(\n el: NumberElement['style'] | Skeleton\n): el is NumberSkeleton {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.number)\n}\nexport function isDateTimeSkeleton(\n el?: DateElement['style'] | TimeElement['style'] | Skeleton\n): el is DateTimeSkeleton {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.dateTime)\n}\n\nexport function createLiteralElement(value: string): LiteralElement {\n return {\n type: TYPE.literal,\n value,\n }\n}\n\nexport function createNumberElement(\n value: string,\n style?: string | null\n): NumberElement {\n return {\n type: TYPE.number,\n value,\n style,\n }\n}\n","import {type NumberSkeletonToken} from '@formatjs/icu-skeleton-parser'\nimport {\n type ArgumentElement,\n type DateElement,\n type DateTimeSkeleton,\n isArgumentElement,\n isDateElement,\n isLiteralElement,\n isNumberElement,\n isPluralElement,\n isPoundElement,\n isSelectElement,\n isTagElement,\n isTimeElement,\n type LiteralElement,\n type MessageFormatElement,\n type NumberElement,\n type PluralElement,\n type SelectElement,\n type Skeleton,\n SKELETON_TYPE,\n type TagElement,\n type TimeElement,\n TYPE,\n} from '#packages/icu-messageformat-parser/types.js'\n\nexport function printAST(ast: MessageFormatElement[]): string {\n return doPrintAST(ast, false)\n}\n\nexport function doPrintAST(\n ast: MessageFormatElement[],\n isInPlural: boolean\n): string {\n const printedNodes = ast.map((el, i) => {\n if (isLiteralElement(el)) {\n return printLiteralElement(el, isInPlural, i === 0, i === ast.length - 1)\n }\n\n if (isArgumentElement(el)) {\n return printArgumentElement(el)\n }\n if (isDateElement(el) || isTimeElement(el) || isNumberElement(el)) {\n return printSimpleFormatElement(el)\n }\n\n if (isPluralElement(el)) {\n return printPluralElement(el)\n }\n\n if (isSelectElement(el)) {\n return printSelectElement(el)\n }\n\n if (isPoundElement(el)) {\n return '#'\n }\n if (isTagElement(el)) {\n return printTagElement(el, isInPlural)\n }\n })\n\n return printedNodes.join('')\n}\n\nfunction printTagElement(el: TagElement, isInPlural: boolean): string {\n return `<${el.value}>${doPrintAST(el.children, isInPlural)}</${el.value}>`\n}\n\nfunction quoteSyntaxToken(token: string): string {\n return `'${token.split(\"'\").join(\"''\")}'`\n}\n\nfunction isAlpha(ch: string | undefined): boolean {\n if (!ch) {\n return false\n }\n const code = ch.charCodeAt(0)\n return (code >= 65 && code <= 90) || (code >= 97 && code <= 122)\n}\n\nfunction isTagSyntaxStart(message: string, index: number): boolean {\n if (message[index] !== '<') {\n return false\n }\n const next = message[index + 1]\n return next === '/' || isAlpha(next)\n}\n\nfunction findTagSyntaxEnd(message: string, index: number): number {\n const closingIndex = message.indexOf('>', index + 1)\n return closingIndex === -1 ? message.length : closingIndex + 1\n}\n\nfunction findBraceSyntaxEnd(message: string, index: number): number {\n const closingIndex = message.indexOf('}', index + 1)\n return closingIndex === -1 ? index + 1 : closingIndex + 1\n}\n\nfunction printEscapedMessage(message: string, isInPlural = false): string {\n let result = ''\n let literalStart = 0\n let quotedStart = -1\n let quotedEnd = -1\n\n function flushQuotedToken() {\n if (quotedStart === -1) {\n return\n }\n\n const literal = message.slice(literalStart, quotedStart)\n result += literal\n if (literal.endsWith(\"'\")) {\n result += \"'\"\n }\n result += quoteSyntaxToken(message.slice(quotedStart, quotedEnd))\n literalStart = quotedEnd\n quotedStart = -1\n }\n\n function quoteToken(start: number, end: number) {\n if (quotedStart !== -1 && start === quotedEnd) {\n quotedEnd = end\n return\n }\n\n flushQuotedToken()\n quotedStart = start\n quotedEnd = end\n }\n\n for (let i = 0; i < message.length; i++) {\n const ch = message[i]\n if (ch === '{') {\n const end = findBraceSyntaxEnd(message, i)\n quoteToken(i, end)\n i = end - 1\n } else if (ch === '}') {\n quoteToken(i, i + 1)\n } else if (isTagSyntaxStart(message, i)) {\n const end = findTagSyntaxEnd(message, i)\n quoteToken(i, end)\n i = end - 1\n } else if (isInPlural && ch === '#') {\n quoteToken(i, i + 1)\n }\n }\n\n flushQuotedToken()\n return result + message.slice(literalStart)\n}\n\nfunction printLiteralElement(\n {value}: LiteralElement,\n isInPlural: boolean,\n isFirstEl: boolean,\n isLastEl: boolean\n) {\n let escaped = value\n // If this literal starts with a ' and its not the 1st node, this means the node before it is non-literal\n // and the `'` needs to be unescaped\n if (!isFirstEl && escaped[0] === `'`) {\n escaped = `''${escaped.slice(1)}`\n }\n // Same logic but for last el\n if (!isLastEl && escaped[escaped.length - 1] === `'`) {\n escaped = `${escaped.slice(0, escaped.length - 1)}''`\n }\n return printEscapedMessage(escaped, isInPlural)\n}\n\nfunction printArgumentElement({value}: ArgumentElement) {\n return `{${value}}`\n}\n\nfunction printSimpleFormatElement(\n el: DateElement | TimeElement | NumberElement\n) {\n return `{${el.value}, ${TYPE[el.type]}${\n el.style ? `, ${printArgumentStyle(el.style)}` : ''\n }}`\n}\n\nfunction printNumberSkeletonToken(token: NumberSkeletonToken): string {\n const {stem, options} = token\n return options.length === 0\n ? stem\n : `${stem}${options.map(o => `/${o}`).join('')}`\n}\n\nfunction printArgumentStyle(style: string | Skeleton) {\n if (typeof style === 'string') {\n return printEscapedMessage(style)\n } else if (style.type === SKELETON_TYPE.dateTime) {\n return `::${printDateTimeSkeleton(style)}`\n } else {\n return `::${style.tokens.map(printNumberSkeletonToken).join(' ')}`\n }\n}\n\nexport function printDateTimeSkeleton(style: DateTimeSkeleton): string {\n return style.pattern\n}\n\n// Rust string ordering is UTF-8 lexicographic, which matches code point order.\nfunction compareCodePoints(a: string, b: string): number {\n const aIter = a[Symbol.iterator]()\n const bIter = b[Symbol.iterator]()\n\n while (true) {\n const aNext = aIter.next()\n const bNext = bIter.next()\n if (aNext.done || bNext.done) {\n return aNext.done === bNext.done ? 0 : aNext.done ? -1 : 1\n }\n\n const diff = aNext.value.codePointAt(0)! - bNext.value.codePointAt(0)!\n if (diff !== 0) {\n return diff\n }\n }\n}\n\nfunction printSelectElement(el: SelectElement) {\n const keys = Object.keys(el.options).sort(compareCodePoints)\n const msg = [\n el.value,\n 'select',\n keys\n .map(id => `${id}{${doPrintAST(el.options[id].value, false)}}`)\n .join(' '),\n ].join(',')\n return `{${msg}}`\n}\n\nconst PLURAL_RULE_ORDER: Record<string, number> = {\n zero: 0,\n one: 1,\n two: 2,\n few: 3,\n many: 4,\n other: 5,\n}\n\nfunction getPluralRuleSortOrder(rule: string): [number, number] {\n const categoryOrder = PLURAL_RULE_ORDER[rule]\n if (categoryOrder !== undefined) {\n return [categoryOrder, 0]\n }\n\n const exactRule = rule.replace(/^=+/, '')\n const exactValue = /^[+-]?\\d+$/.test(exactRule) ? Number(exactRule) : 0\n return [6, exactValue]\n}\n\nfunction printPluralElement(el: PluralElement) {\n const type = el.pluralType === 'cardinal' ? 'plural' : 'selectordinal'\n const keys = Object.keys(el.options).sort((a, b) => {\n const [pa, sa] = getPluralRuleSortOrder(a)\n const [pb, sb] = getPluralRuleSortOrder(b)\n return pa - pb || sa - sb\n })\n const msg = [\n el.value,\n type,\n [\n el.offset ? `offset:${el.offset}` : '',\n ...keys.map(id => `${id}{${doPrintAST(el.options[id].value, true)}}`),\n ]\n .filter(Boolean)\n .join(' '),\n ].join(',')\n return `{${msg}}`\n}\n"],"mappings":";AAOA,IAAY,OAAL,yBAAA,MAAA;;;;CAIL,KAAA,KAAA,aAAA,KAAA;;;;CAIA,KAAA,KAAA,cAAA,KAAA;;;;CAIA,KAAA,KAAA,YAAA,KAAA;;;;CAIA,KAAA,KAAA,UAAA,KAAA;;;;CAIA,KAAA,KAAA,UAAA,KAAA;;;;CAIA,KAAA,KAAA,YAAA,KAAA;;;;CAIA,KAAA,KAAA,YAAA,KAAA;;;;;CAKA,KAAA,KAAA,WAAA,KAAA;;;;CAIA,KAAA,KAAA,SAAA,KAAA;;AACF,EAAA,CAAA,CAAA;;;;AAmGA,SAAgB,iBACd,IACsB;CACtB,OAAO,GAAG,SAAA;AACZ;AACA,SAAgB,kBACd,IACuB;CACvB,OAAO,GAAG,SAAA;AACZ;AACA,SAAgB,gBAAgB,IAA+C;CAC7E,OAAO,GAAG,SAAA;AACZ;AACA,SAAgB,cAAc,IAA6C;CACzE,OAAO,GAAG,SAAA;AACZ;AACA,SAAgB,cAAc,I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GAAG,SAAS,UAAU,GAAG,WAAW,IACpC,GAAG,KAAK,KAAI,OAAM,GAAG,GAAG,GAAG,WAAW,GAAG,QAAQ,GAAG,CAAC,OAAO,IAAI,EAAE,EAAE,CACtE,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;CACb,CAAC,CAAC,KAAK,GACM,EAAE;AACjB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 FormatJS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# icu-skeleton-parser
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//#region packages/icu-skeleton-parser/date-time.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Parse Date time skeleton into Intl.DateTimeFormatOptions
|
|
4
|
+
* Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
5
|
+
* @public
|
|
6
|
+
* @param skeleton skeleton string
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseDateTimeSkeleton(skeleton: string): Intl.DateTimeFormatOptions;
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region packages/ecma402-abstract/types/number.d.ts
|
|
11
|
+
type NumberFormatNotation = "standard" | "scientific" | "engineering" | "compact";
|
|
12
|
+
type RoundingPriorityType = "auto" | "morePrecision" | "lessPrecision";
|
|
13
|
+
type RoundingModeType = "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven";
|
|
14
|
+
type UseGroupingType = "min2" | "auto" | "always" | boolean;
|
|
15
|
+
interface NumberFormatDigitOptions {
|
|
16
|
+
minimumIntegerDigits?: number;
|
|
17
|
+
minimumSignificantDigits?: number;
|
|
18
|
+
maximumSignificantDigits?: number;
|
|
19
|
+
minimumFractionDigits?: number;
|
|
20
|
+
maximumFractionDigits?: number;
|
|
21
|
+
roundingPriority?: RoundingPriorityType;
|
|
22
|
+
roundingIncrement?: number;
|
|
23
|
+
roundingMode?: RoundingModeType;
|
|
24
|
+
trailingZeroDisplay?: TrailingZeroDisplay;
|
|
25
|
+
}
|
|
26
|
+
type NumberFormatOptionsLocaleMatcher = "lookup" | "best fit";
|
|
27
|
+
type NumberFormatOptionsStyle = "decimal" | "percent" | "currency" | "unit";
|
|
28
|
+
type NumberFormatOptionsCompactDisplay = "short" | "long";
|
|
29
|
+
type NumberFormatOptionsCurrencyDisplay = "symbol" | "code" | "name" | "narrowSymbol";
|
|
30
|
+
type NumberFormatOptionsCurrencySign = "standard" | "accounting";
|
|
31
|
+
type NumberFormatOptionsNotation = NumberFormatNotation;
|
|
32
|
+
type NumberFormatOptionsSignDisplay = "auto" | "always" | "never" | "exceptZero" | "negative";
|
|
33
|
+
type NumberFormatOptionsUnitDisplay = "long" | "short" | "narrow";
|
|
34
|
+
type TrailingZeroDisplay = "auto" | "stripIfInteger";
|
|
35
|
+
type NumberFormatOptions = Omit<Intl.NumberFormatOptions, "signDisplay" | "useGrouping"> & NumberFormatDigitOptions & {
|
|
36
|
+
localeMatcher?: NumberFormatOptionsLocaleMatcher;
|
|
37
|
+
style?: NumberFormatOptionsStyle;
|
|
38
|
+
compactDisplay?: NumberFormatOptionsCompactDisplay;
|
|
39
|
+
currencyDisplay?: NumberFormatOptionsCurrencyDisplay;
|
|
40
|
+
currencySign?: NumberFormatOptionsCurrencySign;
|
|
41
|
+
notation?: NumberFormatOptionsNotation;
|
|
42
|
+
signDisplay?: NumberFormatOptionsSignDisplay;
|
|
43
|
+
unit?: string;
|
|
44
|
+
unitDisplay?: NumberFormatOptionsUnitDisplay;
|
|
45
|
+
numberingSystem?: string;
|
|
46
|
+
trailingZeroDisplay?: TrailingZeroDisplay;
|
|
47
|
+
roundingPriority?: RoundingPriorityType;
|
|
48
|
+
roundingIncrement?: number;
|
|
49
|
+
roundingMode?: RoundingModeType;
|
|
50
|
+
useGrouping?: UseGroupingType;
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region packages/icu-skeleton-parser/number.d.ts
|
|
54
|
+
export interface ExtendedNumberFormatOptions extends NumberFormatOptions {
|
|
55
|
+
scale?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface NumberSkeletonToken {
|
|
58
|
+
stem: string;
|
|
59
|
+
options: string[];
|
|
60
|
+
}
|
|
61
|
+
export declare function parseNumberSkeletonFromString(skeleton: string): NumberSkeletonToken[];
|
|
62
|
+
/**
|
|
63
|
+
* https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#skeleton-stems-and-options
|
|
64
|
+
*/
|
|
65
|
+
export declare function parseNumberSkeleton(tokens: NumberSkeletonToken[]): ExtendedNumberFormatOptions;
|
|
66
|
+
//#endregion
|
|
67
|
+
//# sourceMappingURL=index.d.ts.map
|