fuma 2.0.49 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action/index.d.ts +2 -5
- package/dist/action/index.js +2 -5
- package/dist/action/list/handlers.d.ts +6 -6
- package/dist/action/list/handlers.js +6 -5
- package/dist/action/list/index.d.ts +1 -1
- package/dist/action/list/index.js +11 -5
- package/dist/action/list/trigger.js +6 -2
- package/dist/action/list/utils.js +1 -1
- package/dist/action/tip.js +2 -2
- package/dist/command/command.svelte.d.ts +16 -0
- package/dist/command/command.svelte.js +68 -0
- package/dist/command/index.d.ts +1 -0
- package/dist/command/index.js +1 -0
- package/dist/data.d.ts +87 -0
- package/dist/data.js +51 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/input/InputBoolean.svelte +107 -0
- package/dist/input/InputBoolean.svelte.d.ts +12 -0
- package/dist/input/InputNumber.svelte +33 -0
- package/dist/input/InputNumber.svelte.d.ts +10 -0
- package/dist/input/InputRadio.svelte +56 -0
- package/dist/input/InputRadio.svelte.d.ts +11 -0
- package/dist/input/InputRange.svelte +30 -0
- package/dist/input/InputRange.svelte.d.ts +10 -0
- package/dist/input/InputRelation.svelte +119 -0
- package/dist/input/InputRelation.svelte.d.ts +39 -0
- package/dist/input/InputSelect.svelte +113 -0
- package/dist/input/InputSelect.svelte.d.ts +37 -0
- package/dist/input/InputSelectNative.svelte +56 -0
- package/dist/input/InputSelectNative.svelte.d.ts +12 -0
- package/dist/input/InputString.svelte +48 -0
- package/dist/input/InputString.svelte.d.ts +11 -0
- package/dist/input/InputTextarea.svelte +47 -0
- package/dist/input/InputTextarea.svelte.d.ts +11 -0
- package/dist/input/Issues.svelte +21 -0
- package/dist/input/Issues.svelte.d.ts +7 -0
- package/dist/input/index.d.ts +11 -0
- package/dist/input/index.js +10 -0
- package/dist/input/type.d.ts +5 -0
- package/dist/input/type.js +1 -0
- package/dist/popover/Popover.svelte +50 -0
- package/dist/popover/index.d.ts +2 -0
- package/dist/popover/index.js +2 -0
- package/dist/popover/popover.svelte.d.ts +26 -0
- package/dist/popover/popover.svelte.js +101 -0
- package/dist/remote/useForm.d.ts +6 -0
- package/dist/remote/useForm.js +22 -0
- package/dist/search/Spans.svelte +15 -0
- package/dist/search/Spans.svelte.d.ts +7 -0
- package/dist/search/index.d.ts +2 -0
- package/dist/search/index.js +2 -0
- package/dist/search/search.js +96 -0
- package/dist/server/index.d.ts +0 -4
- package/dist/server/index.js +0 -4
- package/dist/server/parseQuery.js +1 -1
- package/dist/server/sse.js +4 -4
- package/dist/server/table.js +1 -1
- package/dist/state/index.d.ts +1 -0
- package/dist/state/index.js +1 -0
- package/dist/state/param.svelte.d.ts +18 -0
- package/dist/state/param.svelte.js +66 -0
- package/dist/ui/button/ButtonDelete.svelte +49 -28
- package/dist/ui/button/ButtonDelete.svelte.d.ts +12 -31
- package/dist/ui/button/index.d.ts +0 -1
- package/dist/ui/button/index.js +0 -1
- package/dist/ui/copy/ButtonCopy.svelte +43 -0
- package/dist/ui/copy/ButtonCopy.svelte.d.ts +17 -0
- package/dist/ui/copy/index.d.ts +2 -0
- package/dist/ui/copy/index.js +2 -0
- package/dist/ui/copy/useCopy.svelte.d.ts +10 -0
- package/dist/ui/copy/useCopy.svelte.js +36 -0
- package/dist/ui/dialog/Dialog.svelte +56 -26
- package/dist/ui/dialog/Dialog.svelte.d.ts +14 -35
- package/dist/ui/dialog/index.d.ts +0 -1
- package/dist/ui/dialog/index.js +0 -1
- package/dist/ui/drawer/Drawer.svelte +53 -45
- package/dist/ui/drawer/Drawer.svelte.d.ts +8 -63
- package/dist/ui/drawer/drawerFly.js +1 -1
- package/dist/ui/drawer/useLayer.svelte.d.ts +5 -0
- package/dist/ui/drawer/useLayer.svelte.js +33 -0
- package/dist/ui/index.d.ts +4 -12
- package/dist/ui/index.js +4 -12
- package/dist/ui/menu/ContextMenu.svelte +27 -26
- package/dist/ui/menu/ContextMenu.svelte.d.ts +9 -35
- package/dist/ui/menu/DropDown.svelte +44 -26
- package/dist/ui/menu/DropDown.svelte.d.ts +18 -43
- package/dist/ui/menu/DropDownMenu.svelte +51 -41
- package/dist/ui/menu/DropDownMenu.svelte.d.ts +7 -29
- package/dist/ui/menu/dropdown.css +4 -4
- package/dist/ui/menu/index.d.ts +1 -1
- package/dist/ui/menu/index.js +2 -1
- package/dist/ui/mode/ToggleMode.svelte +25 -14
- package/dist/ui/mode/ToggleMode.svelte.d.ts +10 -35
- package/dist/ui/mode/index.d.ts +1 -1
- package/dist/ui/mode/index.js +1 -1
- package/dist/ui/mode/useMode.svelte.d.ts +8 -0
- package/dist/ui/mode/useMode.svelte.js +40 -0
- package/dist/ui/pagination/Pagination.svelte +18 -14
- package/dist/ui/pagination/Pagination.svelte.d.ts +4 -18
- package/dist/ui/range/RangePicker.svelte +3 -2
- package/dist/ui/range/RangePickerButton.svelte +49 -37
- package/dist/ui/range/RangePickerButton.svelte.d.ts +7 -21
- package/dist/ui/range/index.d.ts +1 -1
- package/dist/ui/range/index.js +1 -1
- package/dist/ui/table/Table.svelte +15 -21
- package/dist/ui/table/Table.svelte.d.ts +1 -1
- package/dist/ui/table/TableBody.svelte +1 -1
- package/dist/ui/table/TableBody.svelte.d.ts +1 -1
- package/dist/ui/table/TableFieldsEdition.svelte +90 -78
- package/dist/ui/table/TableFieldsEdition.svelte.d.ts +14 -13
- package/dist/ui/table/TableHead.svelte +1 -1
- package/dist/ui/table/TableViewSelect.svelte +69 -69
- package/dist/ui/table/TableViewSelect.svelte.d.ts +10 -23
- package/dist/ui/table/cell/TableCellArray.svelte +1 -1
- package/dist/ui/table/cell/TableCellBoolean.svelte +3 -4
- package/dist/ui/table/cell/index.d.ts +1 -1
- package/dist/ui/table/cell/index.js +1 -1
- package/dist/ui/table/head/OrderButtons.svelte +18 -13
- package/dist/ui/table/head/OrderButtons.svelte.d.ts +11 -23
- package/dist/ui/table/head/TableHeadBoolean.svelte +3 -3
- package/dist/ui/table/head/TableHeadDate.svelte +41 -53
- package/dist/ui/table/head/TableHeadDate.svelte.d.ts +1 -1
- package/dist/ui/table/head/TableHeadDefault.svelte +2 -1
- package/dist/ui/table/head/TableHeadNumber.svelte +94 -108
- package/dist/ui/table/head/TableHeadNumber.svelte.d.ts +13 -10
- package/dist/ui/table/head/TableHeadSelect.svelte +55 -52
- package/dist/ui/table/head/TableHeadSelect.svelte.d.ts +13 -10
- package/dist/ui/table/head/TableHeadString.svelte +28 -34
- package/dist/ui/table/head/index.d.ts +3 -3
- package/dist/ui/table/head/index.js +3 -3
- package/dist/ui/table/index.d.ts +5 -5
- package/dist/ui/table/index.js +4 -5
- package/dist/utils/csv.js +1 -1
- package/dist/utils/eventEmitter.d.ts +2 -2
- package/dist/utils/eventEmitter.js +18 -11
- package/dist/utils/index.d.ts +4 -6
- package/dist/utils/index.js +4 -6
- package/dist/utils/normalizePath.js +1 -1
- package/dist/utils/options.d.ts +6 -5
- package/dist/utils/options.js +3 -2
- package/dist/utils/tippy.d.ts +1 -1
- package/dist/utils/tippy.js +1 -1
- package/dist/validation/index.d.ts +0 -1
- package/dist/validation/index.js +0 -1
- package/dist/validation/zod.d.ts +12 -393
- package/dist/validation/zod.js +22 -82
- package/package.json +111 -134
- package/dist/action/heightScreen.d.ts +0 -10
- package/dist/action/heightScreen.js +0 -24
- package/dist/action/portal.d.ts +0 -3
- package/dist/action/portal.js +0 -9
- package/dist/action/selector.d.ts +0 -15
- package/dist/action/selector.js +0 -71
- package/dist/api/client.d.ts +0 -3
- package/dist/api/client.js +0 -24
- package/dist/api/config.d.ts +0 -46
- package/dist/api/config.js +0 -7
- package/dist/api/index.d.ts +0 -3
- package/dist/api/index.js +0 -3
- package/dist/api/server.d.ts +0 -11
- package/dist/api/server.js +0 -17
- package/dist/private/Meta.svelte +0 -16
- package/dist/private/Meta.svelte.d.ts +0 -30
- package/dist/private/api.d.ts +0 -61
- package/dist/private/api.js +0 -10
- package/dist/private/constant.d.ts +0 -14
- package/dist/private/constant.js +0 -6
- package/dist/private/model.d.ts +0 -70
- package/dist/private/model.js +0 -25
- package/dist/private/prisma.d.ts +0 -2
- package/dist/private/prisma.js +0 -2
- package/dist/private/store.d.ts +0 -1
- package/dist/private/store.js +0 -2
- package/dist/server/auth.d.ts +0 -12
- package/dist/server/auth.js +0 -15
- package/dist/server/formAction.d.ts +0 -13
- package/dist/server/formAction.js +0 -8
- package/dist/server/json.d.ts +0 -1
- package/dist/server/json.js +0 -16
- package/dist/server/parseFormData.d.ts +0 -10
- package/dist/server/parseFormData.js +0 -85
- package/dist/server/try.d.ts +0 -9
- package/dist/server/try.js +0 -41
- package/dist/store/index.d.ts +0 -2
- package/dist/store/index.js +0 -2
- package/dist/store/isSmallScreen.d.ts +0 -1
- package/dist/store/isSmallScreen.js +0 -14
- package/dist/store/param.d.ts +0 -22
- package/dist/store/param.js +0 -61
- package/dist/store/session.d.ts +0 -1
- package/dist/store/session.js +0 -13
- package/dist/ui/badge/Badge.svelte +0 -9
- package/dist/ui/badge/Badge.svelte.d.ts +0 -21
- package/dist/ui/badge/index.d.ts +0 -1
- package/dist/ui/badge/index.js +0 -1
- package/dist/ui/button/ButtonCopy.svelte +0 -59
- package/dist/ui/button/ButtonCopy.svelte.d.ts +0 -27
- package/dist/ui/card/Card.svelte +0 -43
- package/dist/ui/card/Card.svelte.d.ts +0 -41
- package/dist/ui/card/CardBasic.svelte +0 -15
- package/dist/ui/card/CardBasic.svelte.d.ts +0 -31
- package/dist/ui/card/CardCollapse.svelte +0 -71
- package/dist/ui/card/CardCollapse.svelte.d.ts +0 -39
- package/dist/ui/card/CardFullScreen.svelte +0 -31
- package/dist/ui/card/CardFullScreen.svelte.d.ts +0 -38
- package/dist/ui/card/CardLink.svelte +0 -22
- package/dist/ui/card/CardLink.svelte.d.ts +0 -31
- package/dist/ui/card/index.d.ts +0 -5
- package/dist/ui/card/index.js +0 -5
- package/dist/ui/context.d.ts +0 -6
- package/dist/ui/context.js +0 -12
- package/dist/ui/dialog/DialogConfirm.svelte +0 -24
- package/dist/ui/dialog/DialogConfirm.svelte.d.ts +0 -35
- package/dist/ui/drawer/layers.d.ts +0 -7
- package/dist/ui/drawer/layers.js +0 -68
- package/dist/ui/form/Form.svelte +0 -168
- package/dist/ui/form/Form.svelte.d.ts +0 -62
- package/dist/ui/form/FormInput.svelte +0 -15
- package/dist/ui/form/FormSection.svelte +0 -78
- package/dist/ui/form/FormSection.svelte.d.ts +0 -39
- package/dist/ui/form/form.d.ts +0 -37
- package/dist/ui/form/form.js +0 -57
- package/dist/ui/form/formInput.js +0 -33
- package/dist/ui/form/index.d.ts +0 -3
- package/dist/ui/form/index.js +0 -3
- package/dist/ui/icon/Icon.svelte +0 -53
- package/dist/ui/icon/Icon.svelte.d.ts +0 -29
- package/dist/ui/icon/index.d.ts +0 -1
- package/dist/ui/icon/index.js +0 -1
- package/dist/ui/input/FormControl.svelte +0 -77
- package/dist/ui/input/FormControl.svelte.d.ts +0 -34
- package/dist/ui/input/InputBoolean.svelte +0 -33
- package/dist/ui/input/InputBoolean.svelte.d.ts +0 -46
- package/dist/ui/input/InputCheckboxs.svelte +0 -71
- package/dist/ui/input/InputCheckboxs.svelte.d.ts +0 -57
- package/dist/ui/input/InputCheckboxsMenu.svelte +0 -106
- package/dist/ui/input/InputCheckboxsMenu.svelte.d.ts +0 -59
- package/dist/ui/input/InputCheckboxsTree.svelte +0 -18
- package/dist/ui/input/InputCheckboxsTree.svelte.d.ts +0 -25
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte +0 -68
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte.d.ts +0 -27
- package/dist/ui/input/InputCombo.svelte +0 -99
- package/dist/ui/input/InputCombo.svelte.d.ts +0 -59
- package/dist/ui/input/InputDate.svelte +0 -47
- package/dist/ui/input/InputDate.svelte.d.ts +0 -46
- package/dist/ui/input/InputDateTime.svelte +0 -41
- package/dist/ui/input/InputDateTime.svelte.d.ts +0 -23
- package/dist/ui/input/InputImage.svelte +0 -116
- package/dist/ui/input/InputImage.svelte.d.ts +0 -48
- package/dist/ui/input/InputImagePreview.svelte +0 -60
- package/dist/ui/input/InputImagePreview.svelte.d.ts +0 -27
- package/dist/ui/input/InputNumber.svelte +0 -31
- package/dist/ui/input/InputNumber.svelte.d.ts +0 -23
- package/dist/ui/input/InputOptionInParam.svelte +0 -36
- package/dist/ui/input/InputOptionInParam.svelte.d.ts +0 -24
- package/dist/ui/input/InputOptions.svelte +0 -85
- package/dist/ui/input/InputOptions.svelte.d.ts +0 -21
- package/dist/ui/input/InputPassword.svelte +0 -25
- package/dist/ui/input/InputPassword.svelte.d.ts +0 -45
- package/dist/ui/input/InputRadio.svelte +0 -84
- package/dist/ui/input/InputRadio.svelte.d.ts +0 -56
- package/dist/ui/input/InputRelation.svelte +0 -171
- package/dist/ui/input/InputRelation.svelte.d.ts +0 -76
- package/dist/ui/input/InputRelations.svelte +0 -166
- package/dist/ui/input/InputRelations.svelte.d.ts +0 -55
- package/dist/ui/input/InputSearch.svelte +0 -59
- package/dist/ui/input/InputSearch.svelte.d.ts +0 -29
- package/dist/ui/input/InputSelect.svelte +0 -84
- package/dist/ui/input/InputSelect.svelte.d.ts +0 -29
- package/dist/ui/input/InputText.svelte +0 -46
- package/dist/ui/input/InputText.svelte.d.ts +0 -30
- package/dist/ui/input/InputTextarea.svelte +0 -23
- package/dist/ui/input/InputTextarea.svelte.d.ts +0 -23
- package/dist/ui/input/InputTime.svelte +0 -47
- package/dist/ui/input/InputTime.svelte.d.ts +0 -46
- package/dist/ui/input/RelationAfter.svelte +0 -34
- package/dist/ui/input/RelationAfter.svelte.d.ts +0 -26
- package/dist/ui/input/SelectorList.svelte +0 -50
- package/dist/ui/input/SelectorList.svelte.d.ts +0 -49
- package/dist/ui/input/action.d.ts +0 -13
- package/dist/ui/input/action.js +0 -56
- package/dist/ui/input/index.d.ts +0 -26
- package/dist/ui/input/index.js +0 -26
- package/dist/ui/input/textRich/InputTextRich.svelte +0 -72
- package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +0 -48
- package/dist/ui/input/textRich/SuggesionList.svelte +0 -25
- package/dist/ui/input/textRich/SuggesionList.svelte.d.ts +0 -23
- package/dist/ui/input/textRich/ToolMark.svelte +0 -22
- package/dist/ui/input/textRich/ToolMark.svelte.d.ts +0 -25
- package/dist/ui/input/textRich/ToolMarkColor.svelte +0 -36
- package/dist/ui/input/textRich/ToolMarkColor.svelte.d.ts +0 -23
- package/dist/ui/input/textRich/ToolMarkLink.svelte +0 -72
- package/dist/ui/input/textRich/ToolMarkLink.svelte.d.ts +0 -21
- package/dist/ui/input/textRich/ToolMenu.svelte +0 -66
- package/dist/ui/input/textRich/ToolMenu.svelte.d.ts +0 -33
- package/dist/ui/input/textRich/ToolMenuAlign.svelte +0 -50
- package/dist/ui/input/textRich/ToolMenuAlign.svelte.d.ts +0 -21
- package/dist/ui/input/textRich/ToolMenuInsert.svelte +0 -54
- package/dist/ui/input/textRich/ToolMenuInsert.svelte.d.ts +0 -23
- package/dist/ui/input/textRich/ToolMenuNode.svelte +0 -60
- package/dist/ui/input/textRich/ToolMenuNode.svelte.d.ts +0 -21
- package/dist/ui/input/textRich/ToolsBar.svelte +0 -61
- package/dist/ui/input/textRich/ToolsBar.svelte.d.ts +0 -24
- package/dist/ui/input/textRich/extensions.d.ts +0 -2
- package/dist/ui/input/textRich/extensions.js +0 -62
- package/dist/ui/input/textRich/indent.d.ts +0 -13
- package/dist/ui/input/textRich/indent.js +0 -112
- package/dist/ui/input/textRich/index.d.ts +0 -3
- package/dist/ui/input/textRich/index.js +0 -3
- package/dist/ui/input/textRich/suggestion.d.ts +0 -7
- package/dist/ui/input/textRich/suggestion.js +0 -55
- package/dist/ui/input/textRich/tiptapParser.d.ts +0 -4
- package/dist/ui/input/textRich/tiptapParser.js +0 -29
- package/dist/ui/input/types.d.ts +0 -15
- package/dist/ui/input/types.js +0 -1
- package/dist/ui/login/Login.svelte +0 -99
- package/dist/ui/login/Login.svelte.d.ts +0 -20
- package/dist/ui/login/index.d.ts +0 -1
- package/dist/ui/login/index.js +0 -1
- package/dist/ui/placeholder/Placeholder.svelte +0 -12
- package/dist/ui/placeholder/Placeholder.svelte.d.ts +0 -30
- package/dist/ui/placeholder/PlaceholderImage.svelte +0 -16
- package/dist/ui/placeholder/PlaceholderImage.svelte.d.ts +0 -30
- package/dist/ui/placeholder/index.d.ts +0 -2
- package/dist/ui/placeholder/index.js +0 -2
- package/dist/ui/tabs/Tabs.svelte +0 -32
- package/dist/ui/tabs/Tabs.svelte.d.ts +0 -22
- package/dist/ui/tabs/TabsIcon.svelte +0 -60
- package/dist/ui/tabs/TabsIcon.svelte.d.ts +0 -24
- package/dist/ui/tabs/index.d.ts +0 -8
- package/dist/ui/tabs/index.js +0 -2
- package/dist/utils/avatar.d.ts +0 -1
- package/dist/utils/avatar.js +0 -5
- package/dist/utils/component.d.ts +0 -6
- package/dist/utils/component.js +0 -3
- package/dist/validation/form.d.ts +0 -34
- package/dist/validation/form.js +0 -103
package/dist/ui/input/action.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { get } from 'svelte/store';
|
|
2
|
-
import debounce from 'debounce';
|
|
3
|
-
import { urlParam } from '../../store/param.js';
|
|
4
|
-
import { goto } from '$app/navigation';
|
|
5
|
-
export function bindValueWithParams(node, { bindEnable = false, debounceTime = 200, initValue = (initalValue) => (node.value = initalValue), listenerType = 'input' }) {
|
|
6
|
-
const { name } = node;
|
|
7
|
-
if (!name || !bindEnable)
|
|
8
|
-
return;
|
|
9
|
-
const importValueFromParams = () => {
|
|
10
|
-
const _urlParam = get(urlParam);
|
|
11
|
-
const value = _urlParam.get(name);
|
|
12
|
-
if (value)
|
|
13
|
-
return initValue(value);
|
|
14
|
-
};
|
|
15
|
-
const handleInput = debounce(async () => {
|
|
16
|
-
const _urlParam = get(urlParam);
|
|
17
|
-
const newUrl = node.value
|
|
18
|
-
? _urlParam.with({ [name]: node.value }, 'skip', 'take')
|
|
19
|
-
: _urlParam.without(name, 'skip', 'take');
|
|
20
|
-
await goto(newUrl, { replaceState: true, keepFocus: true, noScroll: true });
|
|
21
|
-
}, debounceTime);
|
|
22
|
-
importValueFromParams();
|
|
23
|
-
node.addEventListener(listenerType, handleInput);
|
|
24
|
-
return {
|
|
25
|
-
destroy() {
|
|
26
|
-
node.removeEventListener(listenerType, handleInput);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export function bindCheckedWithParams(node, { bindEnable = false, listenerType = 'input', debounceTime = 0, initValue = (initalValue) => (node.checked = node.value === initalValue) }) {
|
|
31
|
-
const { name } = node;
|
|
32
|
-
if (!name || !bindEnable)
|
|
33
|
-
return;
|
|
34
|
-
const importValueFromParams = () => {
|
|
35
|
-
const _urlParam = get(urlParam);
|
|
36
|
-
if (!_urlParam.has(name))
|
|
37
|
-
return;
|
|
38
|
-
const paramValue = _urlParam.get(name);
|
|
39
|
-
if (paramValue)
|
|
40
|
-
initValue(paramValue);
|
|
41
|
-
};
|
|
42
|
-
const handleInput = debounce(async () => {
|
|
43
|
-
const _urlParam = get(urlParam);
|
|
44
|
-
const newUrl = node.checked
|
|
45
|
-
? _urlParam.with({ [name]: node.value }, 'skip', 'take')
|
|
46
|
-
: _urlParam.without(name, 'skip', 'take');
|
|
47
|
-
await goto(newUrl, { replaceState: true, keepFocus: true, noScroll: true });
|
|
48
|
-
}, debounceTime);
|
|
49
|
-
importValueFromParams();
|
|
50
|
-
node.addEventListener(listenerType, handleInput);
|
|
51
|
-
return {
|
|
52
|
-
destroy: () => {
|
|
53
|
-
node.removeEventListener(listenerType, handleInput);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
package/dist/ui/input/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export * from './types.js';
|
|
2
|
-
export * from './action.js';
|
|
3
|
-
export * from './textRich/index.js';
|
|
4
|
-
export { default as FormControl } from './FormControl.svelte';
|
|
5
|
-
export { default as InputText } from './InputText.svelte';
|
|
6
|
-
export { default as InputPassword } from './InputPassword.svelte';
|
|
7
|
-
export { default as InputTextarea } from './InputTextarea.svelte';
|
|
8
|
-
export { default as InputRelations } from './InputRelations.svelte';
|
|
9
|
-
export { default as InputRelation } from './InputRelation.svelte';
|
|
10
|
-
export { default as InputDate } from './InputDate.svelte';
|
|
11
|
-
export { default as InputDateTime } from './InputDateTime.svelte';
|
|
12
|
-
export { default as InputTime } from './InputTime.svelte';
|
|
13
|
-
export { default as InputNumber } from './InputNumber.svelte';
|
|
14
|
-
export { default as InputBoolean } from './InputBoolean.svelte';
|
|
15
|
-
export { default as InputRadio } from './InputRadio.svelte';
|
|
16
|
-
export { default as InputOptionInParam } from './InputOptionInParam.svelte';
|
|
17
|
-
export { default as InputCheckboxs } from './InputCheckboxs.svelte';
|
|
18
|
-
export { default as InputCheckboxsMenu } from './InputCheckboxsMenu.svelte';
|
|
19
|
-
export { default as InputCheckboxsTree } from './InputCheckboxsTree.svelte';
|
|
20
|
-
export { default as InputSelect } from './InputSelect.svelte';
|
|
21
|
-
export { default as InputOptions } from './InputOptions.svelte';
|
|
22
|
-
export { default as InputSearch } from './InputSearch.svelte';
|
|
23
|
-
export { default as InputImage, type Crop } from './InputImage.svelte';
|
|
24
|
-
export { default as InputImagePreview } from './InputImagePreview.svelte';
|
|
25
|
-
export { default as InputCombo } from './InputCombo.svelte';
|
|
26
|
-
export { default as SelectorList } from './SelectorList.svelte';
|
package/dist/ui/input/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export * from './types.js';
|
|
2
|
-
export * from './action.js';
|
|
3
|
-
export * from './textRich/index.js';
|
|
4
|
-
export { default as FormControl } from './FormControl.svelte';
|
|
5
|
-
export { default as InputText } from './InputText.svelte';
|
|
6
|
-
export { default as InputPassword } from './InputPassword.svelte';
|
|
7
|
-
export { default as InputTextarea } from './InputTextarea.svelte';
|
|
8
|
-
export { default as InputRelations } from './InputRelations.svelte';
|
|
9
|
-
export { default as InputRelation } from './InputRelation.svelte';
|
|
10
|
-
export { default as InputDate } from './InputDate.svelte';
|
|
11
|
-
export { default as InputDateTime } from './InputDateTime.svelte';
|
|
12
|
-
export { default as InputTime } from './InputTime.svelte';
|
|
13
|
-
export { default as InputNumber } from './InputNumber.svelte';
|
|
14
|
-
export { default as InputBoolean } from './InputBoolean.svelte';
|
|
15
|
-
export { default as InputRadio } from './InputRadio.svelte';
|
|
16
|
-
export { default as InputOptionInParam } from './InputOptionInParam.svelte';
|
|
17
|
-
export { default as InputCheckboxs } from './InputCheckboxs.svelte';
|
|
18
|
-
export { default as InputCheckboxsMenu } from './InputCheckboxsMenu.svelte';
|
|
19
|
-
export { default as InputCheckboxsTree } from './InputCheckboxsTree.svelte';
|
|
20
|
-
export { default as InputSelect } from './InputSelect.svelte';
|
|
21
|
-
export { default as InputOptions } from './InputOptions.svelte';
|
|
22
|
-
export { default as InputSearch } from './InputSearch.svelte';
|
|
23
|
-
export { default as InputImage } from './InputImage.svelte';
|
|
24
|
-
export { default as InputImagePreview } from './InputImagePreview.svelte';
|
|
25
|
-
export { default as InputCombo } from './InputCombo.svelte';
|
|
26
|
-
export { default as SelectorList } from './SelectorList.svelte';
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { createEventDispatcher, onMount, type ComponentProps } from 'svelte'
|
|
3
|
-
import { Editor } from '@tiptap/core'
|
|
4
|
-
import debounce from 'debounce'
|
|
5
|
-
|
|
6
|
-
import { jsonParse } from '../../../utils/jsonParse.js'
|
|
7
|
-
import { FormControl } from '../index.js'
|
|
8
|
-
import ToolsBar from './ToolsBar.svelte'
|
|
9
|
-
import { extensions } from './extensions.js'
|
|
10
|
-
|
|
11
|
-
type $$Props = ComponentProps<FormControl> & { value?: string; classToolbar?: string }
|
|
12
|
-
|
|
13
|
-
export let value = ''
|
|
14
|
-
export let classToolbar = ''
|
|
15
|
-
|
|
16
|
-
let element: HTMLDivElement
|
|
17
|
-
let editor: Editor | null = null
|
|
18
|
-
|
|
19
|
-
const dispatch = createEventDispatcher<{ change: void }>()
|
|
20
|
-
|
|
21
|
-
onMount(() => {
|
|
22
|
-
initEditor()
|
|
23
|
-
return () => {
|
|
24
|
-
if (editor) editor.destroy()
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
export function setImage(image: { src: string; alt: string }) {
|
|
29
|
-
if (!editor) return false
|
|
30
|
-
return editor.commands.setImage(image)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function initEditor() {
|
|
34
|
-
const valueAsHtml = !value.startsWith('{') && value !== 'null'
|
|
35
|
-
editor = new Editor({
|
|
36
|
-
element,
|
|
37
|
-
content: valueAsHtml ? value : jsonParse(value, undefined),
|
|
38
|
-
editorProps: {
|
|
39
|
-
attributes: {
|
|
40
|
-
class: 'prose max-w-[210mm] mx-auto focus:outline-none'
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
extensions,
|
|
44
|
-
onTransaction() {
|
|
45
|
-
editor = editor
|
|
46
|
-
updateValue()
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const updateValue = debounce(() => {
|
|
52
|
-
if (!editor) return
|
|
53
|
-
const newValue = JSON.stringify(editor.getJSON())
|
|
54
|
-
if (newValue === value) return
|
|
55
|
-
value = newValue
|
|
56
|
-
dispatch('change')
|
|
57
|
-
}, 120)
|
|
58
|
-
</script>
|
|
59
|
-
|
|
60
|
-
<FormControl {...$$restProps}>
|
|
61
|
-
{#snippet children({ key })}
|
|
62
|
-
<div class="bordered relative rounded-lg border">
|
|
63
|
-
{#if editor}
|
|
64
|
-
<ToolsBar {editor} class={classToolbar} />
|
|
65
|
-
{/if}
|
|
66
|
-
<div bind:this={element} class="min-h-80 p-4 pb-10"></div>
|
|
67
|
-
</div>
|
|
68
|
-
{#if key}
|
|
69
|
-
<input type="hidden" name={key} {value} />
|
|
70
|
-
{/if}
|
|
71
|
-
{/snippet}
|
|
72
|
-
</FormControl>
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const InputTextRich: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
-
setImage?: (image: {
|
|
16
|
-
src: string;
|
|
17
|
-
alt: string;
|
|
18
|
-
}) => boolean;
|
|
19
|
-
} & {
|
|
20
|
-
class?: string;
|
|
21
|
-
classLabel?: string;
|
|
22
|
-
key?: string;
|
|
23
|
-
label?: import("svelte").Snippet | string;
|
|
24
|
-
labelAppend?: import("svelte").Snippet | null;
|
|
25
|
-
error?: string;
|
|
26
|
-
hint?: string;
|
|
27
|
-
prefix?: string | number;
|
|
28
|
-
prefixFor?: string | number;
|
|
29
|
-
enhanceDisabled?: boolean;
|
|
30
|
-
labelPosition?: "top" | "left" | "right";
|
|
31
|
-
children?: import("svelte").Snippet<[{
|
|
32
|
-
key: string;
|
|
33
|
-
}]> | undefined;
|
|
34
|
-
} & {
|
|
35
|
-
value?: string;
|
|
36
|
-
classToolbar?: string;
|
|
37
|
-
}, {
|
|
38
|
-
change: CustomEvent<void>;
|
|
39
|
-
} & {
|
|
40
|
-
[evt: string]: CustomEvent<any>;
|
|
41
|
-
}, {}, {
|
|
42
|
-
setImage: (image: {
|
|
43
|
-
src: string;
|
|
44
|
-
alt: string;
|
|
45
|
-
}) => boolean;
|
|
46
|
-
}, string>;
|
|
47
|
-
type InputTextRich = InstanceType<typeof InputTextRich>;
|
|
48
|
-
export default InputTextRich;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { SuggestionProps } from '@tiptap/suggestion'
|
|
3
|
-
import { SelectorList } from '../index.js'
|
|
4
|
-
import type { SuggestionItem } from './suggestion.js'
|
|
5
|
-
|
|
6
|
-
export let props: SuggestionProps<SuggestionItem>
|
|
7
|
-
export let keyDownEvent: KeyboardEvent | undefined = undefined
|
|
8
|
-
|
|
9
|
-
function handleSelect(index: number) {
|
|
10
|
-
const item = props.items[index]
|
|
11
|
-
if (!item) return
|
|
12
|
-
props.command(item)
|
|
13
|
-
}
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<SelectorList
|
|
17
|
-
items={props.items}
|
|
18
|
-
{keyDownEvent}
|
|
19
|
-
keyDownPreventDefault={false}
|
|
20
|
-
let:item
|
|
21
|
-
on:select={(event) => handleSelect(event.detail)}
|
|
22
|
-
class=" max-h-64 overflow-auto"
|
|
23
|
-
>
|
|
24
|
-
<span>{item.label}</span>
|
|
25
|
-
</SelectorList>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { SuggestionProps } from '@tiptap/suggestion';
|
|
2
|
-
import type { SuggestionItem } from './suggestion.js';
|
|
3
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
4
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
5
|
-
$$bindings?: Bindings;
|
|
6
|
-
} & Exports;
|
|
7
|
-
(internal: unknown, props: Props & {
|
|
8
|
-
$$events?: Events;
|
|
9
|
-
$$slots?: Slots;
|
|
10
|
-
}): Exports & {
|
|
11
|
-
$set?: any;
|
|
12
|
-
$on?: any;
|
|
13
|
-
};
|
|
14
|
-
z_$$bindings?: Bindings;
|
|
15
|
-
}
|
|
16
|
-
declare const SuggesionList: $$__sveltets_2_IsomorphicComponent<{
|
|
17
|
-
props: SuggestionProps<SuggestionItem>;
|
|
18
|
-
keyDownEvent?: KeyboardEvent | undefined;
|
|
19
|
-
}, {
|
|
20
|
-
[evt: string]: CustomEvent<any>;
|
|
21
|
-
}, {}, {}, string>;
|
|
22
|
-
type SuggesionList = InstanceType<typeof SuggesionList>;
|
|
23
|
-
export default SuggesionList;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Editor } from '@tiptap/core'
|
|
3
|
-
import { Icon } from '../../icon/index.js'
|
|
4
|
-
import { tip } from '../../../action/tip.js'
|
|
5
|
-
|
|
6
|
-
export let editor: Editor
|
|
7
|
-
export let key: string
|
|
8
|
-
export let label: string
|
|
9
|
-
export let icon: string
|
|
10
|
-
export let action: () => void
|
|
11
|
-
|
|
12
|
-
$: isActive = editor.isActive(key)
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<button
|
|
16
|
-
type="button"
|
|
17
|
-
use:tip={{ content: label, arrow: true }}
|
|
18
|
-
class="menu-item {isActive ? 'bg-base-200/60' : ''}"
|
|
19
|
-
on:click={action}
|
|
20
|
-
>
|
|
21
|
-
<Icon path={icon} size={19} class={isActive ? 'opacity-90' : 'opacity-60'} />
|
|
22
|
-
</button>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Editor } from '@tiptap/core';
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const ToolMark: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
-
editor: Editor;
|
|
17
|
-
key: string;
|
|
18
|
-
label: string;
|
|
19
|
-
icon: string;
|
|
20
|
-
action: () => void;
|
|
21
|
-
}, {
|
|
22
|
-
[evt: string]: CustomEvent<any>;
|
|
23
|
-
}, {}, {}, string>;
|
|
24
|
-
type ToolMark = InstanceType<typeof ToolMark>;
|
|
25
|
-
export default ToolMark;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Icon } from '../../icon/index.js'
|
|
3
|
-
import { tip } from '../../../action/tip.js'
|
|
4
|
-
|
|
5
|
-
export let icon: string
|
|
6
|
-
export let label: string
|
|
7
|
-
export let color: string
|
|
8
|
-
export let setColor: (color: string) => void
|
|
9
|
-
|
|
10
|
-
let inputColor: HTMLInputElement
|
|
11
|
-
|
|
12
|
-
function handleClick() {
|
|
13
|
-
inputColor.click()
|
|
14
|
-
setColor(color)
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<div class="flex align-bottom">
|
|
19
|
-
<input
|
|
20
|
-
type="color"
|
|
21
|
-
tabindex="-1"
|
|
22
|
-
bind:value={color}
|
|
23
|
-
class="h-0 w-0 translate-y-8 border-none opacity-0 outline-none"
|
|
24
|
-
bind:this={inputColor}
|
|
25
|
-
on:input={() => setColor(color)}
|
|
26
|
-
/>
|
|
27
|
-
<button type="button" class="menu-item gap-2" on:click={handleClick} use:tip={{ content: label }}>
|
|
28
|
-
<div class="indicator">
|
|
29
|
-
<span
|
|
30
|
-
class="badge indicator-item badge-xs scale-75 border transition-none"
|
|
31
|
-
style:background={color}
|
|
32
|
-
></span>
|
|
33
|
-
<Icon path={icon} size={19} class="opacity-70" />
|
|
34
|
-
</div>
|
|
35
|
-
</button>
|
|
36
|
-
</div>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const ToolMarkColor: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
-
icon: string;
|
|
16
|
-
label: string;
|
|
17
|
-
color: string;
|
|
18
|
-
setColor: (color: string) => void;
|
|
19
|
-
}, {
|
|
20
|
-
[evt: string]: CustomEvent<any>;
|
|
21
|
-
}, {}, {}, string>;
|
|
22
|
-
type ToolMarkColor = InstanceType<typeof ToolMarkColor>;
|
|
23
|
-
export default ToolMarkColor;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Editor } from '@tiptap/core'
|
|
3
|
-
import { mdiLinkVariant } from '@mdi/js'
|
|
4
|
-
|
|
5
|
-
import { Dialog } from '../../dialog/index.js'
|
|
6
|
-
import { InputText } from '../index.js'
|
|
7
|
-
import { z } from '../../../validation/zod.js'
|
|
8
|
-
import ToolMark from './ToolMark.svelte'
|
|
9
|
-
|
|
10
|
-
export let editor: Editor
|
|
11
|
-
let dialogLink: HTMLDialogElement
|
|
12
|
-
let linkHref = ''
|
|
13
|
-
let linkError = ''
|
|
14
|
-
|
|
15
|
-
async function handleNewLink() {
|
|
16
|
-
if (!linkHref) {
|
|
17
|
-
linkError = 'URL requis'
|
|
18
|
-
return
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const isEmail = z.string().email().safeParse(linkHref)
|
|
22
|
-
if (isEmail.success) linkHref = 'mailto:' + linkHref
|
|
23
|
-
else if (!linkHref.match(/^http(s)?:\/\//)) {
|
|
24
|
-
linkHref = 'https://' + linkHref
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const isUrl = z.string().url().safeParse(linkHref)
|
|
28
|
-
if (!isUrl.success) {
|
|
29
|
-
linkError = 'URL invalide'
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
editor.chain().focus().setLink({ href: linkHref }).run()
|
|
34
|
-
dialogLink.close()
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function handleRemoveLink() {
|
|
38
|
-
editor.chain().focus().unsetLink().run()
|
|
39
|
-
dialogLink.close()
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function handleKeyDown(event: KeyboardEvent) {
|
|
43
|
-
if (event.key !== 'Enter') return
|
|
44
|
-
event.preventDefault()
|
|
45
|
-
handleNewLink()
|
|
46
|
-
}
|
|
47
|
-
</script>
|
|
48
|
-
|
|
49
|
-
<ToolMark
|
|
50
|
-
{editor}
|
|
51
|
-
key="link"
|
|
52
|
-
label="Lien"
|
|
53
|
-
icon={mdiLinkVariant}
|
|
54
|
-
action={() => {
|
|
55
|
-
const firstChild = editor.state.selection.content().content.firstChild
|
|
56
|
-
linkHref = editor.getAttributes('link').href || firstChild?.textContent || ''
|
|
57
|
-
dialogLink.showModal()
|
|
58
|
-
}}
|
|
59
|
-
/>
|
|
60
|
-
|
|
61
|
-
<Dialog bind:dialog={dialogLink}>
|
|
62
|
-
<h3 slot="header" class="title">Éditer un lien</h3>
|
|
63
|
-
<div class="flex flex-col gap-2">
|
|
64
|
-
<InputText bind:value={linkHref} bind:error={linkError} on:keydown={handleKeyDown} />
|
|
65
|
-
<div class="flex flex-row-reverse gap-2">
|
|
66
|
-
<button type="button" class="btn" on:click={handleNewLink}> Valider </button>
|
|
67
|
-
<button type="button" class="btn btn-ghost text-error" on:click={handleRemoveLink}>
|
|
68
|
-
Supprimer
|
|
69
|
-
</button>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
72
|
-
</Dialog>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Editor } from '@tiptap/core';
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const ToolMarkLink: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
-
editor: Editor;
|
|
17
|
-
}, {
|
|
18
|
-
[evt: string]: CustomEvent<any>;
|
|
19
|
-
}, {}, {}, string>;
|
|
20
|
-
type ToolMarkLink = InstanceType<typeof ToolMarkLink>;
|
|
21
|
-
export default ToolMarkLink;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Editor } from '@tiptap/core'
|
|
3
|
-
import { mdiChevronDown } from '@mdi/js'
|
|
4
|
-
|
|
5
|
-
import { Icon } from '../../icon/index.js'
|
|
6
|
-
import { DropDown } from '../../menu/index.js'
|
|
7
|
-
|
|
8
|
-
type Tool = {
|
|
9
|
-
key?: string
|
|
10
|
-
attributes?: {}
|
|
11
|
-
label: string
|
|
12
|
-
icon: string
|
|
13
|
-
action: () => unknown
|
|
14
|
-
newSection?: true
|
|
15
|
-
disable?: boolean
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export let editor: Editor
|
|
19
|
-
export let tools: Tool[]
|
|
20
|
-
export let hideLabel = false
|
|
21
|
-
|
|
22
|
-
let dropdown: DropDown
|
|
23
|
-
|
|
24
|
-
function handleClick(tool: Tool) {
|
|
25
|
-
tool.action()
|
|
26
|
-
dropdown.hide()
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
$: toolSelected =
|
|
30
|
-
tools.find((t) => {
|
|
31
|
-
if (t.key) return editor.isActive(t.key, t.attributes)
|
|
32
|
-
if (t.attributes) return editor.isActive(t.attributes)
|
|
33
|
-
return false
|
|
34
|
-
}) || tools[0]
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<DropDown hideOnBlur bind:this={dropdown}>
|
|
38
|
-
<button slot="activator" type="button" class="menu-item gap-2">
|
|
39
|
-
<slot name="activator">
|
|
40
|
-
<Icon path={toolSelected.icon} size={20} class="opacity-70" />
|
|
41
|
-
{#if !hideLabel}
|
|
42
|
-
<span class="text-sm font-light">{toolSelected.label}</span>
|
|
43
|
-
{/if}
|
|
44
|
-
</slot>
|
|
45
|
-
<Icon path={mdiChevronDown} size={20} class="translate-y-px opacity-70" />
|
|
46
|
-
</button>
|
|
47
|
-
|
|
48
|
-
{#each tools as tool}
|
|
49
|
-
{#if tool.newSection}
|
|
50
|
-
<hr class="my-2" />
|
|
51
|
-
{/if}
|
|
52
|
-
<button
|
|
53
|
-
disabled={tool.disable}
|
|
54
|
-
type="button"
|
|
55
|
-
class="menu-item w-full"
|
|
56
|
-
class:disabled={tool.disable}
|
|
57
|
-
class:opacity-60={tool.disable}
|
|
58
|
-
on:click={() => handleClick(tool)}
|
|
59
|
-
>
|
|
60
|
-
<Icon path={tool.icon} size={20} class="opacity-70" />
|
|
61
|
-
<span>
|
|
62
|
-
{tool.label}
|
|
63
|
-
</span>
|
|
64
|
-
</button>
|
|
65
|
-
{/each}
|
|
66
|
-
</DropDown>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Editor } from '@tiptap/core';
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const ToolMenu: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
-
editor: Editor;
|
|
17
|
-
tools: {
|
|
18
|
-
key?: string;
|
|
19
|
-
attributes?: {};
|
|
20
|
-
label: string;
|
|
21
|
-
icon: string;
|
|
22
|
-
action: () => unknown;
|
|
23
|
-
newSection?: true;
|
|
24
|
-
disable?: boolean;
|
|
25
|
-
}[];
|
|
26
|
-
hideLabel?: boolean;
|
|
27
|
-
}, {
|
|
28
|
-
[evt: string]: CustomEvent<any>;
|
|
29
|
-
}, {
|
|
30
|
-
activator: {};
|
|
31
|
-
}, {}, string>;
|
|
32
|
-
type ToolMenu = InstanceType<typeof ToolMenu>;
|
|
33
|
-
export default ToolMenu;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Editor } from '@tiptap/core'
|
|
3
|
-
import {
|
|
4
|
-
mdiAlignHorizontalLeft,
|
|
5
|
-
mdiAlignHorizontalCenter,
|
|
6
|
-
mdiAlignHorizontalRight,
|
|
7
|
-
mdiFormatIndentIncrease,
|
|
8
|
-
mdiFormatIndentDecrease,
|
|
9
|
-
} from '@mdi/js'
|
|
10
|
-
|
|
11
|
-
import ToolMenu from './ToolMenu.svelte'
|
|
12
|
-
|
|
13
|
-
export let editor: Editor
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<ToolMenu
|
|
17
|
-
{editor}
|
|
18
|
-
hideLabel
|
|
19
|
-
tools={[
|
|
20
|
-
{
|
|
21
|
-
attributes: { textAlign: 'left' },
|
|
22
|
-
label: 'Aligner à gauche',
|
|
23
|
-
icon: mdiAlignHorizontalLeft,
|
|
24
|
-
action: () => editor.commands.setTextAlign('left'),
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
attributes: { textAlign: 'center' },
|
|
28
|
-
label: 'Aligner au centre',
|
|
29
|
-
icon: mdiAlignHorizontalCenter,
|
|
30
|
-
action: () => editor.commands.setTextAlign('center'),
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
attributes: { textAlign: 'right' },
|
|
34
|
-
label: 'Aligner à droite',
|
|
35
|
-
icon: mdiAlignHorizontalRight,
|
|
36
|
-
action: () => editor.commands.setTextAlign('right'),
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
newSection: true,
|
|
40
|
-
label: 'Retrait à droite',
|
|
41
|
-
icon: mdiFormatIndentIncrease,
|
|
42
|
-
action: () => editor.commands.indent(),
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
label: 'Retrait à droite',
|
|
46
|
-
icon: mdiFormatIndentDecrease,
|
|
47
|
-
action: () => editor.commands.outdent(),
|
|
48
|
-
},
|
|
49
|
-
]}
|
|
50
|
-
/>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Editor } from '@tiptap/core';
|
|
2
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
-
$$bindings?: Bindings;
|
|
5
|
-
} & Exports;
|
|
6
|
-
(internal: unknown, props: Props & {
|
|
7
|
-
$$events?: Events;
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const ToolMenuAlign: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
-
editor: Editor;
|
|
17
|
-
}, {
|
|
18
|
-
[evt: string]: CustomEvent<any>;
|
|
19
|
-
}, {}, {}, string>;
|
|
20
|
-
type ToolMenuAlign = InstanceType<typeof ToolMenuAlign>;
|
|
21
|
-
export default ToolMenuAlign;
|