@atlaskit/tokens 13.0.3 → 13.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/codemods/css-to-design-tokens/lib/meta.tsx +1 -1
- package/codemods/css-to-design-tokens/lib/tokens.tsx +1 -1
- package/codemods/theme-to-design-tokens/transform.tsx +16 -14
- package/codemods/theme-to-design-tokens/utils/ast-meta.tsx +2 -151
- package/codemods/theme-to-design-tokens/utils/ast.tsx +3 -35
- package/codemods/theme-to-design-tokens/utils/clean-meta.tsx +63 -0
- package/codemods/theme-to-design-tokens/utils/color.tsx +3 -11
- package/codemods/theme-to-design-tokens/utils/contains-replaceable-css-declarations.tsx +13 -0
- package/codemods/theme-to-design-tokens/utils/css-utils.tsx +2 -35
- package/codemods/theme-to-design-tokens/utils/find-end-index-of-css-expression.tsx +21 -0
- package/codemods/theme-to-design-tokens/utils/find-first-nonspace-index-after.tsx +9 -0
- package/codemods/theme-to-design-tokens/utils/get-closest-decendant-of-type.tsx +10 -0
- package/codemods/theme-to-design-tokens/utils/get-meta-from-ancestors.tsx +87 -0
- package/codemods/theme-to-design-tokens/utils/is-bold-color.tsx +4 -0
- package/codemods/theme-to-design-tokens/utils/is-decendant-of-token.tsx +14 -0
- package/codemods/theme-to-design-tokens/utils/is-legacy-color.tsx +4 -0
- package/codemods/theme-to-design-tokens/utils/is-legacy-named-color.tsx +4 -0
- package/codemods/theme-to-design-tokens/utils/is-parent-of-token.tsx +13 -0
- package/codemods/theme-to-design-tokens/utils/kebabize.tsx +2 -0
- package/codemods/theme-to-design-tokens/utils/legacy-color-meta-map.tsx +88 -0
- package/codemods/theme-to-design-tokens/utils/legacy-color-mixins.tsx +26 -0
- package/codemods/theme-to-design-tokens/utils/legacy-colors.tsx +2 -115
- package/codemods/theme-to-design-tokens/utils/split-at-index.tsx +3 -0
- package/codemods/theme-to-design-tokens/utils/string-utils.tsx +3 -16
- package/codemods/utils/active-tokens.tsx +284 -0
- package/codemods/utils/tokens.tsx +2 -376
- package/codemods/utils/unique-words-from-tokens.tsx +91 -0
- package/dist/cjs/artifacts/replacement-mapping.js +5 -2
- package/dist/cjs/artifacts/themes/atlassian-dark-increased-contrast.js +2 -2
- package/dist/cjs/artifacts/themes/atlassian-dark.js +2 -2
- package/dist/cjs/artifacts/themes/atlassian-light-increased-contrast.js +2 -2
- package/dist/cjs/artifacts/themes/atlassian-light.js +2 -2
- package/dist/cjs/artifacts/token-default-values.js +2 -2
- package/dist/cjs/artifacts/tokens-raw/atlassian-dark-increased-contrast.js +3 -3
- package/dist/cjs/artifacts/tokens-raw/atlassian-dark.js +3 -3
- package/dist/cjs/artifacts/tokens-raw/atlassian-light-increased-contrast.js +3 -3
- package/dist/cjs/artifacts/tokens-raw/atlassian-light.js +3 -3
- package/dist/cjs/artifacts/tokens-raw/atlassian-motion.js +3 -3
- package/dist/cjs/constants.js +1 -0
- package/dist/cjs/custom-theme.js +10 -60
- package/dist/cjs/entry-points/token-metadata.codegen.js +2 -11
- package/dist/cjs/get-custom-theme-styles.js +57 -0
- package/dist/cjs/get-global-theme.js +2 -2
- package/dist/cjs/get-theme-html-attrs.js +2 -2
- package/dist/cjs/get-theme-styles.js +33 -32
- package/dist/cjs/load-custom-theme-styles.js +2 -2
- package/dist/cjs/set-global-theme.js +36 -34
- package/dist/cjs/theme-color-modes.js +13 -0
- package/dist/cjs/theme-config.js +21 -16
- package/dist/cjs/theme-ids.js +13 -0
- package/dist/cjs/theme-state-transformer.js +3 -2
- package/dist/cjs/utils/color-detection.js +9 -12
- package/dist/cjs/utils/color-utils.js +45 -46
- package/dist/cjs/utils/custom-theme-loading-utils.js +9 -11
- package/dist/cjs/utils/custom-theme-token-contrast-check.js +2 -0
- package/dist/cjs/utils/generate-custom-color-ramp.js +20 -19
- package/dist/cjs/utils/get-alpha.js +13 -0
- package/dist/cjs/utils/get-closest-color-index.js +20 -0
- package/dist/cjs/utils/get-css-custom-property.js +32 -0
- package/dist/cjs/utils/get-fully-qualified-token-id.js +19 -0
- package/dist/cjs/utils/get-theme-override-preferences.js +12 -0
- package/dist/cjs/utils/get-theme-preferences.js +8 -5
- package/dist/cjs/utils/get-token-id.js +26 -0
- package/dist/cjs/utils/hct-color-utils/argb-from-rgb.js +12 -0
- package/dist/cjs/utils/hct-color-utils/clamp-double.js +20 -0
- package/dist/cjs/utils/hct-color-utils/clamp-int.js +20 -0
- package/dist/cjs/utils/hct-color-utils/color-utils.js +42 -59
- package/dist/cjs/utils/hct-color-utils/delinearized.js +27 -0
- package/dist/cjs/utils/hct-color-utils/hct.js +19 -95
- package/dist/cjs/utils/hct-color-utils/lerp.js +14 -0
- package/dist/cjs/utils/hct-color-utils/linearized.js +22 -0
- package/dist/cjs/utils/hct-color-utils/math-utils.js +38 -107
- package/dist/cjs/utils/hct-color-utils/matrix-multiply.js +15 -0
- package/dist/cjs/utils/hct-color-utils/sanitize-degrees-double.js +19 -0
- package/dist/cjs/utils/hct-color-utils/signum.js +20 -0
- package/dist/cjs/utils/hct-color-utils/viewing-conditions.js +98 -0
- package/dist/cjs/utils/hex-to-rgba-values.js +15 -0
- package/dist/cjs/utils/hsl-to-rgb.js +18 -0
- package/dist/cjs/utils/is-valid-brand-hex.js +9 -0
- package/dist/cjs/utils/limit-size-of-custom-style-elements.js +16 -0
- package/dist/cjs/utils/load-theme-css.js +32 -0
- package/dist/cjs/utils/relative-luminance-w3-c.js +18 -0
- package/dist/cjs/utils/rgb-to-hex.js +9 -0
- package/dist/cjs/utils/theme-loading.js +18 -33
- package/dist/cjs/utils/token-ids.js +21 -62
- package/dist/es2019/artifacts/replacement-mapping.js +5 -2
- package/dist/es2019/artifacts/themes/atlassian-dark-increased-contrast.js +2 -2
- package/dist/es2019/artifacts/themes/atlassian-dark.js +2 -2
- package/dist/es2019/artifacts/themes/atlassian-light-increased-contrast.js +2 -2
- package/dist/es2019/artifacts/themes/atlassian-light.js +2 -2
- package/dist/es2019/artifacts/token-default-values.js +2 -2
- package/dist/es2019/artifacts/tokens-raw/atlassian-dark-increased-contrast.js +3 -3
- package/dist/es2019/artifacts/tokens-raw/atlassian-dark.js +3 -3
- package/dist/es2019/artifacts/tokens-raw/atlassian-light-increased-contrast.js +3 -3
- package/dist/es2019/artifacts/tokens-raw/atlassian-light.js +3 -3
- package/dist/es2019/artifacts/tokens-raw/atlassian-motion.js +3 -3
- package/dist/es2019/constants.js +1 -0
- package/dist/es2019/custom-theme.js +4 -66
- package/dist/es2019/entry-points/token-metadata.codegen.js +2 -11
- package/dist/es2019/get-custom-theme-styles.js +60 -0
- package/dist/es2019/get-global-theme.js +1 -1
- package/dist/es2019/get-theme-html-attrs.js +1 -1
- package/dist/es2019/get-theme-styles.js +4 -3
- package/dist/es2019/load-custom-theme-styles.js +1 -1
- package/dist/es2019/set-global-theme.js +3 -2
- package/dist/es2019/theme-color-modes.js +7 -0
- package/dist/es2019/theme-config.js +6 -16
- package/dist/es2019/theme-ids.js +7 -0
- package/dist/es2019/theme-state-transformer.js +2 -1
- package/dist/es2019/utils/color-detection.js +3 -11
- package/dist/es2019/utils/color-utils.js +15 -33
- package/dist/es2019/utils/custom-theme-loading-utils.js +4 -8
- package/dist/es2019/utils/custom-theme-token-contrast-check.js +2 -0
- package/dist/es2019/utils/generate-custom-color-ramp.js +11 -15
- package/dist/es2019/utils/get-alpha.js +7 -0
- package/dist/es2019/utils/get-closest-color-index.js +14 -0
- package/dist/es2019/utils/get-css-custom-property.js +23 -0
- package/dist/es2019/utils/get-fully-qualified-token-id.js +11 -0
- package/dist/es2019/utils/get-theme-override-preferences.js +4 -0
- package/dist/es2019/utils/get-theme-preferences.js +1 -4
- package/dist/es2019/utils/get-token-id.js +18 -0
- package/dist/es2019/utils/hct-color-utils/argb-from-rgb.js +6 -0
- package/dist/es2019/utils/hct-color-utils/clamp-double.js +14 -0
- package/dist/es2019/utils/hct-color-utils/clamp-int.js +14 -0
- package/dist/es2019/utils/hct-color-utils/color-utils.js +15 -45
- package/dist/es2019/utils/hct-color-utils/delinearized.js +20 -0
- package/dist/es2019/utils/hct-color-utils/hct.js +3 -76
- package/dist/es2019/utils/hct-color-utils/lerp.js +8 -0
- package/dist/es2019/utils/hct-color-utils/linearized.js +16 -0
- package/dist/es2019/utils/hct-color-utils/math-utils.js +6 -105
- package/dist/es2019/utils/hct-color-utils/matrix-multiply.js +9 -0
- package/dist/es2019/utils/hct-color-utils/sanitize-degrees-double.js +13 -0
- package/dist/es2019/utils/hct-color-utils/signum.js +14 -0
- package/dist/es2019/utils/hct-color-utils/viewing-conditions.js +78 -0
- package/dist/es2019/utils/hex-to-rgba-values.js +9 -0
- package/dist/es2019/utils/hsl-to-rgb.js +8 -0
- package/dist/es2019/utils/is-valid-brand-hex.js +1 -0
- package/dist/es2019/utils/limit-size-of-custom-style-elements.js +8 -0
- package/dist/es2019/utils/load-theme-css.js +7 -0
- package/dist/es2019/utils/relative-luminance-w3-c.js +12 -0
- package/dist/es2019/utils/rgb-to-hex.js +3 -0
- package/dist/es2019/utils/theme-loading.js +3 -8
- package/dist/es2019/utils/token-ids.js +3 -54
- package/dist/esm/artifacts/replacement-mapping.js +5 -2
- package/dist/esm/artifacts/themes/atlassian-dark-increased-contrast.js +2 -2
- package/dist/esm/artifacts/themes/atlassian-dark.js +2 -2
- package/dist/esm/artifacts/themes/atlassian-light-increased-contrast.js +2 -2
- package/dist/esm/artifacts/themes/atlassian-light.js +2 -2
- package/dist/esm/artifacts/token-default-values.js +2 -2
- package/dist/esm/artifacts/tokens-raw/atlassian-dark-increased-contrast.js +3 -3
- package/dist/esm/artifacts/tokens-raw/atlassian-dark.js +3 -3
- package/dist/esm/artifacts/tokens-raw/atlassian-light-increased-contrast.js +3 -3
- package/dist/esm/artifacts/tokens-raw/atlassian-light.js +3 -3
- package/dist/esm/artifacts/tokens-raw/atlassian-motion.js +3 -3
- package/dist/esm/constants.js +1 -0
- package/dist/esm/custom-theme.js +4 -58
- package/dist/esm/entry-points/token-metadata.codegen.js +2 -11
- package/dist/esm/get-custom-theme-styles.js +52 -0
- package/dist/esm/get-global-theme.js +1 -1
- package/dist/esm/get-theme-html-attrs.js +1 -1
- package/dist/esm/get-theme-styles.js +30 -29
- package/dist/esm/load-custom-theme-styles.js +1 -1
- package/dist/esm/set-global-theme.js +34 -32
- package/dist/esm/theme-color-modes.js +7 -0
- package/dist/esm/theme-config.js +8 -17
- package/dist/esm/theme-ids.js +7 -0
- package/dist/esm/theme-state-transformer.js +2 -1
- package/dist/esm/utils/color-detection.js +3 -11
- package/dist/esm/utils/color-utils.js +15 -39
- package/dist/esm/utils/custom-theme-loading-utils.js +4 -11
- package/dist/esm/utils/custom-theme-token-contrast-check.js +2 -0
- package/dist/esm/utils/generate-custom-color-ramp.js +11 -15
- package/dist/esm/utils/get-alpha.js +7 -0
- package/dist/esm/utils/get-closest-color-index.js +14 -0
- package/dist/esm/utils/get-css-custom-property.js +26 -0
- package/dist/esm/utils/get-fully-qualified-token-id.js +13 -0
- package/dist/esm/utils/get-theme-override-preferences.js +5 -0
- package/dist/esm/utils/get-theme-preferences.js +1 -4
- package/dist/esm/utils/get-token-id.js +20 -0
- package/dist/esm/utils/hct-color-utils/argb-from-rgb.js +6 -0
- package/dist/esm/utils/hct-color-utils/clamp-double.js +14 -0
- package/dist/esm/utils/hct-color-utils/clamp-int.js +14 -0
- package/dist/esm/utils/hct-color-utils/color-utils.js +15 -45
- package/dist/esm/utils/hct-color-utils/delinearized.js +20 -0
- package/dist/esm/utils/hct-color-utils/hct.js +5 -87
- package/dist/esm/utils/hct-color-utils/lerp.js +8 -0
- package/dist/esm/utils/hct-color-utils/linearized.js +16 -0
- package/dist/esm/utils/hct-color-utils/math-utils.js +6 -105
- package/dist/esm/utils/hct-color-utils/matrix-multiply.js +9 -0
- package/dist/esm/utils/hct-color-utils/sanitize-degrees-double.js +13 -0
- package/dist/esm/utils/hct-color-utils/signum.js +14 -0
- package/dist/esm/utils/hct-color-utils/viewing-conditions.js +89 -0
- package/dist/esm/utils/hex-to-rgba-values.js +9 -0
- package/dist/esm/utils/hsl-to-rgb.js +12 -0
- package/dist/esm/utils/is-valid-brand-hex.js +3 -0
- package/dist/esm/utils/limit-size-of-custom-style-elements.js +10 -0
- package/dist/esm/utils/load-theme-css.js +25 -0
- package/dist/esm/utils/relative-luminance-w3-c.js +12 -0
- package/dist/esm/utils/rgb-to-hex.js +3 -0
- package/dist/esm/utils/theme-loading.js +11 -32
- package/dist/esm/utils/token-ids.js +3 -61
- package/dist/types/artifacts/replacement-mapping.d.ts +1 -1
- package/dist/types/artifacts/themes/atlassian-dark-increased-contrast.d.ts +2 -2
- package/dist/types/artifacts/themes/atlassian-dark.d.ts +2 -2
- package/dist/types/artifacts/themes/atlassian-light-increased-contrast.d.ts +2 -2
- package/dist/types/artifacts/themes/atlassian-light.d.ts +2 -2
- package/dist/types/artifacts/token-default-values.d.ts +2 -2
- package/dist/types/artifacts/tokens-raw/atlassian-dark-increased-contrast.d.ts +1 -1
- package/dist/types/artifacts/tokens-raw/atlassian-dark.d.ts +1 -1
- package/dist/types/artifacts/tokens-raw/atlassian-light-increased-contrast.d.ts +1 -1
- package/dist/types/artifacts/tokens-raw/atlassian-light.d.ts +1 -1
- package/dist/types/artifacts/tokens-raw/atlassian-motion.d.ts +1 -1
- package/dist/types/artifacts/types-internal.d.ts +2 -2
- package/dist/types/artifacts/types.d.ts +2 -2
- package/dist/types/custom-theme.d.ts +1 -20
- package/dist/types/entry-points/token-metadata.codegen.d.ts +1 -1
- package/dist/types/get-custom-theme-styles.d.ts +16 -0
- package/dist/types/get-global-theme.d.ts +1 -1
- package/dist/types/theme-color-modes.d.ts +7 -0
- package/dist/types/theme-config.d.ts +4 -14
- package/dist/types/theme-ids.d.ts +7 -0
- package/dist/types/theme-state-transformer.d.ts +1 -1
- package/dist/types/utils/color-detection.d.ts +1 -6
- package/dist/types/utils/color-utils.d.ts +5 -5
- package/dist/types/utils/custom-theme-loading-utils.d.ts +1 -2
- package/dist/types/utils/generate-custom-color-ramp.d.ts +1 -2
- package/dist/types/utils/get-alpha.d.ts +1 -0
- package/dist/types/utils/get-closest-color-index.d.ts +2 -0
- package/dist/types/utils/get-css-custom-property.d.ts +15 -0
- package/dist/types/utils/get-fully-qualified-token-id.d.ts +11 -0
- package/dist/types/utils/get-theme-override-preferences.d.ts +2 -0
- package/dist/types/utils/get-theme-preferences.d.ts +1 -1
- package/dist/types/utils/get-token-id.d.ts +15 -0
- package/dist/types/utils/hct-color-utils/argb-from-rgb.d.ts +4 -0
- package/dist/types/utils/hct-color-utils/clamp-double.d.ts +7 -0
- package/dist/types/utils/hct-color-utils/clamp-int.d.ts +7 -0
- package/dist/types/utils/hct-color-utils/color-utils.d.ts +3 -23
- package/dist/types/utils/hct-color-utils/delinearized.d.ts +9 -0
- package/dist/types/utils/hct-color-utils/hct.d.ts +3 -48
- package/dist/types/utils/hct-color-utils/lerp.d.ts +6 -0
- package/dist/types/utils/hct-color-utils/linearized.d.ts +9 -0
- package/dist/types/utils/hct-color-utils/math-utils.d.ts +6 -60
- package/dist/types/utils/hct-color-utils/matrix-multiply.d.ts +4 -0
- package/dist/types/utils/hct-color-utils/sanitize-degrees-double.d.ts +7 -0
- package/dist/types/utils/hct-color-utils/signum.d.ts +6 -0
- package/dist/types/utils/hct-color-utils/viewing-conditions.d.ts +47 -0
- package/dist/types/utils/hex-to-rgba-values.d.ts +6 -0
- package/dist/types/utils/hsl-to-rgb.d.ts +1 -0
- package/dist/types/utils/is-valid-brand-hex.d.ts +1 -0
- package/dist/types/utils/limit-size-of-custom-style-elements.d.ts +1 -0
- package/dist/types/utils/load-theme-css.d.ts +2 -0
- package/dist/types/utils/relative-luminance-w3-c.d.ts +1 -0
- package/dist/types/utils/rgb-to-hex.d.ts +1 -0
- package/dist/types/utils/theme-loading.d.ts +1 -1
- package/dist/types/utils/token-ids.d.ts +3 -41
- package/dist/types-ts4.5/artifacts/replacement-mapping.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/themes/atlassian-dark-increased-contrast.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/themes/atlassian-dark.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/themes/atlassian-light-increased-contrast.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/themes/atlassian-light.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/token-default-values.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-dark-increased-contrast.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-dark.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-light-increased-contrast.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-light.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/tokens-raw/atlassian-motion.d.ts +1 -1
- package/dist/types-ts4.5/artifacts/types-internal.d.ts +2 -2
- package/dist/types-ts4.5/artifacts/types.d.ts +2 -2
- package/dist/types-ts4.5/custom-theme.d.ts +1 -20
- package/dist/types-ts4.5/entry-points/token-metadata.codegen.d.ts +1 -1
- package/dist/types-ts4.5/get-custom-theme-styles.d.ts +16 -0
- package/dist/types-ts4.5/get-global-theme.d.ts +1 -1
- package/dist/types-ts4.5/theme-color-modes.d.ts +11 -0
- package/dist/types-ts4.5/theme-config.d.ts +4 -29
- package/dist/types-ts4.5/theme-ids.d.ts +18 -0
- package/dist/types-ts4.5/theme-state-transformer.d.ts +1 -1
- package/dist/types-ts4.5/utils/color-detection.d.ts +1 -6
- package/dist/types-ts4.5/utils/color-utils.d.ts +5 -9
- package/dist/types-ts4.5/utils/custom-theme-loading-utils.d.ts +1 -2
- package/dist/types-ts4.5/utils/generate-custom-color-ramp.d.ts +1 -2
- package/dist/types-ts4.5/utils/get-alpha.d.ts +1 -0
- package/dist/types-ts4.5/utils/get-closest-color-index.d.ts +2 -0
- package/dist/types-ts4.5/utils/get-css-custom-property.d.ts +15 -0
- package/dist/types-ts4.5/utils/get-fully-qualified-token-id.d.ts +11 -0
- package/dist/types-ts4.5/utils/get-theme-override-preferences.d.ts +2 -0
- package/dist/types-ts4.5/utils/get-theme-preferences.d.ts +1 -1
- package/dist/types-ts4.5/utils/get-token-id.d.ts +15 -0
- package/dist/types-ts4.5/utils/hct-color-utils/argb-from-rgb.d.ts +4 -0
- package/dist/types-ts4.5/utils/hct-color-utils/clamp-double.d.ts +7 -0
- package/dist/types-ts4.5/utils/hct-color-utils/clamp-int.d.ts +7 -0
- package/dist/types-ts4.5/utils/hct-color-utils/color-utils.d.ts +3 -23
- package/dist/types-ts4.5/utils/hct-color-utils/delinearized.d.ts +9 -0
- package/dist/types-ts4.5/utils/hct-color-utils/hct.d.ts +3 -48
- package/dist/types-ts4.5/utils/hct-color-utils/lerp.d.ts +6 -0
- package/dist/types-ts4.5/utils/hct-color-utils/linearized.d.ts +9 -0
- package/dist/types-ts4.5/utils/hct-color-utils/math-utils.d.ts +6 -60
- package/dist/types-ts4.5/utils/hct-color-utils/matrix-multiply.d.ts +4 -0
- package/dist/types-ts4.5/utils/hct-color-utils/sanitize-degrees-double.d.ts +7 -0
- package/dist/types-ts4.5/utils/hct-color-utils/signum.d.ts +6 -0
- package/dist/types-ts4.5/utils/hct-color-utils/viewing-conditions.d.ts +47 -0
- package/dist/types-ts4.5/utils/hex-to-rgba-values.d.ts +6 -0
- package/dist/types-ts4.5/utils/hsl-to-rgb.d.ts +5 -0
- package/dist/types-ts4.5/utils/is-valid-brand-hex.d.ts +1 -0
- package/dist/types-ts4.5/utils/limit-size-of-custom-style-elements.d.ts +1 -0
- package/dist/types-ts4.5/utils/load-theme-css.d.ts +2 -0
- package/dist/types-ts4.5/utils/relative-luminance-w3-c.d.ts +1 -0
- package/dist/types-ts4.5/utils/rgb-to-hex.d.ts +1 -0
- package/dist/types-ts4.5/utils/theme-loading.d.ts +1 -1
- package/dist/types-ts4.5/utils/token-ids.d.ts +3 -41
- package/figma/atlassian-dark-increased-contrast.json +1 -1
- package/figma/atlassian-dark.json +1 -1
- package/figma/atlassian-light-increased-contrast.json +1 -1
- package/figma/atlassian-light.json +1 -1
- package/package.json +12 -12
- package/tokens.docs.tsx +48 -46
|
@@ -6,16 +6,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.argbFromLinrgb = argbFromLinrgb;
|
|
8
8
|
exports.argbFromLstar = argbFromLstar;
|
|
9
|
-
exports
|
|
9
|
+
Object.defineProperty(exports, "argbFromRgb", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function get() {
|
|
12
|
+
return _argbFromRgb.argbFromRgb;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
10
15
|
exports.argbFromRgba = argbFromRgba;
|
|
11
16
|
exports.argbFromXyz = argbFromXyz;
|
|
12
|
-
exports
|
|
13
|
-
|
|
17
|
+
Object.defineProperty(exports, "delinearized", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function get() {
|
|
20
|
+
return _delinearized.delinearized;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "linearized", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function get() {
|
|
26
|
+
return _linearized.linearized;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
14
29
|
exports.lstarFromArgb = lstarFromArgb;
|
|
15
30
|
exports.lstarFromY = lstarFromY;
|
|
16
31
|
exports.rgbaFromArgb = rgbaFromArgb;
|
|
17
32
|
exports.whitePointD65 = whitePointD65;
|
|
18
33
|
exports.yFromLstar = yFromLstar;
|
|
34
|
+
var _argbFromRgb = require("./argb-from-rgb");
|
|
35
|
+
var _delinearized = require("./delinearized");
|
|
36
|
+
var _linearized = require("./linearized");
|
|
19
37
|
var mathUtils = _interopRequireWildcard(require("./math-utils"));
|
|
20
38
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
21
39
|
/**
|
|
@@ -53,21 +71,14 @@ var SRGB_TO_XYZ = [[0.41233895, 0.35762064, 0.18051042], [0.2126, 0.7152, 0.0722
|
|
|
53
71
|
var XYZ_TO_SRGB = [[3.2413774792388685, -1.5376652402851851, -0.49885366846268053], [-0.9691452513005321, 1.8758853451067872, 0.04156585616912061], [0.05562093689691305, -0.20395524564742123, 1.0571799111220335]];
|
|
54
72
|
var WHITE_POINT_D65 = [95.047, 100.0, 108.883];
|
|
55
73
|
|
|
56
|
-
/**
|
|
57
|
-
* Converts a color from RGB components to ARGB format.
|
|
58
|
-
*/
|
|
59
|
-
function argbFromRgb(red, green, blue) {
|
|
60
|
-
return (255 << 24 | (red & 255) << 16 | (green & 255) << 8 | blue & 255) >>> 0;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
74
|
/**
|
|
64
75
|
* Converts a color from linear RGB components to ARGB format.
|
|
65
76
|
*/
|
|
66
77
|
function argbFromLinrgb(linrgb) {
|
|
67
|
-
var r = delinearized(linrgb[0]);
|
|
68
|
-
var g = delinearized(linrgb[1]);
|
|
69
|
-
var b = delinearized(linrgb[2]);
|
|
70
|
-
return argbFromRgb(r, g, b);
|
|
78
|
+
var r = (0, _delinearized.delinearized)(linrgb[0]);
|
|
79
|
+
var g = (0, _delinearized.delinearized)(linrgb[1]);
|
|
80
|
+
var b = (0, _delinearized.delinearized)(linrgb[2]);
|
|
81
|
+
return (0, _argbFromRgb.argbFromRgb)(r, g, b);
|
|
71
82
|
}
|
|
72
83
|
|
|
73
84
|
/**
|
|
@@ -101,24 +112,25 @@ function blueFromArgb(argb) {
|
|
|
101
112
|
/**
|
|
102
113
|
* Converts a color from ARGB to XYZ.
|
|
103
114
|
*/
|
|
115
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
104
116
|
function argbFromXyz(x, y, z) {
|
|
105
117
|
var matrix = XYZ_TO_SRGB;
|
|
106
118
|
var linearR = matrix[0][0] * x + matrix[0][1] * y + matrix[0][2] * z;
|
|
107
119
|
var linearG = matrix[1][0] * x + matrix[1][1] * y + matrix[1][2] * z;
|
|
108
120
|
var linearB = matrix[2][0] * x + matrix[2][1] * y + matrix[2][2] * z;
|
|
109
|
-
var r = delinearized(linearR);
|
|
110
|
-
var g = delinearized(linearG);
|
|
111
|
-
var b = delinearized(linearB);
|
|
112
|
-
return argbFromRgb(r, g, b);
|
|
121
|
+
var r = (0, _delinearized.delinearized)(linearR);
|
|
122
|
+
var g = (0, _delinearized.delinearized)(linearG);
|
|
123
|
+
var b = (0, _delinearized.delinearized)(linearB);
|
|
124
|
+
return (0, _argbFromRgb.argbFromRgb)(r, g, b);
|
|
113
125
|
}
|
|
114
126
|
|
|
115
127
|
/**
|
|
116
128
|
* Converts a color from XYZ to ARGB.
|
|
117
129
|
*/
|
|
118
130
|
function xyzFromArgb(argb) {
|
|
119
|
-
var r = linearized(redFromArgb(argb));
|
|
120
|
-
var g = linearized(greenFromArgb(argb));
|
|
121
|
-
var b = linearized(blueFromArgb(argb));
|
|
131
|
+
var r = (0, _linearized.linearized)(redFromArgb(argb));
|
|
132
|
+
var g = (0, _linearized.linearized)(greenFromArgb(argb));
|
|
133
|
+
var b = (0, _linearized.linearized)(blueFromArgb(argb));
|
|
122
134
|
return mathUtils.matrixMultiply([r, g, b], SRGB_TO_XYZ);
|
|
123
135
|
}
|
|
124
136
|
|
|
@@ -129,10 +141,11 @@ function xyzFromArgb(argb) {
|
|
|
129
141
|
* @return ARGB representation of grayscale color with lightness
|
|
130
142
|
* matching L*
|
|
131
143
|
*/
|
|
144
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
132
145
|
function argbFromLstar(lstar) {
|
|
133
146
|
var y = yFromLstar(lstar);
|
|
134
|
-
var component = delinearized(y);
|
|
135
|
-
return argbFromRgb(component, component, component);
|
|
147
|
+
var component = (0, _delinearized.delinearized)(y);
|
|
148
|
+
return (0, _argbFromRgb.argbFromRgb)(component, component, component);
|
|
136
149
|
}
|
|
137
150
|
|
|
138
151
|
/**
|
|
@@ -141,6 +154,7 @@ function argbFromLstar(lstar) {
|
|
|
141
154
|
* @param argb ARGB representation of a color
|
|
142
155
|
* @return L*, from L*a*b*, coordinate of the color
|
|
143
156
|
*/
|
|
157
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
144
158
|
function lstarFromArgb(argb) {
|
|
145
159
|
var y = xyzFromArgb(argb)[1];
|
|
146
160
|
return 116.0 * labF(y / 100.0) - 16.0;
|
|
@@ -157,6 +171,7 @@ function lstarFromArgb(argb) {
|
|
|
157
171
|
* @param lstar L* in L*a*b*
|
|
158
172
|
* @return Y in XYZ
|
|
159
173
|
*/
|
|
174
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
160
175
|
function yFromLstar(lstar) {
|
|
161
176
|
return 100.0 * labInvf((lstar + 16.0) / 116.0);
|
|
162
177
|
}
|
|
@@ -172,51 +187,17 @@ function yFromLstar(lstar) {
|
|
|
172
187
|
* @param y Y in XYZ
|
|
173
188
|
* @return L* in L*a*b*
|
|
174
189
|
*/
|
|
190
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
175
191
|
function lstarFromY(y) {
|
|
176
192
|
return labF(y / 100.0) * 116.0 - 16.0;
|
|
177
193
|
}
|
|
178
194
|
|
|
179
|
-
/**
|
|
180
|
-
* Linearizes an RGB component.
|
|
181
|
-
*
|
|
182
|
-
* @param rgbComponent 0 <= rgb_component <= 255, represents R/G/B
|
|
183
|
-
* channel
|
|
184
|
-
* @return 0.0 <= output <= 100.0, color channel converted to
|
|
185
|
-
* linear RGB space
|
|
186
|
-
*/
|
|
187
|
-
function linearized(rgbComponent) {
|
|
188
|
-
var normalized = rgbComponent / 255.0;
|
|
189
|
-
if (normalized <= 0.040449936) {
|
|
190
|
-
return normalized / 12.92 * 100.0;
|
|
191
|
-
} else {
|
|
192
|
-
return Math.pow((normalized + 0.055) / 1.055, 2.4) * 100.0;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Delinearizes an RGB component.
|
|
198
|
-
*
|
|
199
|
-
* @param rgbComponent 0.0 <= rgb_component <= 100.0, represents
|
|
200
|
-
* linear R/G/B channel
|
|
201
|
-
* @return 0 <= output <= 255, color channel converted to regular
|
|
202
|
-
* RGB space
|
|
203
|
-
*/
|
|
204
|
-
function delinearized(rgbComponent) {
|
|
205
|
-
var normalized = rgbComponent / 100.0;
|
|
206
|
-
var delinearized = 0.0;
|
|
207
|
-
if (normalized <= 0.0031308) {
|
|
208
|
-
delinearized = normalized * 12.92;
|
|
209
|
-
} else {
|
|
210
|
-
delinearized = 1.055 * Math.pow(normalized, 1.0 / 2.4) - 0.055;
|
|
211
|
-
}
|
|
212
|
-
return mathUtils.clampInt(0, 255, Math.round(delinearized * 255.0));
|
|
213
|
-
}
|
|
214
|
-
|
|
215
195
|
/**
|
|
216
196
|
* Returns the standard white point; white on a sunny day.
|
|
217
197
|
*
|
|
218
198
|
* @return The white point
|
|
219
199
|
*/
|
|
200
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
220
201
|
function whitePointD65() {
|
|
221
202
|
return WHITE_POINT_D65;
|
|
222
203
|
}
|
|
@@ -236,6 +217,7 @@ function whitePointD65() {
|
|
|
236
217
|
* @param argb ARGB representation of a int32 color.
|
|
237
218
|
* @return RGBA representation of a int32 color.
|
|
238
219
|
*/
|
|
220
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
239
221
|
function rgbaFromArgb(argb) {
|
|
240
222
|
var r = redFromArgb(argb);
|
|
241
223
|
var g = greenFromArgb(argb);
|
|
@@ -255,6 +237,7 @@ function rgbaFromArgb(argb) {
|
|
|
255
237
|
* @param rgba RGBA representation of a int32 color.
|
|
256
238
|
* @returns ARGB representation of a int32 color.
|
|
257
239
|
*/
|
|
240
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
258
241
|
function argbFromRgba(_ref) {
|
|
259
242
|
var r = _ref.r,
|
|
260
243
|
g = _ref.g,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.delinearized = delinearized;
|
|
8
|
+
var mathUtils = _interopRequireWildcard(require("./math-utils"));
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
10
|
+
/**
|
|
11
|
+
* Delinearizes an RGB component.
|
|
12
|
+
*
|
|
13
|
+
* @param rgbComponent 0.0 <= rgb_component <= 100.0, represents
|
|
14
|
+
* linear R/G/B channel
|
|
15
|
+
* @return 0 <= output <= 255, color channel converted to regular
|
|
16
|
+
* RGB space
|
|
17
|
+
*/
|
|
18
|
+
function delinearized(rgbComponent) {
|
|
19
|
+
var normalized = rgbComponent / 100.0;
|
|
20
|
+
var delinearized = 0.0;
|
|
21
|
+
if (normalized <= 0.0031308) {
|
|
22
|
+
delinearized = normalized * 12.92;
|
|
23
|
+
} else {
|
|
24
|
+
delinearized = 1.055 * Math.pow(normalized, 1.0 / 2.4) - 0.055;
|
|
25
|
+
}
|
|
26
|
+
return mathUtils.clampInt(0, 255, Math.round(delinearized * 255.0));
|
|
27
|
+
}
|
|
@@ -5,13 +5,20 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.Hct = void 0;
|
|
9
|
+
Object.defineProperty(exports, "ViewingConditions", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function get() {
|
|
12
|
+
return _viewingConditions.ViewingConditions;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
9
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
17
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
18
|
var utils = _interopRequireWildcard(require("./color-utils"));
|
|
13
19
|
var math = _interopRequireWildcard(require("./math-utils"));
|
|
14
|
-
var
|
|
20
|
+
var _viewingConditions = require("./viewing-conditions");
|
|
21
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
22
|
/**
|
|
16
23
|
* Below lines are copied from @material/material-color-utilities.
|
|
17
24
|
* Do not modify it.
|
|
@@ -32,7 +39,6 @@ var _ViewingConditions;
|
|
|
32
39
|
* See the License for the specific language governing permissions and
|
|
33
40
|
* limitations under the License.
|
|
34
41
|
*/
|
|
35
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
36
42
|
/**
|
|
37
43
|
* A color system built using CAM16 hue and chroma, and L* from
|
|
38
44
|
* L*a*b*.
|
|
@@ -61,7 +67,6 @@ var Hct = exports.Hct = /*#__PURE__*/function () {
|
|
|
61
67
|
this.internalHue = cam.hue;
|
|
62
68
|
this.internalChroma = cam.chroma;
|
|
63
69
|
this.internalTone = utils.lstarFromArgb(argb);
|
|
64
|
-
this.argb = argb;
|
|
65
70
|
}
|
|
66
71
|
return (0, _createClass2.default)(Hct, [{
|
|
67
72
|
key: "toInt",
|
|
@@ -151,7 +156,7 @@ var Hct = exports.Hct = /*#__PURE__*/function () {
|
|
|
151
156
|
var viewedInVc = cam.xyzInViewingConditions(vc);
|
|
152
157
|
|
|
153
158
|
// 2. Create CAM16 of those XYZ coordinates in default VC.
|
|
154
|
-
var recastInVc = Cam16.fromXyzInViewingConditions(viewedInVc[0], viewedInVc[1], viewedInVc[2], ViewingConditions.make());
|
|
159
|
+
var recastInVc = Cam16.fromXyzInViewingConditions(viewedInVc[0], viewedInVc[1], viewedInVc[2], _viewingConditions.ViewingConditions.make());
|
|
155
160
|
|
|
156
161
|
// 3. Create HCT from:
|
|
157
162
|
// - CAM16 using default VC with XYZ coordinates in specified VC.
|
|
@@ -224,6 +229,7 @@ var Cam16 = /*#__PURE__*/function () {
|
|
|
224
229
|
* @param astar CAM16-UCS a coordinate
|
|
225
230
|
* @param bstar CAM16-UCS b coordinate
|
|
226
231
|
*/
|
|
232
|
+
|
|
227
233
|
function Cam16(hue, chroma, j, q, m, s, jstar, astar, bstar) {
|
|
228
234
|
(0, _classCallCheck2.default)(this, Cam16);
|
|
229
235
|
this.hue = hue;
|
|
@@ -267,7 +273,7 @@ var Cam16 = /*#__PURE__*/function () {
|
|
|
267
273
|
* viewing conditions for sRGB.
|
|
268
274
|
*/
|
|
269
275
|
function toInt() {
|
|
270
|
-
return this.viewed(ViewingConditions.DEFAULT);
|
|
276
|
+
return this.viewed(_viewingConditions.ViewingConditions.DEFAULT);
|
|
271
277
|
}
|
|
272
278
|
|
|
273
279
|
/**
|
|
@@ -348,7 +354,7 @@ var Cam16 = /*#__PURE__*/function () {
|
|
|
348
354
|
}], [{
|
|
349
355
|
key: "fromInt",
|
|
350
356
|
value: function fromInt(argb) {
|
|
351
|
-
return Cam16.fromIntInViewingConditions(argb, ViewingConditions.DEFAULT);
|
|
357
|
+
return Cam16.fromIntInViewingConditions(argb, _viewingConditions.ViewingConditions.DEFAULT);
|
|
352
358
|
}
|
|
353
359
|
|
|
354
360
|
/**
|
|
@@ -415,7 +421,7 @@ var Cam16 = /*#__PURE__*/function () {
|
|
|
415
421
|
}, {
|
|
416
422
|
key: "fromJch",
|
|
417
423
|
value: function fromJch(j, c, h) {
|
|
418
|
-
return Cam16.fromJchInViewingConditions(j, c, h, ViewingConditions.DEFAULT);
|
|
424
|
+
return Cam16.fromJchInViewingConditions(j, c, h, _viewingConditions.ViewingConditions.DEFAULT);
|
|
419
425
|
}
|
|
420
426
|
|
|
421
427
|
/**
|
|
@@ -450,7 +456,7 @@ var Cam16 = /*#__PURE__*/function () {
|
|
|
450
456
|
}, {
|
|
451
457
|
key: "fromUcs",
|
|
452
458
|
value: function fromUcs(jstar, astar, bstar) {
|
|
453
|
-
return Cam16.fromUcsInViewingConditions(jstar, astar, bstar, ViewingConditions.DEFAULT);
|
|
459
|
+
return Cam16.fromUcsInViewingConditions(jstar, astar, bstar, _viewingConditions.ViewingConditions.DEFAULT);
|
|
454
460
|
}
|
|
455
461
|
|
|
456
462
|
/**
|
|
@@ -728,8 +734,8 @@ var HctSolver = /*#__PURE__*/function () {
|
|
|
728
734
|
var rightHue = 0.0;
|
|
729
735
|
var initialized = false;
|
|
730
736
|
var uncut = true;
|
|
731
|
-
for (var
|
|
732
|
-
var mid = HctSolver.nthVertex(y,
|
|
737
|
+
for (var n = 0; n < 12; n++) {
|
|
738
|
+
var mid = HctSolver.nthVertex(y, n);
|
|
733
739
|
if (mid[0] < 0) {
|
|
734
740
|
continue;
|
|
735
741
|
}
|
|
@@ -844,7 +850,7 @@ var HctSolver = /*#__PURE__*/function () {
|
|
|
844
850
|
// ===========================================================
|
|
845
851
|
// Operations inlined from Cam16 to avoid repeated calculation
|
|
846
852
|
// ===========================================================
|
|
847
|
-
var viewingConditions = ViewingConditions.DEFAULT;
|
|
853
|
+
var viewingConditions = _viewingConditions.ViewingConditions.DEFAULT;
|
|
848
854
|
var tInnerCoeff = 1 / Math.pow(1.64 - Math.pow(0.29, viewingConditions.n), 0.73);
|
|
849
855
|
var eHue = 0.25 * (Math.cos(hueRadians + 2.0) + 3.8);
|
|
850
856
|
var p1 = eHue * (50000.0 / 13.0) * viewingConditions.nc * viewingConditions.ncb;
|
|
@@ -946,86 +952,4 @@ var HctSolver = /*#__PURE__*/function () {
|
|
|
946
952
|
(0, _defineProperty2.default)(HctSolver, "SCALED_DISCOUNT_FROM_LINRGB", [[0.001200833568784504, 0.002389694492170889, 0.0002795742885861124], [0.0005891086651375999, 0.0029785502573438758, 0.0003270666104008398], [0.00010146692491640572, 0.0005364214359186694, 0.0032979401770712076]]);
|
|
947
953
|
(0, _defineProperty2.default)(HctSolver, "LINRGB_FROM_SCALED_DISCOUNT", [[1373.2198709594231, -1100.4251190754821, -7.278681089101213], [-271.815969077903, 559.6580465940733, -32.46047482791194], [1.9622899599665666, -57.173814538844006, 308.7233197812385]]);
|
|
948
954
|
(0, _defineProperty2.default)(HctSolver, "Y_FROM_LINRGB", [0.2126, 0.7152, 0.0722]);
|
|
949
|
-
(0, _defineProperty2.default)(HctSolver, "CRITICAL_PLANES", [0.015176349177441876, 0.045529047532325624, 0.07588174588720938, 0.10623444424209313, 0.13658714259697685, 0.16693984095186062, 0.19729253930674434, 0.2276452376616281, 0.2579979360165119, 0.28835063437139563, 0.3188300904430532, 0.350925934958123, 0.3848314933096426, 0.42057480301049466, 0.458183274052838, 0.4976837250274023, 0.5391024159806381, 0.5824650784040898, 0.6277969426914107, 0.6751227633498623, 0.7244668422128921, 0.775853049866786, 0.829304845476233, 0.8848452951698498, 0.942497089126609, 1.0022825574869039, 1.0642236851973577, 1.1283421258858297, 1.1946592148522128, 1.2631959812511864, 1.3339731595349034, 1.407011200216447, 1.4823302800086415, 1.5599503113873272, 1.6398909516233677, 1.7221716113234105, 1.8068114625156377, 1.8938294463134073, 1.9832442801866852, 2.075074464868551, 2.1693382909216234, 2.2660538449872063, 2.36523901573795, 2.4669114995532007, 2.5710888059345764, 2.6777882626779785, 2.7870270208169257, 2.898822059350997, 3.0131901897720907, 3.1301480604002863, 3.2497121605402226, 3.3718988244681087, 3.4967242352587946, 3.624204428461639, 3.754355295633311, 3.887192587735158, 4.022731918402185, 4.160988767090289, 4.301978482107941, 4.445716283538092, 4.592217266055746, 4.741496401646282, 4.893568542229298, 5.048448422192488, 5.20615066083972, 5.3666897647573375, 5.5300801301023865, 5.696336044816294, 5.865471690767354, 6.037501145825082, 6.212438385869475, 6.390297286737924, 6.571091626112461, 6.7548350853498045, 6.941541251256611, 7.131223617812143, 7.323895587840543, 7.5195704746346665, 7.7182615035334345, 7.919981813454504, 8.124744458384042, 8.332562408825165, 8.543448553206703, 8.757415699253682, 8.974476575321063, 9.194643831691977, 9.417930041841839, 9.644347703669503, 9.873909240696694, 10.106627003236781, 10.342513269534024, 10.58158024687427, 10.8238400726681, 11.069304815507364, 11.317986476196008, 11.569896988756009, 11.825048221409341, 12.083451977536606, 12.345119996613247, 12.610063955123938, 12.878295467455942, 13.149826086772048, 13.42466730586372, 13.702830557985108, 13.984327217668513, 14.269168601521828, 14.55736596900856, 14.848930523210871, 15.143873411576273, 15.44220572664832, 15.743938506781891, 16.04908273684337, 16.35764934889634, 16.66964922287304, 16.985093187232053, 17.30399201960269, 17.62635644741625, 17.95219714852476, 18.281524751807332, 18.614349837764564, 18.95068293910138, 19.290534541298456, 19.633915083172692, 19.98083495742689, 20.331304511189067, 20.685334046541502, 21.042933821039977, 21.404114048223256, 21.76888489811322, 22.137256497705877, 22.50923893145328, 22.884842241736916, 23.264076429332462, 23.6469514538663, 24.033477234264016, 24.42366364919083, 24.817520537484558, 25.21505769858089, 25.61628489293138, 26.021211842414342, 26.429848230738664, 26.842203703840827, 27.258287870275353, 27.678110301598522, 28.10168053274597, 28.529008062403893, 28.96010235337422, 29.39497283293396, 29.83362889318845, 30.276079891419332, 30.722335150426627, 31.172403958865512, 31.62629557157785, 32.08401920991837, 32.54558406207592, 33.010999283389665, 33.4802739966603, 33.953417292456834, 34.430438229418264, 34.911345834551085, 35.39614910352207, 35.88485700094671, 36.37747846067349, 36.87402238606382, 37.37449765026789, 37.87891309649659, 38.38727753828926, 38.89959975977785, 39.41588851594697, 39.93615253289054, 40.460400508064545, 40.98864111053629, 41.520882981230194, 42.05713473317016, 42.597404951718396, 43.141702194811224, 43.6900349931913, 44.24241185063697, 44.798841244188324, 45.35933162437017, 45.92389141541209, 46.49252901546552, 47.065252796817916, 47.64207110610409, 48.22299226451468, 48.808024568002054, 49.3971762874833, 49.9904556690408, 50.587870934119984, 51.189430279724725, 51.79514187861014, 52.40501387947288, 53.0190544071392, 53.637271562750364, 54.259673423945976, 54.88626804504493, 55.517063457223934, 56.15206766869424, 56.79128866487574, 57.43473440856916, 58.08241284012621, 58.734331877617365, 59.39049941699807, 60.05092333227251, 60.715611475655585, 61.38457167773311, 62.057811747619894, 62.7353394731159, 63.417162620860914, 64.10328893648692, 64.79372614476921, 65.48848194977529, 66.18756403501224, 66.89098006357258, 67.59873767827808, 68.31084450182222, 69.02730813691093, 69.74813616640164, 70.47333615344107, 71.20291564160104, 71.93688215501312, 72.67524319850172, 73.41800625771542, 74.16517879925733, 74.9167682708136, 75.67278210128072, 76.43322770089146, 77.1981124613393, 77.96744375590167, 78.74122893956174, 79.51947534912904, 80.30219030335869, 81.08938110306934, 81.88105503125999, 82.67721935322541, 83.4778813166706, 84.28304815182372, 85.09272707154808, 85.90692527145302, 86.72564993000343, 87.54890820862819, 88.3767072518277, 89.2090541872801, 90.04595612594655, 90.88742016217518, 91.73345337380438, 92.58406282226491, 93.43925555268066, 94.29903859396902, 95.16341895893969, 96.03240364439274, 96.9059996312159, 97.78421388448044, 98.6670533535366, 99.55452497210776]);
|
|
950
|
-
var ViewingConditions = exports.ViewingConditions = /*#__PURE__*/function () {
|
|
951
|
-
/**
|
|
952
|
-
* Parameters are intermediate values of the CAM16 conversion process. Their
|
|
953
|
-
* names are shorthand for technical color science terminology, this class
|
|
954
|
-
* would not benefit from documenting them individually. A brief overview
|
|
955
|
-
* is available in the CAM16 specification, and a complete overview requires
|
|
956
|
-
* a color science textbook, such as Fairchild's Color Appearance Models.
|
|
957
|
-
*/
|
|
958
|
-
function ViewingConditions(n, aw, nbb, ncb, c, nc, rgbD, fl, fLRoot, z) {
|
|
959
|
-
(0, _classCallCheck2.default)(this, ViewingConditions);
|
|
960
|
-
this.n = n;
|
|
961
|
-
this.aw = aw;
|
|
962
|
-
this.nbb = nbb;
|
|
963
|
-
this.ncb = ncb;
|
|
964
|
-
this.c = c;
|
|
965
|
-
this.nc = nc;
|
|
966
|
-
this.rgbD = rgbD;
|
|
967
|
-
this.fl = fl;
|
|
968
|
-
this.fLRoot = fLRoot;
|
|
969
|
-
this.z = z;
|
|
970
|
-
}
|
|
971
|
-
return (0, _createClass2.default)(ViewingConditions, null, [{
|
|
972
|
-
key: "make",
|
|
973
|
-
value:
|
|
974
|
-
/**
|
|
975
|
-
* Create ViewingConditions from a simple, physically relevant, set of
|
|
976
|
-
* parameters.
|
|
977
|
-
*
|
|
978
|
-
* @param whitePoint White point, measured in the XYZ color space.
|
|
979
|
-
* default = D65, or sunny day afternoon
|
|
980
|
-
* @param adaptingLuminance The luminance of the adapting field. Informally,
|
|
981
|
-
* how bright it is in the room where the color is viewed. Can be
|
|
982
|
-
* calculated from lux by multiplying lux by 0.0586. default = 11.72,
|
|
983
|
-
* or 200 lux.
|
|
984
|
-
* @param backgroundLstar The lightness of the area surrounding the color.
|
|
985
|
-
* measured by L* in L*a*b*. default = 50.0
|
|
986
|
-
* @param surround A general description of the lighting surrounding the
|
|
987
|
-
* color. 0 is pitch dark, like watching a movie in a theater. 1.0 is a
|
|
988
|
-
* dimly light room, like watching TV at home at night. 2.0 means there
|
|
989
|
-
* is no difference between the lighting on the color and around it.
|
|
990
|
-
* default = 2.0
|
|
991
|
-
* @param discountingIlluminant Whether the eye accounts for the tint of the
|
|
992
|
-
* ambient lighting, such as knowing an apple is still red in green light.
|
|
993
|
-
* default = false, the eye does not perform this process on
|
|
994
|
-
* self-luminous objects like displays.
|
|
995
|
-
*/
|
|
996
|
-
function make() {
|
|
997
|
-
var whitePoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : utils.whitePointD65();
|
|
998
|
-
var adaptingLuminance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200.0 / Math.PI * utils.yFromLstar(50.0) / 100.0;
|
|
999
|
-
var backgroundLstar = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50.0;
|
|
1000
|
-
var surround = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 2.0;
|
|
1001
|
-
var discountingIlluminant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
1002
|
-
var xyz = whitePoint;
|
|
1003
|
-
var rW = xyz[0] * 0.401288 + xyz[1] * 0.650173 + xyz[2] * -0.051461;
|
|
1004
|
-
var gW = xyz[0] * -0.250268 + xyz[1] * 1.204414 + xyz[2] * 0.045854;
|
|
1005
|
-
var bW = xyz[0] * -0.002079 + xyz[1] * 0.048952 + xyz[2] * 0.953127;
|
|
1006
|
-
var f = 0.8 + surround / 10.0;
|
|
1007
|
-
var c = f >= 0.9 ? math.lerp(0.59, 0.69, (f - 0.9) * 10.0) : math.lerp(0.525, 0.59, (f - 0.8) * 10.0);
|
|
1008
|
-
var d = discountingIlluminant ? 1.0 : f * (1.0 - 1.0 / 3.6 * Math.exp((-adaptingLuminance - 42.0) / 92.0));
|
|
1009
|
-
d = d > 1.0 ? 1.0 : d < 0.0 ? 0.0 : d;
|
|
1010
|
-
var nc = f;
|
|
1011
|
-
var rgbD = [d * (100.0 / rW) + 1.0 - d, d * (100.0 / gW) + 1.0 - d, d * (100.0 / bW) + 1.0 - d];
|
|
1012
|
-
var k = 1.0 / (5.0 * adaptingLuminance + 1.0);
|
|
1013
|
-
var k4 = k * k * k * k;
|
|
1014
|
-
var k4F = 1.0 - k4;
|
|
1015
|
-
var fl = k4 * adaptingLuminance + 0.1 * k4F * k4F * Math.cbrt(5.0 * adaptingLuminance);
|
|
1016
|
-
var n = utils.yFromLstar(backgroundLstar) / whitePoint[1];
|
|
1017
|
-
var z = 1.48 + Math.sqrt(n);
|
|
1018
|
-
var nbb = 0.725 / Math.pow(n, 0.2);
|
|
1019
|
-
var ncb = nbb;
|
|
1020
|
-
var rgbAFactors = [Math.pow(fl * rgbD[0] * rW / 100.0, 0.42), Math.pow(fl * rgbD[1] * gW / 100.0, 0.42), Math.pow(fl * rgbD[2] * bW / 100.0, 0.42)];
|
|
1021
|
-
var rgbA = [400.0 * rgbAFactors[0] / (rgbAFactors[0] + 27.13), 400.0 * rgbAFactors[1] / (rgbAFactors[1] + 27.13), 400.0 * rgbAFactors[2] / (rgbAFactors[2] + 27.13)];
|
|
1022
|
-
var aw = (2.0 * rgbA[0] + rgbA[1] + 0.05 * rgbA[2]) * nbb;
|
|
1023
|
-
return new ViewingConditions(n, aw, nbb, ncb, c, nc, rgbD, fl, Math.pow(fl, 0.25), z);
|
|
1024
|
-
}
|
|
1025
|
-
}]);
|
|
1026
|
-
}();
|
|
1027
|
-
_ViewingConditions = ViewingConditions;
|
|
1028
|
-
/**
|
|
1029
|
-
* sRGB-like viewing conditions.
|
|
1030
|
-
*/
|
|
1031
|
-
(0, _defineProperty2.default)(ViewingConditions, "DEFAULT", _ViewingConditions.make());
|
|
955
|
+
(0, _defineProperty2.default)(HctSolver, "CRITICAL_PLANES", [0.015176349177441876, 0.045529047532325624, 0.07588174588720938, 0.10623444424209313, 0.13658714259697685, 0.16693984095186062, 0.19729253930674434, 0.2276452376616281, 0.2579979360165119, 0.28835063437139563, 0.3188300904430532, 0.350925934958123, 0.3848314933096426, 0.42057480301049466, 0.458183274052838, 0.4976837250274023, 0.5391024159806381, 0.5824650784040898, 0.6277969426914107, 0.6751227633498623, 0.7244668422128921, 0.775853049866786, 0.829304845476233, 0.8848452951698498, 0.942497089126609, 1.0022825574869039, 1.0642236851973577, 1.1283421258858297, 1.1946592148522128, 1.2631959812511864, 1.3339731595349034, 1.407011200216447, 1.4823302800086415, 1.5599503113873272, 1.6398909516233677, 1.7221716113234105, 1.8068114625156377, 1.8938294463134073, 1.9832442801866852, 2.075074464868551, 2.1693382909216234, 2.2660538449872063, 2.36523901573795, 2.4669114995532007, 2.5710888059345764, 2.6777882626779785, 2.7870270208169257, 2.898822059350997, 3.0131901897720907, 3.1301480604002863, 3.2497121605402226, 3.3718988244681087, 3.4967242352587946, 3.624204428461639, 3.754355295633311, 3.887192587735158, 4.022731918402185, 4.160988767090289, 4.301978482107941, 4.445716283538092, 4.592217266055746, 4.741496401646282, 4.893568542229298, 5.048448422192488, 5.20615066083972, 5.3666897647573375, 5.5300801301023865, 5.696336044816294, 5.865471690767354, 6.037501145825082, 6.212438385869475, 6.390297286737924, 6.571091626112461, 6.7548350853498045, 6.941541251256611, 7.131223617812143, 7.323895587840543, 7.5195704746346665, 7.7182615035334345, 7.919981813454504, 8.124744458384042, 8.332562408825165, 8.543448553206703, 8.757415699253682, 8.974476575321063, 9.194643831691977, 9.417930041841839, 9.644347703669503, 9.873909240696694, 10.106627003236781, 10.342513269534024, 10.58158024687427, 10.8238400726681, 11.069304815507364, 11.317986476196008, 11.569896988756009, 11.825048221409341, 12.083451977536606, 12.345119996613247, 12.610063955123938, 12.878295467455942, 13.149826086772048, 13.42466730586372, 13.702830557985108, 13.984327217668513, 14.269168601521828, 14.55736596900856, 14.848930523210871, 15.143873411576273, 15.44220572664832, 15.743938506781891, 16.04908273684337, 16.35764934889634, 16.66964922287304, 16.985093187232053, 17.30399201960269, 17.62635644741625, 17.95219714852476, 18.281524751807332, 18.614349837764564, 18.95068293910138, 19.290534541298456, 19.633915083172692, 19.98083495742689, 20.331304511189067, 20.685334046541502, 21.042933821039977, 21.404114048223256, 21.76888489811322, 22.137256497705877, 22.50923893145328, 22.884842241736916, 23.264076429332462, 23.6469514538663, 24.033477234264016, 24.42366364919083, 24.817520537484558, 25.21505769858089, 25.61628489293138, 26.021211842414342, 26.429848230738664, 26.842203703840827, 27.258287870275353, 27.678110301598522, 28.10168053274597, 28.529008062403893, 28.96010235337422, 29.39497283293396, 29.83362889318845, 30.276079891419332, 30.722335150426627, 31.172403958865512, 31.62629557157785, 32.08401920991837, 32.54558406207592, 33.010999283389665, 33.4802739966603, 33.953417292456834, 34.430438229418264, 34.911345834551085, 35.39614910352207, 35.88485700094671, 36.37747846067349, 36.87402238606382, 37.37449765026789, 37.87891309649659, 38.38727753828926, 38.89959975977785, 39.41588851594697, 39.93615253289054, 40.460400508064545, 40.98864111053629, 41.520882981230194, 42.05713473317016, 42.597404951718396, 43.141702194811224, 43.6900349931913, 44.24241185063697, 44.798841244188324, 45.35933162437017, 45.92389141541209, 46.49252901546552, 47.065252796817916, 47.64207110610409, 48.22299226451468, 48.808024568002054, 49.3971762874833, 49.9904556690408, 50.587870934119984, 51.189430279724725, 51.79514187861014, 52.40501387947288, 53.0190544071392, 53.637271562750364, 54.259673423945976, 54.88626804504493, 55.517063457223934, 56.15206766869424, 56.79128866487574, 57.43473440856916, 58.08241284012621, 58.734331877617365, 59.39049941699807, 60.05092333227251, 60.715611475655585, 61.38457167773311, 62.057811747619894, 62.7353394731159, 63.417162620860914, 64.10328893648692, 64.79372614476921, 65.48848194977529, 66.18756403501224, 66.89098006357258, 67.59873767827808, 68.31084450182222, 69.02730813691093, 69.74813616640164, 70.47333615344107, 71.20291564160104, 71.93688215501312, 72.67524319850172, 73.41800625771542, 74.16517879925733, 74.9167682708136, 75.67278210128072, 76.43322770089146, 77.1981124613393, 77.96744375590167, 78.74122893956174, 79.51947534912904, 80.30219030335869, 81.08938110306934, 81.88105503125999, 82.67721935322541, 83.4778813166706, 84.28304815182372, 85.09272707154808, 85.90692527145302, 86.72564993000343, 87.54890820862819, 88.3767072518277, 89.2090541872801, 90.04595612594655, 90.88742016217518, 91.73345337380438, 92.58406282226491, 93.43925555268066, 94.29903859396902, 95.16341895893969, 96.03240364439274, 96.9059996312159, 97.78421388448044, 98.6670533535366, 99.55452497210776]);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.lerp = lerp;
|
|
7
|
+
/**
|
|
8
|
+
* The linear interpolation function.
|
|
9
|
+
*
|
|
10
|
+
* @return start if amount = 0 and stop if amount = 1
|
|
11
|
+
*/
|
|
12
|
+
function lerp(start, stop, amount) {
|
|
13
|
+
return (1.0 - amount) * start + amount * stop;
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.linearized = linearized;
|
|
7
|
+
/**
|
|
8
|
+
* Linearizes an RGB component.
|
|
9
|
+
*
|
|
10
|
+
* @param rgbComponent 0 <= rgb_component <= 255, represents R/G/B
|
|
11
|
+
* channel
|
|
12
|
+
* @return 0.0 <= output <= 100.0, color channel converted to
|
|
13
|
+
* linear RGB space
|
|
14
|
+
*/
|
|
15
|
+
function linearized(rgbComponent) {
|
|
16
|
+
var normalized = rgbComponent / 255.0;
|
|
17
|
+
if (normalized <= 0.040449936) {
|
|
18
|
+
return normalized / 12.92 * 100.0;
|
|
19
|
+
} else {
|
|
20
|
+
return Math.pow((normalized + 0.055) / 1.055, 2.4) * 100.0;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -3,114 +3,45 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.sanitizeDegreesDouble = sanitizeDegreesDouble;
|
|
11
|
-
exports.signum = signum;
|
|
12
|
-
/**
|
|
13
|
-
* Below lines are copied from @material/material-color-utilities.
|
|
14
|
-
* Do not modify it.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @license
|
|
19
|
-
* Copyright 2021 Google LLC
|
|
20
|
-
*
|
|
21
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
22
|
-
* you may not use this file except in compliance with the License.
|
|
23
|
-
* You may obtain a copy of the License at
|
|
24
|
-
*
|
|
25
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
26
|
-
*
|
|
27
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
28
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
29
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
30
|
-
* See the License for the specific language governing permissions and
|
|
31
|
-
* limitations under the License.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
// This file is automatically generated. Do not modify it.
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Utility methods for mathematical operations.
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* The signum function.
|
|
42
|
-
*
|
|
43
|
-
* @return 1 if num > 0, -1 if num < 0, and 0 if num = 0
|
|
44
|
-
*/
|
|
45
|
-
function signum(num) {
|
|
46
|
-
if (num < 0) {
|
|
47
|
-
return -1;
|
|
48
|
-
} else if (num === 0) {
|
|
49
|
-
return 0;
|
|
50
|
-
} else {
|
|
51
|
-
return 1;
|
|
6
|
+
Object.defineProperty(exports, "clampDouble", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _clampDouble.clampDouble;
|
|
52
10
|
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
* @return start if amount = 0 and stop if amount = 1
|
|
59
|
-
*/
|
|
60
|
-
function lerp(start, stop, amount) {
|
|
61
|
-
return (1.0 - amount) * start + amount * stop;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Clamps an integer between two integers.
|
|
66
|
-
*
|
|
67
|
-
* @return input when min <= input <= max, and either min or max
|
|
68
|
-
* otherwise.
|
|
69
|
-
*/
|
|
70
|
-
function clampInt(min, max, input) {
|
|
71
|
-
if (input < min) {
|
|
72
|
-
return min;
|
|
73
|
-
} else if (input > max) {
|
|
74
|
-
return max;
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "clampInt", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _clampInt.clampInt;
|
|
75
16
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
*
|
|
82
|
-
* @return input when min <= input <= max, and either min or max
|
|
83
|
-
* otherwise.
|
|
84
|
-
*/
|
|
85
|
-
function clampDouble(min, max, input) {
|
|
86
|
-
if (input < min) {
|
|
87
|
-
return min;
|
|
88
|
-
} else if (input > max) {
|
|
89
|
-
return max;
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "lerp", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _lerp.lerp;
|
|
90
22
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
*
|
|
97
|
-
* @return a degree measure between 0.0 (inclusive) and 360.0
|
|
98
|
-
* (exclusive).
|
|
99
|
-
*/
|
|
100
|
-
function sanitizeDegreesDouble(degrees) {
|
|
101
|
-
degrees = degrees % 360.0;
|
|
102
|
-
if (degrees < 0) {
|
|
103
|
-
degrees = degrees + 360.0;
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "matrixMultiply", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _matrixMultiply.matrixMultiply;
|
|
104
28
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "sanitizeDegreesDouble", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _sanitizeDegreesDouble.sanitizeDegreesDouble;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "signum", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _signum.signum;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var _signum = require("./signum");
|
|
43
|
+
var _lerp = require("./lerp");
|
|
44
|
+
var _clampInt = require("./clamp-int");
|
|
45
|
+
var _clampDouble = require("./clamp-double");
|
|
46
|
+
var _sanitizeDegreesDouble = require("./sanitize-degrees-double");
|
|
47
|
+
var _matrixMultiply = require("./matrix-multiply");
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.matrixMultiply = matrixMultiply;
|
|
7
|
+
/**
|
|
8
|
+
* Multiplies a 1x3 row vector with a 3x3 matrix.
|
|
9
|
+
*/
|
|
10
|
+
function matrixMultiply(row, matrix) {
|
|
11
|
+
var a = row[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2];
|
|
12
|
+
var b = row[0] * matrix[1][0] + row[1] * matrix[1][1] + row[2] * matrix[1][2];
|
|
13
|
+
var c = row[0] * matrix[2][0] + row[1] * matrix[2][1] + row[2] * matrix[2][2];
|
|
14
|
+
return [a, b, c];
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.sanitizeDegreesDouble = sanitizeDegreesDouble;
|
|
7
|
+
/**
|
|
8
|
+
* Sanitizes a degree measure as a floating-point number.
|
|
9
|
+
*
|
|
10
|
+
* @return a degree measure between 0.0 (inclusive) and 360.0
|
|
11
|
+
* (exclusive).
|
|
12
|
+
*/
|
|
13
|
+
function sanitizeDegreesDouble(degrees) {
|
|
14
|
+
degrees = degrees % 360.0;
|
|
15
|
+
if (degrees < 0) {
|
|
16
|
+
degrees = degrees + 360.0;
|
|
17
|
+
}
|
|
18
|
+
return degrees;
|
|
19
|
+
}
|