fuma 2.0.50 → 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
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { createEventDispatcher } from 'svelte'
|
|
3
|
-
import type { Editor } from '@tiptap/core'
|
|
4
|
-
import { mdiPlus, mdiMinus, mdiImageOutline, mdiYoutube, mdiAt } from '@mdi/js'
|
|
5
|
-
|
|
6
|
-
import { Icon } from '../../icon/index.js'
|
|
7
|
-
import ToolMenu from './ToolMenu.svelte'
|
|
8
|
-
import { suggestionItems } from './suggestion.js'
|
|
9
|
-
|
|
10
|
-
export let editor: Editor
|
|
11
|
-
|
|
12
|
-
const dispatch = createEventDispatcher<{ insertMedia: void }>()
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<ToolMenu
|
|
16
|
-
{editor}
|
|
17
|
-
tools={[
|
|
18
|
-
{
|
|
19
|
-
label: 'Séparateur',
|
|
20
|
-
icon: mdiMinus,
|
|
21
|
-
action: () => editor.commands.setHorizontalRule()
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
label: 'Image',
|
|
25
|
-
icon: mdiImageOutline,
|
|
26
|
-
action: () => dispatch('insertMedia')
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
label: 'Vidéo',
|
|
30
|
-
icon: mdiYoutube,
|
|
31
|
-
action: () => {
|
|
32
|
-
const src = prompt('Lien youtube')
|
|
33
|
-
if (!src) return
|
|
34
|
-
editor.commands.setYoutubeVideo({ src })
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
label: 'Valeur dynamic',
|
|
39
|
-
icon: mdiAt,
|
|
40
|
-
disable: !$suggestionItems.length,
|
|
41
|
-
action: () => {
|
|
42
|
-
const { from } = editor.state.selection
|
|
43
|
-
const lastChar = editor.state.doc.textBetween(from - 1, from)
|
|
44
|
-
const charToAdd = lastChar === '' || lastChar === ' ' ? '@' : ' @'
|
|
45
|
-
editor.chain().insertContent(charToAdd).focus().run()
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
]}
|
|
49
|
-
hideLabel
|
|
50
|
-
>
|
|
51
|
-
<svelte:fragment slot="activator">
|
|
52
|
-
<Icon path={mdiPlus} size={20} class="opacity-70" />
|
|
53
|
-
</svelte:fragment>
|
|
54
|
-
</ToolMenu>
|
|
@@ -1,23 +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 ToolMenuInsert: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
-
editor: Editor;
|
|
17
|
-
}, {
|
|
18
|
-
insertMedia: CustomEvent<void>;
|
|
19
|
-
} & {
|
|
20
|
-
[evt: string]: CustomEvent<any>;
|
|
21
|
-
}, {}, {}, string>;
|
|
22
|
-
type ToolMenuInsert = InstanceType<typeof ToolMenuInsert>;
|
|
23
|
-
export default ToolMenuInsert;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Editor } from '@tiptap/core'
|
|
3
|
-
import {
|
|
4
|
-
mdiText,
|
|
5
|
-
mdiFormatListBulleted,
|
|
6
|
-
mdiFormatListNumbered,
|
|
7
|
-
mdiFormatHeader1,
|
|
8
|
-
mdiFormatHeader3,
|
|
9
|
-
mdiFormatHeader2,
|
|
10
|
-
} from '@mdi/js'
|
|
11
|
-
|
|
12
|
-
import ToolMenu from './ToolMenu.svelte'
|
|
13
|
-
|
|
14
|
-
export let editor: Editor
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<ToolMenu
|
|
18
|
-
{editor}
|
|
19
|
-
tools={[
|
|
20
|
-
{
|
|
21
|
-
key: 'paragraph',
|
|
22
|
-
label: 'Texte',
|
|
23
|
-
icon: mdiText,
|
|
24
|
-
action: () => editor.commands.setParagraph(),
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
key: 'heading',
|
|
28
|
-
attributes: { level: 1 },
|
|
29
|
-
label: 'Titre 1',
|
|
30
|
-
icon: mdiFormatHeader1,
|
|
31
|
-
action: () => editor.commands.setHeading({ level: 1 }),
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
key: 'heading',
|
|
35
|
-
attributes: { level: 2 },
|
|
36
|
-
label: 'Titre 2',
|
|
37
|
-
icon: mdiFormatHeader2,
|
|
38
|
-
action: () => editor.commands.setHeading({ level: 2 }),
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
key: 'heading',
|
|
42
|
-
attributes: { level: 3 },
|
|
43
|
-
label: 'Titre 3',
|
|
44
|
-
icon: mdiFormatHeader3,
|
|
45
|
-
action: () => editor.commands.setHeading({ level: 3 }),
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
key: 'orderedList',
|
|
49
|
-
label: 'Liste numéroter',
|
|
50
|
-
icon: mdiFormatListNumbered,
|
|
51
|
-
action: () => editor.commands.toggleOrderedList(),
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
key: 'bulletList',
|
|
55
|
-
label: 'Liste à puces',
|
|
56
|
-
icon: mdiFormatListBulleted,
|
|
57
|
-
action: () => editor.commands.toggleBulletList(),
|
|
58
|
-
},
|
|
59
|
-
]}
|
|
60
|
-
/>
|
|
@@ -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 ToolMenuNode: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
-
editor: Editor;
|
|
17
|
-
}, {
|
|
18
|
-
[evt: string]: CustomEvent<any>;
|
|
19
|
-
}, {}, {}, string>;
|
|
20
|
-
type ToolMenuNode = InstanceType<typeof ToolMenuNode>;
|
|
21
|
-
export default ToolMenuNode;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Editor } from '@tiptap/core'
|
|
3
|
-
import { mdiFormatBold, mdiFormatColorFill, mdiFormatColorText, mdiFormatItalic } from '@mdi/js'
|
|
4
|
-
import { toast } from 'svelte-sonner'
|
|
5
|
-
|
|
6
|
-
import ToolMenuNode from './ToolMenuNode.svelte'
|
|
7
|
-
import ToolMark from './ToolMark.svelte'
|
|
8
|
-
import ToolMarkColor from './ToolMarkColor.svelte'
|
|
9
|
-
import ToolMarkLink from './ToolMarkLink.svelte'
|
|
10
|
-
import ToolMenuAlign from './ToolMenuAlign.svelte'
|
|
11
|
-
import ToolMenuInsert from './ToolMenuInsert.svelte'
|
|
12
|
-
|
|
13
|
-
export let editor: Editor
|
|
14
|
-
let klass = ''
|
|
15
|
-
export { klass as class }
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<div
|
|
19
|
-
class="
|
|
20
|
-
sticky top-0 z-10 overflow-y-visible rounded-t-xl border-b bg-base-100
|
|
21
|
-
{klass}
|
|
22
|
-
"
|
|
23
|
-
>
|
|
24
|
-
<div class="flex overflow-x-auto p-2">
|
|
25
|
-
<ToolMenuNode {editor} />
|
|
26
|
-
<ToolMenuAlign {editor} />
|
|
27
|
-
<div class="mx-1 my-auto h-6 border border-y-0 border-l-0"></div>
|
|
28
|
-
|
|
29
|
-
<ToolMark
|
|
30
|
-
{editor}
|
|
31
|
-
key="bold"
|
|
32
|
-
label="Gras (Ctrl+B)"
|
|
33
|
-
icon={mdiFormatBold}
|
|
34
|
-
action={() => editor.chain().focus().toggleBold().run()}
|
|
35
|
-
/>
|
|
36
|
-
<ToolMark
|
|
37
|
-
{editor}
|
|
38
|
-
key="italic"
|
|
39
|
-
label="Italic (Ctrl+C)"
|
|
40
|
-
icon={mdiFormatItalic}
|
|
41
|
-
action={() => editor.chain().focus().toggleItalic().run()}
|
|
42
|
-
/>
|
|
43
|
-
<ToolMarkLink {editor} />
|
|
44
|
-
<ToolMarkColor
|
|
45
|
-
icon={mdiFormatColorText}
|
|
46
|
-
label="Couleur du text"
|
|
47
|
-
color={editor.getAttributes('textStyle').color || '#000000'}
|
|
48
|
-
setColor={editor.commands.setColor}
|
|
49
|
-
/>
|
|
50
|
-
<ToolMarkColor
|
|
51
|
-
icon={mdiFormatColorFill}
|
|
52
|
-
label="Couleur du fond"
|
|
53
|
-
color={editor.getAttributes('highlight').color || '#e51f68'}
|
|
54
|
-
setColor={(color) => editor.commands.setHighlight({ color })}
|
|
55
|
-
/>
|
|
56
|
-
|
|
57
|
-
<div class="mx-1 my-auto h-6 border border-y-0 border-l-0"></div>
|
|
58
|
-
|
|
59
|
-
<ToolMenuInsert {editor} on:insertMedia />
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
@@ -1,24 +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 ToolsBar: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
-
editor: Editor;
|
|
17
|
-
class?: string;
|
|
18
|
-
}, {
|
|
19
|
-
insertMedia: CustomEvent<void>;
|
|
20
|
-
} & {
|
|
21
|
-
[evt: string]: CustomEvent<any>;
|
|
22
|
-
}, {}, {}, string>;
|
|
23
|
-
type ToolsBar = InstanceType<typeof ToolsBar>;
|
|
24
|
-
export default ToolsBar;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import StarterKit from '@tiptap/starter-kit';
|
|
2
|
-
import Link from '@tiptap/extension-link';
|
|
3
|
-
import TextStyle from '@tiptap/extension-text-style';
|
|
4
|
-
import Color from '@tiptap/extension-color';
|
|
5
|
-
import Highlight from '@tiptap/extension-highlight';
|
|
6
|
-
import TextAlign from '@tiptap/extension-text-align';
|
|
7
|
-
import Placeholder from '@tiptap/extension-placeholder';
|
|
8
|
-
import Image from '@tiptap/extension-image';
|
|
9
|
-
import Youtube from '@tiptap/extension-youtube';
|
|
10
|
-
import Mention from '@tiptap/extension-mention';
|
|
11
|
-
import { Indent } from './indent.js';
|
|
12
|
-
import { suggestion } from './suggestion.js';
|
|
13
|
-
export const extensions = [
|
|
14
|
-
StarterKit.configure({
|
|
15
|
-
heading: { levels: [1, 2, 3] }
|
|
16
|
-
}),
|
|
17
|
-
Link.configure({
|
|
18
|
-
protocols: ['tel', 'mailto']
|
|
19
|
-
}),
|
|
20
|
-
TextStyle,
|
|
21
|
-
Color,
|
|
22
|
-
Highlight.configure({
|
|
23
|
-
multicolor: true
|
|
24
|
-
}),
|
|
25
|
-
TextAlign.configure({
|
|
26
|
-
types: ['heading', 'paragraph', 'image'],
|
|
27
|
-
alignments: ['left', 'center', 'right']
|
|
28
|
-
}),
|
|
29
|
-
Placeholder.configure({
|
|
30
|
-
placeholder: 'Write here ...'
|
|
31
|
-
}),
|
|
32
|
-
Indent,
|
|
33
|
-
Image.configure({
|
|
34
|
-
HTMLAttributes: {
|
|
35
|
-
class: 'mx-auto'
|
|
36
|
-
}
|
|
37
|
-
}),
|
|
38
|
-
Youtube.configure({
|
|
39
|
-
// @ts-ignore
|
|
40
|
-
width: '100%',
|
|
41
|
-
height: 360,
|
|
42
|
-
nocookie: true,
|
|
43
|
-
origin: 'benev.io',
|
|
44
|
-
modestBranding: true,
|
|
45
|
-
HTMLAttributes: {
|
|
46
|
-
class: 'mx-auto rounded'
|
|
47
|
-
}
|
|
48
|
-
}),
|
|
49
|
-
Mention.configure({
|
|
50
|
-
suggestion,
|
|
51
|
-
renderHTML({ node }) {
|
|
52
|
-
return [
|
|
53
|
-
'span',
|
|
54
|
-
{
|
|
55
|
-
class: 'suggestion',
|
|
56
|
-
'data-key': node.attrs.id
|
|
57
|
-
},
|
|
58
|
-
node.attrs.label ?? node.attrs.id
|
|
59
|
-
];
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
];
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
declare module '@tiptap/core' {
|
|
3
|
-
interface Commands<ReturnType> {
|
|
4
|
-
indent: {
|
|
5
|
-
indent: () => ReturnType;
|
|
6
|
-
outdent: () => ReturnType;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export declare const Indent: Extension<{
|
|
11
|
-
types: string[];
|
|
12
|
-
defaultIndentLevel: number;
|
|
13
|
-
}, any>;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
import { TextSelection, AllSelection, Transaction } from '@tiptap/pm/state';
|
|
3
|
-
const clamp = (val, min, max) => {
|
|
4
|
-
if (val < min)
|
|
5
|
-
return min;
|
|
6
|
-
if (val > max)
|
|
7
|
-
return max;
|
|
8
|
-
return val;
|
|
9
|
-
};
|
|
10
|
-
const INDENT_OPTIONS = {
|
|
11
|
-
min: 0,
|
|
12
|
-
max: 150,
|
|
13
|
-
more: 10,
|
|
14
|
-
less: -10,
|
|
15
|
-
};
|
|
16
|
-
const nodeNameList = ['bullet_list', 'order_list', 'todo_list'];
|
|
17
|
-
const nodeNameText = ['paragraph', 'heading'];
|
|
18
|
-
function setNodeIndentMarkup(tr, pos, delta) {
|
|
19
|
-
if (!tr.doc)
|
|
20
|
-
return tr;
|
|
21
|
-
const node = tr.doc.nodeAt(pos);
|
|
22
|
-
if (!node)
|
|
23
|
-
return tr;
|
|
24
|
-
const minIndent = INDENT_OPTIONS.min;
|
|
25
|
-
const maxIndent = INDENT_OPTIONS.max;
|
|
26
|
-
const indent = clamp((node.attrs.indent || 0) + delta, minIndent, maxIndent);
|
|
27
|
-
if (indent === node.attrs.indent)
|
|
28
|
-
return tr;
|
|
29
|
-
const nodeAttrs = {
|
|
30
|
-
...node.attrs,
|
|
31
|
-
indent,
|
|
32
|
-
};
|
|
33
|
-
return tr.setNodeMarkup(pos, node.type, nodeAttrs, node.marks);
|
|
34
|
-
}
|
|
35
|
-
const updateIndentLevel = (tr, delta) => {
|
|
36
|
-
const { doc, selection } = tr;
|
|
37
|
-
if (!doc || !selection)
|
|
38
|
-
return tr;
|
|
39
|
-
if (!(selection instanceof TextSelection || selection instanceof AllSelection)) {
|
|
40
|
-
return tr;
|
|
41
|
-
}
|
|
42
|
-
const { from, to } = selection;
|
|
43
|
-
doc.nodesBetween(from, to, (node, pos) => {
|
|
44
|
-
const nodeName = node.type.name;
|
|
45
|
-
if (nodeNameList.includes(nodeName))
|
|
46
|
-
return false;
|
|
47
|
-
if (nodeNameText.includes(nodeName)) {
|
|
48
|
-
tr = setNodeIndentMarkup(tr, pos, delta);
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
return true;
|
|
52
|
-
});
|
|
53
|
-
return tr;
|
|
54
|
-
};
|
|
55
|
-
export const Indent = Extension.create({
|
|
56
|
-
name: 'indent',
|
|
57
|
-
addOptions: () => ({
|
|
58
|
-
types: ['heading', 'paragraph'],
|
|
59
|
-
defaultIndentLevel: 0,
|
|
60
|
-
}),
|
|
61
|
-
addGlobalAttributes() {
|
|
62
|
-
return [
|
|
63
|
-
{
|
|
64
|
-
types: this.options.types,
|
|
65
|
-
attributes: {
|
|
66
|
-
indent: {
|
|
67
|
-
default: this.options.defaultIndentLevel,
|
|
68
|
-
renderHTML: (attributes) => {
|
|
69
|
-
if (attributes.indent === 0)
|
|
70
|
-
return {};
|
|
71
|
-
return {
|
|
72
|
-
style: `margin-left: ${attributes.indent}mm;`,
|
|
73
|
-
};
|
|
74
|
-
},
|
|
75
|
-
parseHTML: (element) => parseInt(element.style.marginLeft) || this.options.defaultIndentLevel,
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
];
|
|
80
|
-
},
|
|
81
|
-
addCommands() {
|
|
82
|
-
const createCommand = (transaction) => ({ tr, dispatch, editor, state, chain }) => {
|
|
83
|
-
tr = tr.setSelection(state.selection);
|
|
84
|
-
tr = transaction(tr);
|
|
85
|
-
if (tr.docChanged) {
|
|
86
|
-
if (dispatch)
|
|
87
|
-
dispatch(tr);
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
editor.chain().focus().run();
|
|
91
|
-
return false;
|
|
92
|
-
};
|
|
93
|
-
return {
|
|
94
|
-
indent: () => createCommand((tr) => updateIndentLevel(tr, INDENT_OPTIONS.more)),
|
|
95
|
-
outdent: () => createCommand((tr) => updateIndentLevel(tr, INDENT_OPTIONS.less)),
|
|
96
|
-
};
|
|
97
|
-
},
|
|
98
|
-
addKeyboardShortcuts() {
|
|
99
|
-
const createShortcuts = (fn) => () => {
|
|
100
|
-
if (this.editor.isActive('bulletList'))
|
|
101
|
-
return false;
|
|
102
|
-
if (this.editor.isActive('orderedList'))
|
|
103
|
-
return false;
|
|
104
|
-
return fn();
|
|
105
|
-
};
|
|
106
|
-
return {
|
|
107
|
-
Tab: createShortcuts(() => this.editor.commands.indent()),
|
|
108
|
-
'Ctrl-q': createShortcuts(() => this.editor.commands.indent()),
|
|
109
|
-
'Shift-Tab': createShortcuts(() => this.editor.commands.outdent()),
|
|
110
|
-
};
|
|
111
|
-
},
|
|
112
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { SuggestionOptions } from '@tiptap/suggestion';
|
|
2
|
-
export type SuggestionItem = {
|
|
3
|
-
id: string;
|
|
4
|
-
label: string;
|
|
5
|
-
};
|
|
6
|
-
export declare let suggestionItems: import("svelte/store").Writable<SuggestionItem[]>;
|
|
7
|
-
export declare const suggestion: Omit<SuggestionOptions<SuggestionItem>, 'editor'>;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { writable, get } from 'svelte/store';
|
|
2
|
-
import { tippy } from '../../../utils/tippy.js';
|
|
3
|
-
import SuggesionList from './SuggesionList.svelte';
|
|
4
|
-
export let suggestionItems = writable([]);
|
|
5
|
-
export const suggestion = {
|
|
6
|
-
items: ({ query }) => {
|
|
7
|
-
const items = get(suggestionItems);
|
|
8
|
-
return items.filter((item) => item.label.toLowerCase().includes(query.toLowerCase()));
|
|
9
|
-
},
|
|
10
|
-
render: () => {
|
|
11
|
-
let popup;
|
|
12
|
-
let target = document.createElement('div');
|
|
13
|
-
let component;
|
|
14
|
-
return {
|
|
15
|
-
onStart: (props) => {
|
|
16
|
-
component = new SuggesionList({ target, props: { props } });
|
|
17
|
-
if (!props.clientRect)
|
|
18
|
-
return;
|
|
19
|
-
popup = tippy(document.body, {
|
|
20
|
-
getReferenceClientRect: props.clientRect,
|
|
21
|
-
appendTo: () => document.body,
|
|
22
|
-
content: target,
|
|
23
|
-
showOnCreate: true,
|
|
24
|
-
interactive: true,
|
|
25
|
-
trigger: 'manual',
|
|
26
|
-
placement: 'bottom-start',
|
|
27
|
-
theme: 'dropdown-border'
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
onUpdate(props) {
|
|
31
|
-
component.$set({ props });
|
|
32
|
-
if (!props.clientRect)
|
|
33
|
-
return;
|
|
34
|
-
popup.setProps({
|
|
35
|
-
getReferenceClientRect: props.clientRect
|
|
36
|
-
});
|
|
37
|
-
},
|
|
38
|
-
onKeyDown(props) {
|
|
39
|
-
if (props.event.key === 'Escape') {
|
|
40
|
-
popup.hide();
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
if (['Enter', 'ArrowUp', 'ArrowDown'].includes(props.event.key)) {
|
|
44
|
-
component.$set({ keyDownEvent: props.event });
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
return false;
|
|
48
|
-
},
|
|
49
|
-
onExit() {
|
|
50
|
-
popup?.destroy();
|
|
51
|
-
component?.$destroy();
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { generateHTML, generateJSON } from '@tiptap/html';
|
|
2
|
-
import { extensions } from './extensions.js';
|
|
3
|
-
import { jsonParse } from '../../../utils/jsonParse.js';
|
|
4
|
-
export const tiptapParser = {
|
|
5
|
-
toHTML(jsonAsString) {
|
|
6
|
-
try {
|
|
7
|
-
if (!jsonAsString.startsWith('{'))
|
|
8
|
-
return jsonAsString;
|
|
9
|
-
const json = jsonParse(jsonAsString, []);
|
|
10
|
-
if (!json)
|
|
11
|
-
return '';
|
|
12
|
-
return generateHTML(json, extensions);
|
|
13
|
-
}
|
|
14
|
-
catch (err) {
|
|
15
|
-
console.error(err);
|
|
16
|
-
return '';
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
toJSON(html) {
|
|
20
|
-
try {
|
|
21
|
-
const json = generateJSON(html, extensions);
|
|
22
|
-
return JSON.stringify(json);
|
|
23
|
-
}
|
|
24
|
-
catch (err) {
|
|
25
|
-
console.error(err);
|
|
26
|
-
return '';
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
package/dist/ui/input/types.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps } from 'svelte';
|
|
2
|
-
import type { HTMLInputAttributes, HTMLTextareaAttributes } from 'svelte/elements';
|
|
3
|
-
import { default as FormControl } from './FormControl.svelte';
|
|
4
|
-
export type InputProps<T = string> = ComponentProps<FormControl> & {
|
|
5
|
-
input?: HTMLInputAttributes;
|
|
6
|
-
inputElement?: HTMLInputElement;
|
|
7
|
-
classWrapper?: string;
|
|
8
|
-
value?: T | null;
|
|
9
|
-
bindWithParams?: boolean;
|
|
10
|
-
};
|
|
11
|
-
export type TextareaProps = ComponentProps<FormControl> & {
|
|
12
|
-
textarea?: HTMLTextareaAttributes;
|
|
13
|
-
value?: string | null;
|
|
14
|
-
bindWithParams?: boolean;
|
|
15
|
-
};
|
package/dist/ui/input/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { default as FormControl } from './FormControl.svelte';
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { slide } from 'svelte/transition'
|
|
3
|
-
import { page } from '$app/stores'
|
|
4
|
-
import { InputText, InputPassword } from '../input/index.js'
|
|
5
|
-
import { useForm } from '../../validation/form.js'
|
|
6
|
-
|
|
7
|
-
export let onSuccess:
|
|
8
|
-
| ((action: URL, data?: Record<string, unknown> | undefined) => any)
|
|
9
|
-
| undefined = undefined
|
|
10
|
-
|
|
11
|
-
const { enhance } = useForm({
|
|
12
|
-
onSuccess,
|
|
13
|
-
successMessage(action) {
|
|
14
|
-
if (action.search === '?/reset_password') {
|
|
15
|
-
recorverDialog.close()
|
|
16
|
-
state = 'login'
|
|
17
|
-
return "Un lien de récupération t'a été envoyé par email"
|
|
18
|
-
}
|
|
19
|
-
return 'Bienvenue'
|
|
20
|
-
},
|
|
21
|
-
onError(err) {
|
|
22
|
-
if (err === 'This account already exists') {
|
|
23
|
-
state = 'login'
|
|
24
|
-
return
|
|
25
|
-
}
|
|
26
|
-
if (err === 'This account already created from an invitation') {
|
|
27
|
-
recorverDialog.showModal()
|
|
28
|
-
return
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
let state: 'login' | 'register' = 'login'
|
|
33
|
-
|
|
34
|
-
$: redirectTo = $page.url.searchParams.get('redirectTo')
|
|
35
|
-
|
|
36
|
-
let recorverDialog: HTMLDialogElement
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
<div class="grid place-content-center p-10">
|
|
40
|
-
<div style:width="min(24rem, calc(100vw - 1rem))" class="card place-content-center shadow-lg">
|
|
41
|
-
<div class="tabs tabs-lifted w-full">
|
|
42
|
-
<span
|
|
43
|
-
role="button"
|
|
44
|
-
tabindex="0"
|
|
45
|
-
class="tab-lg tab h-10 grow"
|
|
46
|
-
class:tab-active={state === 'login'}
|
|
47
|
-
on:click={() => (state = 'login')}
|
|
48
|
-
on:keyup={() => (state = 'login')}
|
|
49
|
-
>
|
|
50
|
-
Connexion
|
|
51
|
-
</span>
|
|
52
|
-
<span
|
|
53
|
-
role="button"
|
|
54
|
-
tabindex="0"
|
|
55
|
-
class="tab-lg tab h-10 grow"
|
|
56
|
-
class:tab-active={state === 'register'}
|
|
57
|
-
on:click={() => (state = 'register')}
|
|
58
|
-
on:keyup={() => (state = 'register')}
|
|
59
|
-
>
|
|
60
|
-
Nouveau compte
|
|
61
|
-
</span>
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<form
|
|
65
|
-
class="card-body rounded-b-lg border border-t-0 border-base-300 bg-base-100"
|
|
66
|
-
method="post"
|
|
67
|
-
use:enhance
|
|
68
|
-
>
|
|
69
|
-
<InputText key="username" label="Nom d'utilisateur" input={{ autocomplete: 'username' }} />
|
|
70
|
-
|
|
71
|
-
{#if state === 'register'}
|
|
72
|
-
<div transition:slide|local>
|
|
73
|
-
<InputText
|
|
74
|
-
key="email"
|
|
75
|
-
label="Email"
|
|
76
|
-
input={{ autocomplete: 'email', inputmode: 'email' }}
|
|
77
|
-
/>
|
|
78
|
-
</div>
|
|
79
|
-
{/if}
|
|
80
|
-
|
|
81
|
-
<InputPassword key="password" label="Mot de passe" />
|
|
82
|
-
|
|
83
|
-
{#if redirectTo}
|
|
84
|
-
<input type="hidden" name="redirectTo" value={redirectTo} />
|
|
85
|
-
{/if}
|
|
86
|
-
|
|
87
|
-
<div class="card-actions flex-row-reverse items-center pt-4">
|
|
88
|
-
<button class="btn" formaction="/auth?/{state}">
|
|
89
|
-
{state === 'login' ? 'Connexion' : 'Valider'}
|
|
90
|
-
</button>
|
|
91
|
-
<div class="grow"></div>
|
|
92
|
-
|
|
93
|
-
<button class="link-hover link" formaction="/auth?/reset_password">
|
|
94
|
-
Mot de passe oublié
|
|
95
|
-
</button>
|
|
96
|
-
</div>
|
|
97
|
-
</form>
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|