@globalpayments/vega 2.38.0 → 2.39.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/dist/cjs/{app-globals-7087f121.js → app-globals-dd3e7925.js} +2 -3
- package/dist/cjs/content-state-c5b47ca1.js +6644 -0
- package/dist/cjs/{image-annotation-action-7d82f7e1.js → image-annotation-action-75b9c0d3.js} +5 -6
- package/dist/cjs/index.cjs.js +13 -14
- package/dist/cjs/loader.cjs.js +8 -9
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +1 -1
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +31 -7
- package/dist/cjs/vega-popover_2.cjs.entry.js +14 -0
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +18 -19
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +75 -79
- package/dist/cjs/vega.cjs.js +8 -9
- package/dist/collection/components/vega-input-phone-number/slimmers/controllers/vega-input-phone-number-value-controller.js +18 -2
- package/dist/collection/components/vega-input-phone-number/vega-input-phone-number.js +7 -4
- package/dist/collection/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.js +4 -0
- package/dist/collection/components/vega-popover/vega-popover.js +37 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.js +52 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.js +63 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-link-group-strategy.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-text-style-strategy.js +32 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/image-set-annotation-map-strategy.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-split-text-strategy.js +134 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-update-annotation-map-strategy.js +47 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-blocks-strategy.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-nodes-strategy.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-image-strategy.js +54 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.js +152 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy.js +99 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-after-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-before-strategy.js +38 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-image-into-text-strategy.js +31 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-strategy.js +57 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-with-blocks-strategy.js +60 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-new-paragraph-strategy.js +55 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-after-node-strategy.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-before-node-strategy.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy.js +25 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-child-block-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-node-with-nodes-strategy.js +28 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-nodes-strategy.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-image-node-strategy.js +48 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-text-node-strategy.js +43 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-list-strategy.js +26 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-block-insert-image-strategy.js +32 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-strategy.js +21 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-with-blocks-strategy.js +55 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-new-paragraph-strategy.js +44 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-update-url-strategy.js +12 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-insert-image-strategy.js +22 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-delete-text-content-strategy.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-image-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-new-paragraph-strategy.js +92 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-nest-list-strategy.js +22 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-node-strategy.js +19 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-replace-nest-list-strategy.js +15 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.js +27 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-list-strategy.js +36 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-paragraph-strategy.js +63 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-replace-selected-text-strategy.js +46 -0
- package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-update-text-strategy.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/image-update-url-action.js +13 -0
- package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +1 -1
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/block.abstract.js +3 -215
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/image-block.js +31 -244
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-block.js +17 -155
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/list-item-block.js +33 -184
- package/dist/collection/components/vega-rich-text-editor/dto/blocks/text-block.js +40 -352
- package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +13 -23
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +14 -6
- package/dist/collection/components/vega-rich-text-editor/dto/nodes/text-node.js +23 -182
- package/dist/collection/components/vega-rich-text-editor/slimmers/renderers/tools/image-toolbar-button-slimmer.js +2 -1
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/action-handle-strategy-registry.test.js +41 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-insert-line-break-with-blocks-strategy.test.js +24 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.js +14 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.js +30 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-set-annotation-map-strategy.test.js +11 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-update-url-strategy.test.js +16 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-block-strategy-register.test.js +20 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-item-strategy-register.test.js +31 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-split-text-strategy.test.js +31 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-update-annotation-map-strategy.test.js +17 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.js +55 -0
- package/dist/collection/components/vega-rich-text-editor/test/dto/action-handle-strategies/update-selected-text-strategy.test.js +23 -0
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +2 -2
- package/dist/collection/helpers/validator/rules/valid-phone-number-rule.js +7 -2
- package/dist/collection/helpers/validator/test/rules/valid-phone-number-rule.test.js +8 -0
- package/dist/esm/{app-globals-4cca4a96.js → app-globals-c954167a.js} +2 -3
- package/dist/esm/content-state-2edba4ec.js +6600 -0
- package/dist/esm/{form-field-controller-slimmer-3535e76a.js → form-field-controller-slimmer-7a9f2b2e.js} +1 -1
- package/dist/esm/{image-annotation-action-3da42221.js → image-annotation-action-b6668f48.js} +1 -2
- package/dist/esm/{index-6e05b241.js → index-d172bafa.js} +1 -1
- package/dist/esm/index.js +5 -6
- package/dist/esm/loader.js +9 -10
- package/dist/esm/{string-input-formatter-slimmer-d4132497.js → string-input-formatter-slimmer-418b54f0.js} +2 -2
- package/dist/esm/{sub-state-notify-slimmer-51151fc3.js → sub-state-notify-slimmer-b36fd081.js} +1 -1
- package/dist/esm/{sub-state-observer-slimmer-d77a1c46.js → sub-state-observer-slimmer-09452523.js} +1 -1
- package/dist/esm/vega-button-group_2.entry.js +3 -3
- package/dist/esm/vega-calendar_3.entry.js +3 -3
- package/dist/esm/vega-checkbox_2.entry.js +2 -2
- package/dist/esm/vega-color-picker.entry.js +2 -2
- package/dist/esm/vega-combo-box.entry.js +2 -2
- package/dist/esm/vega-date-picker_2.entry.js +5 -5
- package/dist/esm/vega-dropdown_5.entry.js +3 -3
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-file-uploader.entry.js +2 -2
- package/dist/esm/vega-form.entry.js +2 -2
- package/dist/esm/vega-image-uploader.entry.js +2 -2
- package/dist/esm/vega-input-credit-card.entry.js +2 -2
- package/dist/esm/vega-input-numeric.entry.js +3 -3
- package/dist/esm/vega-input-phone-number.entry.js +33 -9
- package/dist/esm/vega-input-range.entry.js +2 -2
- package/dist/esm/vega-input-select.entry.js +2 -2
- package/dist/esm/vega-input.entry.js +5 -5
- package/dist/esm/{vega-internal-event-id-d0690d0d.js → vega-internal-event-id-f269c42f.js} +1 -1
- package/dist/esm/vega-left-nav_5.entry.js +3 -3
- package/dist/esm/vega-popover_2.entry.js +15 -1
- package/dist/esm/vega-radio_2.entry.js +2 -2
- package/dist/esm/vega-rich-text-content.entry.js +6 -7
- package/dist/esm/vega-rich-text-editor_4.entry.js +21 -25
- package/dist/esm/vega-selection-chip_2.entry.js +4 -4
- package/dist/esm/vega-selection-tile_2.entry.js +4 -4
- package/dist/esm/vega-sidenav_3.entry.js +3 -3
- package/dist/esm/vega-signature-capture.entry.js +2 -2
- package/dist/esm/vega-stepper.entry.js +2 -2
- package/dist/esm/vega-table_8.entry.js +3 -3
- package/dist/esm/vega-textarea.entry.js +2 -2
- package/dist/esm/vega-time-picker_2.entry.js +2 -2
- package/dist/esm/vega-toggle-switch.entry.js +2 -2
- package/dist/esm/vega.js +9 -10
- package/dist/types/components/vega-input-phone-number/slimmers/controllers/vega-input-phone-number-value-controller.d.ts +7 -0
- package/dist/types/components/vega-popover/slimmers/controllers/vega-popover-appender-controller.d.ts +1 -0
- package/dist/types/components/vega-popover/vega-popover.d.ts +10 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy-registry.d.ts +37 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/action-handle-strategy.abstract.d.ts +66 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-link-group-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/block-update-text-style-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/image-set-annotation-map-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-split-text-strategy.d.ts +47 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/apply-annotation-strategies/node-update-annotation-map-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-blocks-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-append-nodes-strategy.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-image-strategy.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-node-content-strategy.d.ts +61 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-delete-text-content-strategy.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-after-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-blocks-before-strategy.d.ts +23 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-image-into-text-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-strategy.d.ts +30 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-line-break-with-blocks-strategy.d.ts +36 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-new-paragraph-strategy.d.ts +29 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-after-node-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-insert-nodes-before-node-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-merge-nodes-strategy.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-child-block-strategy.d.ts +13 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-remove-node-strategy.d.ts +17 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-node-with-nodes-strategy.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-replace-nodes-strategy.d.ts +16 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-image-node-strategy.d.ts +30 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-split-with-text-node-strategy.d.ts +24 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/block-transform-to-list-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-block-insert-image-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-line-break-with-blocks-strategy.d.ts +27 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-insert-new-paragraph-strategy.d.ts +21 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/image-update-url-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-insert-image-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-delete-text-content-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-image-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-insert-new-paragraph-strategy.d.ts +38 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-nest-list-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-remove-node-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-item-replace-nest-list-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-remove-list-item-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-list-strategy.d.ts +12 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/list-transform-to-paragraph-strategy.d.ts +19 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-replace-selected-text-strategy.d.ts +20 -0
- package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/node-update-text-strategy.d.ts +15 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/image-update-url-action.d.ts +11 -0
- package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +2 -2
- package/dist/types/components/vega-rich-text-editor/dto/blocks/block.abstract.d.ts +1 -79
- package/dist/types/components/vega-rich-text-editor/dto/blocks/image-block.d.ts +3 -77
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-block.d.ts +0 -38
- package/dist/types/components/vega-rich-text-editor/dto/blocks/list-item-block.d.ts +3 -58
- package/dist/types/components/vega-rich-text-editor/dto/blocks/text-block.d.ts +5 -93
- package/dist/types/components/vega-rich-text-editor/dto/content-state.d.ts +1 -2
- package/dist/types/components/vega-rich-text-editor/dto/nodes/text-node.d.ts +0 -43
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/action-handle-strategy-registry.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/block-insert-line-break-with-blocks-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/content-state-strategy-registry.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-block-strategy-register.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-set-annotation-map-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/image-update-url-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-block-strategy-register.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/list-item-strategy-register.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-split-text-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/node-update-annotation-map-strategy.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/text-block-strategy-register.test.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/test/dto/action-handle-strategies/update-selected-text-strategy.test.d.ts +1 -0
- package/dist/types/components.d.ts +14 -0
- package/dist/types/helpers/validator/rules/valid-phone-number-rule.d.ts +3 -1
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-ba077ca8.entry.js → p-073beb31.entry.js} +1 -1
- package/dist/vega/{p-6419e13e.entry.js → p-0b697841.entry.js} +1 -1
- package/dist/vega/p-0cc1ad76.js +1 -0
- package/dist/vega/{p-29d6ec6c.js → p-239bae84.js} +1 -1
- package/dist/vega/{p-7198d675.entry.js → p-24ac5151.entry.js} +1 -1
- package/dist/vega/{p-cb4fd6e1.entry.js → p-257b1bc2.entry.js} +1 -1
- package/dist/vega/{p-ba2833c0.entry.js → p-3c85a11b.entry.js} +1 -1
- package/dist/vega/{p-b517ed15.js → p-49bf2b3a.js} +1 -1
- package/dist/vega/p-4a8db510.entry.js +1 -0
- package/dist/vega/p-4b19706c.entry.js +1 -0
- package/dist/vega/{p-bf4996d5.entry.js → p-4e436842.entry.js} +1 -1
- package/dist/vega/{p-12fe63c1.entry.js → p-59834ea4.entry.js} +1 -1
- package/dist/vega/{p-50eabdca.entry.js → p-59cfed37.entry.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/p-60e1ebe1.entry.js +1 -0
- package/dist/vega/{p-23fd9401.entry.js → p-629bd266.entry.js} +1 -1
- package/dist/vega/p-6408d3dc.entry.js +1 -0
- package/dist/vega/{p-3e8f9fcf.entry.js → p-64e0c944.entry.js} +1 -1
- package/dist/vega/{p-b9a0f136.entry.js → p-64e49394.entry.js} +1 -1
- package/dist/vega/p-6e5db02b.js +1 -0
- package/dist/vega/{p-9689ad99.entry.js → p-74ff73d6.entry.js} +1 -1
- package/dist/vega/{p-b809f3d7.entry.js → p-8120e7a1.entry.js} +1 -1
- package/dist/vega/p-894c067a.entry.js +1 -0
- package/dist/vega/{p-e9785742.entry.js → p-989b36a2.entry.js} +1 -1
- package/dist/vega/{p-a2a34239.entry.js → p-9ee23f34.entry.js} +1 -1
- package/dist/vega/{p-34bd9204.js → p-a9e1123a.js} +1 -1
- package/dist/vega/{p-267cde46.entry.js → p-b071be5c.entry.js} +1 -1
- package/dist/vega/{p-1b67c443.entry.js → p-b6bffdf3.entry.js} +1 -1
- package/dist/vega/{p-20326c64.js → p-bd0116f9.js} +1 -1
- package/dist/vega/{p-a7e078ac.entry.js → p-bf6d3c00.entry.js} +1 -1
- package/dist/vega/{p-ecaf4cfa.entry.js → p-c00fde35.entry.js} +1 -1
- package/dist/vega/{p-7baa4fae.entry.js → p-c2e96537.entry.js} +1 -1
- package/dist/vega/{p-3cb90bdf.entry.js → p-ce94a9c5.entry.js} +1 -1
- package/dist/vega/{p-904b489a.entry.js → p-d03945cb.entry.js} +1 -1
- package/dist/vega/p-d2e6090a.js +1 -0
- package/dist/vega/{p-348e95ba.js → p-d2ff56d8.js} +1 -1
- package/dist/vega/p-e0d3ca2d.js +1 -0
- package/dist/vega/{p-ee2e4bff.entry.js → p-ea78ddfa.entry.js} +1 -1
- package/dist/vega/{p-e9a5bd12.entry.js → p-f1ebe86b.entry.js} +1 -1
- package/dist/vega/{p-497f2f86.entry.js → p-fc49a98e.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/content-state-f97d3278.js +0 -2990
- package/dist/cjs/node-annotation.abstract-4f6df9cf.js +0 -3223
- package/dist/collection/components/vega-rich-text-editor/dto/actions/clear-child-nodes-action.js +0 -12
- package/dist/collection/components/vega-rich-text-editor/dto/helper/block-base-operator.js +0 -47
- package/dist/esm/content-state-ccf5f960.js +0 -2954
- package/dist/esm/node-annotation.abstract-b2e36bc4.js +0 -3214
- package/dist/types/components/vega-rich-text-editor/dto/actions/clear-child-nodes-action.d.ts +0 -9
- package/dist/types/components/vega-rich-text-editor/dto/helper/block-base-operator.d.ts +0 -24
- package/dist/vega/p-0461e318.js +0 -1
- package/dist/vega/p-1d93b3a9.js +0 -1
- package/dist/vega/p-2fecbcf9.entry.js +0 -1
- package/dist/vega/p-52a8a4f8.js +0 -1
- package/dist/vega/p-7edcb8d0.entry.js +0 -1
- package/dist/vega/p-9728d571.entry.js +0 -1
- package/dist/vega/p-a7f40a65.entry.js +0 -1
- package/dist/vega/p-a8b16ff2.js +0 -1
- package/dist/vega/p-aed80794.entry.js +0 -1
- package/dist/vega/p-f86ec91b.js +0 -1
|
@@ -1,3223 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const _commonjsHelpers = require('./_commonjsHelpers-537d719a.js');
|
|
4
|
-
const staticSubjectTitle = require('./static-subject-title-c589a1bd.js');
|
|
5
|
-
const changeManager = require('./change-manager-a297e4d2.js');
|
|
6
|
-
const observer = require('./observer-f49483e8.js');
|
|
7
|
-
require('./global-slimmer-registry-b3bce7e0.js');
|
|
8
|
-
const createPublicApiRuntimeMetricsSlimmer = require('./create-public-api-runtime-metrics-slimmer-54c3f73b.js');
|
|
9
|
-
const domNodeSubjectFactory = require('./dom-node-subject-factory-ce1777a9.js');
|
|
10
|
-
const vegaInternalEventId = require('./vega-internal-event-id-bda63e14.js');
|
|
11
|
-
|
|
12
|
-
var tinycolor = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
13
|
-
// This file is autogenerated. It's used to publish CJS to npm.
|
|
14
|
-
(function (global, factory) {
|
|
15
|
-
module.exports = factory() ;
|
|
16
|
-
})(_commonjsHelpers.commonjsGlobal, (function () {
|
|
17
|
-
// https://github.com/bgrins/TinyColor
|
|
18
|
-
// Brian Grinstead, MIT License
|
|
19
|
-
|
|
20
|
-
const trimLeft = /^\s+/;
|
|
21
|
-
const trimRight = /\s+$/;
|
|
22
|
-
|
|
23
|
-
function tinycolor(color, opts) {
|
|
24
|
-
color = color ? color : "";
|
|
25
|
-
opts = opts || {};
|
|
26
|
-
|
|
27
|
-
// If input is already a tinycolor, return itself
|
|
28
|
-
if (color instanceof tinycolor) {
|
|
29
|
-
return color;
|
|
30
|
-
}
|
|
31
|
-
// If we are called as a function, call using new instead
|
|
32
|
-
if (!(this instanceof tinycolor)) {
|
|
33
|
-
return new tinycolor(color, opts);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var rgb = inputToRGB(color);
|
|
37
|
-
(this._originalInput = color),
|
|
38
|
-
(this._r = rgb.r),
|
|
39
|
-
(this._g = rgb.g),
|
|
40
|
-
(this._b = rgb.b),
|
|
41
|
-
(this._a = rgb.a),
|
|
42
|
-
(this._roundA = Math.round(100 * this._a) / 100),
|
|
43
|
-
(this._format = opts.format || rgb.format);
|
|
44
|
-
this._gradientType = opts.gradientType;
|
|
45
|
-
|
|
46
|
-
// Don't let the range of [0,255] come back in [0,1].
|
|
47
|
-
// Potentially lose a little bit of precision here, but will fix issues where
|
|
48
|
-
// .5 gets interpreted as half of the total, instead of half of 1
|
|
49
|
-
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
|
50
|
-
if (this._r < 1) this._r = Math.round(this._r);
|
|
51
|
-
if (this._g < 1) this._g = Math.round(this._g);
|
|
52
|
-
if (this._b < 1) this._b = Math.round(this._b);
|
|
53
|
-
|
|
54
|
-
this._ok = rgb.ok;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
tinycolor.prototype = {
|
|
58
|
-
isDark: function () {
|
|
59
|
-
return this.getBrightness() < 128;
|
|
60
|
-
},
|
|
61
|
-
isLight: function () {
|
|
62
|
-
return !this.isDark();
|
|
63
|
-
},
|
|
64
|
-
isValid: function () {
|
|
65
|
-
return this._ok;
|
|
66
|
-
},
|
|
67
|
-
getOriginalInput: function () {
|
|
68
|
-
return this._originalInput;
|
|
69
|
-
},
|
|
70
|
-
getFormat: function () {
|
|
71
|
-
return this._format;
|
|
72
|
-
},
|
|
73
|
-
getAlpha: function () {
|
|
74
|
-
return this._a;
|
|
75
|
-
},
|
|
76
|
-
getBrightness: function () {
|
|
77
|
-
//http://www.w3.org/TR/AERT#color-contrast
|
|
78
|
-
var rgb = this.toRgb();
|
|
79
|
-
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
|
80
|
-
},
|
|
81
|
-
getLuminance: function () {
|
|
82
|
-
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
83
|
-
var rgb = this.toRgb();
|
|
84
|
-
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
85
|
-
RsRGB = rgb.r / 255;
|
|
86
|
-
GsRGB = rgb.g / 255;
|
|
87
|
-
BsRGB = rgb.b / 255;
|
|
88
|
-
|
|
89
|
-
if (RsRGB <= 0.03928) R = RsRGB / 12.92;
|
|
90
|
-
else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
91
|
-
if (GsRGB <= 0.03928) G = GsRGB / 12.92;
|
|
92
|
-
else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
93
|
-
if (BsRGB <= 0.03928) B = BsRGB / 12.92;
|
|
94
|
-
else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
95
|
-
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
96
|
-
},
|
|
97
|
-
setAlpha: function (value) {
|
|
98
|
-
this._a = boundAlpha(value);
|
|
99
|
-
this._roundA = Math.round(100 * this._a) / 100;
|
|
100
|
-
return this;
|
|
101
|
-
},
|
|
102
|
-
toHsv: function () {
|
|
103
|
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
104
|
-
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
|
|
105
|
-
},
|
|
106
|
-
toHsvString: function () {
|
|
107
|
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
108
|
-
var h = Math.round(hsv.h * 360),
|
|
109
|
-
s = Math.round(hsv.s * 100),
|
|
110
|
-
v = Math.round(hsv.v * 100);
|
|
111
|
-
return this._a == 1
|
|
112
|
-
? "hsv(" + h + ", " + s + "%, " + v + "%)"
|
|
113
|
-
: "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
|
|
114
|
-
},
|
|
115
|
-
toHsl: function () {
|
|
116
|
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
117
|
-
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
|
|
118
|
-
},
|
|
119
|
-
toHslString: function () {
|
|
120
|
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
121
|
-
var h = Math.round(hsl.h * 360),
|
|
122
|
-
s = Math.round(hsl.s * 100),
|
|
123
|
-
l = Math.round(hsl.l * 100);
|
|
124
|
-
return this._a == 1
|
|
125
|
-
? "hsl(" + h + ", " + s + "%, " + l + "%)"
|
|
126
|
-
: "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
|
|
127
|
-
},
|
|
128
|
-
toHex: function (allow3Char) {
|
|
129
|
-
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
130
|
-
},
|
|
131
|
-
toHexString: function (allow3Char) {
|
|
132
|
-
return "#" + this.toHex(allow3Char);
|
|
133
|
-
},
|
|
134
|
-
toHex8: function (allow4Char) {
|
|
135
|
-
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
136
|
-
},
|
|
137
|
-
toHex8String: function (allow4Char) {
|
|
138
|
-
return "#" + this.toHex8(allow4Char);
|
|
139
|
-
},
|
|
140
|
-
toRgb: function () {
|
|
141
|
-
return {
|
|
142
|
-
r: Math.round(this._r),
|
|
143
|
-
g: Math.round(this._g),
|
|
144
|
-
b: Math.round(this._b),
|
|
145
|
-
a: this._a,
|
|
146
|
-
};
|
|
147
|
-
},
|
|
148
|
-
toRgbString: function () {
|
|
149
|
-
return this._a == 1
|
|
150
|
-
? "rgb(" +
|
|
151
|
-
Math.round(this._r) +
|
|
152
|
-
", " +
|
|
153
|
-
Math.round(this._g) +
|
|
154
|
-
", " +
|
|
155
|
-
Math.round(this._b) +
|
|
156
|
-
")"
|
|
157
|
-
: "rgba(" +
|
|
158
|
-
Math.round(this._r) +
|
|
159
|
-
", " +
|
|
160
|
-
Math.round(this._g) +
|
|
161
|
-
", " +
|
|
162
|
-
Math.round(this._b) +
|
|
163
|
-
", " +
|
|
164
|
-
this._roundA +
|
|
165
|
-
")";
|
|
166
|
-
},
|
|
167
|
-
toPercentageRgb: function () {
|
|
168
|
-
return {
|
|
169
|
-
r: Math.round(bound01(this._r, 255) * 100) + "%",
|
|
170
|
-
g: Math.round(bound01(this._g, 255) * 100) + "%",
|
|
171
|
-
b: Math.round(bound01(this._b, 255) * 100) + "%",
|
|
172
|
-
a: this._a,
|
|
173
|
-
};
|
|
174
|
-
},
|
|
175
|
-
toPercentageRgbString: function () {
|
|
176
|
-
return this._a == 1
|
|
177
|
-
? "rgb(" +
|
|
178
|
-
Math.round(bound01(this._r, 255) * 100) +
|
|
179
|
-
"%, " +
|
|
180
|
-
Math.round(bound01(this._g, 255) * 100) +
|
|
181
|
-
"%, " +
|
|
182
|
-
Math.round(bound01(this._b, 255) * 100) +
|
|
183
|
-
"%)"
|
|
184
|
-
: "rgba(" +
|
|
185
|
-
Math.round(bound01(this._r, 255) * 100) +
|
|
186
|
-
"%, " +
|
|
187
|
-
Math.round(bound01(this._g, 255) * 100) +
|
|
188
|
-
"%, " +
|
|
189
|
-
Math.round(bound01(this._b, 255) * 100) +
|
|
190
|
-
"%, " +
|
|
191
|
-
this._roundA +
|
|
192
|
-
")";
|
|
193
|
-
},
|
|
194
|
-
toName: function () {
|
|
195
|
-
if (this._a === 0) {
|
|
196
|
-
return "transparent";
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (this._a < 1) {
|
|
200
|
-
return false;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
204
|
-
},
|
|
205
|
-
toFilter: function (secondColor) {
|
|
206
|
-
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
207
|
-
var secondHex8String = hex8String;
|
|
208
|
-
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
209
|
-
|
|
210
|
-
if (secondColor) {
|
|
211
|
-
var s = tinycolor(secondColor);
|
|
212
|
-
secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return (
|
|
216
|
-
"progid:DXImageTransform.Microsoft.gradient(" +
|
|
217
|
-
gradientType +
|
|
218
|
-
"startColorstr=" +
|
|
219
|
-
hex8String +
|
|
220
|
-
",endColorstr=" +
|
|
221
|
-
secondHex8String +
|
|
222
|
-
")"
|
|
223
|
-
);
|
|
224
|
-
},
|
|
225
|
-
toString: function (format) {
|
|
226
|
-
var formatSet = !!format;
|
|
227
|
-
format = format || this._format;
|
|
228
|
-
|
|
229
|
-
var formattedString = false;
|
|
230
|
-
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
231
|
-
var needsAlphaFormat =
|
|
232
|
-
!formatSet &&
|
|
233
|
-
hasAlpha &&
|
|
234
|
-
(format === "hex" ||
|
|
235
|
-
format === "hex6" ||
|
|
236
|
-
format === "hex3" ||
|
|
237
|
-
format === "hex4" ||
|
|
238
|
-
format === "hex8" ||
|
|
239
|
-
format === "name");
|
|
240
|
-
|
|
241
|
-
if (needsAlphaFormat) {
|
|
242
|
-
// Special case for "transparent", all other non-alpha formats
|
|
243
|
-
// will return rgba when there is transparency.
|
|
244
|
-
if (format === "name" && this._a === 0) {
|
|
245
|
-
return this.toName();
|
|
246
|
-
}
|
|
247
|
-
return this.toRgbString();
|
|
248
|
-
}
|
|
249
|
-
if (format === "rgb") {
|
|
250
|
-
formattedString = this.toRgbString();
|
|
251
|
-
}
|
|
252
|
-
if (format === "prgb") {
|
|
253
|
-
formattedString = this.toPercentageRgbString();
|
|
254
|
-
}
|
|
255
|
-
if (format === "hex" || format === "hex6") {
|
|
256
|
-
formattedString = this.toHexString();
|
|
257
|
-
}
|
|
258
|
-
if (format === "hex3") {
|
|
259
|
-
formattedString = this.toHexString(true);
|
|
260
|
-
}
|
|
261
|
-
if (format === "hex4") {
|
|
262
|
-
formattedString = this.toHex8String(true);
|
|
263
|
-
}
|
|
264
|
-
if (format === "hex8") {
|
|
265
|
-
formattedString = this.toHex8String();
|
|
266
|
-
}
|
|
267
|
-
if (format === "name") {
|
|
268
|
-
formattedString = this.toName();
|
|
269
|
-
}
|
|
270
|
-
if (format === "hsl") {
|
|
271
|
-
formattedString = this.toHslString();
|
|
272
|
-
}
|
|
273
|
-
if (format === "hsv") {
|
|
274
|
-
formattedString = this.toHsvString();
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
return formattedString || this.toHexString();
|
|
278
|
-
},
|
|
279
|
-
clone: function () {
|
|
280
|
-
return tinycolor(this.toString());
|
|
281
|
-
},
|
|
282
|
-
|
|
283
|
-
_applyModification: function (fn, args) {
|
|
284
|
-
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
285
|
-
this._r = color._r;
|
|
286
|
-
this._g = color._g;
|
|
287
|
-
this._b = color._b;
|
|
288
|
-
this.setAlpha(color._a);
|
|
289
|
-
return this;
|
|
290
|
-
},
|
|
291
|
-
lighten: function () {
|
|
292
|
-
return this._applyModification(lighten, arguments);
|
|
293
|
-
},
|
|
294
|
-
brighten: function () {
|
|
295
|
-
return this._applyModification(brighten, arguments);
|
|
296
|
-
},
|
|
297
|
-
darken: function () {
|
|
298
|
-
return this._applyModification(darken, arguments);
|
|
299
|
-
},
|
|
300
|
-
desaturate: function () {
|
|
301
|
-
return this._applyModification(desaturate, arguments);
|
|
302
|
-
},
|
|
303
|
-
saturate: function () {
|
|
304
|
-
return this._applyModification(saturate, arguments);
|
|
305
|
-
},
|
|
306
|
-
greyscale: function () {
|
|
307
|
-
return this._applyModification(greyscale, arguments);
|
|
308
|
-
},
|
|
309
|
-
spin: function () {
|
|
310
|
-
return this._applyModification(spin, arguments);
|
|
311
|
-
},
|
|
312
|
-
|
|
313
|
-
_applyCombination: function (fn, args) {
|
|
314
|
-
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
315
|
-
},
|
|
316
|
-
analogous: function () {
|
|
317
|
-
return this._applyCombination(analogous, arguments);
|
|
318
|
-
},
|
|
319
|
-
complement: function () {
|
|
320
|
-
return this._applyCombination(complement, arguments);
|
|
321
|
-
},
|
|
322
|
-
monochromatic: function () {
|
|
323
|
-
return this._applyCombination(monochromatic, arguments);
|
|
324
|
-
},
|
|
325
|
-
splitcomplement: function () {
|
|
326
|
-
return this._applyCombination(splitcomplement, arguments);
|
|
327
|
-
},
|
|
328
|
-
// Disabled until https://github.com/bgrins/TinyColor/issues/254
|
|
329
|
-
// polyad: function (number) {
|
|
330
|
-
// return this._applyCombination(polyad, [number]);
|
|
331
|
-
// },
|
|
332
|
-
triad: function () {
|
|
333
|
-
return this._applyCombination(polyad, [3]);
|
|
334
|
-
},
|
|
335
|
-
tetrad: function () {
|
|
336
|
-
return this._applyCombination(polyad, [4]);
|
|
337
|
-
},
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
// If input is an object, force 1 into "1.0" to handle ratios properly
|
|
341
|
-
// String input requires "1.0" as input, so 1 will be treated as 1
|
|
342
|
-
tinycolor.fromRatio = function (color, opts) {
|
|
343
|
-
if (typeof color == "object") {
|
|
344
|
-
var newColor = {};
|
|
345
|
-
for (var i in color) {
|
|
346
|
-
if (color.hasOwnProperty(i)) {
|
|
347
|
-
if (i === "a") {
|
|
348
|
-
newColor[i] = color[i];
|
|
349
|
-
} else {
|
|
350
|
-
newColor[i] = convertToPercentage(color[i]);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
color = newColor;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
return tinycolor(color, opts);
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
// Given a string or object, convert that input to RGB
|
|
361
|
-
// Possible string inputs:
|
|
362
|
-
//
|
|
363
|
-
// "red"
|
|
364
|
-
// "#f00" or "f00"
|
|
365
|
-
// "#ff0000" or "ff0000"
|
|
366
|
-
// "#ff000000" or "ff000000"
|
|
367
|
-
// "rgb 255 0 0" or "rgb (255, 0, 0)"
|
|
368
|
-
// "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
|
369
|
-
// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
|
370
|
-
// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
|
371
|
-
// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
|
372
|
-
// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
|
373
|
-
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
374
|
-
//
|
|
375
|
-
function inputToRGB(color) {
|
|
376
|
-
var rgb = { r: 0, g: 0, b: 0 };
|
|
377
|
-
var a = 1;
|
|
378
|
-
var s = null;
|
|
379
|
-
var v = null;
|
|
380
|
-
var l = null;
|
|
381
|
-
var ok = false;
|
|
382
|
-
var format = false;
|
|
383
|
-
|
|
384
|
-
if (typeof color == "string") {
|
|
385
|
-
color = stringInputToObject(color);
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
if (typeof color == "object") {
|
|
389
|
-
if (
|
|
390
|
-
isValidCSSUnit(color.r) &&
|
|
391
|
-
isValidCSSUnit(color.g) &&
|
|
392
|
-
isValidCSSUnit(color.b)
|
|
393
|
-
) {
|
|
394
|
-
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
395
|
-
ok = true;
|
|
396
|
-
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
397
|
-
} else if (
|
|
398
|
-
isValidCSSUnit(color.h) &&
|
|
399
|
-
isValidCSSUnit(color.s) &&
|
|
400
|
-
isValidCSSUnit(color.v)
|
|
401
|
-
) {
|
|
402
|
-
s = convertToPercentage(color.s);
|
|
403
|
-
v = convertToPercentage(color.v);
|
|
404
|
-
rgb = hsvToRgb(color.h, s, v);
|
|
405
|
-
ok = true;
|
|
406
|
-
format = "hsv";
|
|
407
|
-
} else if (
|
|
408
|
-
isValidCSSUnit(color.h) &&
|
|
409
|
-
isValidCSSUnit(color.s) &&
|
|
410
|
-
isValidCSSUnit(color.l)
|
|
411
|
-
) {
|
|
412
|
-
s = convertToPercentage(color.s);
|
|
413
|
-
l = convertToPercentage(color.l);
|
|
414
|
-
rgb = hslToRgb(color.h, s, l);
|
|
415
|
-
ok = true;
|
|
416
|
-
format = "hsl";
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
if (color.hasOwnProperty("a")) {
|
|
420
|
-
a = color.a;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
a = boundAlpha(a);
|
|
425
|
-
|
|
426
|
-
return {
|
|
427
|
-
ok: ok,
|
|
428
|
-
format: color.format || format,
|
|
429
|
-
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
430
|
-
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
431
|
-
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
432
|
-
a: a,
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
// Conversion Functions
|
|
437
|
-
// --------------------
|
|
438
|
-
|
|
439
|
-
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
|
|
440
|
-
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
|
441
|
-
|
|
442
|
-
// `rgbToRgb`
|
|
443
|
-
// Handle bounds / percentage checking to conform to CSS color spec
|
|
444
|
-
// <http://www.w3.org/TR/css3-color/>
|
|
445
|
-
// *Assumes:* r, g, b in [0, 255] or [0, 1]
|
|
446
|
-
// *Returns:* { r, g, b } in [0, 255]
|
|
447
|
-
function rgbToRgb(r, g, b) {
|
|
448
|
-
return {
|
|
449
|
-
r: bound01(r, 255) * 255,
|
|
450
|
-
g: bound01(g, 255) * 255,
|
|
451
|
-
b: bound01(b, 255) * 255,
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
// `rgbToHsl`
|
|
456
|
-
// Converts an RGB color value to HSL.
|
|
457
|
-
// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
|
|
458
|
-
// *Returns:* { h, s, l } in [0,1]
|
|
459
|
-
function rgbToHsl(r, g, b) {
|
|
460
|
-
r = bound01(r, 255);
|
|
461
|
-
g = bound01(g, 255);
|
|
462
|
-
b = bound01(b, 255);
|
|
463
|
-
|
|
464
|
-
var max = Math.max(r, g, b),
|
|
465
|
-
min = Math.min(r, g, b);
|
|
466
|
-
var h,
|
|
467
|
-
s,
|
|
468
|
-
l = (max + min) / 2;
|
|
469
|
-
|
|
470
|
-
if (max == min) {
|
|
471
|
-
h = s = 0; // achromatic
|
|
472
|
-
} else {
|
|
473
|
-
var d = max - min;
|
|
474
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
475
|
-
switch (max) {
|
|
476
|
-
case r:
|
|
477
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
478
|
-
break;
|
|
479
|
-
case g:
|
|
480
|
-
h = (b - r) / d + 2;
|
|
481
|
-
break;
|
|
482
|
-
case b:
|
|
483
|
-
h = (r - g) / d + 4;
|
|
484
|
-
break;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
h /= 6;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
return { h: h, s: s, l: l };
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
// `hslToRgb`
|
|
494
|
-
// Converts an HSL color value to RGB.
|
|
495
|
-
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
|
|
496
|
-
// *Returns:* { r, g, b } in the set [0, 255]
|
|
497
|
-
function hslToRgb(h, s, l) {
|
|
498
|
-
var r, g, b;
|
|
499
|
-
|
|
500
|
-
h = bound01(h, 360);
|
|
501
|
-
s = bound01(s, 100);
|
|
502
|
-
l = bound01(l, 100);
|
|
503
|
-
|
|
504
|
-
function hue2rgb(p, q, t) {
|
|
505
|
-
if (t < 0) t += 1;
|
|
506
|
-
if (t > 1) t -= 1;
|
|
507
|
-
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
508
|
-
if (t < 1 / 2) return q;
|
|
509
|
-
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
510
|
-
return p;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
if (s === 0) {
|
|
514
|
-
r = g = b = l; // achromatic
|
|
515
|
-
} else {
|
|
516
|
-
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
517
|
-
var p = 2 * l - q;
|
|
518
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
519
|
-
g = hue2rgb(p, q, h);
|
|
520
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
// `rgbToHsv`
|
|
527
|
-
// Converts an RGB color value to HSV
|
|
528
|
-
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
|
529
|
-
// *Returns:* { h, s, v } in [0,1]
|
|
530
|
-
function rgbToHsv(r, g, b) {
|
|
531
|
-
r = bound01(r, 255);
|
|
532
|
-
g = bound01(g, 255);
|
|
533
|
-
b = bound01(b, 255);
|
|
534
|
-
|
|
535
|
-
var max = Math.max(r, g, b),
|
|
536
|
-
min = Math.min(r, g, b);
|
|
537
|
-
var h,
|
|
538
|
-
s,
|
|
539
|
-
v = max;
|
|
540
|
-
|
|
541
|
-
var d = max - min;
|
|
542
|
-
s = max === 0 ? 0 : d / max;
|
|
543
|
-
|
|
544
|
-
if (max == min) {
|
|
545
|
-
h = 0; // achromatic
|
|
546
|
-
} else {
|
|
547
|
-
switch (max) {
|
|
548
|
-
case r:
|
|
549
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
550
|
-
break;
|
|
551
|
-
case g:
|
|
552
|
-
h = (b - r) / d + 2;
|
|
553
|
-
break;
|
|
554
|
-
case b:
|
|
555
|
-
h = (r - g) / d + 4;
|
|
556
|
-
break;
|
|
557
|
-
}
|
|
558
|
-
h /= 6;
|
|
559
|
-
}
|
|
560
|
-
return { h: h, s: s, v: v };
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
// `hsvToRgb`
|
|
564
|
-
// Converts an HSV color value to RGB.
|
|
565
|
-
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
|
566
|
-
// *Returns:* { r, g, b } in the set [0, 255]
|
|
567
|
-
function hsvToRgb(h, s, v) {
|
|
568
|
-
h = bound01(h, 360) * 6;
|
|
569
|
-
s = bound01(s, 100);
|
|
570
|
-
v = bound01(v, 100);
|
|
571
|
-
|
|
572
|
-
var i = Math.floor(h),
|
|
573
|
-
f = h - i,
|
|
574
|
-
p = v * (1 - s),
|
|
575
|
-
q = v * (1 - f * s),
|
|
576
|
-
t = v * (1 - (1 - f) * s),
|
|
577
|
-
mod = i % 6,
|
|
578
|
-
r = [v, q, p, p, t, v][mod],
|
|
579
|
-
g = [t, v, v, q, p, p][mod],
|
|
580
|
-
b = [p, p, t, v, v, q][mod];
|
|
581
|
-
|
|
582
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
// `rgbToHex`
|
|
586
|
-
// Converts an RGB color to hex
|
|
587
|
-
// Assumes r, g, and b are contained in the set [0, 255]
|
|
588
|
-
// Returns a 3 or 6 character hex
|
|
589
|
-
function rgbToHex(r, g, b, allow3Char) {
|
|
590
|
-
var hex = [
|
|
591
|
-
pad2(Math.round(r).toString(16)),
|
|
592
|
-
pad2(Math.round(g).toString(16)),
|
|
593
|
-
pad2(Math.round(b).toString(16)),
|
|
594
|
-
];
|
|
595
|
-
|
|
596
|
-
// Return a 3 character hex if possible
|
|
597
|
-
if (
|
|
598
|
-
allow3Char &&
|
|
599
|
-
hex[0].charAt(0) == hex[0].charAt(1) &&
|
|
600
|
-
hex[1].charAt(0) == hex[1].charAt(1) &&
|
|
601
|
-
hex[2].charAt(0) == hex[2].charAt(1)
|
|
602
|
-
) {
|
|
603
|
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
return hex.join("");
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
// `rgbaToHex`
|
|
610
|
-
// Converts an RGBA color plus alpha transparency to hex
|
|
611
|
-
// Assumes r, g, b are contained in the set [0, 255] and
|
|
612
|
-
// a in [0, 1]. Returns a 4 or 8 character rgba hex
|
|
613
|
-
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
614
|
-
var hex = [
|
|
615
|
-
pad2(Math.round(r).toString(16)),
|
|
616
|
-
pad2(Math.round(g).toString(16)),
|
|
617
|
-
pad2(Math.round(b).toString(16)),
|
|
618
|
-
pad2(convertDecimalToHex(a)),
|
|
619
|
-
];
|
|
620
|
-
|
|
621
|
-
// Return a 4 character hex if possible
|
|
622
|
-
if (
|
|
623
|
-
allow4Char &&
|
|
624
|
-
hex[0].charAt(0) == hex[0].charAt(1) &&
|
|
625
|
-
hex[1].charAt(0) == hex[1].charAt(1) &&
|
|
626
|
-
hex[2].charAt(0) == hex[2].charAt(1) &&
|
|
627
|
-
hex[3].charAt(0) == hex[3].charAt(1)
|
|
628
|
-
) {
|
|
629
|
-
return (
|
|
630
|
-
hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0)
|
|
631
|
-
);
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
return hex.join("");
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
// `rgbaToArgbHex`
|
|
638
|
-
// Converts an RGBA color to an ARGB Hex8 string
|
|
639
|
-
// Rarely used, but required for "toFilter()"
|
|
640
|
-
function rgbaToArgbHex(r, g, b, a) {
|
|
641
|
-
var hex = [
|
|
642
|
-
pad2(convertDecimalToHex(a)),
|
|
643
|
-
pad2(Math.round(r).toString(16)),
|
|
644
|
-
pad2(Math.round(g).toString(16)),
|
|
645
|
-
pad2(Math.round(b).toString(16)),
|
|
646
|
-
];
|
|
647
|
-
|
|
648
|
-
return hex.join("");
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
// `equals`
|
|
652
|
-
// Can be called with any tinycolor input
|
|
653
|
-
tinycolor.equals = function (color1, color2) {
|
|
654
|
-
if (!color1 || !color2) return false;
|
|
655
|
-
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
|
656
|
-
};
|
|
657
|
-
|
|
658
|
-
tinycolor.random = function () {
|
|
659
|
-
return tinycolor.fromRatio({
|
|
660
|
-
r: Math.random(),
|
|
661
|
-
g: Math.random(),
|
|
662
|
-
b: Math.random(),
|
|
663
|
-
});
|
|
664
|
-
};
|
|
665
|
-
|
|
666
|
-
// Modification Functions
|
|
667
|
-
// ----------------------
|
|
668
|
-
// Thanks to less.js for some of the basics here
|
|
669
|
-
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
|
|
670
|
-
|
|
671
|
-
function desaturate(color, amount) {
|
|
672
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
673
|
-
var hsl = tinycolor(color).toHsl();
|
|
674
|
-
hsl.s -= amount / 100;
|
|
675
|
-
hsl.s = clamp01(hsl.s);
|
|
676
|
-
return tinycolor(hsl);
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
function saturate(color, amount) {
|
|
680
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
681
|
-
var hsl = tinycolor(color).toHsl();
|
|
682
|
-
hsl.s += amount / 100;
|
|
683
|
-
hsl.s = clamp01(hsl.s);
|
|
684
|
-
return tinycolor(hsl);
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
function greyscale(color) {
|
|
688
|
-
return tinycolor(color).desaturate(100);
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
function lighten(color, amount) {
|
|
692
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
693
|
-
var hsl = tinycolor(color).toHsl();
|
|
694
|
-
hsl.l += amount / 100;
|
|
695
|
-
hsl.l = clamp01(hsl.l);
|
|
696
|
-
return tinycolor(hsl);
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
function brighten(color, amount) {
|
|
700
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
701
|
-
var rgb = tinycolor(color).toRgb();
|
|
702
|
-
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
703
|
-
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
704
|
-
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
705
|
-
return tinycolor(rgb);
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
function darken(color, amount) {
|
|
709
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
710
|
-
var hsl = tinycolor(color).toHsl();
|
|
711
|
-
hsl.l -= amount / 100;
|
|
712
|
-
hsl.l = clamp01(hsl.l);
|
|
713
|
-
return tinycolor(hsl);
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
717
|
-
// Values outside of this range will be wrapped into this range.
|
|
718
|
-
function spin(color, amount) {
|
|
719
|
-
var hsl = tinycolor(color).toHsl();
|
|
720
|
-
var hue = (hsl.h + amount) % 360;
|
|
721
|
-
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
722
|
-
return tinycolor(hsl);
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
// Combination Functions
|
|
726
|
-
// ---------------------
|
|
727
|
-
// Thanks to jQuery xColor for some of the ideas behind these
|
|
728
|
-
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
|
|
729
|
-
|
|
730
|
-
function complement(color) {
|
|
731
|
-
var hsl = tinycolor(color).toHsl();
|
|
732
|
-
hsl.h = (hsl.h + 180) % 360;
|
|
733
|
-
return tinycolor(hsl);
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
function polyad(color, number) {
|
|
737
|
-
if (isNaN(number) || number <= 0) {
|
|
738
|
-
throw new Error("Argument to polyad must be a positive number");
|
|
739
|
-
}
|
|
740
|
-
var hsl = tinycolor(color).toHsl();
|
|
741
|
-
var result = [tinycolor(color)];
|
|
742
|
-
var step = 360 / number;
|
|
743
|
-
for (var i = 1; i < number; i++) {
|
|
744
|
-
result.push(tinycolor({ h: (hsl.h + i * step) % 360, s: hsl.s, l: hsl.l }));
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
return result;
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
function splitcomplement(color) {
|
|
751
|
-
var hsl = tinycolor(color).toHsl();
|
|
752
|
-
var h = hsl.h;
|
|
753
|
-
return [
|
|
754
|
-
tinycolor(color),
|
|
755
|
-
tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
|
|
756
|
-
tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l }),
|
|
757
|
-
];
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
function analogous(color, results, slices) {
|
|
761
|
-
results = results || 6;
|
|
762
|
-
slices = slices || 30;
|
|
763
|
-
|
|
764
|
-
var hsl = tinycolor(color).toHsl();
|
|
765
|
-
var part = 360 / slices;
|
|
766
|
-
var ret = [tinycolor(color)];
|
|
767
|
-
|
|
768
|
-
for (hsl.h = (hsl.h - ((part * results) >> 1) + 720) % 360; --results; ) {
|
|
769
|
-
hsl.h = (hsl.h + part) % 360;
|
|
770
|
-
ret.push(tinycolor(hsl));
|
|
771
|
-
}
|
|
772
|
-
return ret;
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
function monochromatic(color, results) {
|
|
776
|
-
results = results || 6;
|
|
777
|
-
var hsv = tinycolor(color).toHsv();
|
|
778
|
-
var h = hsv.h,
|
|
779
|
-
s = hsv.s,
|
|
780
|
-
v = hsv.v;
|
|
781
|
-
var ret = [];
|
|
782
|
-
var modification = 1 / results;
|
|
783
|
-
|
|
784
|
-
while (results--) {
|
|
785
|
-
ret.push(tinycolor({ h: h, s: s, v: v }));
|
|
786
|
-
v = (v + modification) % 1;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
return ret;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
// Utility Functions
|
|
793
|
-
// ---------------------
|
|
794
|
-
|
|
795
|
-
tinycolor.mix = function (color1, color2, amount) {
|
|
796
|
-
amount = amount === 0 ? 0 : amount || 50;
|
|
797
|
-
|
|
798
|
-
var rgb1 = tinycolor(color1).toRgb();
|
|
799
|
-
var rgb2 = tinycolor(color2).toRgb();
|
|
800
|
-
|
|
801
|
-
var p = amount / 100;
|
|
802
|
-
|
|
803
|
-
var rgba = {
|
|
804
|
-
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
805
|
-
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
806
|
-
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
|
807
|
-
a: (rgb2.a - rgb1.a) * p + rgb1.a,
|
|
808
|
-
};
|
|
809
|
-
|
|
810
|
-
return tinycolor(rgba);
|
|
811
|
-
};
|
|
812
|
-
|
|
813
|
-
// Readability Functions
|
|
814
|
-
// ---------------------
|
|
815
|
-
// <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
|
|
816
|
-
|
|
817
|
-
// `contrast`
|
|
818
|
-
// Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
|
|
819
|
-
tinycolor.readability = function (color1, color2) {
|
|
820
|
-
var c1 = tinycolor(color1);
|
|
821
|
-
var c2 = tinycolor(color2);
|
|
822
|
-
return (
|
|
823
|
-
(Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) /
|
|
824
|
-
(Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05)
|
|
825
|
-
);
|
|
826
|
-
};
|
|
827
|
-
|
|
828
|
-
// `isReadable`
|
|
829
|
-
// Ensure that foreground and background color combinations meet WCAG2 guidelines.
|
|
830
|
-
// The third argument is an optional Object.
|
|
831
|
-
// the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
|
|
832
|
-
// the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
|
|
833
|
-
// If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
|
|
834
|
-
|
|
835
|
-
// *Example*
|
|
836
|
-
// tinycolor.isReadable("#000", "#111") => false
|
|
837
|
-
// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
|
|
838
|
-
tinycolor.isReadable = function (color1, color2, wcag2) {
|
|
839
|
-
var readability = tinycolor.readability(color1, color2);
|
|
840
|
-
var wcag2Parms, out;
|
|
841
|
-
|
|
842
|
-
out = false;
|
|
843
|
-
|
|
844
|
-
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
845
|
-
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
846
|
-
case "AAsmall":
|
|
847
|
-
case "AAAlarge":
|
|
848
|
-
out = readability >= 4.5;
|
|
849
|
-
break;
|
|
850
|
-
case "AAlarge":
|
|
851
|
-
out = readability >= 3;
|
|
852
|
-
break;
|
|
853
|
-
case "AAAsmall":
|
|
854
|
-
out = readability >= 7;
|
|
855
|
-
break;
|
|
856
|
-
}
|
|
857
|
-
return out;
|
|
858
|
-
};
|
|
859
|
-
|
|
860
|
-
// `mostReadable`
|
|
861
|
-
// Given a base color and a list of possible foreground or background
|
|
862
|
-
// colors for that base, returns the most readable color.
|
|
863
|
-
// Optionally returns Black or White if the most readable color is unreadable.
|
|
864
|
-
// *Example*
|
|
865
|
-
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
|
|
866
|
-
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
|
|
867
|
-
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
|
|
868
|
-
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
|
|
869
|
-
tinycolor.mostReadable = function (baseColor, colorList, args) {
|
|
870
|
-
var bestColor = null;
|
|
871
|
-
var bestScore = 0;
|
|
872
|
-
var readability;
|
|
873
|
-
var includeFallbackColors, level, size;
|
|
874
|
-
args = args || {};
|
|
875
|
-
includeFallbackColors = args.includeFallbackColors;
|
|
876
|
-
level = args.level;
|
|
877
|
-
size = args.size;
|
|
878
|
-
|
|
879
|
-
for (var i = 0; i < colorList.length; i++) {
|
|
880
|
-
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
881
|
-
if (readability > bestScore) {
|
|
882
|
-
bestScore = readability;
|
|
883
|
-
bestColor = tinycolor(colorList[i]);
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
if (
|
|
888
|
-
tinycolor.isReadable(baseColor, bestColor, {
|
|
889
|
-
level: level,
|
|
890
|
-
size: size,
|
|
891
|
-
}) ||
|
|
892
|
-
!includeFallbackColors
|
|
893
|
-
) {
|
|
894
|
-
return bestColor;
|
|
895
|
-
} else {
|
|
896
|
-
args.includeFallbackColors = false;
|
|
897
|
-
return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
|
|
898
|
-
}
|
|
899
|
-
};
|
|
900
|
-
|
|
901
|
-
// Big List of Colors
|
|
902
|
-
// ------------------
|
|
903
|
-
// <https://www.w3.org/TR/css-color-4/#named-colors>
|
|
904
|
-
var names = (tinycolor.names = {
|
|
905
|
-
aliceblue: "f0f8ff",
|
|
906
|
-
antiquewhite: "faebd7",
|
|
907
|
-
aqua: "0ff",
|
|
908
|
-
aquamarine: "7fffd4",
|
|
909
|
-
azure: "f0ffff",
|
|
910
|
-
beige: "f5f5dc",
|
|
911
|
-
bisque: "ffe4c4",
|
|
912
|
-
black: "000",
|
|
913
|
-
blanchedalmond: "ffebcd",
|
|
914
|
-
blue: "00f",
|
|
915
|
-
blueviolet: "8a2be2",
|
|
916
|
-
brown: "a52a2a",
|
|
917
|
-
burlywood: "deb887",
|
|
918
|
-
burntsienna: "ea7e5d",
|
|
919
|
-
cadetblue: "5f9ea0",
|
|
920
|
-
chartreuse: "7fff00",
|
|
921
|
-
chocolate: "d2691e",
|
|
922
|
-
coral: "ff7f50",
|
|
923
|
-
cornflowerblue: "6495ed",
|
|
924
|
-
cornsilk: "fff8dc",
|
|
925
|
-
crimson: "dc143c",
|
|
926
|
-
cyan: "0ff",
|
|
927
|
-
darkblue: "00008b",
|
|
928
|
-
darkcyan: "008b8b",
|
|
929
|
-
darkgoldenrod: "b8860b",
|
|
930
|
-
darkgray: "a9a9a9",
|
|
931
|
-
darkgreen: "006400",
|
|
932
|
-
darkgrey: "a9a9a9",
|
|
933
|
-
darkkhaki: "bdb76b",
|
|
934
|
-
darkmagenta: "8b008b",
|
|
935
|
-
darkolivegreen: "556b2f",
|
|
936
|
-
darkorange: "ff8c00",
|
|
937
|
-
darkorchid: "9932cc",
|
|
938
|
-
darkred: "8b0000",
|
|
939
|
-
darksalmon: "e9967a",
|
|
940
|
-
darkseagreen: "8fbc8f",
|
|
941
|
-
darkslateblue: "483d8b",
|
|
942
|
-
darkslategray: "2f4f4f",
|
|
943
|
-
darkslategrey: "2f4f4f",
|
|
944
|
-
darkturquoise: "00ced1",
|
|
945
|
-
darkviolet: "9400d3",
|
|
946
|
-
deeppink: "ff1493",
|
|
947
|
-
deepskyblue: "00bfff",
|
|
948
|
-
dimgray: "696969",
|
|
949
|
-
dimgrey: "696969",
|
|
950
|
-
dodgerblue: "1e90ff",
|
|
951
|
-
firebrick: "b22222",
|
|
952
|
-
floralwhite: "fffaf0",
|
|
953
|
-
forestgreen: "228b22",
|
|
954
|
-
fuchsia: "f0f",
|
|
955
|
-
gainsboro: "dcdcdc",
|
|
956
|
-
ghostwhite: "f8f8ff",
|
|
957
|
-
gold: "ffd700",
|
|
958
|
-
goldenrod: "daa520",
|
|
959
|
-
gray: "808080",
|
|
960
|
-
green: "008000",
|
|
961
|
-
greenyellow: "adff2f",
|
|
962
|
-
grey: "808080",
|
|
963
|
-
honeydew: "f0fff0",
|
|
964
|
-
hotpink: "ff69b4",
|
|
965
|
-
indianred: "cd5c5c",
|
|
966
|
-
indigo: "4b0082",
|
|
967
|
-
ivory: "fffff0",
|
|
968
|
-
khaki: "f0e68c",
|
|
969
|
-
lavender: "e6e6fa",
|
|
970
|
-
lavenderblush: "fff0f5",
|
|
971
|
-
lawngreen: "7cfc00",
|
|
972
|
-
lemonchiffon: "fffacd",
|
|
973
|
-
lightblue: "add8e6",
|
|
974
|
-
lightcoral: "f08080",
|
|
975
|
-
lightcyan: "e0ffff",
|
|
976
|
-
lightgoldenrodyellow: "fafad2",
|
|
977
|
-
lightgray: "d3d3d3",
|
|
978
|
-
lightgreen: "90ee90",
|
|
979
|
-
lightgrey: "d3d3d3",
|
|
980
|
-
lightpink: "ffb6c1",
|
|
981
|
-
lightsalmon: "ffa07a",
|
|
982
|
-
lightseagreen: "20b2aa",
|
|
983
|
-
lightskyblue: "87cefa",
|
|
984
|
-
lightslategray: "789",
|
|
985
|
-
lightslategrey: "789",
|
|
986
|
-
lightsteelblue: "b0c4de",
|
|
987
|
-
lightyellow: "ffffe0",
|
|
988
|
-
lime: "0f0",
|
|
989
|
-
limegreen: "32cd32",
|
|
990
|
-
linen: "faf0e6",
|
|
991
|
-
magenta: "f0f",
|
|
992
|
-
maroon: "800000",
|
|
993
|
-
mediumaquamarine: "66cdaa",
|
|
994
|
-
mediumblue: "0000cd",
|
|
995
|
-
mediumorchid: "ba55d3",
|
|
996
|
-
mediumpurple: "9370db",
|
|
997
|
-
mediumseagreen: "3cb371",
|
|
998
|
-
mediumslateblue: "7b68ee",
|
|
999
|
-
mediumspringgreen: "00fa9a",
|
|
1000
|
-
mediumturquoise: "48d1cc",
|
|
1001
|
-
mediumvioletred: "c71585",
|
|
1002
|
-
midnightblue: "191970",
|
|
1003
|
-
mintcream: "f5fffa",
|
|
1004
|
-
mistyrose: "ffe4e1",
|
|
1005
|
-
moccasin: "ffe4b5",
|
|
1006
|
-
navajowhite: "ffdead",
|
|
1007
|
-
navy: "000080",
|
|
1008
|
-
oldlace: "fdf5e6",
|
|
1009
|
-
olive: "808000",
|
|
1010
|
-
olivedrab: "6b8e23",
|
|
1011
|
-
orange: "ffa500",
|
|
1012
|
-
orangered: "ff4500",
|
|
1013
|
-
orchid: "da70d6",
|
|
1014
|
-
palegoldenrod: "eee8aa",
|
|
1015
|
-
palegreen: "98fb98",
|
|
1016
|
-
paleturquoise: "afeeee",
|
|
1017
|
-
palevioletred: "db7093",
|
|
1018
|
-
papayawhip: "ffefd5",
|
|
1019
|
-
peachpuff: "ffdab9",
|
|
1020
|
-
peru: "cd853f",
|
|
1021
|
-
pink: "ffc0cb",
|
|
1022
|
-
plum: "dda0dd",
|
|
1023
|
-
powderblue: "b0e0e6",
|
|
1024
|
-
purple: "800080",
|
|
1025
|
-
rebeccapurple: "663399",
|
|
1026
|
-
red: "f00",
|
|
1027
|
-
rosybrown: "bc8f8f",
|
|
1028
|
-
royalblue: "4169e1",
|
|
1029
|
-
saddlebrown: "8b4513",
|
|
1030
|
-
salmon: "fa8072",
|
|
1031
|
-
sandybrown: "f4a460",
|
|
1032
|
-
seagreen: "2e8b57",
|
|
1033
|
-
seashell: "fff5ee",
|
|
1034
|
-
sienna: "a0522d",
|
|
1035
|
-
silver: "c0c0c0",
|
|
1036
|
-
skyblue: "87ceeb",
|
|
1037
|
-
slateblue: "6a5acd",
|
|
1038
|
-
slategray: "708090",
|
|
1039
|
-
slategrey: "708090",
|
|
1040
|
-
snow: "fffafa",
|
|
1041
|
-
springgreen: "00ff7f",
|
|
1042
|
-
steelblue: "4682b4",
|
|
1043
|
-
tan: "d2b48c",
|
|
1044
|
-
teal: "008080",
|
|
1045
|
-
thistle: "d8bfd8",
|
|
1046
|
-
tomato: "ff6347",
|
|
1047
|
-
turquoise: "40e0d0",
|
|
1048
|
-
violet: "ee82ee",
|
|
1049
|
-
wheat: "f5deb3",
|
|
1050
|
-
white: "fff",
|
|
1051
|
-
whitesmoke: "f5f5f5",
|
|
1052
|
-
yellow: "ff0",
|
|
1053
|
-
yellowgreen: "9acd32",
|
|
1054
|
-
});
|
|
1055
|
-
|
|
1056
|
-
// Make it easy to access colors via `hexNames[hex]`
|
|
1057
|
-
var hexNames = (tinycolor.hexNames = flip(names));
|
|
1058
|
-
|
|
1059
|
-
// Utilities
|
|
1060
|
-
// ---------
|
|
1061
|
-
|
|
1062
|
-
// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
|
|
1063
|
-
function flip(o) {
|
|
1064
|
-
var flipped = {};
|
|
1065
|
-
for (var i in o) {
|
|
1066
|
-
if (o.hasOwnProperty(i)) {
|
|
1067
|
-
flipped[o[i]] = i;
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
return flipped;
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
// Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
1074
|
-
function boundAlpha(a) {
|
|
1075
|
-
a = parseFloat(a);
|
|
1076
|
-
|
|
1077
|
-
if (isNaN(a) || a < 0 || a > 1) {
|
|
1078
|
-
a = 1;
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
return a;
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
// Take input from [0, n] and return it as [0, 1]
|
|
1085
|
-
function bound01(n, max) {
|
|
1086
|
-
if (isOnePointZero(n)) n = "100%";
|
|
1087
|
-
|
|
1088
|
-
var processPercent = isPercentage(n);
|
|
1089
|
-
n = Math.min(max, Math.max(0, parseFloat(n)));
|
|
1090
|
-
|
|
1091
|
-
// Automatically convert percentage into number
|
|
1092
|
-
if (processPercent) {
|
|
1093
|
-
n = parseInt(n * max, 10) / 100;
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
// Handle floating point rounding errors
|
|
1097
|
-
if (Math.abs(n - max) < 0.000001) {
|
|
1098
|
-
return 1;
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
// Convert into [0, 1] range if it isn't already
|
|
1102
|
-
return (n % max) / parseFloat(max);
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
// Force a number between 0 and 1
|
|
1106
|
-
function clamp01(val) {
|
|
1107
|
-
return Math.min(1, Math.max(0, val));
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
// Parse a base-16 hex value into a base-10 integer
|
|
1111
|
-
function parseIntFromHex(val) {
|
|
1112
|
-
return parseInt(val, 16);
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
|
1116
|
-
// <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
|
1117
|
-
function isOnePointZero(n) {
|
|
1118
|
-
return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
// Check to see if string passed in is a percentage
|
|
1122
|
-
function isPercentage(n) {
|
|
1123
|
-
return typeof n === "string" && n.indexOf("%") != -1;
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
// Force a hex value to have 2 characters
|
|
1127
|
-
function pad2(c) {
|
|
1128
|
-
return c.length == 1 ? "0" + c : "" + c;
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
// Replace a decimal with it's percentage value
|
|
1132
|
-
function convertToPercentage(n) {
|
|
1133
|
-
if (n <= 1) {
|
|
1134
|
-
n = n * 100 + "%";
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
return n;
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
|
-
// Converts a decimal to a hex value
|
|
1141
|
-
function convertDecimalToHex(d) {
|
|
1142
|
-
return Math.round(parseFloat(d) * 255).toString(16);
|
|
1143
|
-
}
|
|
1144
|
-
// Converts a hex value to a decimal
|
|
1145
|
-
function convertHexToDecimal(h) {
|
|
1146
|
-
return parseIntFromHex(h) / 255;
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
var matchers = (function () {
|
|
1150
|
-
// <http://www.w3.org/TR/css3-values/#integers>
|
|
1151
|
-
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
1152
|
-
|
|
1153
|
-
// <http://www.w3.org/TR/css3-values/#number-value>
|
|
1154
|
-
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
|
1155
|
-
|
|
1156
|
-
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
|
|
1157
|
-
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
1158
|
-
|
|
1159
|
-
// Actual matching.
|
|
1160
|
-
// Parentheses and commas are optional, but not required.
|
|
1161
|
-
// Whitespace can take the place of commas or opening paren
|
|
1162
|
-
var PERMISSIVE_MATCH3 =
|
|
1163
|
-
"[\\s|\\(]+(" +
|
|
1164
|
-
CSS_UNIT +
|
|
1165
|
-
")[,|\\s]+(" +
|
|
1166
|
-
CSS_UNIT +
|
|
1167
|
-
")[,|\\s]+(" +
|
|
1168
|
-
CSS_UNIT +
|
|
1169
|
-
")\\s*\\)?";
|
|
1170
|
-
var PERMISSIVE_MATCH4 =
|
|
1171
|
-
"[\\s|\\(]+(" +
|
|
1172
|
-
CSS_UNIT +
|
|
1173
|
-
")[,|\\s]+(" +
|
|
1174
|
-
CSS_UNIT +
|
|
1175
|
-
")[,|\\s]+(" +
|
|
1176
|
-
CSS_UNIT +
|
|
1177
|
-
")[,|\\s]+(" +
|
|
1178
|
-
CSS_UNIT +
|
|
1179
|
-
")\\s*\\)?";
|
|
1180
|
-
|
|
1181
|
-
return {
|
|
1182
|
-
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
1183
|
-
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
1184
|
-
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
|
1185
|
-
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
|
1186
|
-
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
|
1187
|
-
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
|
1188
|
-
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
|
1189
|
-
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1190
|
-
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
1191
|
-
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1192
|
-
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
1193
|
-
};
|
|
1194
|
-
})();
|
|
1195
|
-
|
|
1196
|
-
// `isValidCSSUnit`
|
|
1197
|
-
// Take in a single string / number and check to see if it looks like a CSS unit
|
|
1198
|
-
// (see `matchers` above for definition).
|
|
1199
|
-
function isValidCSSUnit(color) {
|
|
1200
|
-
return !!matchers.CSS_UNIT.exec(color);
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
// `stringInputToObject`
|
|
1204
|
-
// Permissive string parsing. Take in a number of formats, and output an object
|
|
1205
|
-
// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
|
|
1206
|
-
function stringInputToObject(color) {
|
|
1207
|
-
color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
|
|
1208
|
-
var named = false;
|
|
1209
|
-
if (names[color]) {
|
|
1210
|
-
color = names[color];
|
|
1211
|
-
named = true;
|
|
1212
|
-
} else if (color == "transparent") {
|
|
1213
|
-
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
// Try to match string input using regular expressions.
|
|
1217
|
-
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
|
|
1218
|
-
// Just return an object and let the conversion functions handle that.
|
|
1219
|
-
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
|
1220
|
-
var match;
|
|
1221
|
-
if ((match = matchers.rgb.exec(color))) {
|
|
1222
|
-
return { r: match[1], g: match[2], b: match[3] };
|
|
1223
|
-
}
|
|
1224
|
-
if ((match = matchers.rgba.exec(color))) {
|
|
1225
|
-
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
1226
|
-
}
|
|
1227
|
-
if ((match = matchers.hsl.exec(color))) {
|
|
1228
|
-
return { h: match[1], s: match[2], l: match[3] };
|
|
1229
|
-
}
|
|
1230
|
-
if ((match = matchers.hsla.exec(color))) {
|
|
1231
|
-
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
1232
|
-
}
|
|
1233
|
-
if ((match = matchers.hsv.exec(color))) {
|
|
1234
|
-
return { h: match[1], s: match[2], v: match[3] };
|
|
1235
|
-
}
|
|
1236
|
-
if ((match = matchers.hsva.exec(color))) {
|
|
1237
|
-
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
1238
|
-
}
|
|
1239
|
-
if ((match = matchers.hex8.exec(color))) {
|
|
1240
|
-
return {
|
|
1241
|
-
r: parseIntFromHex(match[1]),
|
|
1242
|
-
g: parseIntFromHex(match[2]),
|
|
1243
|
-
b: parseIntFromHex(match[3]),
|
|
1244
|
-
a: convertHexToDecimal(match[4]),
|
|
1245
|
-
format: named ? "name" : "hex8",
|
|
1246
|
-
};
|
|
1247
|
-
}
|
|
1248
|
-
if ((match = matchers.hex6.exec(color))) {
|
|
1249
|
-
return {
|
|
1250
|
-
r: parseIntFromHex(match[1]),
|
|
1251
|
-
g: parseIntFromHex(match[2]),
|
|
1252
|
-
b: parseIntFromHex(match[3]),
|
|
1253
|
-
format: named ? "name" : "hex",
|
|
1254
|
-
};
|
|
1255
|
-
}
|
|
1256
|
-
if ((match = matchers.hex4.exec(color))) {
|
|
1257
|
-
return {
|
|
1258
|
-
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
1259
|
-
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
1260
|
-
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
1261
|
-
a: convertHexToDecimal(match[4] + "" + match[4]),
|
|
1262
|
-
format: named ? "name" : "hex8",
|
|
1263
|
-
};
|
|
1264
|
-
}
|
|
1265
|
-
if ((match = matchers.hex3.exec(color))) {
|
|
1266
|
-
return {
|
|
1267
|
-
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
1268
|
-
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
1269
|
-
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
1270
|
-
format: named ? "name" : "hex",
|
|
1271
|
-
};
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
return false;
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
function validateWCAG2Parms(parms) {
|
|
1278
|
-
// return valid WCAG2 parms for isReadable.
|
|
1279
|
-
// If input parms are invalid, return {"level":"AA", "size":"small"}
|
|
1280
|
-
var level, size;
|
|
1281
|
-
parms = parms || { level: "AA", size: "small" };
|
|
1282
|
-
level = (parms.level || "AA").toUpperCase();
|
|
1283
|
-
size = (parms.size || "small").toLowerCase();
|
|
1284
|
-
if (level !== "AA" && level !== "AAA") {
|
|
1285
|
-
level = "AA";
|
|
1286
|
-
}
|
|
1287
|
-
if (size !== "small" && size !== "large") {
|
|
1288
|
-
size = "small";
|
|
1289
|
-
}
|
|
1290
|
-
return { level: level, size: size };
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
return tinycolor;
|
|
1294
|
-
|
|
1295
|
-
}));
|
|
1296
|
-
});
|
|
1297
|
-
|
|
1298
|
-
const formatValue$2 = (tinyColor) => {
|
|
1299
|
-
if (!tinyColor) {
|
|
1300
|
-
return '';
|
|
1301
|
-
}
|
|
1302
|
-
const { r, g, b, a } = tinyColor.toRgb();
|
|
1303
|
-
return `${r} ${g} ${b} / ${a}`;
|
|
1304
|
-
};
|
|
1305
|
-
const OverridableColorTokens = [
|
|
1306
|
-
{
|
|
1307
|
-
name: 'bg-action',
|
|
1308
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1309
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1310
|
-
if (!overrideBaseColor) {
|
|
1311
|
-
return '';
|
|
1312
|
-
}
|
|
1313
|
-
const baseColor = overrideBaseColor
|
|
1314
|
-
? tinycolor(overrideBaseColor)
|
|
1315
|
-
: undefined;
|
|
1316
|
-
let value = baseColor
|
|
1317
|
-
? baseColor.clone()
|
|
1318
|
-
: undefined;
|
|
1319
|
-
return formatValue$2(value);
|
|
1320
|
-
},
|
|
1321
|
-
},
|
|
1322
|
-
{
|
|
1323
|
-
name: 'dark-bg-action',
|
|
1324
|
-
},
|
|
1325
|
-
{
|
|
1326
|
-
name: 'bg-action-hover',
|
|
1327
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1328
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1329
|
-
if (!overrideBaseColor) {
|
|
1330
|
-
return '';
|
|
1331
|
-
}
|
|
1332
|
-
const baseColor = overrideBaseColor
|
|
1333
|
-
? tinycolor(overrideBaseColor)
|
|
1334
|
-
: undefined;
|
|
1335
|
-
let value = baseColor
|
|
1336
|
-
? baseColor.clone()
|
|
1337
|
-
: undefined;
|
|
1338
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1339
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(10);
|
|
1340
|
-
}
|
|
1341
|
-
else {
|
|
1342
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-10);
|
|
1343
|
-
}
|
|
1344
|
-
return formatValue$2(value);
|
|
1345
|
-
},
|
|
1346
|
-
},
|
|
1347
|
-
{
|
|
1348
|
-
name: 'dark-bg-action-hover',
|
|
1349
|
-
},
|
|
1350
|
-
{
|
|
1351
|
-
name: 'bg-action-focus',
|
|
1352
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1353
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1354
|
-
if (!overrideBaseColor) {
|
|
1355
|
-
return '';
|
|
1356
|
-
}
|
|
1357
|
-
const baseColor = overrideBaseColor
|
|
1358
|
-
? tinycolor(overrideBaseColor)
|
|
1359
|
-
: undefined;
|
|
1360
|
-
let value = baseColor
|
|
1361
|
-
? baseColor.clone()
|
|
1362
|
-
: undefined;
|
|
1363
|
-
return formatValue$2(value);
|
|
1364
|
-
},
|
|
1365
|
-
},
|
|
1366
|
-
{
|
|
1367
|
-
name: 'dark-bg-action-focus',
|
|
1368
|
-
},
|
|
1369
|
-
{
|
|
1370
|
-
name: 'bg-action-active',
|
|
1371
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1372
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1373
|
-
if (!overrideBaseColor) {
|
|
1374
|
-
return '';
|
|
1375
|
-
}
|
|
1376
|
-
const baseColor = overrideBaseColor
|
|
1377
|
-
? tinycolor(overrideBaseColor)
|
|
1378
|
-
: undefined;
|
|
1379
|
-
let value = baseColor
|
|
1380
|
-
? baseColor.clone()
|
|
1381
|
-
: undefined;
|
|
1382
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1383
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(15);
|
|
1384
|
-
}
|
|
1385
|
-
else {
|
|
1386
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-15);
|
|
1387
|
-
}
|
|
1388
|
-
return formatValue$2(value);
|
|
1389
|
-
},
|
|
1390
|
-
},
|
|
1391
|
-
{
|
|
1392
|
-
name: 'dark-bg-action-active',
|
|
1393
|
-
},
|
|
1394
|
-
{
|
|
1395
|
-
name: 'bg-action-secondary-hover',
|
|
1396
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1397
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1398
|
-
if (!overrideBaseColor) {
|
|
1399
|
-
return '';
|
|
1400
|
-
}
|
|
1401
|
-
const baseColor = overrideBaseColor
|
|
1402
|
-
? tinycolor(overrideBaseColor)
|
|
1403
|
-
: undefined;
|
|
1404
|
-
let value = baseColor
|
|
1405
|
-
? baseColor.clone()
|
|
1406
|
-
: undefined;
|
|
1407
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1408
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(10);
|
|
1409
|
-
}
|
|
1410
|
-
else {
|
|
1411
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-10);
|
|
1412
|
-
}
|
|
1413
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.15);
|
|
1414
|
-
return formatValue$2(value);
|
|
1415
|
-
},
|
|
1416
|
-
},
|
|
1417
|
-
{
|
|
1418
|
-
name: 'dark-bg-action-secondary-hover',
|
|
1419
|
-
},
|
|
1420
|
-
{
|
|
1421
|
-
name: 'bg-action-secondary-active',
|
|
1422
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1423
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1424
|
-
if (!overrideBaseColor) {
|
|
1425
|
-
return '';
|
|
1426
|
-
}
|
|
1427
|
-
const baseColor = overrideBaseColor
|
|
1428
|
-
? tinycolor(overrideBaseColor)
|
|
1429
|
-
: undefined;
|
|
1430
|
-
let value = baseColor
|
|
1431
|
-
? baseColor.clone()
|
|
1432
|
-
: undefined;
|
|
1433
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1434
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(20);
|
|
1435
|
-
}
|
|
1436
|
-
else {
|
|
1437
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-20);
|
|
1438
|
-
}
|
|
1439
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.15);
|
|
1440
|
-
return formatValue$2(value);
|
|
1441
|
-
},
|
|
1442
|
-
},
|
|
1443
|
-
{
|
|
1444
|
-
name: 'dark-bg-action-secondary-active',
|
|
1445
|
-
},
|
|
1446
|
-
{
|
|
1447
|
-
name: 'bg-divider',
|
|
1448
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1449
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1450
|
-
if (!overrideBaseColor) {
|
|
1451
|
-
return '';
|
|
1452
|
-
}
|
|
1453
|
-
const baseColor = overrideBaseColor
|
|
1454
|
-
? tinycolor(overrideBaseColor)
|
|
1455
|
-
: undefined;
|
|
1456
|
-
let value = baseColor
|
|
1457
|
-
? baseColor.clone()
|
|
1458
|
-
: undefined;
|
|
1459
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
|
|
1460
|
-
return formatValue$2(value);
|
|
1461
|
-
},
|
|
1462
|
-
},
|
|
1463
|
-
{
|
|
1464
|
-
name: 'dark-bg-divider',
|
|
1465
|
-
},
|
|
1466
|
-
{
|
|
1467
|
-
name: 'bg-keypad-btn-active',
|
|
1468
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1469
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1470
|
-
if (!overrideBaseColor) {
|
|
1471
|
-
return '';
|
|
1472
|
-
}
|
|
1473
|
-
const baseColor = overrideBaseColor
|
|
1474
|
-
? tinycolor(overrideBaseColor)
|
|
1475
|
-
: undefined;
|
|
1476
|
-
let value = baseColor
|
|
1477
|
-
? baseColor.clone()
|
|
1478
|
-
: undefined;
|
|
1479
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.3);
|
|
1480
|
-
return formatValue$2(value);
|
|
1481
|
-
},
|
|
1482
|
-
},
|
|
1483
|
-
{
|
|
1484
|
-
name: 'dark-bg-keypad-btn-active',
|
|
1485
|
-
},
|
|
1486
|
-
{
|
|
1487
|
-
name: 'bg-selected',
|
|
1488
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1489
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1490
|
-
if (!overrideBaseColor) {
|
|
1491
|
-
return '';
|
|
1492
|
-
}
|
|
1493
|
-
const baseColor = overrideBaseColor
|
|
1494
|
-
? tinycolor(overrideBaseColor)
|
|
1495
|
-
: undefined;
|
|
1496
|
-
let value = baseColor
|
|
1497
|
-
? baseColor.clone()
|
|
1498
|
-
: undefined;
|
|
1499
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1500
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(10);
|
|
1501
|
-
}
|
|
1502
|
-
else {
|
|
1503
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-10);
|
|
1504
|
-
}
|
|
1505
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.25);
|
|
1506
|
-
return formatValue$2(value);
|
|
1507
|
-
},
|
|
1508
|
-
},
|
|
1509
|
-
{
|
|
1510
|
-
name: 'dark-bg-selected',
|
|
1511
|
-
},
|
|
1512
|
-
{
|
|
1513
|
-
name: 'bg-sidebar',
|
|
1514
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1515
|
-
const overrideBaseColor = overrideColors['sidebarColor'];
|
|
1516
|
-
if (!overrideBaseColor) {
|
|
1517
|
-
return '';
|
|
1518
|
-
}
|
|
1519
|
-
const baseColor = overrideBaseColor
|
|
1520
|
-
? tinycolor(overrideBaseColor)
|
|
1521
|
-
: undefined;
|
|
1522
|
-
let value = baseColor
|
|
1523
|
-
? baseColor.clone()
|
|
1524
|
-
: undefined;
|
|
1525
|
-
return formatValue$2(value);
|
|
1526
|
-
},
|
|
1527
|
-
},
|
|
1528
|
-
{
|
|
1529
|
-
name: 'dark-bg-sidebar',
|
|
1530
|
-
},
|
|
1531
|
-
{
|
|
1532
|
-
name: 'bg-sidebar-item-hover',
|
|
1533
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1534
|
-
const overrideBaseColor = overrideColors['sidebarColor'];
|
|
1535
|
-
if (!overrideBaseColor) {
|
|
1536
|
-
return '';
|
|
1537
|
-
}
|
|
1538
|
-
const baseColor = overrideBaseColor
|
|
1539
|
-
? tinycolor(overrideBaseColor)
|
|
1540
|
-
: undefined;
|
|
1541
|
-
let value = baseColor
|
|
1542
|
-
? baseColor.clone()
|
|
1543
|
-
: undefined;
|
|
1544
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1545
|
-
value = tinycolor({ a: 0.9, r: 255, b: 255, g: 255 });
|
|
1546
|
-
}
|
|
1547
|
-
else {
|
|
1548
|
-
value = tinycolor({ a: 0.86, r: 15, b: 15, g: 15 });
|
|
1549
|
-
}
|
|
1550
|
-
return formatValue$2(value);
|
|
1551
|
-
},
|
|
1552
|
-
},
|
|
1553
|
-
{
|
|
1554
|
-
name: 'dark-bg-sidebar-item-hover',
|
|
1555
|
-
},
|
|
1556
|
-
{
|
|
1557
|
-
name: 'bg-sidebar-item-selected',
|
|
1558
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1559
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1560
|
-
if (!overrideBaseColor) {
|
|
1561
|
-
return '';
|
|
1562
|
-
}
|
|
1563
|
-
const baseColor = overrideBaseColor
|
|
1564
|
-
? tinycolor(overrideBaseColor)
|
|
1565
|
-
: undefined;
|
|
1566
|
-
let value = baseColor
|
|
1567
|
-
? baseColor.clone()
|
|
1568
|
-
: undefined;
|
|
1569
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.4);
|
|
1570
|
-
return formatValue$2(value);
|
|
1571
|
-
},
|
|
1572
|
-
},
|
|
1573
|
-
{
|
|
1574
|
-
name: 'dark-bg-sidebar-item-selected',
|
|
1575
|
-
},
|
|
1576
|
-
{
|
|
1577
|
-
name: 'bg-table-selected-row',
|
|
1578
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1579
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1580
|
-
if (!overrideBaseColor) {
|
|
1581
|
-
return '';
|
|
1582
|
-
}
|
|
1583
|
-
const baseColor = overrideBaseColor
|
|
1584
|
-
? tinycolor(overrideBaseColor)
|
|
1585
|
-
: undefined;
|
|
1586
|
-
let value = baseColor
|
|
1587
|
-
? baseColor.clone()
|
|
1588
|
-
: undefined;
|
|
1589
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.2);
|
|
1590
|
-
return formatValue$2(value);
|
|
1591
|
-
},
|
|
1592
|
-
},
|
|
1593
|
-
{
|
|
1594
|
-
name: 'dark-bg-table-selected-row',
|
|
1595
|
-
},
|
|
1596
|
-
{
|
|
1597
|
-
name: 'bg-toggle-switch-selected-disabled',
|
|
1598
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1599
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1600
|
-
if (!overrideBaseColor) {
|
|
1601
|
-
return '';
|
|
1602
|
-
}
|
|
1603
|
-
const baseColor = overrideBaseColor
|
|
1604
|
-
? tinycolor(overrideBaseColor)
|
|
1605
|
-
: undefined;
|
|
1606
|
-
let value = baseColor
|
|
1607
|
-
? baseColor.clone()
|
|
1608
|
-
: undefined;
|
|
1609
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.5);
|
|
1610
|
-
return formatValue$2(value);
|
|
1611
|
-
},
|
|
1612
|
-
},
|
|
1613
|
-
{
|
|
1614
|
-
name: 'dark-bg-toggle-switch-selected-disabled',
|
|
1615
|
-
},
|
|
1616
|
-
{
|
|
1617
|
-
name: 'bg-date-picker-range',
|
|
1618
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1619
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1620
|
-
if (!overrideBaseColor) {
|
|
1621
|
-
return '';
|
|
1622
|
-
}
|
|
1623
|
-
const baseColor = overrideBaseColor
|
|
1624
|
-
? tinycolor(overrideBaseColor)
|
|
1625
|
-
: undefined;
|
|
1626
|
-
let value = baseColor
|
|
1627
|
-
? baseColor.clone()
|
|
1628
|
-
: undefined;
|
|
1629
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1630
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(10);
|
|
1631
|
-
}
|
|
1632
|
-
else {
|
|
1633
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-10);
|
|
1634
|
-
}
|
|
1635
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.15);
|
|
1636
|
-
return formatValue$2(value);
|
|
1637
|
-
},
|
|
1638
|
-
},
|
|
1639
|
-
{
|
|
1640
|
-
name: 'dark-bg-date-picker-range',
|
|
1641
|
-
},
|
|
1642
|
-
{
|
|
1643
|
-
name: 'text-link',
|
|
1644
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1645
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1646
|
-
if (!overrideBaseColor) {
|
|
1647
|
-
return '';
|
|
1648
|
-
}
|
|
1649
|
-
const baseColor = overrideBaseColor
|
|
1650
|
-
? tinycolor(overrideBaseColor)
|
|
1651
|
-
: undefined;
|
|
1652
|
-
let value = baseColor
|
|
1653
|
-
? baseColor.clone()
|
|
1654
|
-
: undefined;
|
|
1655
|
-
return formatValue$2(value);
|
|
1656
|
-
},
|
|
1657
|
-
},
|
|
1658
|
-
{
|
|
1659
|
-
name: 'dark-text-link',
|
|
1660
|
-
},
|
|
1661
|
-
{
|
|
1662
|
-
name: 'text-link-hover',
|
|
1663
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1664
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1665
|
-
if (!overrideBaseColor) {
|
|
1666
|
-
return '';
|
|
1667
|
-
}
|
|
1668
|
-
const baseColor = overrideBaseColor
|
|
1669
|
-
? tinycolor(overrideBaseColor)
|
|
1670
|
-
: undefined;
|
|
1671
|
-
let value = baseColor
|
|
1672
|
-
? baseColor.clone()
|
|
1673
|
-
: undefined;
|
|
1674
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1675
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(10);
|
|
1676
|
-
}
|
|
1677
|
-
else {
|
|
1678
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-10);
|
|
1679
|
-
}
|
|
1680
|
-
return formatValue$2(value);
|
|
1681
|
-
},
|
|
1682
|
-
},
|
|
1683
|
-
{
|
|
1684
|
-
name: 'dark-text-link-hover',
|
|
1685
|
-
},
|
|
1686
|
-
{
|
|
1687
|
-
name: 'text-link-active',
|
|
1688
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1689
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1690
|
-
if (!overrideBaseColor) {
|
|
1691
|
-
return '';
|
|
1692
|
-
}
|
|
1693
|
-
const baseColor = overrideBaseColor
|
|
1694
|
-
? tinycolor(overrideBaseColor)
|
|
1695
|
-
: undefined;
|
|
1696
|
-
let value = baseColor
|
|
1697
|
-
? baseColor.clone()
|
|
1698
|
-
: undefined;
|
|
1699
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1700
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(15);
|
|
1701
|
-
}
|
|
1702
|
-
else {
|
|
1703
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-15);
|
|
1704
|
-
}
|
|
1705
|
-
return formatValue$2(value);
|
|
1706
|
-
},
|
|
1707
|
-
},
|
|
1708
|
-
{
|
|
1709
|
-
name: 'dark-text-link-active',
|
|
1710
|
-
},
|
|
1711
|
-
{
|
|
1712
|
-
name: 'text-link-focus',
|
|
1713
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1714
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1715
|
-
if (!overrideBaseColor) {
|
|
1716
|
-
return '';
|
|
1717
|
-
}
|
|
1718
|
-
const baseColor = overrideBaseColor
|
|
1719
|
-
? tinycolor(overrideBaseColor)
|
|
1720
|
-
: undefined;
|
|
1721
|
-
let value = baseColor
|
|
1722
|
-
? baseColor.clone()
|
|
1723
|
-
: undefined;
|
|
1724
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1725
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(10);
|
|
1726
|
-
}
|
|
1727
|
-
else {
|
|
1728
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-10);
|
|
1729
|
-
}
|
|
1730
|
-
return formatValue$2(value);
|
|
1731
|
-
},
|
|
1732
|
-
},
|
|
1733
|
-
{
|
|
1734
|
-
name: 'dark-text-link-focus',
|
|
1735
|
-
},
|
|
1736
|
-
{
|
|
1737
|
-
name: 'text-link-visited',
|
|
1738
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1739
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1740
|
-
if (!overrideBaseColor) {
|
|
1741
|
-
return '';
|
|
1742
|
-
}
|
|
1743
|
-
const baseColor = overrideBaseColor
|
|
1744
|
-
? tinycolor(overrideBaseColor)
|
|
1745
|
-
: undefined;
|
|
1746
|
-
let value = baseColor
|
|
1747
|
-
? baseColor.clone()
|
|
1748
|
-
: undefined;
|
|
1749
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1750
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(20);
|
|
1751
|
-
}
|
|
1752
|
-
else {
|
|
1753
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-22);
|
|
1754
|
-
}
|
|
1755
|
-
return formatValue$2(value);
|
|
1756
|
-
},
|
|
1757
|
-
},
|
|
1758
|
-
{
|
|
1759
|
-
name: 'dark-text-link-visited',
|
|
1760
|
-
},
|
|
1761
|
-
{
|
|
1762
|
-
name: 'text-sidebar-link',
|
|
1763
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1764
|
-
const overrideBaseColor = overrideColors['sidebarColor'];
|
|
1765
|
-
if (!overrideBaseColor) {
|
|
1766
|
-
return '';
|
|
1767
|
-
}
|
|
1768
|
-
const baseColor = overrideBaseColor
|
|
1769
|
-
? tinycolor(overrideBaseColor)
|
|
1770
|
-
: undefined;
|
|
1771
|
-
let value = baseColor
|
|
1772
|
-
? baseColor.clone()
|
|
1773
|
-
: undefined;
|
|
1774
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1775
|
-
value = tinycolor({ a: 0.9, b: 255, r: 255, g: 255 });
|
|
1776
|
-
}
|
|
1777
|
-
else {
|
|
1778
|
-
value = tinycolor({ a: 0.86, b: 15, r: 15, g: 15 });
|
|
1779
|
-
}
|
|
1780
|
-
return formatValue$2(value);
|
|
1781
|
-
},
|
|
1782
|
-
},
|
|
1783
|
-
{
|
|
1784
|
-
name: 'dark-text-sidebar-link',
|
|
1785
|
-
},
|
|
1786
|
-
{
|
|
1787
|
-
name: 'text-sidebar-link-hover',
|
|
1788
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1789
|
-
const overrideBaseColor = overrideColors['sidebarColor'];
|
|
1790
|
-
if (!overrideBaseColor) {
|
|
1791
|
-
return '';
|
|
1792
|
-
}
|
|
1793
|
-
const baseColor = overrideBaseColor
|
|
1794
|
-
? tinycolor(overrideBaseColor)
|
|
1795
|
-
: undefined;
|
|
1796
|
-
let value = baseColor
|
|
1797
|
-
? baseColor.clone()
|
|
1798
|
-
: undefined;
|
|
1799
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1800
|
-
value = tinycolor({ a: 0.86, r: 15, b: 15, g: 15 });
|
|
1801
|
-
}
|
|
1802
|
-
else {
|
|
1803
|
-
value = tinycolor({ a: 0.9, r: 255, b: 255, g: 255 });
|
|
1804
|
-
}
|
|
1805
|
-
return formatValue$2(value);
|
|
1806
|
-
},
|
|
1807
|
-
},
|
|
1808
|
-
{
|
|
1809
|
-
name: 'dark-text-sidebar-link-hover',
|
|
1810
|
-
},
|
|
1811
|
-
{
|
|
1812
|
-
name: 'text-sidebar-link-selected',
|
|
1813
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1814
|
-
const overrideBaseColor = overrideColors['sidebarColor'];
|
|
1815
|
-
if (!overrideBaseColor) {
|
|
1816
|
-
return '';
|
|
1817
|
-
}
|
|
1818
|
-
const baseColor = overrideBaseColor
|
|
1819
|
-
? tinycolor(overrideBaseColor)
|
|
1820
|
-
: undefined;
|
|
1821
|
-
let value = baseColor
|
|
1822
|
-
? baseColor.clone()
|
|
1823
|
-
: undefined;
|
|
1824
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1825
|
-
value = tinycolor({ a: 0.9, r: 255, b: 255, g: 255 });
|
|
1826
|
-
}
|
|
1827
|
-
else {
|
|
1828
|
-
value = tinycolor({ a: 0.86, b: 15, r: 15, g: 15 });
|
|
1829
|
-
}
|
|
1830
|
-
return formatValue$2(value);
|
|
1831
|
-
},
|
|
1832
|
-
},
|
|
1833
|
-
{
|
|
1834
|
-
name: 'dark-text-sidebar-link-selected',
|
|
1835
|
-
},
|
|
1836
|
-
{
|
|
1837
|
-
name: 'border-color-action',
|
|
1838
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1839
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1840
|
-
if (!overrideBaseColor) {
|
|
1841
|
-
return '';
|
|
1842
|
-
}
|
|
1843
|
-
const baseColor = overrideBaseColor
|
|
1844
|
-
? tinycolor(overrideBaseColor)
|
|
1845
|
-
: undefined;
|
|
1846
|
-
let value = baseColor
|
|
1847
|
-
? baseColor.clone()
|
|
1848
|
-
: undefined;
|
|
1849
|
-
return formatValue$2(value);
|
|
1850
|
-
},
|
|
1851
|
-
},
|
|
1852
|
-
{
|
|
1853
|
-
name: 'dark-border-color-action',
|
|
1854
|
-
},
|
|
1855
|
-
{
|
|
1856
|
-
name: 'border-color-action-hover',
|
|
1857
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1858
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1859
|
-
if (!overrideBaseColor) {
|
|
1860
|
-
return '';
|
|
1861
|
-
}
|
|
1862
|
-
const baseColor = overrideBaseColor
|
|
1863
|
-
? tinycolor(overrideBaseColor)
|
|
1864
|
-
: undefined;
|
|
1865
|
-
let value = baseColor
|
|
1866
|
-
? baseColor.clone()
|
|
1867
|
-
: undefined;
|
|
1868
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1869
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(10);
|
|
1870
|
-
}
|
|
1871
|
-
else {
|
|
1872
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-10);
|
|
1873
|
-
}
|
|
1874
|
-
return formatValue$2(value);
|
|
1875
|
-
},
|
|
1876
|
-
},
|
|
1877
|
-
{
|
|
1878
|
-
name: 'dark-border-color-action-hover',
|
|
1879
|
-
},
|
|
1880
|
-
{
|
|
1881
|
-
name: 'border-color-action-active',
|
|
1882
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1883
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1884
|
-
if (!overrideBaseColor) {
|
|
1885
|
-
return '';
|
|
1886
|
-
}
|
|
1887
|
-
const baseColor = overrideBaseColor
|
|
1888
|
-
? tinycolor(overrideBaseColor)
|
|
1889
|
-
: undefined;
|
|
1890
|
-
let value = baseColor
|
|
1891
|
-
? baseColor.clone()
|
|
1892
|
-
: undefined;
|
|
1893
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1894
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(15);
|
|
1895
|
-
}
|
|
1896
|
-
else {
|
|
1897
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-15);
|
|
1898
|
-
}
|
|
1899
|
-
return formatValue$2(value);
|
|
1900
|
-
},
|
|
1901
|
-
},
|
|
1902
|
-
{
|
|
1903
|
-
name: 'dark-border-color-action-active',
|
|
1904
|
-
},
|
|
1905
|
-
{
|
|
1906
|
-
name: 'border-color-divider',
|
|
1907
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1908
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1909
|
-
if (!overrideBaseColor) {
|
|
1910
|
-
return '';
|
|
1911
|
-
}
|
|
1912
|
-
const baseColor = overrideBaseColor
|
|
1913
|
-
? tinycolor(overrideBaseColor)
|
|
1914
|
-
: undefined;
|
|
1915
|
-
let value = baseColor
|
|
1916
|
-
? baseColor.clone()
|
|
1917
|
-
: undefined;
|
|
1918
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
|
|
1919
|
-
return formatValue$2(value);
|
|
1920
|
-
},
|
|
1921
|
-
},
|
|
1922
|
-
{
|
|
1923
|
-
name: 'dark-border-color-divider',
|
|
1924
|
-
},
|
|
1925
|
-
{
|
|
1926
|
-
name: 'border-color-divider-secondary',
|
|
1927
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1928
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1929
|
-
if (!overrideBaseColor) {
|
|
1930
|
-
return '';
|
|
1931
|
-
}
|
|
1932
|
-
const baseColor = overrideBaseColor
|
|
1933
|
-
? tinycolor(overrideBaseColor)
|
|
1934
|
-
: undefined;
|
|
1935
|
-
let value = baseColor
|
|
1936
|
-
? baseColor.clone()
|
|
1937
|
-
: undefined;
|
|
1938
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1939
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(15);
|
|
1940
|
-
}
|
|
1941
|
-
else {
|
|
1942
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-15);
|
|
1943
|
-
}
|
|
1944
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.4);
|
|
1945
|
-
return formatValue$2(value);
|
|
1946
|
-
},
|
|
1947
|
-
},
|
|
1948
|
-
{
|
|
1949
|
-
name: 'dark-border-color-divider-secondary',
|
|
1950
|
-
},
|
|
1951
|
-
{
|
|
1952
|
-
name: 'border-color-input-field',
|
|
1953
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1954
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1955
|
-
if (!overrideBaseColor) {
|
|
1956
|
-
return '';
|
|
1957
|
-
}
|
|
1958
|
-
const baseColor = overrideBaseColor
|
|
1959
|
-
? tinycolor(overrideBaseColor)
|
|
1960
|
-
: undefined;
|
|
1961
|
-
let value = baseColor
|
|
1962
|
-
? baseColor.clone()
|
|
1963
|
-
: undefined;
|
|
1964
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
|
|
1965
|
-
return formatValue$2(value);
|
|
1966
|
-
},
|
|
1967
|
-
},
|
|
1968
|
-
{
|
|
1969
|
-
name: 'dark-border-color-input-field',
|
|
1970
|
-
},
|
|
1971
|
-
{
|
|
1972
|
-
name: 'border-color-input-field-hover',
|
|
1973
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
1974
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
1975
|
-
if (!overrideBaseColor) {
|
|
1976
|
-
return '';
|
|
1977
|
-
}
|
|
1978
|
-
const baseColor = overrideBaseColor
|
|
1979
|
-
? tinycolor(overrideBaseColor)
|
|
1980
|
-
: undefined;
|
|
1981
|
-
let value = baseColor
|
|
1982
|
-
? baseColor.clone()
|
|
1983
|
-
: undefined;
|
|
1984
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
1985
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(10);
|
|
1986
|
-
}
|
|
1987
|
-
else {
|
|
1988
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-10);
|
|
1989
|
-
}
|
|
1990
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
|
|
1991
|
-
return formatValue$2(value);
|
|
1992
|
-
},
|
|
1993
|
-
},
|
|
1994
|
-
{
|
|
1995
|
-
name: 'dark-border-color-input-field-hover',
|
|
1996
|
-
},
|
|
1997
|
-
{
|
|
1998
|
-
name: 'border-color-input-field-focus',
|
|
1999
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2000
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2001
|
-
if (!overrideBaseColor) {
|
|
2002
|
-
return '';
|
|
2003
|
-
}
|
|
2004
|
-
const baseColor = overrideBaseColor
|
|
2005
|
-
? tinycolor(overrideBaseColor)
|
|
2006
|
-
: undefined;
|
|
2007
|
-
let value = baseColor
|
|
2008
|
-
? baseColor.clone()
|
|
2009
|
-
: undefined;
|
|
2010
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
2011
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(15);
|
|
2012
|
-
}
|
|
2013
|
-
else {
|
|
2014
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-15);
|
|
2015
|
-
}
|
|
2016
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
|
|
2017
|
-
return formatValue$2(value);
|
|
2018
|
-
},
|
|
2019
|
-
},
|
|
2020
|
-
{
|
|
2021
|
-
name: 'dark-border-color-input-field-focus',
|
|
2022
|
-
},
|
|
2023
|
-
{
|
|
2024
|
-
name: 'border-color-input-field-disabled',
|
|
2025
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2026
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2027
|
-
if (!overrideBaseColor) {
|
|
2028
|
-
return '';
|
|
2029
|
-
}
|
|
2030
|
-
const baseColor = overrideBaseColor
|
|
2031
|
-
? tinycolor(overrideBaseColor)
|
|
2032
|
-
: undefined;
|
|
2033
|
-
let value = baseColor
|
|
2034
|
-
? baseColor.clone()
|
|
2035
|
-
: undefined;
|
|
2036
|
-
value = tinycolor({ a: 0.2, r: 15, b: 15, g: 15 });
|
|
2037
|
-
return formatValue$2(value);
|
|
2038
|
-
},
|
|
2039
|
-
},
|
|
2040
|
-
{
|
|
2041
|
-
name: 'dark-border-color-input-field-disabled',
|
|
2042
|
-
},
|
|
2043
|
-
{
|
|
2044
|
-
name: 'border-color-tile-focus',
|
|
2045
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2046
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2047
|
-
if (!overrideBaseColor) {
|
|
2048
|
-
return '';
|
|
2049
|
-
}
|
|
2050
|
-
const baseColor = overrideBaseColor
|
|
2051
|
-
? tinycolor(overrideBaseColor)
|
|
2052
|
-
: undefined;
|
|
2053
|
-
let value = baseColor
|
|
2054
|
-
? baseColor.clone()
|
|
2055
|
-
: undefined;
|
|
2056
|
-
return formatValue$2(value);
|
|
2057
|
-
},
|
|
2058
|
-
},
|
|
2059
|
-
{
|
|
2060
|
-
name: 'dark-border-color-tile-focus',
|
|
2061
|
-
},
|
|
2062
|
-
{
|
|
2063
|
-
name: 'border-color-tile-selected-focus',
|
|
2064
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2065
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2066
|
-
if (!overrideBaseColor) {
|
|
2067
|
-
return '';
|
|
2068
|
-
}
|
|
2069
|
-
const baseColor = overrideBaseColor
|
|
2070
|
-
? tinycolor(overrideBaseColor)
|
|
2071
|
-
: undefined;
|
|
2072
|
-
let value = baseColor
|
|
2073
|
-
? baseColor.clone()
|
|
2074
|
-
: undefined;
|
|
2075
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
2076
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(15);
|
|
2077
|
-
}
|
|
2078
|
-
else {
|
|
2079
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-15);
|
|
2080
|
-
}
|
|
2081
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
|
|
2082
|
-
return formatValue$2(value);
|
|
2083
|
-
},
|
|
2084
|
-
},
|
|
2085
|
-
{
|
|
2086
|
-
name: 'dark-border-color-tile-selected-focus',
|
|
2087
|
-
},
|
|
2088
|
-
{
|
|
2089
|
-
name: 'border-color-tile-selected',
|
|
2090
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2091
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2092
|
-
if (!overrideBaseColor) {
|
|
2093
|
-
return '';
|
|
2094
|
-
}
|
|
2095
|
-
const baseColor = overrideBaseColor
|
|
2096
|
-
? tinycolor(overrideBaseColor)
|
|
2097
|
-
: undefined;
|
|
2098
|
-
let value = baseColor
|
|
2099
|
-
? baseColor.clone()
|
|
2100
|
-
: undefined;
|
|
2101
|
-
return formatValue$2(value);
|
|
2102
|
-
},
|
|
2103
|
-
},
|
|
2104
|
-
{
|
|
2105
|
-
name: 'dark-border-color-tile-selected',
|
|
2106
|
-
},
|
|
2107
|
-
{
|
|
2108
|
-
name: 'border-color-tile-selected-hover',
|
|
2109
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2110
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2111
|
-
if (!overrideBaseColor) {
|
|
2112
|
-
return '';
|
|
2113
|
-
}
|
|
2114
|
-
const baseColor = overrideBaseColor
|
|
2115
|
-
? tinycolor(overrideBaseColor)
|
|
2116
|
-
: undefined;
|
|
2117
|
-
let value = baseColor
|
|
2118
|
-
? baseColor.clone()
|
|
2119
|
-
: undefined;
|
|
2120
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
2121
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(10);
|
|
2122
|
-
}
|
|
2123
|
-
else {
|
|
2124
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-10);
|
|
2125
|
-
}
|
|
2126
|
-
return formatValue$2(value);
|
|
2127
|
-
},
|
|
2128
|
-
},
|
|
2129
|
-
{
|
|
2130
|
-
name: 'dark-border-color-tile-selected-hover',
|
|
2131
|
-
},
|
|
2132
|
-
];
|
|
2133
|
-
|
|
2134
|
-
const formatValue$1 = (tinyColor) => {
|
|
2135
|
-
if (!tinyColor) {
|
|
2136
|
-
return '';
|
|
2137
|
-
}
|
|
2138
|
-
const { r, g, b, a } = tinyColor.toRgb();
|
|
2139
|
-
return `${r} ${g} ${b} / ${a}`;
|
|
2140
|
-
};
|
|
2141
|
-
const OverridableBorderTokens = [
|
|
2142
|
-
{
|
|
2143
|
-
name: 'border-secondary-btn',
|
|
2144
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2145
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2146
|
-
if (!overrideBaseColor) {
|
|
2147
|
-
return '';
|
|
2148
|
-
}
|
|
2149
|
-
const baseColor = overrideBaseColor
|
|
2150
|
-
? tinycolor(overrideBaseColor)
|
|
2151
|
-
: undefined;
|
|
2152
|
-
let value = baseColor
|
|
2153
|
-
? baseColor.clone()
|
|
2154
|
-
: undefined;
|
|
2155
|
-
return formatValue$1(value);
|
|
2156
|
-
},
|
|
2157
|
-
},
|
|
2158
|
-
{
|
|
2159
|
-
name: 'dark-border-secondary-btn',
|
|
2160
|
-
},
|
|
2161
|
-
{
|
|
2162
|
-
name: 'border-secondary-btn-hover',
|
|
2163
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2164
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2165
|
-
if (!overrideBaseColor) {
|
|
2166
|
-
return '';
|
|
2167
|
-
}
|
|
2168
|
-
const baseColor = overrideBaseColor
|
|
2169
|
-
? tinycolor(overrideBaseColor)
|
|
2170
|
-
: undefined;
|
|
2171
|
-
let value = baseColor
|
|
2172
|
-
? baseColor.clone()
|
|
2173
|
-
: undefined;
|
|
2174
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
2175
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(10);
|
|
2176
|
-
}
|
|
2177
|
-
else {
|
|
2178
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-10);
|
|
2179
|
-
}
|
|
2180
|
-
return formatValue$1(value);
|
|
2181
|
-
},
|
|
2182
|
-
},
|
|
2183
|
-
{
|
|
2184
|
-
name: 'dark-border-secondary-btn-hover',
|
|
2185
|
-
},
|
|
2186
|
-
{
|
|
2187
|
-
name: 'border-secondary-btn-active',
|
|
2188
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2189
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2190
|
-
if (!overrideBaseColor) {
|
|
2191
|
-
return '';
|
|
2192
|
-
}
|
|
2193
|
-
const baseColor = overrideBaseColor
|
|
2194
|
-
? tinycolor(overrideBaseColor)
|
|
2195
|
-
: undefined;
|
|
2196
|
-
let value = baseColor
|
|
2197
|
-
? baseColor.clone()
|
|
2198
|
-
: undefined;
|
|
2199
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
2200
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(15);
|
|
2201
|
-
}
|
|
2202
|
-
else {
|
|
2203
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-15);
|
|
2204
|
-
}
|
|
2205
|
-
return formatValue$1(value);
|
|
2206
|
-
},
|
|
2207
|
-
},
|
|
2208
|
-
{
|
|
2209
|
-
name: 'dark-border-secondary-btn-active',
|
|
2210
|
-
},
|
|
2211
|
-
{
|
|
2212
|
-
name: 'border-input-field',
|
|
2213
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2214
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2215
|
-
if (!overrideBaseColor) {
|
|
2216
|
-
return '';
|
|
2217
|
-
}
|
|
2218
|
-
const baseColor = overrideBaseColor
|
|
2219
|
-
? tinycolor(overrideBaseColor)
|
|
2220
|
-
: undefined;
|
|
2221
|
-
let value = baseColor
|
|
2222
|
-
? baseColor.clone()
|
|
2223
|
-
: undefined;
|
|
2224
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
|
|
2225
|
-
return formatValue$1(value);
|
|
2226
|
-
},
|
|
2227
|
-
},
|
|
2228
|
-
{
|
|
2229
|
-
name: 'dark-border-input-field',
|
|
2230
|
-
},
|
|
2231
|
-
{
|
|
2232
|
-
name: 'border-input-field-hover',
|
|
2233
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2234
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2235
|
-
if (!overrideBaseColor) {
|
|
2236
|
-
return '';
|
|
2237
|
-
}
|
|
2238
|
-
const baseColor = overrideBaseColor
|
|
2239
|
-
? tinycolor(overrideBaseColor)
|
|
2240
|
-
: undefined;
|
|
2241
|
-
let value = baseColor
|
|
2242
|
-
? baseColor.clone()
|
|
2243
|
-
: undefined;
|
|
2244
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
2245
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(10);
|
|
2246
|
-
}
|
|
2247
|
-
else {
|
|
2248
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-10);
|
|
2249
|
-
}
|
|
2250
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
|
|
2251
|
-
return formatValue$1(value);
|
|
2252
|
-
},
|
|
2253
|
-
},
|
|
2254
|
-
{
|
|
2255
|
-
name: 'dark-border-input-field-hover',
|
|
2256
|
-
},
|
|
2257
|
-
{
|
|
2258
|
-
name: 'border-input-field-focus',
|
|
2259
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2260
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2261
|
-
if (!overrideBaseColor) {
|
|
2262
|
-
return '';
|
|
2263
|
-
}
|
|
2264
|
-
const baseColor = overrideBaseColor
|
|
2265
|
-
? tinycolor(overrideBaseColor)
|
|
2266
|
-
: undefined;
|
|
2267
|
-
let value = baseColor
|
|
2268
|
-
? baseColor.clone()
|
|
2269
|
-
: undefined;
|
|
2270
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
2271
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(15);
|
|
2272
|
-
}
|
|
2273
|
-
else {
|
|
2274
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-15);
|
|
2275
|
-
}
|
|
2276
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
|
|
2277
|
-
return formatValue$1(value);
|
|
2278
|
-
},
|
|
2279
|
-
},
|
|
2280
|
-
{
|
|
2281
|
-
name: 'dark-border-input-field-focus',
|
|
2282
|
-
},
|
|
2283
|
-
{
|
|
2284
|
-
name: 'border-input-field-disabled',
|
|
2285
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2286
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2287
|
-
if (!overrideBaseColor) {
|
|
2288
|
-
return '';
|
|
2289
|
-
}
|
|
2290
|
-
const baseColor = overrideBaseColor
|
|
2291
|
-
? tinycolor(overrideBaseColor)
|
|
2292
|
-
: undefined;
|
|
2293
|
-
let value = baseColor
|
|
2294
|
-
? baseColor.clone()
|
|
2295
|
-
: undefined;
|
|
2296
|
-
value = tinycolor({ a: 0.2, r: 15, b: 15, g: 15 });
|
|
2297
|
-
return formatValue$1(value);
|
|
2298
|
-
},
|
|
2299
|
-
},
|
|
2300
|
-
{
|
|
2301
|
-
name: 'dark-border-input-field-disabled',
|
|
2302
|
-
},
|
|
2303
|
-
{
|
|
2304
|
-
name: 'border-divider',
|
|
2305
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2306
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2307
|
-
if (!overrideBaseColor) {
|
|
2308
|
-
return '';
|
|
2309
|
-
}
|
|
2310
|
-
const baseColor = overrideBaseColor
|
|
2311
|
-
? tinycolor(overrideBaseColor)
|
|
2312
|
-
: undefined;
|
|
2313
|
-
let value = baseColor
|
|
2314
|
-
? baseColor.clone()
|
|
2315
|
-
: undefined;
|
|
2316
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
|
|
2317
|
-
return formatValue$1(value);
|
|
2318
|
-
},
|
|
2319
|
-
},
|
|
2320
|
-
{
|
|
2321
|
-
name: 'dark-border-divider',
|
|
2322
|
-
},
|
|
2323
|
-
{
|
|
2324
|
-
name: 'border-divider-secondary',
|
|
2325
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2326
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2327
|
-
if (!overrideBaseColor) {
|
|
2328
|
-
return '';
|
|
2329
|
-
}
|
|
2330
|
-
const baseColor = overrideBaseColor
|
|
2331
|
-
? tinycolor(overrideBaseColor)
|
|
2332
|
-
: undefined;
|
|
2333
|
-
let value = baseColor
|
|
2334
|
-
? baseColor.clone()
|
|
2335
|
-
: undefined;
|
|
2336
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
2337
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(15);
|
|
2338
|
-
}
|
|
2339
|
-
else {
|
|
2340
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-15);
|
|
2341
|
-
}
|
|
2342
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.4);
|
|
2343
|
-
return formatValue$1(value);
|
|
2344
|
-
},
|
|
2345
|
-
},
|
|
2346
|
-
{
|
|
2347
|
-
name: 'dark-border-divider-secondary',
|
|
2348
|
-
},
|
|
2349
|
-
{
|
|
2350
|
-
name: 'border-tile-selected',
|
|
2351
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2352
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2353
|
-
if (!overrideBaseColor) {
|
|
2354
|
-
return '';
|
|
2355
|
-
}
|
|
2356
|
-
const baseColor = overrideBaseColor
|
|
2357
|
-
? tinycolor(overrideBaseColor)
|
|
2358
|
-
: undefined;
|
|
2359
|
-
let value = baseColor
|
|
2360
|
-
? baseColor.clone()
|
|
2361
|
-
: undefined;
|
|
2362
|
-
return formatValue$1(value);
|
|
2363
|
-
},
|
|
2364
|
-
},
|
|
2365
|
-
{
|
|
2366
|
-
name: 'dark-border-tile-selected',
|
|
2367
|
-
},
|
|
2368
|
-
{
|
|
2369
|
-
name: 'border-tile-selected-hover',
|
|
2370
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2371
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2372
|
-
if (!overrideBaseColor) {
|
|
2373
|
-
return '';
|
|
2374
|
-
}
|
|
2375
|
-
const baseColor = overrideBaseColor
|
|
2376
|
-
? tinycolor(overrideBaseColor)
|
|
2377
|
-
: undefined;
|
|
2378
|
-
let value = baseColor
|
|
2379
|
-
? baseColor.clone()
|
|
2380
|
-
: undefined;
|
|
2381
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
2382
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(10);
|
|
2383
|
-
}
|
|
2384
|
-
else {
|
|
2385
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-10);
|
|
2386
|
-
}
|
|
2387
|
-
return formatValue$1(value);
|
|
2388
|
-
},
|
|
2389
|
-
},
|
|
2390
|
-
{
|
|
2391
|
-
name: 'dark-border-tile-selected-hover',
|
|
2392
|
-
},
|
|
2393
|
-
{
|
|
2394
|
-
name: 'border-tile-focus',
|
|
2395
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2396
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2397
|
-
if (!overrideBaseColor) {
|
|
2398
|
-
return '';
|
|
2399
|
-
}
|
|
2400
|
-
const baseColor = overrideBaseColor
|
|
2401
|
-
? tinycolor(overrideBaseColor)
|
|
2402
|
-
: undefined;
|
|
2403
|
-
let value = baseColor
|
|
2404
|
-
? baseColor.clone()
|
|
2405
|
-
: undefined;
|
|
2406
|
-
return formatValue$1(value);
|
|
2407
|
-
},
|
|
2408
|
-
},
|
|
2409
|
-
{
|
|
2410
|
-
name: 'dark-border-tile-focus',
|
|
2411
|
-
},
|
|
2412
|
-
{
|
|
2413
|
-
name: 'border-tile-selected-focus',
|
|
2414
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2415
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2416
|
-
if (!overrideBaseColor) {
|
|
2417
|
-
return '';
|
|
2418
|
-
}
|
|
2419
|
-
const baseColor = overrideBaseColor
|
|
2420
|
-
? tinycolor(overrideBaseColor)
|
|
2421
|
-
: undefined;
|
|
2422
|
-
let value = baseColor
|
|
2423
|
-
? baseColor.clone()
|
|
2424
|
-
: undefined;
|
|
2425
|
-
if (baseColor === null || baseColor === void 0 ? void 0 : baseColor.isDark()) {
|
|
2426
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(15);
|
|
2427
|
-
}
|
|
2428
|
-
else {
|
|
2429
|
-
value = value === null || value === void 0 ? void 0 : value.lighten(-15);
|
|
2430
|
-
}
|
|
2431
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.6);
|
|
2432
|
-
return formatValue$1(value);
|
|
2433
|
-
},
|
|
2434
|
-
},
|
|
2435
|
-
{
|
|
2436
|
-
name: 'dark-border-tile-selected-focus',
|
|
2437
|
-
},
|
|
2438
|
-
];
|
|
2439
|
-
|
|
2440
|
-
const formatValue = (tinyColor) => {
|
|
2441
|
-
if (!tinyColor) {
|
|
2442
|
-
return '';
|
|
2443
|
-
}
|
|
2444
|
-
const { r, g, b, a } = tinyColor.toRgb();
|
|
2445
|
-
return `${r} ${g} ${b} / ${a}`;
|
|
2446
|
-
};
|
|
2447
|
-
const OverridableRingTokens = [
|
|
2448
|
-
{
|
|
2449
|
-
name: 'ring-input-focus',
|
|
2450
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2451
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2452
|
-
if (!overrideBaseColor) {
|
|
2453
|
-
return '';
|
|
2454
|
-
}
|
|
2455
|
-
const baseColor = overrideBaseColor
|
|
2456
|
-
? tinycolor(overrideBaseColor)
|
|
2457
|
-
: undefined;
|
|
2458
|
-
let value = baseColor
|
|
2459
|
-
? baseColor.clone()
|
|
2460
|
-
: undefined;
|
|
2461
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.25);
|
|
2462
|
-
return formatValue(value);
|
|
2463
|
-
},
|
|
2464
|
-
},
|
|
2465
|
-
{
|
|
2466
|
-
name: 'dark-ring-input-focus',
|
|
2467
|
-
},
|
|
2468
|
-
{
|
|
2469
|
-
name: 'ring-action-focus',
|
|
2470
|
-
overrideGetter: (overrideColors, tinycolor) => {
|
|
2471
|
-
const overrideBaseColor = overrideColors['actionColor'];
|
|
2472
|
-
if (!overrideBaseColor) {
|
|
2473
|
-
return '';
|
|
2474
|
-
}
|
|
2475
|
-
const baseColor = overrideBaseColor
|
|
2476
|
-
? tinycolor(overrideBaseColor)
|
|
2477
|
-
: undefined;
|
|
2478
|
-
let value = baseColor
|
|
2479
|
-
? baseColor.clone()
|
|
2480
|
-
: undefined;
|
|
2481
|
-
value = value === null || value === void 0 ? void 0 : value.setAlpha(0.25);
|
|
2482
|
-
return formatValue(value);
|
|
2483
|
-
},
|
|
2484
|
-
},
|
|
2485
|
-
{
|
|
2486
|
-
name: 'dark-ring-action-focus',
|
|
2487
|
-
},
|
|
2488
|
-
];
|
|
2489
|
-
|
|
2490
|
-
/**
|
|
2491
|
-
* Vega components color override controller
|
|
2492
|
-
*/
|
|
2493
|
-
class ColorSchemaOverridingController {
|
|
2494
|
-
/**
|
|
2495
|
-
* It takes a color and generates a bunch of other colors based on that color
|
|
2496
|
-
*
|
|
2497
|
-
* @param {VegaThemeOverrideColors} overrideColors - OverrideColors - This is the object that is passed in from the user.
|
|
2498
|
-
* @returns {OverrideColor[]} Parsed action colors
|
|
2499
|
-
*/
|
|
2500
|
-
generateOverrideThemes(overrideColors) {
|
|
2501
|
-
return this.getOverridableTokens().map((item) => {
|
|
2502
|
-
return {
|
|
2503
|
-
name: item.name,
|
|
2504
|
-
value: this.parseCssVarValue(item, overrideColors),
|
|
2505
|
-
};
|
|
2506
|
-
});
|
|
2507
|
-
}
|
|
2508
|
-
/**
|
|
2509
|
-
* Set the custom override theme colors to customOverrideThemeStyleContainer
|
|
2510
|
-
*
|
|
2511
|
-
* @param {OverrideColor[]} overrideThemes Parsed custom override colors
|
|
2512
|
-
*/
|
|
2513
|
-
applyTheme(overrideThemes) {
|
|
2514
|
-
this.getOverrideThemeContainer().innerHTML = `
|
|
2515
|
-
:root {
|
|
2516
|
-
\t\t${overrideThemes
|
|
2517
|
-
.filter((item) => {
|
|
2518
|
-
return !!item.value;
|
|
2519
|
-
})
|
|
2520
|
-
.map((item) => `--v-${item.name}: ${item.value};`)
|
|
2521
|
-
.join('\n\t\t')}
|
|
2522
|
-
}
|
|
2523
|
-
`;
|
|
2524
|
-
}
|
|
2525
|
-
/**
|
|
2526
|
-
* It creates a customOverrideTheme style tag in the head of the document if it doesn't exist, and returns it
|
|
2527
|
-
*
|
|
2528
|
-
* @returns {Element} The customOverrideThemeStyleContainer is being returned.
|
|
2529
|
-
*/
|
|
2530
|
-
getOverrideThemeContainer() {
|
|
2531
|
-
let customOverrideThemeStyleContainer = document.head.querySelector(`#vegaCustomOverrideTheme`);
|
|
2532
|
-
if (!customOverrideThemeStyleContainer) {
|
|
2533
|
-
customOverrideThemeStyleContainer = document.createElement('style');
|
|
2534
|
-
customOverrideThemeStyleContainer.id = 'vegaCustomOverrideTheme';
|
|
2535
|
-
document.head.append(customOverrideThemeStyleContainer);
|
|
2536
|
-
}
|
|
2537
|
-
return customOverrideThemeStyleContainer;
|
|
2538
|
-
}
|
|
2539
|
-
/**
|
|
2540
|
-
* Get the overridable color tokens from design token
|
|
2541
|
-
*
|
|
2542
|
-
* @returns {OverridableToken[]} overridable action color token array
|
|
2543
|
-
*/
|
|
2544
|
-
getOverridableTokens() {
|
|
2545
|
-
return [...OverridableColorTokens, ...OverridableBorderTokens, ...OverridableRingTokens];
|
|
2546
|
-
}
|
|
2547
|
-
/**
|
|
2548
|
-
* Calculate and parse color to css var value
|
|
2549
|
-
*
|
|
2550
|
-
* @param {OverridableToken} overrideColorToken The token will be overridden
|
|
2551
|
-
* @param {VegaThemeOverrideColors} overrideColors the payload of override colors
|
|
2552
|
-
* @returns {string} The css var value
|
|
2553
|
-
*/
|
|
2554
|
-
parseCssVarValue(overrideColorToken, overrideColors) {
|
|
2555
|
-
var _a;
|
|
2556
|
-
return (_a = overrideColorToken.overrideGetter) === null || _a === void 0 ? void 0 : _a.call(overrideColorToken, overrideColors, tinycolor);
|
|
2557
|
-
}
|
|
2558
|
-
}
|
|
2559
|
-
const VegaColorSchemaOverridingController = new ColorSchemaOverridingController();
|
|
2560
|
-
|
|
2561
|
-
/* This file is generated by vega-design 2.0.77 */
|
|
2562
|
-
const DarkModeColorTokens = {
|
|
2563
|
-
'bg-brand': '176, 180, 181, 1',
|
|
2564
|
-
'bg-page': '24, 24, 48, 1',
|
|
2565
|
-
'bg-primary': '4, 4, 28, 1',
|
|
2566
|
-
'bg-secondary': '18, 18, 39, 1',
|
|
2567
|
-
'bg-tertiary': '24, 24, 48, 1',
|
|
2568
|
-
'bg-quaternary': '70, 71, 101, 1',
|
|
2569
|
-
'bg-inverted-primary': '252, 252, 252, 1',
|
|
2570
|
-
'bg-inverted-secondary': '247, 247, 247, 1',
|
|
2571
|
-
'bg-inverted-tertiary': '240, 243, 247, 1',
|
|
2572
|
-
'bg-inverted-quaternary': '241, 248, 251, 1',
|
|
2573
|
-
'bg-action': '0, 187, 255, 1',
|
|
2574
|
-
'bg-action-hover': '0, 204, 255, 1',
|
|
2575
|
-
'bg-action-focus': '0, 187, 255, 1',
|
|
2576
|
-
'bg-action-active': '4, 165, 245, 1',
|
|
2577
|
-
'bg-action-quaternary': '51, 57, 61, 1',
|
|
2578
|
-
'bg-action-quaternary-hover': '89, 96, 99, 1',
|
|
2579
|
-
'bg-action-quaternary-active': '24, 24, 48, 1',
|
|
2580
|
-
'bg-action-secondary': '0, 0, 0, 0',
|
|
2581
|
-
'bg-action-secondary-hover': '0, 204, 255, 0.2',
|
|
2582
|
-
'bg-action-secondary-active': '4, 165, 245, 0.2',
|
|
2583
|
-
'bg-action-tertiary': '0, 0, 0, 0',
|
|
2584
|
-
'bg-action-tertiary-hover': '252, 252, 252, 0.2',
|
|
2585
|
-
'bg-action-tertiary-active': '252, 252, 252, 0.1',
|
|
2586
|
-
'bg-app-header': '24, 24, 48, 0.92',
|
|
2587
|
-
'bg-backdrop-modal': '70, 71, 101, 0.8',
|
|
2588
|
-
'bg-backdrop-popover': '70, 71, 101, 0.56',
|
|
2589
|
-
'bg-backdrop-sidebar': '70, 71, 101, 0.8',
|
|
2590
|
-
'bg-chip': '252, 252, 252, 0.1',
|
|
2591
|
-
'bg-chip-hover': '252, 252, 252, 0.2',
|
|
2592
|
-
'bg-chip-active': '252, 252, 252, 0.06',
|
|
2593
|
-
'bg-danger': '255, 56, 97, 1',
|
|
2594
|
-
'bg-danger-hover': '255, 71, 123, 1',
|
|
2595
|
-
'bg-danger-focus': '255, 56, 97, 1',
|
|
2596
|
-
'bg-danger-active': '230, 50, 87, 1',
|
|
2597
|
-
'bg-danger-tertiary': '0, 0, 0, 0',
|
|
2598
|
-
'bg-danger-tertiary-hover': '255, 71, 123, 0.2',
|
|
2599
|
-
'bg-danger-tertiary-active': '230, 50, 87, 0.2',
|
|
2600
|
-
'bg-disabled': '70, 71, 101, 1',
|
|
2601
|
-
'bg-divider': '32, 54, 69, 1',
|
|
2602
|
-
'bg-divider-secondary': '51, 57, 61, 1',
|
|
2603
|
-
'bg-keypad-btn-active': '45, 76, 97, 1',
|
|
2604
|
-
'bg-loading-progress': '4, 165, 245, 1',
|
|
2605
|
-
'bg-loading-track': '142, 223, 249, 1',
|
|
2606
|
-
'bg-segment-hover': '70, 71, 101, 1',
|
|
2607
|
-
'bg-segment-control': '210, 208, 223, 0.1',
|
|
2608
|
-
'bg-selected': '85, 218, 255, 0.3',
|
|
2609
|
-
'bg-sidebar': '18, 18, 39, 1',
|
|
2610
|
-
'bg-sidebar-icon': '188, 186, 213, 1',
|
|
2611
|
-
'bg-sidebar-icon-hover': '18, 18, 39, 1',
|
|
2612
|
-
'bg-sidebar-icon-selected': '252, 252, 252, 1',
|
|
2613
|
-
'bg-sidebar-item-hover': '252, 252, 252, 1',
|
|
2614
|
-
'bg-sidebar-item-selected': '0, 187, 255, 0.4',
|
|
2615
|
-
'bg-site-footer': '51, 57, 61, 1',
|
|
2616
|
-
'bg-site-footer-action': '171, 198, 216, 1',
|
|
2617
|
-
'bg-site-footer-action-hover': '199, 217, 229, 1',
|
|
2618
|
-
'bg-site-footer-action-active': '143, 179, 203, 1',
|
|
2619
|
-
'bg-site-footer-field': '89, 96, 99, 1',
|
|
2620
|
-
'bg-slider-handle': '252, 252, 252, 1',
|
|
2621
|
-
'bg-status-error': '189, 41, 71, 1',
|
|
2622
|
-
'bg-status-info': '252, 252, 252, 1',
|
|
2623
|
-
'bg-status-success': '123, 242, 151, 1',
|
|
2624
|
-
'bg-status-warning': '255, 212, 105, 1',
|
|
2625
|
-
'bg-tab': '51, 57, 61, 1',
|
|
2626
|
-
'bg-tab-hover': '89, 96, 99, 1',
|
|
2627
|
-
'bg-tab-selected': '240, 243, 247, 1',
|
|
2628
|
-
'bg-table-alt-row': '18, 18, 39, 1',
|
|
2629
|
-
'bg-table-header': '24, 24, 48, 1',
|
|
2630
|
-
'bg-table-row-hover': '70, 71, 101, 1',
|
|
2631
|
-
'bg-table-row-selected-expanded': '32, 54, 69, 1',
|
|
2632
|
-
'bg-table-selected-row': '45, 76, 97, 1',
|
|
2633
|
-
'bg-textarea-count': '252, 252, 252, 0.5',
|
|
2634
|
-
'bg-tile': '4, 4, 28, 1',
|
|
2635
|
-
'bg-tile-hover': '24, 24, 48, 1',
|
|
2636
|
-
'bg-tile-selected': '32, 54, 69, 1',
|
|
2637
|
-
'bg-tile-selected-hover': '45, 76, 97, 1',
|
|
2638
|
-
'bg-toggle-switch': '210, 208, 223, 1',
|
|
2639
|
-
'bg-toggle-switch-hover': '188, 186, 213, 1',
|
|
2640
|
-
'bg-toggle-switch-selected-disabled': '0, 75, 128, 1',
|
|
2641
|
-
'bg-transparent': '0, 0, 0, 0',
|
|
2642
|
-
'bg-accent1-primary': '109, 217, 202, 1',
|
|
2643
|
-
'bg-accent1-secondary': '174, 234, 226, 1',
|
|
2644
|
-
'bg-accent1-tertiary': '223, 247, 243, 1',
|
|
2645
|
-
'bg-accent2-primary': '95, 56, 206, 1',
|
|
2646
|
-
'bg-accent2-secondary': '184, 167, 233, 1',
|
|
2647
|
-
'bg-accent2-tertiary': '219, 211, 244, 1',
|
|
2648
|
-
'bg-accent3-primary': '255, 203, 105, 1',
|
|
2649
|
-
'bg-accent3-secondary': '251, 226, 185, 1',
|
|
2650
|
-
'bg-accent3-tertiary': '255, 243, 222, 1',
|
|
2651
|
-
'bg-accent4-primary': '255, 129, 87, 1',
|
|
2652
|
-
'bg-accent4-secondary': '255, 185, 162, 1',
|
|
2653
|
-
'bg-accent4-tertiary': '255, 227, 218, 1',
|
|
2654
|
-
'bg-accent5-primary': '4, 165, 245, 1',
|
|
2655
|
-
'bg-accent5-secondary': '85, 218, 255, 1',
|
|
2656
|
-
'bg-accent5-tertiary': '227, 247, 253, 1',
|
|
2657
|
-
'bg-accent6-primary': '255, 84, 165, 1',
|
|
2658
|
-
'bg-accent6-secondary': '255, 179, 215, 1',
|
|
2659
|
-
'bg-accent6-tertiary': '255, 217, 235, 1',
|
|
2660
|
-
'bg-accent7-primary': '37, 159, 159, 1',
|
|
2661
|
-
'bg-accent7-secondary': '155, 212, 214, 1',
|
|
2662
|
-
'bg-accent7-tertiary': '208, 239, 239, 1',
|
|
2663
|
-
'bg-accent8-primary': '86, 61, 130, 1',
|
|
2664
|
-
'bg-accent8-secondary': '199, 162, 204, 1',
|
|
2665
|
-
'bg-accent8-tertiary': '230, 214, 234, 1',
|
|
2666
|
-
'bg-accent9-primary': '255, 191, 63, 1',
|
|
2667
|
-
'bg-accent9-secondary': '254, 215, 142, 1',
|
|
2668
|
-
'bg-accent9-tertiary': '251, 226, 185, 1',
|
|
2669
|
-
'bg-accent10-primary': '237, 122, 35, 1',
|
|
2670
|
-
'bg-accent10-secondary': '241, 146, 85, 1',
|
|
2671
|
-
'bg-accent10-tertiary': '245, 187, 148, 1',
|
|
2672
|
-
'bg-date-picker-range': '32, 54, 69, 1',
|
|
2673
|
-
'text-primary': '252, 252, 252, 1',
|
|
2674
|
-
'text-secondary': '188, 186, 213, 1',
|
|
2675
|
-
'text-inverted-primary': '4, 4, 28, 1',
|
|
2676
|
-
'text-inverted-secondary': '107, 116, 125, 1',
|
|
2677
|
-
'text-black': '32, 54, 69, 1',
|
|
2678
|
-
'text-white': '252, 252, 252, 1',
|
|
2679
|
-
'text-brand': '176, 180, 181, 1',
|
|
2680
|
-
'text-danger-link': '255, 56, 97, 1',
|
|
2681
|
-
'text-danger-link-hover': '255, 71, 123, 1',
|
|
2682
|
-
'text-danger-link-active': '230, 50, 87, 1',
|
|
2683
|
-
'text-danger-link-focus': '255, 82, 136, 1',
|
|
2684
|
-
'text-danger-link-visited': '255, 56, 97, 1',
|
|
2685
|
-
'text-disabled': '70, 71, 101, 1',
|
|
2686
|
-
'text-error': '255, 56, 97, 1',
|
|
2687
|
-
'text-input-disabled': '176, 180, 181, 1',
|
|
2688
|
-
'text-input-placeholder': '89, 96, 99, 1',
|
|
2689
|
-
'text-link': '0, 187, 255, 1',
|
|
2690
|
-
'text-link-hover': '0, 204, 255, 1',
|
|
2691
|
-
'text-link-active': '4, 165, 245, 1',
|
|
2692
|
-
'text-link-focus': '0, 204, 255, 1',
|
|
2693
|
-
'text-link-visited': '128, 107, 255, 1',
|
|
2694
|
-
'text-on-action': '4, 4, 28, 1',
|
|
2695
|
-
'text-on-danger': '4, 4, 28, 1',
|
|
2696
|
-
'text-on-disabled': '4, 4, 28, 1',
|
|
2697
|
-
'text-sidebar-link': '188, 186, 213, 1',
|
|
2698
|
-
'text-sidebar-link-hover': '18, 18, 39, 1',
|
|
2699
|
-
'text-sidebar-link-selected': '252, 252, 252, 1',
|
|
2700
|
-
'text-site-footer-link': '171, 198, 216, 1',
|
|
2701
|
-
'text-site-footer-link-hover': '199, 217, 229, 1',
|
|
2702
|
-
'text-site-footer-link-active': '143, 179, 203, 1',
|
|
2703
|
-
'text-success': '89, 217, 119, 1',
|
|
2704
|
-
'text-inverted-success': '1, 128, 31, 1',
|
|
2705
|
-
'text-accent1-primary': '109, 217, 202, 1',
|
|
2706
|
-
'text-accent2-primary': '95, 56, 206, 1',
|
|
2707
|
-
'text-accent3-primary': '255, 203, 105, 1',
|
|
2708
|
-
'text-accent4-primary': '255, 129, 87, 1',
|
|
2709
|
-
'text-accent5-primary': '4, 165, 245, 1',
|
|
2710
|
-
'text-accent6-primary': '255, 71, 123, 1',
|
|
2711
|
-
'text-accent7-primary': '37, 159, 159, 1',
|
|
2712
|
-
'text-accent8-primary': '86, 61, 130, 1',
|
|
2713
|
-
'text-accent9-primary': '255, 191, 63, 1',
|
|
2714
|
-
'text-accent10-primary': '237, 122, 35, 1',
|
|
2715
|
-
'border-color-action': '0, 187, 255, 1',
|
|
2716
|
-
'border-color-action-hover': '0, 204, 255, 1',
|
|
2717
|
-
'border-color-action-active': '4, 165, 245, 1',
|
|
2718
|
-
'border-color-chip': '107, 116, 125, 1',
|
|
2719
|
-
'border-color-danger': '255, 56, 97, 1',
|
|
2720
|
-
'border-color-danger-hover': '255, 71, 123, 1',
|
|
2721
|
-
'border-color-danger-active': '230, 50, 87, 1',
|
|
2722
|
-
'border-color-divider': '32, 54, 69, 1',
|
|
2723
|
-
'border-color-divider-secondary': '51, 57, 61, 1',
|
|
2724
|
-
'border-color-input-field': '32, 54, 69, 1',
|
|
2725
|
-
'border-color-input-field-hover': '58, 98, 125, 1',
|
|
2726
|
-
'border-color-input-field-focus': '0, 187, 255, 1',
|
|
2727
|
-
'border-color-input-field-danger': '255, 56, 97, 1',
|
|
2728
|
-
'border-color-input-field-danger-hover': '255, 71, 123, 1',
|
|
2729
|
-
'border-color-input-field-danger-focus': '255, 56, 97, 1',
|
|
2730
|
-
'border-color-input-field-disabled': '4, 4, 28, 1',
|
|
2731
|
-
'border-color-secondary-btn-disabled': '70, 71, 101, 1',
|
|
2732
|
-
'border-color-sidebar-item-focus': '0, 187, 255, 1',
|
|
2733
|
-
'border-color-slider-handle': '107, 116, 125, 1',
|
|
2734
|
-
'border-color-success': '89, 217, 119, 1',
|
|
2735
|
-
'border-color-table-divider': '32, 54, 69, 1',
|
|
2736
|
-
'border-color-tile': '32, 54, 69, 1',
|
|
2737
|
-
'border-color-tile-hover': '58, 98, 125, 1',
|
|
2738
|
-
'border-color-tile-focus': '0, 187, 255, 1',
|
|
2739
|
-
'border-color-tile-selected-focus': '153, 192, 255, 1',
|
|
2740
|
-
'border-color-tile-selected': '153, 192, 255, 1',
|
|
2741
|
-
'border-color-tile-selected-hover': '178, 208, 255, 1',
|
|
2742
|
-
'border-color-notification-btn': '252, 252, 252, 1',
|
|
2743
|
-
'border-color-notification-btn-dark': '32, 54, 69, 1',
|
|
2744
|
-
};
|
|
2745
|
-
|
|
2746
|
-
/* This file is generated by vega-design 2.0.77 */
|
|
2747
|
-
const DarkModeBorderTokens = {
|
|
2748
|
-
'border-secondary-btn': '0, 187, 255, 1',
|
|
2749
|
-
'border-secondary-btn-hover': '0, 204, 255, 1',
|
|
2750
|
-
'border-secondary-danger-btn': '255, 56, 97, 1',
|
|
2751
|
-
'border-secondary-btn-active': '4, 165, 245, 1',
|
|
2752
|
-
'border-secondary-danger-btn-hover': '255, 71, 123, 1',
|
|
2753
|
-
'border-secondary-danger-btn-active': '230, 50, 87, 1',
|
|
2754
|
-
'border-input-field': '32, 54, 69, 1',
|
|
2755
|
-
'border-input-field-hover': '58, 98, 125, 1',
|
|
2756
|
-
'border-input-field-focus': '0, 187, 255, 1',
|
|
2757
|
-
'border-input-field-danger': '255, 56, 97, 1',
|
|
2758
|
-
'border-input-field-danger-hover': '255, 71, 123, 1',
|
|
2759
|
-
'border-input-field-danger-focus': '255, 56, 97, 1',
|
|
2760
|
-
'border-sidebar-item-focus': '0, 187, 255, 1',
|
|
2761
|
-
'border-input-field-disabled': '4, 4, 28, 1',
|
|
2762
|
-
'border-success': '89, 217, 119, 1',
|
|
2763
|
-
'border-secondary-btn-disabled': '70, 71, 101, 1',
|
|
2764
|
-
'border-chip': '107, 116, 125, 1',
|
|
2765
|
-
'border-divider': '32, 54, 69, 1',
|
|
2766
|
-
'border-divider-secondary': '51, 57, 61, 1',
|
|
2767
|
-
'border-tile-selected': '153, 192, 255, 1',
|
|
2768
|
-
'border-tile-selected-hover': '178, 208, 255, 1',
|
|
2769
|
-
'border-table-divider': '32, 54, 69, 1',
|
|
2770
|
-
'border-slider-handle': '107, 116, 125, 1',
|
|
2771
|
-
'border-tile': '32, 54, 69, 1',
|
|
2772
|
-
'border-tile-hover': '58, 98, 125, 1',
|
|
2773
|
-
'border-tile-focus': '0, 187, 255, 1',
|
|
2774
|
-
'border-tile-selected-focus': '153, 192, 255, 1',
|
|
2775
|
-
'border-notification-btn': '252, 252, 252, 1',
|
|
2776
|
-
'border-notification-btn-black': '32, 54, 69, 1',
|
|
2777
|
-
};
|
|
2778
|
-
|
|
2779
|
-
/* This file is generated by vega-design 2.0.77 */
|
|
2780
|
-
const DarkModeShadowTokens = {
|
|
2781
|
-
'shadow-card': '0px 2px 10px 0px rgba(0, 0, 0, 0.18), 0px 2px 4px 0px rgba(0, 0, 0, 0.1)',
|
|
2782
|
-
'shadow-modal': '0px 6px 40px 0px rgba(2, 2, 15, 0.14), 0px 4px 24px 0px rgba(2, 2, 15, 0.28), 0px 8px 80px 0px rgba(2, 2, 15, 0.26)',
|
|
2783
|
-
'shadow-popover': '0px 0px 88px 0px rgba(2, 2, 15, 0.08), 0px 0px 32px 0px rgba(2, 2, 15, 0.1), 0px 4px 72px 0px rgba(2, 2, 15, 0.16)',
|
|
2784
|
-
'shadow-form-field': '0px 1px 2px 0px rgba(170, 170, 170, 0.06), 0px 1px 3px 0px rgba(170, 170, 170, 0.1)',
|
|
2785
|
-
'shadow-dropdown-menu': '0px 2px 4px -2px rgba(0, 0, 0, 0.14), 0px 4px 6px -1px rgba(0, 0, 0, 0.16)',
|
|
2786
|
-
'shadow-app-header': '0px 1px 0px 0px rgba(188, 186, 213, 0.25)',
|
|
2787
|
-
'shadow-modal-header': '0px 1px 0px 0px rgba(188, 186, 213, 0.25)',
|
|
2788
|
-
'shadow-modal-footer': '0px -2px 8px 0px rgba(188, 186, 213, 0.4), 0px -1px 0px 0px rgba(188, 186, 213, 0.25)',
|
|
2789
|
-
'shadow-modal-footer-no-scroll': '0px -1px 0px 0px rgba(188, 186, 213, 0.25)',
|
|
2790
|
-
};
|
|
2791
|
-
|
|
2792
|
-
/* This file is generated by vega-design 2.0.77 */
|
|
2793
|
-
const DarkModeRingTokens = {
|
|
2794
|
-
'ring-input-focus': '0, 187, 255, 0.25',
|
|
2795
|
-
'ring-input-danger-focus': '255, 56, 97, 0.25',
|
|
2796
|
-
'ring-action-focus': '0, 187, 255, 0.25',
|
|
2797
|
-
'ring-action-danger-focus': '255, 56, 97, 0.25',
|
|
2798
|
-
};
|
|
2799
|
-
|
|
2800
|
-
// TODO: Remove this after the token add in vega design.
|
|
2801
|
-
const CustomDarkModeColorTokens = {
|
|
2802
|
-
'bg-backdrop-loading': '0, 0, 0, 0.5',
|
|
2803
|
-
'text-page-notification-content': DarkModeColorTokens['text-inverted-primary'],
|
|
2804
|
-
'bg-textarea-counter-exceed-max-length': '255, 87, 114',
|
|
2805
|
-
'bg-date-picker-range': '32, 54, 69, 1',
|
|
2806
|
-
'regular-credit-card-bg': '252, 252, 252, 1',
|
|
2807
|
-
'regular-credit-card-top': '4, 4, 28, 1',
|
|
2808
|
-
'regular-credit-card-bottom': '255, 255, 255, 1',
|
|
2809
|
-
};
|
|
2810
|
-
/**
|
|
2811
|
-
* Vega components dark mode style controller
|
|
2812
|
-
*/
|
|
2813
|
-
class DarkModeStyleController {
|
|
2814
|
-
constructor() {
|
|
2815
|
-
this.dynamicCustomDarkModeColor = {};
|
|
2816
|
-
this.darkModeColorAllTokens = {};
|
|
2817
|
-
this.observer = new observer.Observer(this.isAcceptObserver.bind(this), (isDark) => {
|
|
2818
|
-
if (isDark) {
|
|
2819
|
-
this.generateDarkModeStyle();
|
|
2820
|
-
}
|
|
2821
|
-
else {
|
|
2822
|
-
this.removeDarkModeStyleContainer();
|
|
2823
|
-
}
|
|
2824
|
-
});
|
|
2825
|
-
changeManager.ChangeManager.register(staticSubjectTitle.DARK_MODE_CHANGE, this.observer);
|
|
2826
|
-
}
|
|
2827
|
-
/**
|
|
2828
|
-
* This method dynamically registers a custom dark color.
|
|
2829
|
-
*
|
|
2830
|
-
* @param {Record<string, string>} customDarkModeColor - custom dark mode color
|
|
2831
|
-
*/
|
|
2832
|
-
registerCustomDarkModeColor(customDarkModeColor) {
|
|
2833
|
-
this.dynamicCustomDarkModeColor = Object.assign(Object.assign({}, this.dynamicCustomDarkModeColor), customDarkModeColor);
|
|
2834
|
-
this.generateDarkModeStyle();
|
|
2835
|
-
}
|
|
2836
|
-
/**
|
|
2837
|
-
* It generates a CSS style for dark mode to override the style.
|
|
2838
|
-
*/
|
|
2839
|
-
generateDarkModeStyle() {
|
|
2840
|
-
this.darkModeColorAllTokens = Object.assign(DarkModeColorTokens, DarkModeBorderTokens, DarkModeRingTokens, DarkModeShadowTokens, CustomDarkModeColorTokens, this.dynamicCustomDarkModeColor);
|
|
2841
|
-
const keys = Object.keys(this.darkModeColorAllTokens);
|
|
2842
|
-
this.getDarkModeStyleContainer().innerHTML = `
|
|
2843
|
-
html.dark {
|
|
2844
|
-
\t\t${keys.map((key) => `--v-${key}: ${this.darkModeColorAllTokens[key]};`).join('\n\t\t')}}`;
|
|
2845
|
-
}
|
|
2846
|
-
/**
|
|
2847
|
-
* It creates a `vegaDarkModeStyle` style tag in the head of the document if it doesn't exist, and returns it.
|
|
2848
|
-
*
|
|
2849
|
-
* @returns {Element} The `vegaDarkModeStyleContainer` is being returned.
|
|
2850
|
-
*/
|
|
2851
|
-
getDarkModeStyleContainer() {
|
|
2852
|
-
let vegaDarkModeStyleContainer = document.head.querySelector(`#vegaDarkModeStyle`);
|
|
2853
|
-
if (!vegaDarkModeStyleContainer) {
|
|
2854
|
-
vegaDarkModeStyleContainer = document.createElement('style');
|
|
2855
|
-
vegaDarkModeStyleContainer.id = 'vegaDarkModeStyle';
|
|
2856
|
-
document.head.append(vegaDarkModeStyleContainer);
|
|
2857
|
-
}
|
|
2858
|
-
return vegaDarkModeStyleContainer;
|
|
2859
|
-
}
|
|
2860
|
-
/**
|
|
2861
|
-
* Remove the vegaDarkModeStyle style element.
|
|
2862
|
-
*/
|
|
2863
|
-
removeDarkModeStyleContainer() {
|
|
2864
|
-
const vegaDarkModeStyleContainer = document.head.querySelector(`#vegaDarkModeStyle`);
|
|
2865
|
-
if (vegaDarkModeStyleContainer) {
|
|
2866
|
-
vegaDarkModeStyleContainer.remove();
|
|
2867
|
-
}
|
|
2868
|
-
}
|
|
2869
|
-
/**
|
|
2870
|
-
* Determines whether the observer should accept changes.
|
|
2871
|
-
*
|
|
2872
|
-
* @returns {boolean} Always returns true in the current implementation.
|
|
2873
|
-
*/
|
|
2874
|
-
isAcceptObserver() {
|
|
2875
|
-
return true;
|
|
2876
|
-
}
|
|
2877
|
-
}
|
|
2878
|
-
const VegaDarkModeStyleController = new DarkModeStyleController();
|
|
2879
|
-
|
|
2880
|
-
const ThemeManagerRuntimeMetricsPayloadDefinition = [
|
|
2881
|
-
{
|
|
2882
|
-
payloadKey: 'IS_OVERRIDECOLORS_METHOD_CALLED',
|
|
2883
|
-
payloadDescription: 'Indicate if the method overrideColors of public API ThemeManager is called',
|
|
2884
|
-
/**
|
|
2885
|
-
* Indicate whether the method is collected when the method been called .
|
|
2886
|
-
*
|
|
2887
|
-
* @param {string} scope - The class name of public api
|
|
2888
|
-
* @param {string} methodName - The method name called by the public api
|
|
2889
|
-
* @returns {boolean} A boolean value
|
|
2890
|
-
*/
|
|
2891
|
-
canAccept: (scope, methodName) => scope === 'ThemeManager' && methodName === 'overrideColors',
|
|
2892
|
-
/**
|
|
2893
|
-
* The function checks if the method is be called.
|
|
2894
|
-
*
|
|
2895
|
-
* @returns {boolean} A boolean value
|
|
2896
|
-
*/
|
|
2897
|
-
payloadValue: () => {
|
|
2898
|
-
return true;
|
|
2899
|
-
},
|
|
2900
|
-
},
|
|
2901
|
-
{
|
|
2902
|
-
payloadKey: 'IS_RESET_METHOD_CALLED',
|
|
2903
|
-
payloadDescription: 'Indicate if the method reset of public API ThemeManager is called',
|
|
2904
|
-
/**
|
|
2905
|
-
* Indicate whether the method is collected when the method been called .
|
|
2906
|
-
*
|
|
2907
|
-
* @param {string} scope - The class name of public api
|
|
2908
|
-
* @param {string} methodName - The method name called by the public api
|
|
2909
|
-
* @returns {boolean} A boolean value
|
|
2910
|
-
*/
|
|
2911
|
-
canAccept: (scope, methodName) => scope === 'ThemeManager' && methodName === 'reset',
|
|
2912
|
-
/**
|
|
2913
|
-
* The function checks if the method is be called.
|
|
2914
|
-
*
|
|
2915
|
-
* @returns {boolean} A boolean value
|
|
2916
|
-
*/
|
|
2917
|
-
payloadValue: () => {
|
|
2918
|
-
return true;
|
|
2919
|
-
},
|
|
2920
|
-
},
|
|
2921
|
-
{
|
|
2922
|
-
payloadKey: 'IS_TOGGLEDARKMODE_METHOD_CALLED',
|
|
2923
|
-
payloadDescription: 'Indicate if the method toggleDarkMode of public API ThemeManager is called',
|
|
2924
|
-
/**
|
|
2925
|
-
* Indicate whether the method is collected when the method been called .
|
|
2926
|
-
*
|
|
2927
|
-
* @param {string} scope - The class name of public api
|
|
2928
|
-
* @param {string} methodName - The method name called by the public api
|
|
2929
|
-
* @returns {boolean} A boolean value
|
|
2930
|
-
*/
|
|
2931
|
-
canAccept: (scope, methodName) => scope === 'ThemeManager' && methodName === 'toggleDarkMode',
|
|
2932
|
-
/**
|
|
2933
|
-
* The function checks if the method is be called.
|
|
2934
|
-
*
|
|
2935
|
-
* @returns {boolean} A boolean value
|
|
2936
|
-
*/
|
|
2937
|
-
payloadValue: () => {
|
|
2938
|
-
return true;
|
|
2939
|
-
},
|
|
2940
|
-
},
|
|
2941
|
-
{
|
|
2942
|
-
payloadKey: 'IS_ISDARKMODE_METHOD_CALLED',
|
|
2943
|
-
payloadDescription: 'Indicate if the method isDarkMode of public API ThemeManager is called',
|
|
2944
|
-
/**
|
|
2945
|
-
* Indicate whether the method is collected when the method been called .
|
|
2946
|
-
*
|
|
2947
|
-
* @param {string} scope - The class name of public api
|
|
2948
|
-
* @param {string} methodName - The method name called by the public api
|
|
2949
|
-
* @returns {boolean} A boolean value
|
|
2950
|
-
*/
|
|
2951
|
-
canAccept: (scope, methodName) => scope === 'ThemeManager' && methodName === 'isDarkMode',
|
|
2952
|
-
/**
|
|
2953
|
-
* The function checks if the method is be called.
|
|
2954
|
-
*
|
|
2955
|
-
* @returns {boolean} A boolean value
|
|
2956
|
-
*/
|
|
2957
|
-
payloadValue: () => {
|
|
2958
|
-
return true;
|
|
2959
|
-
},
|
|
2960
|
-
},
|
|
2961
|
-
];
|
|
2962
|
-
|
|
2963
|
-
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
2964
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2965
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2966
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2967
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2968
|
-
};
|
|
2969
|
-
/**
|
|
2970
|
-
* Vega components theme manager
|
|
2971
|
-
*/
|
|
2972
|
-
class ThemeManager {
|
|
2973
|
-
constructor() {
|
|
2974
|
-
this.vegaPublicAPIRuntimeMetricsSlimmer = createPublicApiRuntimeMetricsSlimmer.createPublicAPIRuntimeMetricsSlimmer(ThemeManager, ['overrideColors', 'reset', 'toggleDarkMode', 'isDarkMode'], ThemeManagerRuntimeMetricsPayloadDefinition);
|
|
2975
|
-
}
|
|
2976
|
-
/**
|
|
2977
|
-
* It takes the colors you passed in, parses them into the correct format, and then applies them to the theme
|
|
2978
|
-
*
|
|
2979
|
-
* @param {VegaThemeOverrideColors} overrideColors - OverrideColors - This is the object that you pass to the function.
|
|
2980
|
-
* @vegaVersion 1.20.0
|
|
2981
|
-
*/
|
|
2982
|
-
async overrideColors(overrideColors) {
|
|
2983
|
-
const overrideThemes = VegaColorSchemaOverridingController.generateOverrideThemes(overrideColors);
|
|
2984
|
-
VegaColorSchemaOverridingController.applyTheme(overrideThemes);
|
|
2985
|
-
}
|
|
2986
|
-
/**
|
|
2987
|
-
* It removes all the custom override theme styles from the DOM
|
|
2988
|
-
*
|
|
2989
|
-
* @vegaVersion 1.20.0
|
|
2990
|
-
*/
|
|
2991
|
-
async reset() {
|
|
2992
|
-
VegaColorSchemaOverridingController.getOverrideThemeContainer().innerHTML = '';
|
|
2993
|
-
}
|
|
2994
|
-
/**
|
|
2995
|
-
* This function toggles the dark mode of a webpage by adding or removing a 'dark' class to the HTML element.
|
|
2996
|
-
*
|
|
2997
|
-
* @param {boolean | undefined} darkMode - A boolean or undefined value that determines whether to enable or disable dark mode.
|
|
2998
|
-
* If it is true, dark mode is enabled.
|
|
2999
|
-
* If it is false, dark mode is disabled.
|
|
3000
|
-
* @vegaVersion 1.32.0
|
|
3001
|
-
*/
|
|
3002
|
-
toggleDarkMode(darkMode) {
|
|
3003
|
-
if (darkMode) {
|
|
3004
|
-
document.documentElement.classList.add('dark');
|
|
3005
|
-
VegaDarkModeStyleController.generateDarkModeStyle();
|
|
3006
|
-
}
|
|
3007
|
-
else {
|
|
3008
|
-
document.documentElement.classList.remove('dark');
|
|
3009
|
-
}
|
|
3010
|
-
changeManager.ChangeManager.notify(staticSubjectTitle.DARK_MODE_CHANGE, darkMode);
|
|
3011
|
-
}
|
|
3012
|
-
/**
|
|
3013
|
-
* The function checks if the HTML element has a class of "dark" and returns a boolean value accordingly.
|
|
3014
|
-
*
|
|
3015
|
-
* @returns {boolean} A boolean value indicating whether the HTML element has a class of "dark", which is
|
|
3016
|
-
* typically used to indicate that the website is in dark mode.
|
|
3017
|
-
* @vegaVersion 1.32.0
|
|
3018
|
-
*/
|
|
3019
|
-
isDarkMode() {
|
|
3020
|
-
return document.documentElement.classList.contains('dark');
|
|
3021
|
-
}
|
|
3022
|
-
}
|
|
3023
|
-
__decorate([
|
|
3024
|
-
createPublicApiRuntimeMetricsSlimmer.InjectVegaTelemetrySlimmer()
|
|
3025
|
-
], ThemeManager.prototype, "vegaPublicAPIRuntimeMetricsSlimmer", void 0);
|
|
3026
|
-
const VegaThemeManager = new ThemeManager();
|
|
3027
|
-
|
|
3028
|
-
exports.InternalAnnotationTypeEnum = void 0;
|
|
3029
|
-
(function (InternalAnnotationTypeEnum) {
|
|
3030
|
-
InternalAnnotationTypeEnum["SELECTION_RANGE"] = "SELECTION_RANGE";
|
|
3031
|
-
InternalAnnotationTypeEnum["CLEAR_FORMATTING"] = "CLEAR_FORMATTING";
|
|
3032
|
-
InternalAnnotationTypeEnum["LINK_GROUP"] = "LINK_GROUP";
|
|
3033
|
-
})(exports.InternalAnnotationTypeEnum || (exports.InternalAnnotationTypeEnum = {}));
|
|
3034
|
-
/**
|
|
3035
|
-
* Abstract class for all annotations
|
|
3036
|
-
*/
|
|
3037
|
-
class Annotation {
|
|
3038
|
-
}
|
|
3039
|
-
|
|
3040
|
-
exports.BlockAnnotationTypeEnum = void 0;
|
|
3041
|
-
(function (BlockAnnotationTypeEnum) {
|
|
3042
|
-
BlockAnnotationTypeEnum["ALIGNMENT"] = "ALIGNMENT";
|
|
3043
|
-
BlockAnnotationTypeEnum["TEXT_STYLE"] = "TEXT_STYLE";
|
|
3044
|
-
BlockAnnotationTypeEnum["INDENT"] = "INDENT";
|
|
3045
|
-
})(exports.BlockAnnotationTypeEnum || (exports.BlockAnnotationTypeEnum = {}));
|
|
3046
|
-
/**
|
|
3047
|
-
* BlockAnnotation is an abstract class that represents a block annotation.
|
|
3048
|
-
*/
|
|
3049
|
-
class BlockAnnotation extends Annotation {
|
|
3050
|
-
}
|
|
3051
|
-
|
|
3052
|
-
/**
|
|
3053
|
-
* This class is responsible for keeping track of the DOM elements and their corresponding entities.
|
|
3054
|
-
*/
|
|
3055
|
-
class StateEntityRenderingRegistry {
|
|
3056
|
-
constructor() {
|
|
3057
|
-
this.domToEntity = new WeakMap();
|
|
3058
|
-
this.entityToDOM = new WeakMap();
|
|
3059
|
-
}
|
|
3060
|
-
/**
|
|
3061
|
-
* Registers a DOM element and its corresponding entity.
|
|
3062
|
-
*
|
|
3063
|
-
* @param {HTMLElement} dom The DOM element to register.
|
|
3064
|
-
* @param {RTEBlock | RTENode} entity The entity to register.
|
|
3065
|
-
*/
|
|
3066
|
-
register(dom, entity) {
|
|
3067
|
-
this.domToEntity.set(dom, entity);
|
|
3068
|
-
this.entityToDOM.set(entity, dom);
|
|
3069
|
-
}
|
|
3070
|
-
/**
|
|
3071
|
-
* Retrieves the entity corresponding to a DOM element.
|
|
3072
|
-
*
|
|
3073
|
-
* @param {HTMLElement} dom The DOM element to retrieve the entity for.
|
|
3074
|
-
* @returns {Nullable<RTEBlock | RTENode>} The entity corresponding to the DOM element, or null if not found.
|
|
3075
|
-
*/
|
|
3076
|
-
getEntityByDOM(dom) {
|
|
3077
|
-
return this.domToEntity.get(dom);
|
|
3078
|
-
}
|
|
3079
|
-
/**
|
|
3080
|
-
* Retrieves the DOM element corresponding to an entity.
|
|
3081
|
-
*
|
|
3082
|
-
* @param {RTEBlock | RTENode} entity The entity to retrieve the DOM element for.
|
|
3083
|
-
* @returns {Nullable<HTMLElement>} The DOM element corresponding to the entity, or null if not found.
|
|
3084
|
-
*/
|
|
3085
|
-
getDOMByEntity(entity) {
|
|
3086
|
-
return this.entityToDOM.get(entity);
|
|
3087
|
-
}
|
|
3088
|
-
}
|
|
3089
|
-
const stateEntityRenderingRegistry = new StateEntityRenderingRegistry();
|
|
3090
|
-
|
|
3091
|
-
exports.ModifyContentActionType = void 0;
|
|
3092
|
-
(function (ModifyContentActionType) {
|
|
3093
|
-
ModifyContentActionType["DELETE_CHILD"] = "DELETE_CHILD";
|
|
3094
|
-
ModifyContentActionType["DELETE_NEST_LIST"] = "DELETE_NEST_LIST";
|
|
3095
|
-
ModifyContentActionType["UPDATE_TEXT"] = "UPDATE_TEXT";
|
|
3096
|
-
ModifyContentActionType["REPLACE_SELECTED_TEXT"] = "REPLACE_SELECTED_TEXT";
|
|
3097
|
-
ModifyContentActionType["APPEND_CHILD_NODES"] = "APPEND_CHILD_NODES";
|
|
3098
|
-
ModifyContentActionType["CLEAR_CHILD_NODES"] = "CLEAR_CHILD_NODES";
|
|
3099
|
-
ModifyContentActionType["INSERT_BLOCKS_AFTER"] = "INSERT_BLOCKS_AFTER";
|
|
3100
|
-
ModifyContentActionType["INSERT_BLOCKS_BEFORE"] = "INSERT_BLOCKS_BEFORE";
|
|
3101
|
-
ModifyContentActionType["INSERT_NODES_AFTER"] = "INSERT_NODES_AFTER";
|
|
3102
|
-
ModifyContentActionType["INSERT_NODES_BEFORE"] = "INSERT_NODES_BEFORE";
|
|
3103
|
-
ModifyContentActionType["SPLIT_BLOCK_WITH_NODE"] = "SPLIT_BLOCK_WITH_NODE";
|
|
3104
|
-
ModifyContentActionType["REPLACE_CHILD_NODES"] = "REPLACE_CHILD_NODES";
|
|
3105
|
-
ModifyContentActionType["REPLACE_NEST_LIST"] = "REPLACE_NEST_LIST";
|
|
3106
|
-
ModifyContentActionType["MERGE_TWO_BLOCKS_NODES"] = "MERGE_TWO_BLOCKS_NODES";
|
|
3107
|
-
ModifyContentActionType["BREAK_SINGLE_BLOCK"] = "BREAK_SINGLE_BLOCK";
|
|
3108
|
-
ModifyContentActionType["LINE_BREAK_SINGLE_BLOCK"] = "LINE_BREAK_SINGLE_BLOCK";
|
|
3109
|
-
ModifyContentActionType["LINE_BREAK_MULTIPLE_BLOCKS"] = "LINE_BREAK_MULTIPLE_BLOCKS";
|
|
3110
|
-
ModifyContentActionType["TRANSFORM_LIST_BLOCK"] = "TRANSFORM_LIST_BLOCK";
|
|
3111
|
-
ModifyContentActionType["TRANSFORM_PARAGRAPH_BLOCK"] = "TRANSFORM_PARAGRAPH_BLOCK";
|
|
3112
|
-
ModifyContentActionType["DELETE_BLOCK_CONTENT"] = "DELETE_BLOCK_CONTENT";
|
|
3113
|
-
ModifyContentActionType["INSERT_IMAGE_TO_BLOCK"] = "INSERT_IMAGE_TO_BLOCK";
|
|
3114
|
-
})(exports.ModifyContentActionType || (exports.ModifyContentActionType = {}));
|
|
3115
|
-
/**
|
|
3116
|
-
* Abstract class for update node content, delete node, insert node
|
|
3117
|
-
*/
|
|
3118
|
-
class ModifyContentAction {
|
|
3119
|
-
constructor() {
|
|
3120
|
-
this.isFlushable = false;
|
|
3121
|
-
}
|
|
3122
|
-
}
|
|
3123
|
-
|
|
3124
|
-
exports.NodeTypeEnum = void 0;
|
|
3125
|
-
(function (NodeTypeEnum) {
|
|
3126
|
-
NodeTypeEnum["TEXT"] = "TEXT";
|
|
3127
|
-
NodeTypeEnum["IMAGE"] = "IMAGE";
|
|
3128
|
-
})(exports.NodeTypeEnum || (exports.NodeTypeEnum = {}));
|
|
3129
|
-
/**
|
|
3130
|
-
* Abstract class for all nodes
|
|
3131
|
-
*/
|
|
3132
|
-
class RTENode {
|
|
3133
|
-
constructor(id, annotationMap) {
|
|
3134
|
-
this.annotationMap = new Map();
|
|
3135
|
-
this.id = id;
|
|
3136
|
-
if (annotationMap) {
|
|
3137
|
-
this.annotationMap = annotationMap;
|
|
3138
|
-
}
|
|
3139
|
-
}
|
|
3140
|
-
/**
|
|
3141
|
-
* Get annotation by type
|
|
3142
|
-
*
|
|
3143
|
-
* @param {RTENodeAnnotationMapKey} type - Annotation type
|
|
3144
|
-
* @returns {Nullable<RTENodeAnnotationMapValue>} - Annotation
|
|
3145
|
-
*/
|
|
3146
|
-
getAnnotationByType(type) {
|
|
3147
|
-
return this.annotationMap.get(type);
|
|
3148
|
-
}
|
|
3149
|
-
/**
|
|
3150
|
-
* Delete annotation by type
|
|
3151
|
-
*
|
|
3152
|
-
* @param {RTENodeAnnotationMapKey} type - Annotation type
|
|
3153
|
-
*/
|
|
3154
|
-
deleteAnnotationByType(type) {
|
|
3155
|
-
this.annotationMap.delete(type);
|
|
3156
|
-
this.flushChange();
|
|
3157
|
-
}
|
|
3158
|
-
/**
|
|
3159
|
-
* Apply action to node
|
|
3160
|
-
*
|
|
3161
|
-
* @param {AnnotationAction} action - Annotation action
|
|
3162
|
-
* @returns {this} - Node
|
|
3163
|
-
*/
|
|
3164
|
-
apply(action) {
|
|
3165
|
-
this.doApply(action);
|
|
3166
|
-
if (action.isFlushable) {
|
|
3167
|
-
this.flushChange();
|
|
3168
|
-
}
|
|
3169
|
-
return this;
|
|
3170
|
-
}
|
|
3171
|
-
/**
|
|
3172
|
-
* apply annotation action or modify content action
|
|
3173
|
-
*
|
|
3174
|
-
* @param {AnnotationAction | ModifyContentAction} action annotation type action or modify content type action
|
|
3175
|
-
*/
|
|
3176
|
-
doApply(action) {
|
|
3177
|
-
if (action instanceof ModifyContentAction) {
|
|
3178
|
-
this.doModifyActionApply(action);
|
|
3179
|
-
}
|
|
3180
|
-
else {
|
|
3181
|
-
this.doAnnotationActionApply(action);
|
|
3182
|
-
}
|
|
3183
|
-
}
|
|
3184
|
-
/**
|
|
3185
|
-
* Flush the value change
|
|
3186
|
-
*/
|
|
3187
|
-
flushChange() {
|
|
3188
|
-
const domNode = stateEntityRenderingRegistry.getDOMByEntity(this);
|
|
3189
|
-
if (domNode) {
|
|
3190
|
-
const nodeSubject = domNodeSubjectFactory.domNodeSubjectFactory.getSubjectFromParentNodeByEventId(domNode, vegaInternalEventId.VegaInternalRichTextEditorFlushChanges);
|
|
3191
|
-
if (nodeSubject) {
|
|
3192
|
-
changeManager.ChangeManager.notify(nodeSubject, {});
|
|
3193
|
-
}
|
|
3194
|
-
}
|
|
3195
|
-
}
|
|
3196
|
-
}
|
|
3197
|
-
|
|
3198
|
-
exports.NodeAnnotationTypeEnum = void 0;
|
|
3199
|
-
(function (NodeAnnotationTypeEnum) {
|
|
3200
|
-
NodeAnnotationTypeEnum["BOLD"] = "BOLD";
|
|
3201
|
-
NodeAnnotationTypeEnum["ITALIC"] = "ITALIC";
|
|
3202
|
-
NodeAnnotationTypeEnum["UNDERLINE"] = "UNDERLINE";
|
|
3203
|
-
NodeAnnotationTypeEnum["STRIKETHROUGH"] = "STRIKETHROUGH";
|
|
3204
|
-
NodeAnnotationTypeEnum["SELECTION_RANGE"] = "SELECTION_RANGE";
|
|
3205
|
-
NodeAnnotationTypeEnum["IMAGE"] = "IMAGE";
|
|
3206
|
-
NodeAnnotationTypeEnum["CODE"] = "CODE";
|
|
3207
|
-
NodeAnnotationTypeEnum["TEXT_COLOR"] = "TEXT_COLOR";
|
|
3208
|
-
NodeAnnotationTypeEnum["LINK"] = "LINK";
|
|
3209
|
-
})(exports.NodeAnnotationTypeEnum || (exports.NodeAnnotationTypeEnum = {}));
|
|
3210
|
-
/**
|
|
3211
|
-
* Abstract class for all annotations
|
|
3212
|
-
*/
|
|
3213
|
-
class NodeAnnotation extends Annotation {
|
|
3214
|
-
}
|
|
3215
|
-
|
|
3216
|
-
exports.Annotation = Annotation;
|
|
3217
|
-
exports.BlockAnnotation = BlockAnnotation;
|
|
3218
|
-
exports.ModifyContentAction = ModifyContentAction;
|
|
3219
|
-
exports.NodeAnnotation = NodeAnnotation;
|
|
3220
|
-
exports.RTENode = RTENode;
|
|
3221
|
-
exports.VegaDarkModeStyleController = VegaDarkModeStyleController;
|
|
3222
|
-
exports.VegaThemeManager = VegaThemeManager;
|
|
3223
|
-
exports.stateEntityRenderingRegistry = stateEntityRenderingRegistry;
|