@milaboratories/uikit 2.3.8 → 2.3.10

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.
Files changed (35) hide show
  1. package/.turbo/turbo-build.log +21 -19
  2. package/.turbo/turbo-type-check.log +1 -1
  3. package/CHANGELOG.md +14 -0
  4. package/dist/components/PlAutocomplete/PlAutocomplete.vue.js +1 -1
  5. package/dist/components/PlDropdown/PlDropdown.vue.js +1 -1
  6. package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js +1 -1
  7. package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js +1 -1
  8. package/dist/components/PlFileInput/PlFileInput.vue.js +1 -1
  9. package/dist/components/PlNumberField/PlNumberField.vue.d.ts.map +1 -1
  10. package/dist/components/PlNumberField/PlNumberField.vue.js +75 -70
  11. package/dist/components/PlNumberField/PlNumberField.vue.js.map +1 -1
  12. package/dist/components/PlTextArea/PlTextArea.vue.js +1 -1
  13. package/dist/components/PlTextField/PlTextField.vue.js +1 -1
  14. package/dist/composition/computedCached.d.ts +12 -0
  15. package/dist/composition/computedCached.d.ts.map +1 -0
  16. package/dist/composition/computedCached.js +24 -0
  17. package/dist/composition/computedCached.js.map +1 -0
  18. package/dist/composition/watchCached.d.ts +9 -0
  19. package/dist/composition/watchCached.d.ts.map +1 -0
  20. package/dist/composition/watchCached.js +31 -0
  21. package/dist/composition/watchCached.js.map +1 -0
  22. package/dist/generated/components/svg/images/{SvgRequired.vue2.js → SvgRequired.vue.js} +1 -1
  23. package/dist/generated/components/svg/images/SvgRequired.vue.js.map +1 -0
  24. package/dist/index.d.ts +2 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +45 -41
  27. package/dist/index.js.map +1 -1
  28. package/dist/sdk/model/dist/index.js +1 -1
  29. package/dist/sdk/model/dist/index.js.map +1 -1
  30. package/package.json +2 -2
  31. package/src/components/PlNumberField/PlNumberField.vue +10 -2
  32. package/src/composition/computedCached.ts +58 -0
  33. package/src/composition/watchCached.ts +45 -0
  34. package/src/index.ts +2 -0
  35. package/dist/generated/components/svg/images/SvgRequired.vue2.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PlNumberField.vue.js","sources":["../../../src/components/PlNumberField/PlNumberField.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport './pl-number-field.scss';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport { computed, ref, useSlots, watch } from 'vue';\nimport { PlTooltip } from '../PlTooltip';\n\ntype NumberInputProps = {\n /** Input is disabled if true */\n disabled?: boolean;\n /** Label on the top border of the field, empty by default */\n label?: string;\n /** Input placeholder, empty by default */\n placeholder?: string;\n /** Step for increment/decrement buttons, 1 by default */\n step?: number;\n /** If defined - show an error if value is lower */\n minValue?: number;\n /** If defined - show an error if value is higher */\n maxValue?: number;\n /** If false - remove buttons on the right */\n useIncrementButtons?: boolean;\n /** If true - changes do not apply immediately, they apply only by removing focus from the input (by click enter or by click outside) */\n updateOnEnterOrClickOutside?: boolean;\n /** Error message that shows always when it's provided, without other checks */\n errorMessage?: string;\n /** Additional validity check for input value that must return an error text if failed */\n validate?: (v: number) => string | undefined;\n};\n\nconst props = withDefaults(defineProps<NumberInputProps>(), {\n step: 1,\n label: undefined,\n placeholder: undefined,\n minValue: undefined,\n maxValue: undefined,\n useIncrementButtons: true,\n updateOnEnter: false,\n errorMessage: undefined,\n validate: undefined,\n});\n\nconst modelValue = defineModel<number | undefined>({ required: true });\n\nconst root = ref<HTMLElement>();\nconst slots = useSlots();\nconst input = ref<HTMLInputElement>();\n\nuseLabelNotch(root);\n\nfunction modelToString(v: number | undefined) {\n return v === undefined ? '' : String(+v); // (+v) to avoid staying in input non-number values if they are provided in model\n}\n\nfunction isPartial(v: string) {\n return v === '.' || v === ',' || v === '-';\n}\nfunction stringToModel(v: string) {\n if (v === '') {\n return undefined;\n }\n if (isPartial(v)) {\n return 0;\n }\n let forParsing = v;\n forParsing = forParsing.replace(',', '.');\n forParsing = forParsing.replace('−', '-'); // minus, replacing for the case of input the whole copied value\n forParsing = forParsing.replace('–', '-'); // dash, replacing for the case of input the whole copied value\n forParsing = forParsing.replace('+', '');\n return parseFloat(forParsing);\n}\n\nconst innerTextValue = ref(modelToString(modelValue.value));\nconst innerNumberValue = computed(() => stringToModel(innerTextValue.value));\n\nwatch(() => modelValue.value, (outerValue) => { // update inner value if outer value is changed\n if (parseFloat(innerTextValue.value) !== outerValue) {\n innerTextValue.value = modelToString(outerValue);\n }\n});\n\nconst NUMBER_REGEX = /^[-−–+]?(\\d+)?[\\\\.,]?(\\d+)?$/; // parseFloat works without errors on strings with multiple dots, or letters in value\nconst inputValue = computed({\n get() {\n return innerTextValue.value;\n },\n set(nextValue: string) {\n const parsedValue = stringToModel(nextValue);\n // we allow to set empty value or valid numeric value, otherwise reset input value to previous valid\n if (parsedValue === undefined\n || (nextValue.match(NUMBER_REGEX) && !isNaN(parsedValue))\n ) {\n innerTextValue.value = nextValue;\n if (!props.updateOnEnterOrClickOutside && !isPartial(nextValue)) { // to avoid applying '-' or '.'\n applyChanges();\n }\n } else if (input.value) {\n input.value.value = innerTextValue.value;\n }\n },\n});\nconst focused = ref(false);\n\nfunction applyChanges() {\n if (innerTextValue.value === '') {\n modelValue.value = undefined;\n return;\n }\n modelValue.value = innerNumberValue.value;\n}\n\nconst errors = computed(() => {\n let ers: string[] = [];\n if (props.errorMessage) {\n ers.push(props.errorMessage);\n }\n const parsedValue = innerNumberValue.value;\n if (parsedValue !== undefined && isNaN(parsedValue)) {\n ers.push('Value is not a number');\n } else if (props.validate && parsedValue !== undefined) {\n const error = props.validate(parsedValue);\n if (error) {\n ers.push(error);\n }\n } else {\n if (props.minValue !== undefined && parsedValue !== undefined && parsedValue < props.minValue) {\n ers.push(`Value must be higher than ${props.minValue}`);\n }\n if (props.maxValue !== undefined && parsedValue !== undefined && parsedValue > props.maxValue) {\n ers.push(`Value must be less than ${props.maxValue}`);\n }\n }\n\n ers = [...ers];\n\n return ers.join(' ');\n});\n\nconst isIncrementDisabled = computed(() => {\n const parsedValue = innerNumberValue.value;\n if (props.maxValue !== undefined && parsedValue !== undefined) {\n return parsedValue >= props.maxValue;\n }\n return false;\n});\n\nconst isDecrementDisabled = computed(() => {\n const parsedValue = innerNumberValue.value;\n if (props.minValue !== undefined && parsedValue !== undefined) {\n return parsedValue <= props.minValue;\n }\n return false;\n});\n\nfunction increment() {\n const parsedValue = innerNumberValue.value;\n if (!isIncrementDisabled.value) {\n let nV;\n if (parsedValue === undefined) {\n nV = props.minValue ? props.minValue : 0;\n } else {\n nV = (parsedValue || 0) + props.step;\n }\n modelValue.value = props.maxValue !== undefined ? Math.min(props.maxValue, nV) : nV;\n }\n}\n\nfunction decrement() {\n const parsedValue = innerNumberValue.value;\n if (!isDecrementDisabled.value) {\n let nV;\n if (parsedValue === undefined) {\n nV = 0;\n } else {\n nV = +(parsedValue || 0) - props.step;\n }\n modelValue.value = props.minValue !== undefined ? Math.max(props.minValue, nV) : nV;\n }\n}\n\nfunction handleKeyPress(e: { code: string; preventDefault(): void }) {\n if (props.updateOnEnterOrClickOutside) {\n if (e.code === 'Escape') {\n innerTextValue.value = modelToString(modelValue.value);\n input.value?.blur();\n }\n if (e.code === 'Enter') {\n input.value?.blur();\n }\n }\n\n if (e.code === 'Enter') {\n innerTextValue.value = String(modelValue.value); // to make .1 => 0.1, 10.00 => 10, remove leading zeros etc\n }\n\n if (['ArrowDown', 'ArrowUp'].includes(e.code)) {\n e.preventDefault();\n }\n if (props.useIncrementButtons && e.code === 'ArrowUp') {\n increment();\n }\n if (props.useIncrementButtons && e.code === 'ArrowDown') {\n decrement();\n }\n}\n\n// https://stackoverflow.com/questions/880512/prevent-text-selection-after-double-click#:~:text=If%20you%20encounter%20a%20situation,none%3B%20to%20the%20summary%20element.\n// this prevents selecting of more than input content in some cases,\n// but also disable selecting input content by double-click (useful feature)\nconst onMousedown = (ev: MouseEvent) => {\n if (ev.detail > 1) {\n ev.preventDefault();\n }\n};\n</script>\n\n<template>\n <div\n ref=\"root\"\n :class=\"{ error: !!errors.trim(), disabled: disabled }\"\n class=\"mi-number-field d-flex-column\"\n @keydown=\"handleKeyPress($event)\"\n >\n <div class=\"mi-number-field__main-wrapper d-flex\">\n <DoubleContour class=\"mi-number-field__contour\"/>\n <div\n class=\"mi-number-field__wrapper flex-grow d-flex flex-align-center\"\n :class=\"{withoutArrows: !useIncrementButtons}\"\n >\n <label v-if=\"label\" class=\"text-description\">\n {{ label }}\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\"/>\n </template>\n </PlTooltip>\n </label>\n <input\n ref=\"input\"\n v-model=\"inputValue\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder\"\n class=\"text-s flex-grow\"\n @focusin=\"focused = true\"\n @focusout=\"focused = false; applyChanges()\"\n />\n </div>\n <div v-if=\"useIncrementButtons\" class=\"mi-number-field__icons d-flex-column\" @mousedown=\"onMousedown\">\n <div\n :class=\"{ disabled: isIncrementDisabled }\"\n class=\"mi-number-field__icon d-flex flex-justify-center uc-pointer flex-grow flex-align-center\"\n @click=\"increment\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M8 4.93933L13.5303 10.4697L12.4697 11.5303L8 7.06065L3.53033 11.5303L2.46967 10.4697L8 4.93933Z\"\n fill=\"#110529\"\n />\n </svg>\n </div>\n <div\n :class=\"{ disabled: isDecrementDisabled }\"\n class=\"mi-number-field__icon d-flex flex-justify-center uc-pointer flex-grow flex-align-center\"\n @click=\"decrement\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M2.46967 6.53033L3.53033 5.46967L8 9.93934L12.4697 5.46967L13.5303 6.53033L8 12.0607L2.46967 6.53033Z\"\n fill=\"#110529\"\n />\n </svg>\n </div>\n </div>\n </div>\n <div v-if=\"errors.trim()\" class=\"mi-number-field__hint text-description\">\n {{ errors }}\n </div>\n </div>\n</template>\n"],"names":["props","__props","modelValue","_useModel","root","ref","slots","useSlots","input","useLabelNotch","modelToString","v","isPartial","stringToModel","forParsing","innerTextValue","innerNumberValue","computed","watch","outerValue","NUMBER_REGEX","inputValue","nextValue","parsedValue","applyChanges","focused","errors","ers","error","isIncrementDisabled","isDecrementDisabled","increment","nV","decrement","handleKeyPress","_a","_b","onMousedown","ev"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,UAAMA,IAAQC,GAYRC,IAAaC,iBAAkD,GAE/DC,IAAOC,EAAiB,GACxBC,IAAQC,EAAS,GACjBC,IAAQH,EAAsB;AAEpC,IAAAI,EAAcL,CAAI;AAElB,aAASM,EAAcC,GAAuB;AAC5C,aAAOA,MAAM,SAAY,KAAK,OAAO,CAACA,CAAC;AAAA,IAAA;AAGzC,aAASC,EAAUD,GAAW;AAC5B,aAAOA,MAAM,OAAOA,MAAM,OAAOA,MAAM;AAAA,IAAA;AAEzC,aAASE,EAAcF,GAAW;AAChC,UAAIA,MAAM;AACD;AAEL,UAAAC,EAAUD,CAAC;AACN,eAAA;AAET,UAAIG,IAAaH;AACJ,aAAAG,IAAAA,EAAW,QAAQ,KAAK,GAAG,GAC3BA,IAAAA,EAAW,QAAQ,KAAK,GAAG,GAC3BA,IAAAA,EAAW,QAAQ,KAAK,GAAG,GAC3BA,IAAAA,EAAW,QAAQ,KAAK,EAAE,GAChC,WAAWA,CAAU;AAAA,IAAA;AAG9B,UAAMC,IAAiBV,EAAIK,EAAcR,EAAW,KAAK,CAAC,GACpDc,IAAmBC,EAAS,MAAMJ,EAAcE,EAAe,KAAK,CAAC;AAE3E,IAAAG,EAAM,MAAMhB,EAAW,OAAO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,IAAI,KAC1C,EAAE,eAAe,GAEfF,EAAM,uBAAuB,EAAE,SAAS,aAChC+B,EAAA,GAER/B,EAAM,uBAAuB,EAAE,SAAS,eAChCiC,EAAA;AAAA,IACZ;AAMI,UAAAI,IAAc,CAACC,MAAmB;AAClC,MAAAA,EAAG,SAAS,KACdA,EAAG,eAAe;AAAA,IAEtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"PlNumberField.vue.js","sources":["../../../src/components/PlNumberField/PlNumberField.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport './pl-number-field.scss';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport { computed, ref, useSlots, watch } from 'vue';\nimport { PlTooltip } from '../PlTooltip';\n\ntype NumberInputProps = {\n /** Input is disabled if true */\n disabled?: boolean;\n /** Label on the top border of the field, empty by default */\n label?: string;\n /** Input placeholder, empty by default */\n placeholder?: string;\n /** Step for increment/decrement buttons, 1 by default */\n step?: number;\n /** If defined - show an error if value is lower */\n minValue?: number;\n /** If defined - show an error if value is higher */\n maxValue?: number;\n /** If false - remove buttons on the right */\n useIncrementButtons?: boolean;\n /** If true - changes do not apply immediately, they apply only by removing focus from the input (by click enter or by click outside) */\n updateOnEnterOrClickOutside?: boolean;\n /** Error message that shows always when it's provided, without other checks */\n errorMessage?: string;\n /** Additional validity check for input value that must return an error text if failed */\n validate?: (v: number) => string | undefined;\n};\n\nconst props = withDefaults(defineProps<NumberInputProps>(), {\n step: 1,\n label: undefined,\n placeholder: undefined,\n minValue: undefined,\n maxValue: undefined,\n useIncrementButtons: true,\n updateOnEnter: false,\n errorMessage: undefined,\n validate: undefined,\n});\n\nconst modelValue = defineModel<number | undefined>({ required: true });\n\nconst root = ref<HTMLElement>();\nconst slots = useSlots();\nconst input = ref<HTMLInputElement>();\n\nuseLabelNotch(root);\n\nfunction modelToString(v: number | undefined) {\n return v === undefined ? '' : String(+v); // (+v) to avoid staying in input non-number values if they are provided in model\n}\n\nfunction isPartial(v: string) {\n return v === '.' || v === ',' || v === '-';\n}\nfunction stringToModel(v: string) {\n if (v === '') {\n return undefined;\n }\n if (isPartial(v)) {\n return 0;\n }\n let forParsing = v;\n forParsing = forParsing.replace(',', '.');\n forParsing = forParsing.replace('−', '-'); // minus, replacing for the case of input the whole copied value\n forParsing = forParsing.replace('–', '-'); // dash, replacing for the case of input the whole copied value\n forParsing = forParsing.replace('+', '');\n return parseFloat(forParsing);\n}\n\nconst innerTextValue = ref(modelToString(modelValue.value));\nconst innerNumberValue = computed(() => stringToModel(innerTextValue.value));\n\nwatch(() => modelValue.value, (outerValue) => { // update inner value if outer value is changed\n if (parseFloat(innerTextValue.value) !== outerValue) {\n innerTextValue.value = modelToString(outerValue);\n }\n});\n\nconst NUMBER_REGEX = /^[-−–+]?(\\d+)?[\\\\.,]?(\\d+)?$/; // parseFloat works without errors on strings with multiple dots, or letters in value\nconst inputValue = computed({\n get() {\n return innerTextValue.value;\n },\n set(nextValue: string) {\n const parsedValue = stringToModel(nextValue);\n // we allow to set empty value or valid numeric value, otherwise reset input value to previous valid\n if (parsedValue === undefined\n || (nextValue.match(NUMBER_REGEX) && !isNaN(parsedValue))\n ) {\n innerTextValue.value = nextValue;\n if (!props.updateOnEnterOrClickOutside && !isPartial(nextValue)) { // to avoid applying '-' or '.'\n applyChanges();\n }\n } else if (input.value) {\n input.value.value = innerTextValue.value;\n }\n },\n});\nconst focused = ref(false);\n\nfunction applyChanges() {\n if (innerTextValue.value === '') {\n modelValue.value = undefined;\n return;\n }\n modelValue.value = innerNumberValue.value;\n}\n\nconst errors = computed(() => {\n let ers: string[] = [];\n if (props.errorMessage) {\n ers.push(props.errorMessage);\n }\n const parsedValue = innerNumberValue.value;\n if (parsedValue !== undefined && isNaN(parsedValue)) {\n ers.push('Value is not a number');\n } else if (props.validate && parsedValue !== undefined) {\n const error = props.validate(parsedValue);\n if (error) {\n ers.push(error);\n }\n } else {\n if (props.minValue !== undefined && parsedValue !== undefined && parsedValue < props.minValue) {\n ers.push(`Value must be higher than ${props.minValue}`);\n }\n if (props.maxValue !== undefined && parsedValue !== undefined && parsedValue > props.maxValue) {\n ers.push(`Value must be less than ${props.maxValue}`);\n }\n }\n\n ers = [...ers];\n\n return ers.join(' ');\n});\n\nconst isIncrementDisabled = computed(() => {\n const parsedValue = innerNumberValue.value;\n if (props.maxValue !== undefined && parsedValue !== undefined) {\n return parsedValue >= props.maxValue;\n }\n return false;\n});\n\nconst isDecrementDisabled = computed(() => {\n const parsedValue = innerNumberValue.value;\n if (props.minValue !== undefined && parsedValue !== undefined) {\n return parsedValue <= props.minValue;\n }\n return false;\n});\n\nconst multiplier = computed(() =>\n 10 ** (props.step.toString().split('.').at(1)?.length ?? 0),\n);\n\nfunction increment() {\n const parsedValue = innerNumberValue.value;\n if (!isIncrementDisabled.value) {\n let nV;\n if (parsedValue === undefined) {\n nV = props.minValue ? props.minValue : 0;\n } else {\n nV = ((parsedValue || 0) * multiplier.value\n + props.step * multiplier.value)\n / multiplier.value;\n }\n modelValue.value = props.maxValue !== undefined ? Math.min(props.maxValue, nV) : nV;\n }\n}\n\nfunction decrement() {\n const parsedValue = innerNumberValue.value;\n if (!isDecrementDisabled.value) {\n let nV;\n if (parsedValue === undefined) {\n nV = 0;\n } else {\n nV = ((parsedValue || 0) * multiplier.value\n - props.step * multiplier.value)\n / multiplier.value;\n }\n modelValue.value = props.minValue !== undefined ? Math.max(props.minValue, nV) : nV;\n }\n}\n\nfunction handleKeyPress(e: { code: string; preventDefault(): void }) {\n if (props.updateOnEnterOrClickOutside) {\n if (e.code === 'Escape') {\n innerTextValue.value = modelToString(modelValue.value);\n input.value?.blur();\n }\n if (e.code === 'Enter') {\n input.value?.blur();\n }\n }\n\n if (e.code === 'Enter') {\n innerTextValue.value = String(modelValue.value); // to make .1 => 0.1, 10.00 => 10, remove leading zeros etc\n }\n\n if (['ArrowDown', 'ArrowUp'].includes(e.code)) {\n e.preventDefault();\n }\n if (props.useIncrementButtons && e.code === 'ArrowUp') {\n increment();\n }\n if (props.useIncrementButtons && e.code === 'ArrowDown') {\n decrement();\n }\n}\n\n// https://stackoverflow.com/questions/880512/prevent-text-selection-after-double-click#:~:text=If%20you%20encounter%20a%20situation,none%3B%20to%20the%20summary%20element.\n// this prevents selecting of more than input content in some cases,\n// but also disable selecting input content by double-click (useful feature)\nconst onMousedown = (ev: MouseEvent) => {\n if (ev.detail > 1) {\n ev.preventDefault();\n }\n};\n</script>\n\n<template>\n <div\n ref=\"root\"\n :class=\"{ error: !!errors.trim(), disabled: disabled }\"\n class=\"mi-number-field d-flex-column\"\n @keydown=\"handleKeyPress($event)\"\n >\n <div class=\"mi-number-field__main-wrapper d-flex\">\n <DoubleContour class=\"mi-number-field__contour\"/>\n <div\n class=\"mi-number-field__wrapper flex-grow d-flex flex-align-center\"\n :class=\"{withoutArrows: !useIncrementButtons}\"\n >\n <label v-if=\"label\" class=\"text-description\">\n {{ label }}\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\"/>\n </template>\n </PlTooltip>\n </label>\n <input\n ref=\"input\"\n v-model=\"inputValue\"\n :disabled=\"disabled\"\n :placeholder=\"placeholder\"\n class=\"text-s flex-grow\"\n @focusin=\"focused = true\"\n @focusout=\"focused = false; applyChanges()\"\n />\n </div>\n <div v-if=\"useIncrementButtons\" class=\"mi-number-field__icons d-flex-column\" @mousedown=\"onMousedown\">\n <div\n :class=\"{ disabled: isIncrementDisabled }\"\n class=\"mi-number-field__icon d-flex flex-justify-center uc-pointer flex-grow flex-align-center\"\n @click=\"increment\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M8 4.93933L13.5303 10.4697L12.4697 11.5303L8 7.06065L3.53033 11.5303L2.46967 10.4697L8 4.93933Z\"\n fill=\"#110529\"\n />\n </svg>\n </div>\n <div\n :class=\"{ disabled: isDecrementDisabled }\"\n class=\"mi-number-field__icon d-flex flex-justify-center uc-pointer flex-grow flex-align-center\"\n @click=\"decrement\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M2.46967 6.53033L3.53033 5.46967L8 9.93934L12.4697 5.46967L13.5303 6.53033L8 12.0607L2.46967 6.53033Z\"\n fill=\"#110529\"\n />\n </svg>\n </div>\n </div>\n </div>\n <div v-if=\"errors.trim()\" class=\"mi-number-field__hint text-description\">\n {{ errors }}\n </div>\n </div>\n</template>\n"],"names":["props","__props","modelValue","_useModel","root","ref","slots","useSlots","input","useLabelNotch","modelToString","v","isPartial","stringToModel","forParsing","innerTextValue","innerNumberValue","computed","watch","outerValue","NUMBER_REGEX","inputValue","nextValue","parsedValue","applyChanges","focused","errors","ers","error","isIncrementDisabled","isDecrementDisabled","multiplier","_a","increment","nV","decrement","handleKeyPress","_b","onMousedown","ev"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,UAAMA,IAAQC,GAYRC,IAAaC,iBAAkD,GAE/DC,IAAOC,EAAiB,GACxBC,IAAQC,EAAS,GACjBC,IAAQH,EAAsB;AAEpC,IAAAI,EAAcL,CAAI;AAElB,aAASM,EAAcC,GAAuB;AAC5C,aAAOA,MAAM,SAAY,KAAK,OAAO,CAACA,CAAC;AAAA,IAAA;AAGzC,aAASC,EAAUD,GAAW;AAC5B,aAAOA,MAAM,OAAOA,MAAM,OAAOA,MAAM;AAAA,IAAA;AAEzC,aAASE,EAAcF,GAAW;AAChC,UAAIA,MAAM;AACD;AAEL,UAAAC,EAAUD,CAAC;AACN,eAAA;AAET,UAAIG,IA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AY;AACnB,YAAMZ,IAAcP,EAAiB;AACjC,UAAA,CAACc,EAAoB,OAAO;AAC1B,YAAAI;AACJ,QAAIX,MAAgB,SACbW,IAAA,IAEEA,MAAAX,KAAe,KAAKQ,EAAW,QAClC/B,EAAM,OAAO+B,EAAW,SAC1BA,EAAW,OAEJ7B,EAAA,QAAQF,EAAM,aAAa,SAAY,KAAK,IAAIA,EAAM,UAAUkC,CAAE,IAAIA;AAAA,MAAA;AAAA,IACnF;AAGF,aAASE,EAAe,GAA6C;;AACnE,MAAIpC,EAAM,gCACJ,EAAE,SAAS,aACEe,EAAA,QAAQL,EAAcR,EAAW,KAAK,IACrD8B,IAAAxB,EAAM,UAAN,QAAAwB,EAAa,SAEX,EAAE,SAAS,aACbK,IAAA7B,EAAM,UAAN,QAAA6B,EAAa,UAIb,EAAE,SAAS,YACEtB,EAAA,QAAQ,OAAOb,EAAW,KAAK,IAG5C,CAAC,aAAa,SAAS,EAAE,SAAS,EAAE,IAAI,KAC1C,EAAE,eAAe,GAEfF,EAAM,uBAAuB,EAAE,SAAS,aAChCiC,EAAA,GAERjC,EAAM,uBAAuB,EAAE,SAAS,eAChCmC,EAAA;AAAA,IACZ;AAMI,UAAAG,IAAc,CAACC,MAAmB;AAClC,MAAAA,EAAG,SAAS,KACdA,EAAG,eAAe;AAAA,IAEtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -5,7 +5,7 @@ import H from "../PlTooltip/PlTooltip.vue.js";
5
5
  import T from "../../utils/DoubleContour.vue.js";
6
6
  import { useLabelNotch as z } from "../../utils/useLabelNotch.js";
7
7
  import { useValidation as A } from "../../utils/useValidation.js";
8
- import I from "../../generated/components/svg/images/SvgRequired.vue2.js";
8
+ import I from "../../generated/components/svg/images/SvgRequired.vue.js";
9
9
  import { getErrorMessage as L } from "../../helpers/error.js";
10
10
  const P = { class: "ui-text-area__envelope" }, R = {
11
11
  key: 0,
@@ -7,7 +7,7 @@ import { useLabelNotch as J } from "../../utils/useLabelNotch.js";
7
7
  import { useValidation as K } from "../../utils/useValidation.js";
8
8
  import Q from "../PlIcon16/PlIcon16.vue.js";
9
9
  import W from "../PlIcon24/PlIcon24.vue.js";
10
- import X from "../../generated/components/svg/images/SvgRequired.vue2.js";
10
+ import X from "../../generated/components/svg/images/SvgRequired.vue.js";
11
11
  import { getErrorMessage as Y } from "../../helpers/error.js";
12
12
  const Z = { class: "pl-text-field__envelope" }, ee = {
13
13
  key: 0,
@@ -0,0 +1,12 @@
1
+ import { ComputedGetter, ComputedSetter, ComputedRef, WritableComputedRef } from 'vue';
2
+ export declare function computedCached<T>(options: {
3
+ get: ComputedGetter<T>;
4
+ set: ComputedSetter<T>;
5
+ deep?: boolean;
6
+ }): WritableComputedRef<T>;
7
+ export declare function computedCached<T>(options: {
8
+ get: ComputedGetter<T>;
9
+ deep?: boolean;
10
+ }): ComputedRef<T>;
11
+ export declare function computedCached<T>(getter: ComputedGetter<T>): ComputedRef<T>;
12
+ //# sourceMappingURL=computedCached.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computedCached.d.ts","sourceRoot":"","sources":["../../src/composition/computedCached.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACzB,MAAM,KAAK,CAAC;AAEb,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE;IACzC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IACvB,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAC3B,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE;IACzC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AACnB,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { isJsonEqual as f } from "../lib/util/helpers/dist/index.js";
2
+ import { ref as o, watch as i, computed as a } from "vue";
3
+ function v(r) {
4
+ typeof r == "function" && (r = {
5
+ get: r
6
+ });
7
+ const { get: u, set: c, deep: l } = r, e = o(u());
8
+ return i(
9
+ u,
10
+ (t) => {
11
+ f(t, e.value) || (e.value = t);
12
+ },
13
+ { deep: l }
14
+ ), c ? a({
15
+ get: () => e.value,
16
+ set: (t) => {
17
+ f(t, e.value) || (e.value = t, c(t));
18
+ }
19
+ }) : a(() => e.value);
20
+ }
21
+ export {
22
+ v as computedCached
23
+ };
24
+ //# sourceMappingURL=computedCached.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computedCached.js","sources":["../../src/composition/computedCached.ts"],"sourcesContent":["import { isJsonEqual } from '@milaboratories/helpers';\nimport {\n computed,\n ref,\n watch,\n type ComputedGetter,\n type ComputedSetter,\n type ComputedRef,\n type WritableComputedRef,\n} from 'vue';\n\nexport function computedCached<T>(options: {\n get: ComputedGetter<T>;\n set: ComputedSetter<T>;\n deep?: boolean;\n}): WritableComputedRef<T>;\nexport function computedCached<T>(options: {\n get: ComputedGetter<T>;\n deep?: boolean;\n}): ComputedRef<T>;\nexport function computedCached<T>(getter: ComputedGetter<T>): ComputedRef<T>;\nexport function computedCached<T>(options: ComputedGetter<T> | {\n get: ComputedGetter<T>;\n set?: ComputedSetter<T>;\n deep?: boolean;\n}) {\n if (typeof options === 'function') {\n options = {\n get: options,\n };\n }\n const { get: getter, set: setter, deep } = options;\n\n const cachedValue = ref<T>(getter());\n watch(\n getter,\n (newValue) => {\n if (!isJsonEqual(newValue, cachedValue.value)) {\n cachedValue.value = newValue;\n }\n },\n { deep },\n );\n\n if (setter) {\n return computed({\n get: () => cachedValue.value,\n set: (newValue) => {\n if (!isJsonEqual(newValue, cachedValue.value)) {\n cachedValue.value = newValue;\n setter(newValue);\n }\n },\n });\n } else {\n return computed(() => cachedValue.value);\n }\n}\n"],"names":["computedCached","options","getter","setter","deep","cachedValue","ref","watch","newValue","isJsonEqual","computed"],"mappings":";;AAqBO,SAASA,EAAkBC,GAI/B;AACG,EAAA,OAAOA,KAAY,eACXA,IAAA;AAAA,IACR,KAAKA;AAAA,EACP;AAEF,QAAM,EAAE,KAAKC,GAAQ,KAAKC,GAAQ,MAAAC,MAASH,GAErCI,IAAcC,EAAOJ,GAAQ;AAWnC,SAVAK;AAAA,IACEL;AAAA,IACA,CAACM,MAAa;AACZ,MAAKC,EAAYD,GAAUH,EAAY,KAAK,MAC1CA,EAAY,QAAQG;AAAA,IAExB;AAAA,IACA,EAAE,MAAAJ,EAAK;AAAA,EACT,GAEID,IACKO,EAAS;AAAA,IACd,KAAK,MAAML,EAAY;AAAA,IACvB,KAAK,CAACG,MAAa;AACjB,MAAKC,EAAYD,GAAUH,EAAY,KAAK,MAC1CA,EAAY,QAAQG,GACpBL,EAAOK,CAAQ;AAAA,IACjB;AAAA,EACF,CACD,IAEME,EAAS,MAAML,EAAY,KAAK;AAE3C;"}
@@ -0,0 +1,9 @@
1
+ import { WatchCallback, WatchHandle, WatchSource } from 'vue';
2
+ type MaybeUndefined<T, I> = I extends true ? T | undefined : T;
3
+ export interface WatchCachedOptions<Immediate = boolean> {
4
+ immediate?: Immediate;
5
+ deep?: boolean;
6
+ }
7
+ export declare function watchCached<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, MaybeUndefined<T, Immediate>>, options?: WatchCachedOptions<Immediate>): WatchHandle;
8
+ export {};
9
+ //# sourceMappingURL=watchCached.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchCached.d.ts","sourceRoot":"","sources":["../../src/composition/watchCached.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,WAAW,EACjB,MAAM,KAAK,CAAC;AAEb,KAAK,cAAc,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC;AAC/D,MAAM,WAAW,kBAAkB,CAAC,SAAS,GAAG,OAAO;IACrD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;CAEhB;AACD,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,SAAS,QAAQ,CAAC,OAAO,CAAC,GAAG,KAAK,EACxE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EACtB,EAAE,EAAE,aAAa,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,EAClD,OAAO,CAAC,EAAE,kBAAkB,CAAC,SAAS,CAAC,GACtC,WAAW,CAyBb"}
@@ -0,0 +1,31 @@
1
+ import { isJsonEqual as l } from "../lib/util/helpers/dist/index.js";
2
+ import { ref as f, watch as m } from "vue";
3
+ function q(r, c, e) {
4
+ const a = f(), u = m(
5
+ r,
6
+ (d) => {
7
+ l(d, a.value) || (a.value = d);
8
+ },
9
+ {
10
+ deep: e == null ? void 0 : e.deep,
11
+ immediate: !0
12
+ // always initialize cachedValue
13
+ }
14
+ );
15
+ return m(
16
+ () => a.value,
17
+ // `as T` is safe as we always initialize cachedValue
18
+ c,
19
+ // separate watch so that `onWatcherCleanup` would only be triggerred here
20
+ {
21
+ // standard vue `WatchOptions` conform to `WatchCachedOptions` interface,
22
+ // so construct new options to remove unsupported entries
23
+ deep: e == null ? void 0 : e.deep,
24
+ immediate: e == null ? void 0 : e.immediate
25
+ }
26
+ ), u;
27
+ }
28
+ export {
29
+ q as watchCached
30
+ };
31
+ //# sourceMappingURL=watchCached.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchCached.js","sources":["../../src/composition/watchCached.ts"],"sourcesContent":["import { isJsonEqual } from '@milaboratories/helpers';\nimport {\n ref,\n watch,\n type WatchCallback,\n type WatchHandle,\n type WatchSource,\n} from 'vue';\n\ntype MaybeUndefined<T, I> = I extends true ? T | undefined : T;\nexport interface WatchCachedOptions<Immediate = boolean> {\n immediate?: Immediate;\n deep?: boolean;\n // when `once` is needed, caching is useless, use plain watch instead\n}\nexport function watchCached<T, Immediate extends Readonly<boolean> = false>(\n source: WatchSource<T>,\n cb: WatchCallback<T, MaybeUndefined<T, Immediate>>,\n options?: WatchCachedOptions<Immediate>,\n): WatchHandle {\n const cachedValue = ref<T>();\n const handle = watch(\n source,\n (newValue) => {\n if (!isJsonEqual(newValue, cachedValue.value)) {\n cachedValue.value = newValue;\n }\n },\n {\n deep: options?.deep,\n immediate: true, // always initialize cachedValue\n },\n );\n watch<T, Immediate>(\n () => cachedValue.value as T, // `as T` is safe as we always initialize cachedValue\n cb, // separate watch so that `onWatcherCleanup` would only be triggerred here\n {\n // standard vue `WatchOptions` conform to `WatchCachedOptions` interface,\n // so construct new options to remove unsupported entries\n deep: options?.deep,\n immediate: options?.immediate,\n },\n );\n return handle; // stopping first handle would effectively stop the second one\n}\n"],"names":["watchCached","source","cb","options","cachedValue","ref","handle","watch","newValue","isJsonEqual"],"mappings":";;AAegB,SAAAA,EACdC,GACAC,GACAC,GACa;AACb,QAAMC,IAAcC,EAAO,GACrBC,IAASC;AAAA,IACbN;AAAA,IACA,CAACO,MAAa;AACZ,MAAKC,EAAYD,GAAUJ,EAAY,KAAK,MAC1CA,EAAY,QAAQI;AAAA,IAExB;AAAA,IACA;AAAA,MACE,MAAML,KAAA,gBAAAA,EAAS;AAAA,MACf,WAAW;AAAA;AAAA,IAAA;AAAA,EAEf;AACA,SAAAI;AAAA,IACE,MAAMH,EAAY;AAAA;AAAA,IAClBF;AAAA;AAAA,IACA;AAAA;AAAA;AAAA,MAGE,MAAMC,KAAA,gBAAAA,EAAS;AAAA,MACf,WAAWA,KAAA,gBAAAA,EAAS;AAAA,IAAA;AAAA,EAExB,GACOG;AACT;"}
@@ -14,4 +14,4 @@ const h = /* @__PURE__ */ r(e, [["render", i]]);
14
14
  export {
15
15
  h as default
16
16
  };
17
- //# sourceMappingURL=SvgRequired.vue2.js.map
17
+ //# sourceMappingURL=SvgRequired.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SvgRequired.vue.js","sources":["../../../../../src/generated/components/svg/images/SvgRequired.vue"],"sourcesContent":["<!-- ⚠️ AUTOGENERATED. DO NOT EDIT. -->\n<script lang=\"ts\">\nimport '../svg-styles.css';\nexport default { name: 'SvgRequired' };\n</script>\n\n<template>\n <div class=\"svg-icon SvgRequired\" style=\"width: 5px; height: 12px\" />\n</template>\n\n<style>\n .SvgRequired { background-image: url(\"data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%225%22%20height%3D%2212%22%20viewBox%3D%220%200%205%2012%22%20fill%3D%22none%22%3E%3Cpath%20d%3D%22M1.51685%204.8L2.5%203.34159L3.47612%204.8L4.39607%204.12743L3.31461%202.7469L5%202.25133L4.64888%201.16106L3.00562%201.77699L3.06882%200H1.93118L1.99438%201.77699L0.351124%201.16106L0%202.25133L1.68539%202.7469L0.59691%204.12743L1.51685%204.8Z%22%20fill%3D%22%23F1222F%22%2F%3E%3C%2Fsvg%3E\"); }\n</style>\n"],"names":["_hoisted_1"],"mappings":";;;;AAOoC,MAAAA,IAAA;AAAA,EAAA,OAAA;AAAA;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -91,6 +91,8 @@ export { useQuery } from './composition/useQuery.ts';
91
91
  export { useDraggable } from './composition/useDraggable';
92
92
  export { useComponentProp } from './composition/useComponentProp';
93
93
  export * from './composition/useWatchFetch';
94
+ export * from './composition/watchCached';
95
+ export * from './composition/computedCached';
94
96
  /**
95
97
  * Utils/Partials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AO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAE7C;;GAEG;AAEH,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACzE,cAAc,yBAAyB,CAAC;AAExC;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,mBAAmB,SAAS,CAAC;AAE7B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAE3C,cAAc,eAAe,CAAC;AAE9B,cAAc,iBAAiB,CAAC;AAEhC;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC;AAG/E,OAAO,EAAE,eAAe,EAAE,CAAC;AAG3B,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;AAGhE,QAAA,MAAM,QAAQ;;;;;;;;;CAAyC,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import { default as g } from "./components/LongText.vue.js";
11
11
 
12
12
  import { default as h } from "./components/SliderRangeTriple.vue.js";
13
13
  import { default as b } from "./components/SliderRange.vue.js";
14
- import { default as D } from "./components/Scrollable.vue.js";
14
+ import { default as B } from "./components/Scrollable.vue.js";
15
15
  import { allCssVariables as e } from "./demo-site-data/all-css-variables.js";
16
16
  import { default as k } from "./layout/PlBlockPage/PlBlockPage.vue.js";
17
17
  import { usePlBlockPageTitleTeleportTarget as I } from "./layout/PlBlockPage/usePlBlockPageTitleTeleportTarget.js";
@@ -39,7 +39,7 @@ import { default as ce } from "./components/PlDropdownLine/PlDropdownLine.vue.js
39
39
  import { default as ge } from "./components/PlDropdownLegacy/PlDropdownLegacy.vue.js";
40
40
  import { default as he } from "./components/PlTooltip/PlTooltip.vue.js";
41
41
  import { default as be } from "./components/PlProgressBar/PlProgressBar.vue.js";
42
- import { default as De } from "./components/PlNumberField/PlNumberField.vue.js";
42
+ import { default as Be } from "./components/PlNumberField/PlNumberField.vue.js";
43
43
  import { default as ke } from "./components/PlDropdownMulti/PlDropdownMulti.vue.js";
44
44
  import { default as Ie } from "./components/PlDropdownMultiRef/PlDropdownMultiRef.vue.js";
45
45
  import { default as ve } from "./components/PlCheckbox/PlCheckbox.vue.js";
@@ -64,8 +64,8 @@ import { default as io } from "./components/PlFileInput/PlFileInput.vue.js";
64
64
  import { default as Po } from "./components/PlNotificationAlert/PlNotificationAlert.vue.js";
65
65
  import { default as So } from "./components/PlSvg/PlSvg.vue.js";
66
66
  import { default as Co, default as ho } from "./components/PlIcon16/PlIcon16.vue.js";
67
- import { default as bo, default as Bo } from "./components/PlIcon24/PlIcon24.vue.js";
68
- import { default as wo } from "./components/PlChartStackedBar/PlChartStackedBar.vue.js";
67
+ import { default as bo, default as wo } from "./components/PlIcon24/PlIcon24.vue.js";
68
+ import { default as Do } from "./components/PlChartStackedBar/PlChartStackedBar.vue.js";
69
69
  import { default as Lo } from "./components/PlChartStackedBar/PlChartStackedBarCompact.vue.js";
70
70
  import { default as Mo } from "./components/PlChartHistogram/PlChartHistogram.vue.js";
71
71
  import { default as Eo } from "./components/PlRadio/PlRadio.vue.js";
@@ -89,15 +89,17 @@ import { useInterval as cr } from "./composition/useInterval.js";
89
89
  import { useFormState as gr } from "./composition/useFormState.js";
90
90
  import { useQuery as hr } from "./composition/useQuery.js";
91
91
  import { useDraggable as br } from "./composition/useDraggable.js";
92
- import { useComponentProp as Dr } from "./composition/useComponentProp.js";
92
+ import { useComponentProp as Br } from "./composition/useComponentProp.js";
93
93
  import { useWatchFetch as kr } from "./composition/useWatchFetch.js";
94
- import { default as Ir } from "./utils/PlCloseModalBtn.vue.js";
95
- import { default as vr } from "./utils/DropdownOverlay/DropdownOverlay.vue.js";
96
- import { useLabelNotch as Or } from "./utils/useLabelNotch.js";
97
- import { icons16 as yr } from "./generated/icons-16.js";
98
- import { icons24 as Fr } from "./generated/icons-24.js";
99
- import { detectOutside as Vr, eventListener as zr, getElementScrollPosition as Nr, isElementVisible as Hr, scrollIntoView as qr } from "./helpers/dom.js";
100
- import { animate as Wr, animateInfinite as jr, call as Jr, delay as Kr, listToOptions as Ur, makeEaseInOut as Xr, makeEaseOut as Yr, normalizeListOptions as Zr, randomInt as _r, randomString as $r, requestTick as et, throttle as ot, timeout as rt } from "./helpers/utils.js";
94
+ import { watchCached as Ir } from "./composition/watchCached.js";
95
+ import { computedCached as vr } from "./composition/computedCached.js";
96
+ import { default as Or } from "./utils/PlCloseModalBtn.vue.js";
97
+ import { default as yr } from "./utils/DropdownOverlay/DropdownOverlay.vue.js";
98
+ import { useLabelNotch as Fr } from "./utils/useLabelNotch.js";
99
+ import { icons16 as Vr } from "./generated/icons-16.js";
100
+ import { icons24 as Nr } from "./generated/icons-24.js";
101
+ import { detectOutside as qr, eventListener as Qr, getElementScrollPosition as Wr, isElementVisible as jr, scrollIntoView as Jr } from "./helpers/dom.js";
102
+ import { animate as Ur, animateInfinite as Xr, call as Yr, delay as Zr, listToOptions as _r, makeEaseInOut as $r, makeEaseOut as et, normalizeListOptions as ot, randomInt as rt, randomString as tt, requestTick as at, throttle as lt, timeout as ft } from "./helpers/utils.js";
101
103
  const l = { allCssVariables: e() };
102
104
  export {
103
105
  No as Color,
@@ -105,7 +107,7 @@ export {
105
107
  r as DataTable,
106
108
  l as DemoData,
107
109
  u as DropdownListItem,
108
- vr as DropdownOverlay,
110
+ yr as DropdownOverlay,
109
111
  qo as Gradient,
110
112
  g as LongText,
111
113
  Ue as PlAccordion,
@@ -122,12 +124,12 @@ export {
122
124
  Y as PlBtnSecondary,
123
125
  q as PlBtnSplit,
124
126
  Mo as PlChartHistogram,
125
- wo as PlChartStackedBar,
127
+ Do as PlChartStackedBar,
126
128
  Lo as PlChartStackedBarCompact,
127
129
  ve as PlCheckbox,
128
130
  Oe as PlCheckboxGroup,
129
131
  ye as PlChip,
130
- Ir as PlCloseModalBtn,
132
+ Or as PlCloseModalBtn,
131
133
  v as PlContainer,
132
134
  Fe as PlDialogModal,
133
135
  xe as PlDropdown,
@@ -147,9 +149,9 @@ export {
147
149
  eo as PlLoaderCircular,
148
150
  qe as PlLogView,
149
151
  ho as PlMaskIcon16,
150
- Bo as PlMaskIcon24,
152
+ wo as PlMaskIcon24,
151
153
  Po as PlNotificationAlert,
152
- De as PlNumberField,
154
+ Be as PlNumberField,
153
155
  be as PlProgressBar,
154
156
  ao as PlProgressCell,
155
157
  Eo as PlRadio,
@@ -167,45 +169,46 @@ export {
167
169
  fe as PlTextField,
168
170
  Ne as PlToggleSwitch,
169
171
  he as PlTooltip,
170
- D as Scrollable,
172
+ B as Scrollable,
171
173
  n as Slider,
172
174
  b as SliderRange,
173
175
  h as SliderRangeTriple,
174
176
  p as ThemeSwitcher,
175
- Wr as animate,
176
- jr as animateInfinite,
177
- Jr as call,
177
+ Ur as animate,
178
+ Xr as animateInfinite,
179
+ Yr as call,
178
180
  Ao as categoricalColors,
179
- Kr as delay,
180
- Vr as detectOutside,
181
- zr as eventListener,
182
- Nr as getElementScrollPosition,
183
- yr as icons16,
184
- Fr as icons24,
181
+ vr as computedCached,
182
+ Zr as delay,
183
+ qr as detectOutside,
184
+ Qr as eventListener,
185
+ Wr as getElementScrollPosition,
186
+ Vr as icons16,
187
+ Nr as icons24,
185
188
  Qo as interpolateColor,
186
- Hr as isElementVisible,
187
- Ur as listToOptions,
189
+ jr as isElementVisible,
190
+ _r as listToOptions,
188
191
  Fo as magma,
189
- Xr as makeEaseInOut,
190
- Yr as makeEaseOut,
192
+ $r as makeEaseInOut,
193
+ et as makeEaseOut,
191
194
  Wo as normalizeGradient,
192
- Zr as normalizeListOptions,
195
+ ot as normalizeListOptions,
193
196
  Go as palettes,
194
- _r as randomInt,
195
- $r as randomString,
196
- et as requestTick,
197
- qr as scrollIntoView,
197
+ rt as randomInt,
198
+ tt as randomString,
199
+ at as requestTick,
200
+ Jr as scrollIntoView,
198
201
  c as showContextMenu,
199
- ot as throttle,
200
- rt as timeout,
202
+ lt as throttle,
203
+ ft as timeout,
201
204
  Uo as useClickOutside,
202
- Dr as useComponentProp,
205
+ Br as useComponentProp,
203
206
  br as useDraggable,
204
207
  Yo as useEventListener,
205
208
  gr as useFormState,
206
209
  pr as useHover,
207
210
  cr as useInterval,
208
- Or as useLabelNotch,
211
+ Fr as useLabelNotch,
209
212
  ar as useLocalStorage,
210
213
  ur as useMouse,
211
214
  fr as useMouseCapture,
@@ -218,6 +221,7 @@ export {
218
221
  nr as useSortable2,
219
222
  rr as useTheme,
220
223
  kr as useWatchFetch,
221
- Vo as viridis
224
+ Vo as viridis,
225
+ Ir as watchCached
222
226
  };
223
227
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import './assets/ui.scss';\n\n// @TODO review\nimport * as DataTable from './components/DataTable';\nimport ThemeSwitcher from './components/ThemeSwitcher.vue';\n// @TODO review (may be private)\nimport DropdownListItem from './components/DropdownListItem.vue';\n\n// @TODO review\nimport ContextProvider from './components/ContextProvider.vue';\nimport Slider from './components/Slider.vue';\nimport { showContextMenu } from './components/contextMenu';\n// for new version\nimport LongText from './components/LongText.vue';\nimport SliderRangeTriple from './components/SliderRangeTriple.vue';\nimport SliderRange from './components/SliderRange.vue';\nimport Scrollable from './components/Scrollable.vue';\n\nimport { allCssVariables } from './demo-site-data/all-css-variables.ts';\n\n/**\n * Layout components\n */\n\nexport * from './layout/PlBlockPage';\nexport * from './layout/PlContainer';\nexport * from './layout/PlRow';\nexport * from './layout/PlSpacer';\nexport * from './layout/PlGrid';\n\n/**\n * Components\n */\nexport * from './components/PlErrorBoundary';\n// export * from './components/PlErrorAlert'; // @TODO discuss if we should export it\nexport * from './components/PlAlert';\nexport * from './components/PlBtnSplit';\nexport * from './components/PlBtnPrimary';\nexport * from './components/PlBtnAccent';\nexport * from './components/PlBtnDanger';\nexport * from './components/PlBtnSecondary';\nexport * from './components/PlBtnGhost';\nexport * from './components/PlBtnLink';\nexport * from './components/PlBtnGroup';\nexport * from './components/PlEditableTitle';\nexport * from './components/PlTextField';\nexport * from './components/PlSearchField';\nexport * from './components/PlTextArea';\nexport * from './components/PlDropdown';\nexport * from './components/PlDropdownRef';\nexport * from './components/PlDropdownLine';\nexport * from './components/PlDropdownLegacy';\nexport * from './components/PlTooltip';\nexport * from './components/PlProgressBar';\nexport * from './components/PlNumberField';\nexport * from './components/PlDropdownMulti';\nexport * from './components/PlDropdownMultiRef';\nexport * from './components/PlCheckbox';\nexport * from './components/PlCheckboxGroup';\nexport * from './components/PlChip';\nexport * from './components/PlDialogModal';\nexport * from './components/PlSlideModal';\nexport * from './components/PlToggleSwitch';\nexport * from './components/PlLogView';\nexport * from './components/PlTabs';\nexport * from './components/PlSectionSeparator';\nexport * from './components/PlAccordion';\nexport * from './components/PlStatusTag';\nexport * from './components/PlLoaderCircular';\nexport * from './components/PlSplash';\nexport * from './components/PlProgressCell';\nexport * from './components/PlAutocomplete';\nexport * from './components/PlElementList';\n\nexport * from './components/PlFileDialog';\nexport * from './components/PlFileInput';\nexport * from './components/PlNotificationAlert';\n\nexport * from './components/PlSvg';\nexport * from './components/PlMaskIcon16';\nexport * from './components/PlMaskIcon24';\nexport * from './components/PlIcon16';\nexport * from './components/PlIcon24';\n\nexport * from './components/PlChartStackedBar';\nexport * from './components/PlChartHistogram';\n\nexport * from './components/PlRadio';\n\nexport * from './colors';\n\n/**\n * Usables\n */\nexport { useElementPosition as usePosition } from './composition/usePosition';\nexport { useClickOutside } from './composition/useClickOutside';\nexport { useEventListener } from './composition/useEventListener';\nexport { useScroll } from './composition/useScroll';\nexport { useResizeObserver } from './composition/useResizeObserver';\nexport { useTheme } from './composition/useTheme';\nexport { useLocalStorage } from './composition/useLocalStorage';\nexport { useMouseCapture } from './composition/useMouseCapture';\nexport { useHover } from './composition/useHover';\nexport { useMouse } from './composition/useMouse';\nexport { useSortable } from './composition/useSortable';\nexport { useSortable2 } from './composition/useSortable2';\nexport { useInterval } from './composition/useInterval';\nexport { useFormState } from './composition/useFormState';\nexport { useQuery } from './composition/useQuery.ts';\nexport { useDraggable } from './composition/useDraggable';\nexport { useComponentProp } from './composition/useComponentProp';\nexport * from './composition/useWatchFetch';\n\n/**\n * Utils/Partials\n */\n\nexport { default as PlCloseModalBtn } from './utils/PlCloseModalBtn.vue';\nexport * from './utils/DropdownOverlay';\n\n/**\n * Technical\n * @TODO move it from here maybe\n */\nexport { useLabelNotch } from './utils/useLabelNotch.ts';\n\nexport type * from './types';\n\nexport { icons16, icons24 } from './types';\n\nexport * from './helpers/dom';\n\nexport * from './helpers/utils';\n\n/**\n * @TODO review\n */\nexport { ThemeSwitcher, DropdownListItem, DataTable, ContextProvider, Slider };\n\n// Helpers\nexport { showContextMenu };\n\n// move to new version pl-uikit\nexport { LongText, SliderRangeTriple, SliderRange, Scrollable };\n\n// @todo\nconst DemoData = { allCssVariables: allCssVariables() };\nexport { DemoData };\n"],"names":["DemoData","allCssVariables"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkJA,MAAMA,IAAW,EAAE,iBAAiBC,EAAkB,EAAA;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import './assets/ui.scss';\n\n// @TODO review\nimport * as DataTable from './components/DataTable';\nimport ThemeSwitcher from './components/ThemeSwitcher.vue';\n// @TODO review (may be private)\nimport DropdownListItem from './components/DropdownListItem.vue';\n\n// @TODO review\nimport ContextProvider from './components/ContextProvider.vue';\nimport Slider from './components/Slider.vue';\nimport { showContextMenu } from './components/contextMenu';\n// for new version\nimport LongText from './components/LongText.vue';\nimport SliderRangeTriple from './components/SliderRangeTriple.vue';\nimport SliderRange from './components/SliderRange.vue';\nimport Scrollable from './components/Scrollable.vue';\n\nimport { allCssVariables } from './demo-site-data/all-css-variables.ts';\n\n/**\n * Layout components\n */\n\nexport * from './layout/PlBlockPage';\nexport * from './layout/PlContainer';\nexport * from './layout/PlRow';\nexport * from './layout/PlSpacer';\nexport * from './layout/PlGrid';\n\n/**\n * Components\n */\nexport * from './components/PlErrorBoundary';\n// export * from './components/PlErrorAlert'; // @TODO discuss if we should export it\nexport * from './components/PlAlert';\nexport * from './components/PlBtnSplit';\nexport * from './components/PlBtnPrimary';\nexport * from './components/PlBtnAccent';\nexport * from './components/PlBtnDanger';\nexport * from './components/PlBtnSecondary';\nexport * from './components/PlBtnGhost';\nexport * from './components/PlBtnLink';\nexport * from './components/PlBtnGroup';\nexport * from './components/PlEditableTitle';\nexport * from './components/PlTextField';\nexport * from './components/PlSearchField';\nexport * from './components/PlTextArea';\nexport * from './components/PlDropdown';\nexport * from './components/PlDropdownRef';\nexport * from './components/PlDropdownLine';\nexport * from './components/PlDropdownLegacy';\nexport * from './components/PlTooltip';\nexport * from './components/PlProgressBar';\nexport * from './components/PlNumberField';\nexport * from './components/PlDropdownMulti';\nexport * from './components/PlDropdownMultiRef';\nexport * from './components/PlCheckbox';\nexport * from './components/PlCheckboxGroup';\nexport * from './components/PlChip';\nexport * from './components/PlDialogModal';\nexport * from './components/PlSlideModal';\nexport * from './components/PlToggleSwitch';\nexport * from './components/PlLogView';\nexport * from './components/PlTabs';\nexport * from './components/PlSectionSeparator';\nexport * from './components/PlAccordion';\nexport * from './components/PlStatusTag';\nexport * from './components/PlLoaderCircular';\nexport * from './components/PlSplash';\nexport * from './components/PlProgressCell';\nexport * from './components/PlAutocomplete';\nexport * from './components/PlElementList';\n\nexport * from './components/PlFileDialog';\nexport * from './components/PlFileInput';\nexport * from './components/PlNotificationAlert';\n\nexport * from './components/PlSvg';\nexport * from './components/PlMaskIcon16';\nexport * from './components/PlMaskIcon24';\nexport * from './components/PlIcon16';\nexport * from './components/PlIcon24';\n\nexport * from './components/PlChartStackedBar';\nexport * from './components/PlChartHistogram';\n\nexport * from './components/PlRadio';\n\nexport * from './colors';\n\n/**\n * Usables\n */\nexport { useElementPosition as usePosition } from './composition/usePosition';\nexport { useClickOutside } from './composition/useClickOutside';\nexport { useEventListener } from './composition/useEventListener';\nexport { useScroll } from './composition/useScroll';\nexport { useResizeObserver } from './composition/useResizeObserver';\nexport { useTheme } from './composition/useTheme';\nexport { useLocalStorage } from './composition/useLocalStorage';\nexport { useMouseCapture } from './composition/useMouseCapture';\nexport { useHover } from './composition/useHover';\nexport { useMouse } from './composition/useMouse';\nexport { useSortable } from './composition/useSortable';\nexport { useSortable2 } from './composition/useSortable2';\nexport { useInterval } from './composition/useInterval';\nexport { useFormState } from './composition/useFormState';\nexport { useQuery } from './composition/useQuery.ts';\nexport { useDraggable } from './composition/useDraggable';\nexport { useComponentProp } from './composition/useComponentProp';\nexport * from './composition/useWatchFetch';\nexport * from './composition/watchCached';\nexport * from './composition/computedCached';\n\n/**\n * Utils/Partials\n */\n\nexport { default as PlCloseModalBtn } from './utils/PlCloseModalBtn.vue';\nexport * from './utils/DropdownOverlay';\n\n/**\n * Technical\n * @TODO move it from here maybe\n */\nexport { useLabelNotch } from './utils/useLabelNotch.ts';\n\nexport type * from './types';\n\nexport { icons16, icons24 } from './types';\n\nexport * from './helpers/dom';\n\nexport * from './helpers/utils';\n\n/**\n * @TODO review\n */\nexport { ThemeSwitcher, DropdownListItem, DataTable, ContextProvider, Slider };\n\n// Helpers\nexport { showContextMenu };\n\n// move to new version pl-uikit\nexport { LongText, SliderRangeTriple, SliderRange, Scrollable };\n\n// @todo\nconst DemoData = { allCssVariables: allCssVariables() };\nexport { DemoData };\n"],"names":["DemoData","allCssVariables"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoJA,MAAMA,IAAW,EAAE,iBAAiBC,EAAkB,EAAA;"}
@@ -1256,7 +1256,7 @@ class z {
1256
1256
  this.ctx.logError(e);
1257
1257
  }
1258
1258
  }
1259
- const Y = "1.39.18";
1259
+ const Y = "1.40.0";
1260
1260
  function ht(n) {
1261
1261
  return n.__renderLambda === !0;
1262
1262
  }