@dxtmisha/wiki 0.24.3 → 0.39.1
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/package.json +8 -8
- package/src/classes/WikiStorybook.ts +92 -1
- package/src/classes/WikiStorybookItem.ts +79 -5
- package/src/classes/WikiStorybookProp.ts +109 -0
- package/src/library.ts +1 -0
- package/src/media/descriptions/wikiDescriptions.ts +32 -0
- package/src/media/descriptions/wikiDescriptionsAccordion.ts +204 -0
- package/src/media/descriptions/wikiDescriptionsActionSheet.ts +264 -0
- package/src/media/descriptions/wikiDescriptionsActions.ts +189 -0
- package/src/media/descriptions/wikiDescriptionsAnchor.ts +78 -0
- package/src/media/descriptions/wikiDescriptionsArrow.ts +214 -0
- package/src/media/descriptions/wikiDescriptionsBadge.ts +43 -0
- package/src/media/descriptions/wikiDescriptionsBars.ts +33 -0
- package/src/media/descriptions/wikiDescriptionsBlock.ts +159 -0
- package/src/media/descriptions/wikiDescriptionsButton.ts +32 -1
- package/src/media/descriptions/wikiDescriptionsCell.ts +26 -1
- package/src/media/descriptions/wikiDescriptionsChip.ts +42 -0
- package/src/media/descriptions/wikiDescriptionsChipGroup.ts +199 -0
- package/src/media/descriptions/wikiDescriptionsDialog.ts +226 -0
- package/src/media/descriptions/wikiDescriptionsField.ts +57 -2
- package/src/media/descriptions/wikiDescriptionsFieldCounter.ts +32 -0
- package/src/media/descriptions/wikiDescriptionsFieldLabel.ts +22 -0
- package/src/media/descriptions/wikiDescriptionsFieldMessage.ts +25 -0
- package/src/media/descriptions/wikiDescriptionsIcon.ts +46 -8
- package/src/media/descriptions/wikiDescriptionsImage.ts +91 -7
- package/src/media/descriptions/wikiDescriptionsInput.ts +313 -0
- package/src/media/descriptions/wikiDescriptionsList.ts +31 -0
- package/src/media/descriptions/wikiDescriptionsListGroup.ts +57 -0
- package/src/media/descriptions/wikiDescriptionsListItem.ts +42 -0
- package/src/media/descriptions/wikiDescriptionsListMenu.ts +41 -0
- package/src/media/descriptions/wikiDescriptionsMask.ts +42 -0
- package/src/media/descriptions/wikiDescriptionsMenu.ts +179 -0
- package/src/media/descriptions/wikiDescriptionsModal.ts +200 -0
- package/src/media/descriptions/wikiDescriptionsMotionTransform.ts +59 -6
- package/src/media/descriptions/wikiDescriptionsPage.ts +155 -0
- package/src/media/descriptions/wikiDescriptionsProgress.ts +39 -0
- package/src/media/descriptions/wikiDescriptionsRipple.ts +42 -3
- package/src/media/descriptions/wikiDescriptionsScrollbar.ts +48 -0
- package/src/media/descriptions/wikiDescriptionsSection.ts +152 -0
- package/src/media/descriptions/wikiDescriptionsSelect.ts +253 -0
- package/src/media/descriptions/wikiDescriptionsSelectValue.ts +107 -0
- package/src/media/descriptions/wikiDescriptionsSkeleton.ts +42 -1
- package/src/media/descriptions/wikiDescriptionsTextareaAutosize.ts +80 -0
- package/src/media/descriptions/wikiDescriptionsTooltip.ts +136 -0
- package/src/media/descriptions/wikiDescriptionsWindow.ts +60 -0
- package/src/media/functional/en/conversions.mdx +67 -0
- package/src/media/functional/en/dataUtils.mdx +25 -0
- package/src/media/functional/en/datetimeRef.mdx +1 -1
- package/src/media/functional/en/eventRef.mdx +1 -1
- package/src/media/functional/en/executionUtils.mdx +58 -0
- package/src/media/functional/en/geoFlagRef.mdx +1 -1
- package/src/media/functional/en/geoIntlRef.mdx +1 -1
- package/src/media/functional/en/geoRef.mdx +2 -2
- package/src/media/functional/en/meta.mdx +1206 -0
- package/src/media/functional/en/metaManager.mdx +376 -0
- package/src/media/functional/en/metaOg.mdx +694 -0
- package/src/media/functional/en/metaTwitter.mdx +853 -0
- package/src/media/functional/en/reactive.mdx +40 -0
- package/src/media/functional/en/refTypes.mdx +1 -1
- package/src/media/functional/en/useApiRef.mdx +5 -5
- package/src/media/functional/en/useMeta.mdx +431 -0
- package/src/media/functional/en/validationUtils.mdx +11 -0
- package/src/media/functional/functional-basic/functions/getCurrentDate/getCurrentDate.en.mdx +25 -0
- package/src/media/functional/functional-basic/functions/getCurrentDate/getCurrentDate.ru.mdx +25 -0
- package/src/media/functional/functional-basic/functions/getCurrentDate/getCurrentDate.vi.mdx +25 -0
- package/src/media/functional/functional-basic/functions/isEnter/isEnter.en.mdx +30 -0
- package/src/media/functional/functional-basic/functions/isEnter/isEnter.ru.mdx +30 -0
- package/src/media/functional/functional-basic/functions/isEnter/isEnter.vi.mdx +30 -0
- package/src/media/functional/ru/conversions.mdx +67 -0
- package/src/media/functional/ru/dataUtils.mdx +25 -0
- package/src/media/functional/ru/datetimeRef.mdx +2 -2
- package/src/media/functional/ru/eventRef.mdx +1 -1
- package/src/media/functional/ru/executionUtils.mdx +58 -0
- package/src/media/functional/ru/geoFlagRef.mdx +1 -1
- package/src/media/functional/ru/geoIntl.mdx +2 -2
- package/src/media/functional/ru/geoIntlRef.mdx +1 -1
- package/src/media/functional/ru/geoRef.mdx +2 -2
- package/src/media/functional/ru/listTypes.mdx +1 -1
- package/src/media/functional/ru/meta.mdx +1330 -0
- package/src/media/functional/ru/metaManager.mdx +376 -0
- package/src/media/functional/ru/metaOg.mdx +694 -0
- package/src/media/functional/ru/metaTwitter.mdx +853 -0
- package/src/media/functional/ru/reactive.mdx +40 -0
- package/src/media/functional/ru/refTypes.mdx +2 -2
- package/src/media/functional/ru/useApiRef.mdx +5 -5
- package/src/media/functional/ru/useMeta.mdx +431 -0
- package/src/media/functional/ru/validationUtils.mdx +11 -0
- package/src/media/mdx/Accordion/accordion.en.mdx +59 -0
- package/src/media/mdx/Accordion/accordion.ru.mdx +59 -0
- package/src/media/mdx/Accordion/slots.en.mdx +6 -0
- package/src/media/mdx/Accordion/slots.ru.mdx +6 -0
- package/src/media/mdx/Accordion/wikiMdxAccordion.ts +25 -0
- package/src/media/mdx/ActionSheet/actionSheet.en.mdx +61 -0
- package/src/media/mdx/ActionSheet/actionSheet.ru.mdx +61 -0
- package/src/media/mdx/ActionSheet/touchClose.en.mdx +21 -0
- package/src/media/mdx/ActionSheet/touchClose.ru.mdx +21 -0
- package/src/media/mdx/ActionSheet/wikiMdxActionSheet.ts +25 -0
- package/src/media/mdx/Actions/actions.en.mdx +48 -0
- package/src/media/mdx/Actions/actions.ru.mdx +48 -0
- package/src/media/mdx/Actions/flexible.en.mdx +19 -0
- package/src/media/mdx/Actions/flexible.ru.mdx +19 -0
- package/src/media/mdx/Actions/list.en.mdx +50 -0
- package/src/media/mdx/Actions/list.ru.mdx +50 -0
- package/src/media/mdx/Actions/wikiMdxActions.ts +31 -0
- package/src/media/mdx/Anchor/anchor.en.mdx +34 -0
- package/src/media/mdx/Anchor/anchor.ru.mdx +34 -0
- package/src/media/mdx/Anchor/expose.go.en.mdx +6 -0
- package/src/media/mdx/Anchor/expose.go.ru.mdx +6 -0
- package/src/media/mdx/Anchor/hide.en.mdx +28 -0
- package/src/media/mdx/Anchor/hide.ru.mdx +28 -0
- package/src/media/mdx/Anchor/isCopy.en.mdx +23 -0
- package/src/media/mdx/Anchor/isCopy.ru.mdx +23 -0
- package/src/media/mdx/Anchor/scroll.en.mdx +34 -0
- package/src/media/mdx/Anchor/scroll.ru.mdx +35 -0
- package/src/media/mdx/Anchor/wikiMdxAnchor.ts +43 -0
- package/src/media/mdx/Arrow/arrow.en.mdx +33 -0
- package/src/media/mdx/Arrow/arrow.ru.mdx +33 -0
- package/src/media/mdx/Arrow/wikiMdxArrow.ts +19 -0
- package/src/media/mdx/Block/block.en.mdx +42 -0
- package/src/media/mdx/Block/block.ru.mdx +42 -0
- package/src/media/mdx/Block/wikiMdxBlock.ts +19 -0
- package/src/media/mdx/ChipGroup/chipGroup.en.mdx +51 -0
- package/src/media/mdx/ChipGroup/chipGroup.ru.mdx +51 -0
- package/src/media/mdx/ChipGroup/selected.en.mdx +50 -0
- package/src/media/mdx/ChipGroup/selected.ru.mdx +50 -0
- package/src/media/mdx/ChipGroup/wikiMdxChipGroup.ts +25 -0
- package/src/media/mdx/Dialog/buttons.en.mdx +45 -0
- package/src/media/mdx/Dialog/buttons.ru.mdx +45 -0
- package/src/media/mdx/Dialog/dialog.en.mdx +66 -0
- package/src/media/mdx/Dialog/dialog.ru.mdx +65 -0
- package/src/media/mdx/Dialog/events.en.mdx +63 -0
- package/src/media/mdx/Dialog/events.ru.mdx +63 -0
- package/src/media/mdx/Dialog/states.en.mdx +58 -0
- package/src/media/mdx/Dialog/states.ru.mdx +57 -0
- package/src/media/mdx/Dialog/wikiMdxDialog.ts +37 -0
- package/src/media/mdx/Field/arrows.en.mdx +22 -6
- package/src/media/mdx/Field/arrows.ru.mdx +22 -6
- package/src/media/mdx/Field/slots.en.mdx +0 -13
- package/src/media/mdx/Field/slots.ru.mdx +0 -13
- package/src/media/mdx/Image/flag.en.mdx +23 -0
- package/src/media/mdx/Image/flag.ru.mdx +23 -0
- package/src/media/mdx/Image/image.en.mdx +26 -21
- package/src/media/mdx/Image/image.ru.mdx +26 -22
- package/src/media/mdx/Image/img-tag.en.mdx +105 -0
- package/src/media/mdx/Image/img-tag.ru.mdx +105 -0
- package/src/media/mdx/Image/wikiMdxImage.ts +12 -0
- package/src/media/mdx/Input/currency.en.mdx +38 -0
- package/src/media/mdx/Input/currency.ru.mdx +38 -0
- package/src/media/mdx/Input/date.en.mdx +53 -0
- package/src/media/mdx/Input/date.ru.mdx +53 -0
- package/src/media/mdx/Input/input.en.mdx +143 -0
- package/src/media/mdx/Input/input.ru.mdx +71 -0
- package/src/media/mdx/Input/mask.en.mdx +30 -0
- package/src/media/mdx/Input/mask.ru.mdx +30 -0
- package/src/media/mdx/Input/number.en.mdx +41 -0
- package/src/media/mdx/Input/number.ru.mdx +41 -0
- package/src/media/mdx/Input/type.en.mdx +26 -0
- package/src/media/mdx/Input/type.ru.mdx +26 -0
- package/src/media/mdx/Input/wikiMdxInput.ts +49 -0
- package/src/media/mdx/Menu/event.updateValue.en.mdx +29 -0
- package/src/media/mdx/Menu/event.updateValue.ru.mdx +30 -0
- package/src/media/mdx/Menu/expose.navigation.en.mdx +12 -0
- package/src/media/mdx/Menu/expose.navigation.ru.mdx +12 -0
- package/src/media/mdx/Menu/navigation.en.mdx +56 -0
- package/src/media/mdx/Menu/navigation.ru.mdx +56 -0
- package/src/media/mdx/Menu/slots.control.en.mdx +65 -0
- package/src/media/mdx/Menu/slots.control.ru.mdx +65 -0
- package/src/media/mdx/Menu/slots.en.mdx +2 -24
- package/src/media/mdx/Menu/slots.ru.mdx +2 -24
- package/src/media/mdx/Menu/wikiMdxMenu.ts +27 -3
- package/src/media/mdx/Modal/differences.en.mdx +130 -0
- package/src/media/mdx/Modal/differences.ru.mdx +65 -0
- package/src/media/mdx/Modal/modal.en.mdx +63 -0
- package/src/media/mdx/Modal/modal.ru.mdx +63 -0
- package/src/media/mdx/Modal/wikiMdxModal.ts +25 -0
- package/src/media/mdx/MotionTransform/expose.motionTransformElement.en.mdx +13 -0
- package/src/media/mdx/MotionTransform/expose.motionTransformElement.ru.mdx +14 -0
- package/src/media/mdx/MotionTransform/wikiMdxMotionTransform.ts +6 -0
- package/src/media/mdx/Page/page.en.mdx +38 -0
- package/src/media/mdx/Page/page.ru.mdx +38 -0
- package/src/media/mdx/Page/wikiMdxPage.ts +19 -0
- package/src/media/mdx/Section/section.en.mdx +38 -0
- package/src/media/mdx/Section/section.ru.mdx +38 -0
- package/src/media/mdx/Section/wikiMdxSection.ts +19 -0
- package/src/media/mdx/Select/select.en.mdx +69 -0
- package/src/media/mdx/Select/select.ru.mdx +69 -0
- package/src/media/mdx/Select/wikiMdxSelect.ts +19 -0
- package/src/media/mdx/SelectValue/selectValue.en.mdx +64 -0
- package/src/media/mdx/SelectValue/selectValue.ru.mdx +64 -0
- package/src/media/mdx/SelectValue/wikiMdxSelectValue.ts +19 -0
- package/src/media/mdx/TextareaAutosize/textarea-autosize.en.mdx +65 -0
- package/src/media/mdx/TextareaAutosize/textarea-autosize.ru.mdx +65 -0
- package/src/media/mdx/TextareaAutosize/wikiMdxTextareaAutosize.ts +19 -0
- package/src/media/mdx/Tooltip/event.tooltip.en.mdx +7 -0
- package/src/media/mdx/Tooltip/event.tooltip.ru.mdx +8 -0
- package/src/media/mdx/Tooltip/slot.control.en.mdx +14 -0
- package/src/media/mdx/Tooltip/slot.control.ru.mdx +14 -0
- package/src/media/mdx/Tooltip/tooltip.en.mdx +34 -0
- package/src/media/mdx/Tooltip/tooltip.ru.mdx +34 -0
- package/src/media/mdx/Tooltip/wikiMdxTooltip.ts +31 -0
- package/src/media/mdx/Window/classes.ru.mdx +1 -1
- package/src/media/mdx/event/events.actions.en.mdx +44 -0
- package/src/media/mdx/event/events.actions.ru.mdx +44 -0
- package/src/media/mdx/event/events.inputStandard.en.mdx +6 -0
- package/src/media/mdx/event/events.inputStandard.ru.mdx +6 -0
- package/src/media/mdx/event/wikiMdxEvent.ts +20 -8
- package/src/media/mdx/expose/expose.clear.en.mdx +1 -1
- package/src/media/mdx/expose/expose.descriptionId.en.mdx +6 -0
- package/src/media/mdx/expose/expose.descriptionId.ru.mdx +6 -0
- package/src/media/mdx/expose/expose.id.en.mdx +6 -0
- package/src/media/mdx/expose/expose.id.ru.mdx +6 -0
- package/src/media/mdx/expose/expose.labelId.en.mdx +6 -0
- package/src/media/mdx/expose/expose.labelId.ru.mdx +6 -0
- package/src/media/mdx/expose/wikiMdxExpose.ts +18 -0
- package/src/media/mdx/slot/body.en.mdx +6 -0
- package/src/media/mdx/slot/body.ru.mdx +6 -0
- package/src/media/mdx/slot/headline.en.mdx +7 -0
- package/src/media/mdx/slot/headline.ru.mdx +6 -0
- package/src/media/mdx/slot/leading.en.mdx +7 -0
- package/src/media/mdx/slot/leading.ru.mdx +7 -0
- package/src/media/mdx/slot/secondary.en.mdx +5 -0
- package/src/media/mdx/slot/secondary.ru.mdx +5 -0
- package/src/media/mdx/slot/trailing.en.mdx +7 -0
- package/src/media/mdx/slot/trailing.ru.mdx +7 -0
- package/src/media/mdx/slot/wikiMdxSlot.ts +30 -0
- package/src/media/mdx/style/isSkeleton.en.mdx +2 -2
- package/src/media/mdx/style/isSkeleton.ru.mdx +2 -2
- package/src/media/mdx/value/v-model-selected.en.mdx +28 -0
- package/src/media/mdx/value/v-model-selected.ru.mdx +28 -0
- package/src/media/mdx/value/v-model.en.mdx +26 -0
- package/src/media/mdx/value/v-model.ru.mdx +26 -0
- package/src/media/mdx/value/wikiMdxValue.ts +24 -3
- package/src/media/mdx/wikiMdx.ts +33 -1
- package/src/media/props/wiki.ts +44 -0
- package/src/media/props/wikiActions.ts +43 -0
- package/src/media/props/wikiActionsInclude.ts +62 -0
- package/src/media/props/wikiAnchor.ts +85 -0
- package/src/media/props/wikiAria.ts +123 -0
- package/src/media/props/wikiArrow.ts +24 -0
- package/src/media/props/wikiArrowInclude.ts +45 -0
- package/src/media/props/wikiAttributes.ts +143 -0
- package/src/media/props/wikiBadge.ts +7 -4
- package/src/media/props/wikiBars.ts +7 -6
- package/src/media/props/wikiBarsInclude.ts +82 -0
- package/src/media/props/wikiButton.ts +8 -4
- package/src/media/props/wikiChip.ts +4 -2
- package/src/media/props/wikiChipGroup.ts +39 -0
- package/src/media/props/wikiDialog.ts +33 -0
- package/src/media/props/wikiField.ts +18 -31
- package/src/media/props/wikiFieldCounterInclude.ts +87 -0
- package/src/media/props/wikiForm.ts +267 -0
- package/src/media/props/wikiHook.ts +20 -0
- package/src/media/props/wikiIcon.ts +19 -6
- package/src/media/props/wikiIconInclude.ts +322 -0
- package/src/media/props/wikiImage.ts +97 -20
- package/src/media/props/wikiInformation.ts +164 -0
- package/src/media/props/wikiInput.ts +34 -0
- package/src/media/props/wikiList.ts +10 -4
- package/src/media/props/wikiListItem.ts +23 -2
- package/src/media/props/wikiMask.ts +2 -12
- package/src/media/props/wikiMaskInclude.ts +54 -0
- package/src/media/props/wikiMenu.ts +1 -11
- package/src/media/props/wikiMotionTransform.ts +7 -13
- package/src/media/props/wikiOption.ts +356 -0
- package/src/media/props/wikiProgress.ts +8 -5
- package/src/media/props/wikiScrollbar.ts +6 -6
- package/src/media/props/wikiSelect.ts +68 -0
- package/src/media/props/wikiSelectValue.ts +30 -0
- package/src/media/props/wikiStatus.ts +34 -57
- package/src/media/props/wikiStyle.ts +85 -406
- package/src/media/props/wikiTechnical.ts +141 -1
- package/src/media/props/wikiText.ts +167 -0
- package/src/media/props/wikiTooltip.ts +53 -0
- package/src/media/props/wikiValue.ts +22 -276
- package/src/media/props/wikiWindow.ts +24 -45
- package/src/shims-mdx.d.ts +5 -0
- package/src/styles/storybookStyle.scss +3 -1
- package/src/types/storybookTypes.ts +48 -4
|
@@ -207,5 +207,65 @@ export const wikiDescriptionsWindow: StorybookComponentsDescriptionItem = {
|
|
|
207
207
|
slots: `
|
|
208
208
|
<StorybookDescriptions componentName={'Window'} type={'slots'}/>
|
|
209
209
|
`
|
|
210
|
+
},
|
|
211
|
+
ai: {
|
|
212
|
+
render: `
|
|
213
|
+
<div :class="classDemo.item">
|
|
214
|
+
<Window embedded open v-bind="args">
|
|
215
|
+
<template #control="{ binds }">
|
|
216
|
+
<button v-bind="binds">Open Window</button>
|
|
217
|
+
</template>
|
|
218
|
+
<template #title>
|
|
219
|
+
<h3>Window Title</h3>
|
|
220
|
+
</template>
|
|
221
|
+
<template #default>
|
|
222
|
+
<p>Window content goes here. This is a demonstration of the window component capabilities.</p>
|
|
223
|
+
<p>It can contain text, images, forms, or any other content.</p>
|
|
224
|
+
</template>
|
|
225
|
+
<template #footer>
|
|
226
|
+
<div>
|
|
227
|
+
<button>Cancel</button>
|
|
228
|
+
<button>Save</button>
|
|
229
|
+
</div>
|
|
230
|
+
</template>
|
|
231
|
+
</Window>
|
|
232
|
+
</div>
|
|
233
|
+
`,
|
|
234
|
+
description: `
|
|
235
|
+
**Note:** This is a low-level component. Use it only if specialized components like \`Modal\`, \`Dialog\`, or \`Menu\` do not fit your requirements.
|
|
236
|
+
|
|
237
|
+
Window is a versatile container component used for Modals, Popups, Dropdowns, and Cards.
|
|
238
|
+
It automatically handles z-index, focus management, teleportation, and scroll locking.
|
|
239
|
+
|
|
240
|
+
**Note:** The \`embedded\` prop is used only for documentation examples to render the component inline. Do not use it in production code.
|
|
241
|
+
|
|
242
|
+
**When to use:**
|
|
243
|
+
1. **Modal/Dialog:** When a centered box overlays the page content. Use default props.
|
|
244
|
+
2. **Dropdown/Popover:** When a box appears next to a button/trigger. Use \`axis="y"\` (vertical) or \`axis="x"\` (horizontal).
|
|
245
|
+
3. **Select Menu:** When a list overlays the trigger exactly. Use \`axis="on"\`.
|
|
246
|
+
4. **Card/Panel:** When you need the visual style of a window but embedded in the page flow. Use \`staticMode\`.
|
|
247
|
+
|
|
248
|
+
**Key Features:**
|
|
249
|
+
- **Structure:**
|
|
250
|
+
- \`#control\`: The trigger element (button, link). Bind \`binds\` to this element to enable automatic toggling.
|
|
251
|
+
- \`#title\`: The header area of the window.
|
|
252
|
+
- \`#default\`: The main content area (automatically wrapped in a Scrollbar).
|
|
253
|
+
- \`#footer\`: The bottom area for action buttons.
|
|
254
|
+
|
|
255
|
+
- **Positioning (\`axis\`):**
|
|
256
|
+
- \`undefined\` (default): Centered modal.
|
|
257
|
+
- \`y\`: Opens vertically relative to the trigger (like a standard dropdown).
|
|
258
|
+
- \`x\`: Opens horizontally relative to the trigger (like a nested menu).
|
|
259
|
+
- \`on\`: Overlays the trigger element.
|
|
260
|
+
|
|
261
|
+
- **Behavior:**
|
|
262
|
+
- \`staticMode\`: Disables teleportation and absolute positioning, rendering it as a regular block.
|
|
263
|
+
- \`persistent\`: Prevents closing when clicking outside or pressing Escape.
|
|
264
|
+
- \`closeButton\`: Automatically adds a close button in the top-right corner.
|
|
265
|
+
|
|
266
|
+
**Example:**
|
|
267
|
+
\`<Window axis="y">\` creates a dropdown menu.
|
|
268
|
+
\`<Window :open="true">\` creates a modal dialog.
|
|
269
|
+
`
|
|
210
270
|
}
|
|
211
271
|
}
|
|
@@ -45,6 +45,42 @@ applyTemplate('This is [bold]bold text[/bold]', { bold: '<b>[content]</b>' }) //
|
|
|
45
45
|
applyTemplate('Text with [red]colored[/red] word', { red: '<span style="color:red">[content]</span>' })
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
## `blobToBase64`
|
|
49
|
+
|
|
50
|
+
Converts a Blob to a Base64 string (data URL).
|
|
51
|
+
|
|
52
|
+
**Parameters:**
|
|
53
|
+
- `blob: Blob` — Blob object to convert
|
|
54
|
+
|
|
55
|
+
```javascript
|
|
56
|
+
import { blobToBase64 } from '@dxtmisha/functional'
|
|
57
|
+
|
|
58
|
+
const blob = new Blob(['Hello World'], { type: 'text/plain' })
|
|
59
|
+
const base64 = await blobToBase64(blob)
|
|
60
|
+
// 'data:text/plain;base64,SGVsbG8gV29ybGQ='
|
|
61
|
+
|
|
62
|
+
// Using with images
|
|
63
|
+
const imageBlob = new Blob([imageData], { type: 'image/png' })
|
|
64
|
+
const imageBase64 = await blobToBase64(imageBlob)
|
|
65
|
+
// 'data:image/png;base64,iVBORw0KGgo...'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## `encodeAttribute`
|
|
70
|
+
|
|
71
|
+
Encodes special characters in a string for safe use in HTML attributes. Converts characters `&`, `<`, `>`, `"`, `'` into corresponding HTML entities to prevent XSS attacks and ensure correct display.
|
|
72
|
+
|
|
73
|
+
**Parameters:**
|
|
74
|
+
- `text: string` — text to encode
|
|
75
|
+
|
|
76
|
+
```javascript
|
|
77
|
+
import { encodeAttribute } from '@dxtmisha/functional'
|
|
78
|
+
|
|
79
|
+
encodeAttribute('Hello & "World"') // 'Hello & "World"'
|
|
80
|
+
encodeAttribute('<script>alert("XSS")</script>') // '<script>alert("XSS")</script>'
|
|
81
|
+
encodeAttribute("It's a test") // 'It's a test'
|
|
82
|
+
```
|
|
83
|
+
|
|
48
84
|
## `replaceRecursive`
|
|
49
85
|
|
|
50
86
|
Recursively replaces values in an object or array.
|
|
@@ -78,6 +114,37 @@ replaceTemplate('User [id]: [name]', {id: '123', name: 'John'}) // 'User 123: Jo
|
|
|
78
114
|
replaceTemplate('Time: [time]', {time: () => new Date().toLocaleString()}) // with function
|
|
79
115
|
```
|
|
80
116
|
|
|
117
|
+
## `resizeImageByMax`
|
|
118
|
+
|
|
119
|
+
Resizes an image to fit within a maximum size constraint.
|
|
120
|
+
|
|
121
|
+
**Parameters:**
|
|
122
|
+
- `image: HTMLImageElement | string` — image element or URL
|
|
123
|
+
- `maxSize: number` — maximum size for width or height
|
|
124
|
+
- `type: 'auto' | 'width' | 'height'` — resize type (default 'auto')
|
|
125
|
+
- `typeData?: string` — data type for the resulting image (e.g., 'image/png', 'image/jpeg')
|
|
126
|
+
|
|
127
|
+
```javascript
|
|
128
|
+
import { resizeImageByMax } from '@dxtmisha/functional'
|
|
129
|
+
|
|
130
|
+
// Automatic scaling (by larger dimension)
|
|
131
|
+
const image = document.querySelector('img')
|
|
132
|
+
const resized = resizeImageByMax(image, 800) // data URL
|
|
133
|
+
// Image 1200x800 becomes 800x533
|
|
134
|
+
|
|
135
|
+
// Scale by width
|
|
136
|
+
resizeImageByMax(image, 600, 'width')
|
|
137
|
+
// Width will be 600px, height proportional
|
|
138
|
+
|
|
139
|
+
// Scale by height
|
|
140
|
+
resizeImageByMax(image, 400, 'height')
|
|
141
|
+
// Height will be 400px, width proportional
|
|
142
|
+
|
|
143
|
+
// With specified data type
|
|
144
|
+
resizeImageByMax(image, 1024, 'auto', 'image/jpeg')
|
|
145
|
+
// Returns JPEG data URL
|
|
146
|
+
```
|
|
147
|
+
|
|
81
148
|
## `secondToTime`
|
|
82
149
|
|
|
83
150
|
Converts seconds to time format (hours:minutes:seconds).
|
|
@@ -37,6 +37,31 @@ const copy = copyObject(original)
|
|
|
37
37
|
copy.data.age = 25 // original.data.age remains 30
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
## `copyObjectLite`
|
|
41
|
+
|
|
42
|
+
Creates a shallow copy of a simple object. If the `source` parameter is passed, creates a new object and merges `value` and `source`.
|
|
43
|
+
|
|
44
|
+
**Parameters:**
|
|
45
|
+
- `value: T` — object to copy
|
|
46
|
+
- `source?: any` — additional properties to copy (optional)
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
import { copyObjectLite } from '@dxtmisha/functional'
|
|
50
|
+
|
|
51
|
+
const original = { name: 'John', age: 30 }
|
|
52
|
+
const copy = copyObjectLite(original) // { name: 'John', age: 30 }
|
|
53
|
+
|
|
54
|
+
// With additional properties
|
|
55
|
+
const extended = copyObjectLite(original, { city: 'Moscow' })
|
|
56
|
+
// { name: 'John', age: 30, city: 'Moscow' }
|
|
57
|
+
|
|
58
|
+
// Overriding properties
|
|
59
|
+
const overridden = copyObjectLite(original, { age: 25 })
|
|
60
|
+
// { name: 'John', age: 25 }
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Note:** This is a shallow copy — nested objects retain references to the originals. For deep cloning use `copyObject`, `structuredClone` or `_.cloneDeep`.
|
|
64
|
+
|
|
40
65
|
## `forEach`
|
|
41
66
|
|
|
42
67
|
Universal iteration function for arrays, objects and Map.
|
|
@@ -259,7 +259,7 @@ const eventRef = new EventRef(buttonRef, containerRef, 'click')
|
|
|
259
259
|
|
|
260
260
|
### Vue Component with Reactive Events
|
|
261
261
|
|
|
262
|
-
```
|
|
262
|
+
```html
|
|
263
263
|
<template>
|
|
264
264
|
<button ref="buttonEl" @click="handleClick">Click me</button>
|
|
265
265
|
<input ref="inputEl" placeholder="Type...">
|
|
@@ -6,6 +6,62 @@ import {Meta} from '@storybook/addon-docs/blocks'
|
|
|
6
6
|
|
|
7
7
|
A set of functions for universal execution of synchronous and asynchronous operations.
|
|
8
8
|
|
|
9
|
+
## `computedByLanguage`
|
|
10
|
+
|
|
11
|
+
Creates a reactive computed property whose value depends on the current language and specified conditions.
|
|
12
|
+
|
|
13
|
+
**Parameters:**
|
|
14
|
+
- `getter: ComputedGetter<R>` — function that returns the main value depending on the language
|
|
15
|
+
- `getterNone: R | (() => R)` — alternative value if conditions are not met or getter returns undefined (default undefined)
|
|
16
|
+
- `conditions: () => boolean` — condition for calling the main getter (optional)
|
|
17
|
+
- `debugOptions: DebuggerOptions` — Vue debug options (optional)
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
import { computedByLanguage } from '@dxtmisha/functional'
|
|
21
|
+
import { ref } from 'vue'
|
|
22
|
+
|
|
23
|
+
// Simple example with translations
|
|
24
|
+
const title = computedByLanguage(
|
|
25
|
+
() => {
|
|
26
|
+
const lang = GeoRef.get().value
|
|
27
|
+
return lang === 'ru' ? 'Заголовок' : 'Title'
|
|
28
|
+
},
|
|
29
|
+
'Default Title'
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
// With condition
|
|
33
|
+
const description = computedByLanguage(
|
|
34
|
+
() => {
|
|
35
|
+
const lang = GeoRef.get().value
|
|
36
|
+
const translations = {
|
|
37
|
+
ru: 'Описание на русском',
|
|
38
|
+
en: 'Description in English'
|
|
39
|
+
}
|
|
40
|
+
return translations[lang]
|
|
41
|
+
},
|
|
42
|
+
() => 'Default description',
|
|
43
|
+
() => showDescription.value // show condition
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
// Usage in component
|
|
47
|
+
export default {
|
|
48
|
+
setup() {
|
|
49
|
+
const showText = ref(true)
|
|
50
|
+
|
|
51
|
+
const greeting = computedByLanguage(
|
|
52
|
+
() => {
|
|
53
|
+
const lang = GeoRef.get().value
|
|
54
|
+
return lang === 'ru' ? 'Привет, мир!' : 'Hello, world!'
|
|
55
|
+
},
|
|
56
|
+
'Greeting',
|
|
57
|
+
() => showText.value
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
return { greeting }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
9
65
|
## `executeFunction`
|
|
10
66
|
|
|
11
67
|
Executes a function and returns its result, or returns input data if it's not a function.
|
|
@@ -127,3 +183,5 @@ export default {
|
|
|
127
183
|
}
|
|
128
184
|
}
|
|
129
185
|
```
|
|
186
|
+
|
|
187
|
+
|
|
@@ -141,7 +141,7 @@ const flag = new GeoFlagRef() // will use de-DE
|
|
|
141
141
|
|
|
142
142
|
### Vue Component with Global Geolocation
|
|
143
143
|
|
|
144
|
-
```
|
|
144
|
+
```html
|
|
145
145
|
<template>
|
|
146
146
|
<div class="geo-info">
|
|
147
147
|
<h2>Current Location</h2>
|
|
@@ -202,7 +202,7 @@ GeoRef.set(userLocale)
|
|
|
202
202
|
|
|
203
203
|
### Global Locale Provider
|
|
204
204
|
|
|
205
|
-
```
|
|
205
|
+
```html
|
|
206
206
|
<!-- App.vue -->
|
|
207
207
|
<template>
|
|
208
208
|
<div class="app">
|