@blokkli/editor 1.3.4 → 1.4.0-alpha.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/dist/module.d.mts +71 -2
- package/dist/module.d.ts +71 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +315 -123
- package/dist/runtime/blokkliPlugins/AddAction/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +1 -1
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue +1 -1
- package/dist/runtime/components/Blocks/Fragment/index.vue +7 -4
- package/dist/runtime/components/Blocks/FromLibrary/index.vue +8 -5
- package/dist/runtime/components/BlokkliField.vue +2 -2
- package/dist/runtime/components/BlokkliItem.vue +2 -2
- package/dist/runtime/components/Edit/Actions/index.vue +1 -1
- package/dist/runtime/components/Edit/AddListItem/index.vue +1 -1
- package/dist/runtime/components/Edit/AppMenu/index.vue +1 -1
- package/dist/runtime/components/Edit/BlockProxy/index.vue +5 -21
- package/dist/runtime/components/Edit/Dialog/index.vue +1 -1
- package/dist/runtime/components/Edit/DraggableList.vue +2 -2
- package/dist/runtime/components/Edit/EditIndicator.vue +2 -2
- package/dist/runtime/components/Edit/EditProvider.vue +5 -8
- package/dist/runtime/components/Edit/Features/Artboard/index.vue +9 -8
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Debug/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Edit/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +38 -32
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/Item/index.vue +13 -6
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +65 -67
- package/dist/runtime/components/Edit/Features/Library/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/Item.vue +1 -1
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +3 -11
- package/dist/runtime/components/Edit/Features/MediaLibrary/types.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +28 -3
- package/dist/runtime/components/Edit/Features/Options/index.vue +4 -1
- package/dist/runtime/components/Edit/Features/Publish/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/Theme/Color/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Theme/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Translations/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/index.vue +1 -1
- package/dist/runtime/components/Edit/FormOverlay/Header/index.vue +1 -1
- package/dist/runtime/components/Edit/FormOverlay/index.vue +1 -1
- package/dist/runtime/components/Edit/Icon/index.vue +2 -2
- package/dist/runtime/components/Edit/ItemIcon/index.vue +1 -1
- package/dist/runtime/components/Edit/Pagination/index.vue +21 -0
- package/dist/runtime/components/Edit/PreviewProvider.vue +2 -2
- package/dist/runtime/components/Edit/ScaleToFit/index.vue +37 -6
- package/dist/runtime/components/Edit/index.d.ts +2 -1
- package/dist/runtime/components/Edit/index.js +3 -1
- package/dist/runtime/composables/defineBlokkli.d.ts +2 -2
- package/dist/runtime/composables/defineBlokkli.js +19 -55
- package/dist/runtime/composables/defineBlokkliFeature.d.ts +1 -1
- package/dist/runtime/composables/defineBlokkliFeature.js +1 -1
- package/dist/runtime/composables/defineBlokkliFragment.d.ts +1 -1
- package/dist/runtime/composables/defineBlokkliFragment.js +3 -30
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/domProvider.d.ts +0 -4
- package/dist/runtime/helpers/domProvider.js +63 -67
- package/dist/runtime/helpers/featuresProvider.d.ts +1 -1
- package/dist/runtime/helpers/featuresProvider.js +1 -1
- package/dist/runtime/helpers/index.d.ts +1 -0
- package/dist/runtime/helpers/index.js +7 -1
- package/dist/runtime/helpers/runtimeHelpers/index.d.ts +23 -2
- package/dist/runtime/helpers/runtimeHelpers/index.js +83 -10
- package/dist/runtime/helpers/storageProvider.js +1 -1
- package/dist/runtime/helpers/textProvider.js +2 -2
- package/dist/runtime/helpers/themeProvider.js +1 -1
- package/dist/runtime/types/index.d.ts +7 -4
- package/package.json +2 -2
- package/dist/runtime/helpers/options.d.ts +0 -2
- package/dist/runtime/helpers/options.js +0 -21
|
@@ -6,78 +6,76 @@
|
|
|
6
6
|
@close="onClose"
|
|
7
7
|
>
|
|
8
8
|
<div class="bk-library-dialog">
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<div class="bk
|
|
19
|
-
<div>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
</
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
v-
|
|
45
|
-
|
|
46
|
-
:value="v.bundle"
|
|
9
|
+
<div>
|
|
10
|
+
<p class="bk-lead">
|
|
11
|
+
{{
|
|
12
|
+
$t(
|
|
13
|
+
'libraryPlaceDialogLead',
|
|
14
|
+
'Select a reusable block from the library to add it to your layout. You can detach the block later.',
|
|
15
|
+
)
|
|
16
|
+
}}
|
|
17
|
+
</p>
|
|
18
|
+
<div class="bk">
|
|
19
|
+
<div class="bk-form-group">
|
|
20
|
+
<div>
|
|
21
|
+
<label class="bk-form-label" for="library_search">
|
|
22
|
+
{{ $t('libraryPlaceSearchLabel', 'Filter library items') }}
|
|
23
|
+
</label>
|
|
24
|
+
<input
|
|
25
|
+
id="library_search"
|
|
26
|
+
v-model.lazy="searchText"
|
|
27
|
+
type="text"
|
|
28
|
+
class="bk-form-input"
|
|
29
|
+
:placeholder="
|
|
30
|
+
$t(
|
|
31
|
+
'libraryPlaceSearchInputPlaceholder',
|
|
32
|
+
'Search library items',
|
|
33
|
+
)
|
|
34
|
+
"
|
|
35
|
+
required
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
<div>
|
|
39
|
+
<label class="bk-form-label" for="library_bundle">
|
|
40
|
+
{{ $t('libraryPlaceBundleSelectLabel', 'Bundle') }}
|
|
41
|
+
</label>
|
|
42
|
+
<select
|
|
43
|
+
id="library_bundle"
|
|
44
|
+
v-model="selectedBundle"
|
|
45
|
+
class="bk-form-input"
|
|
47
46
|
>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
<option
|
|
48
|
+
v-for="v in bundleOptions"
|
|
49
|
+
:key="v.bundle"
|
|
50
|
+
:value="v.bundle"
|
|
51
|
+
>
|
|
52
|
+
{{ v.label }}
|
|
53
|
+
</option>
|
|
54
|
+
</select>
|
|
55
|
+
</div>
|
|
51
56
|
</div>
|
|
52
57
|
</div>
|
|
58
|
+
<div class="bk-library-dialog-content">
|
|
59
|
+
<Loading v-if="status === 'pending'" />
|
|
60
|
+
<ul ref="listEl" class="bk-library-dialog-list">
|
|
61
|
+
<li
|
|
62
|
+
v-for="item in items"
|
|
63
|
+
:key="item.uuid"
|
|
64
|
+
:class="{
|
|
65
|
+
'bk-is-selected': selectedItem === item.uuid,
|
|
66
|
+
}"
|
|
67
|
+
@click="selectedItem = item.uuid"
|
|
68
|
+
>
|
|
69
|
+
<LibraryListItem v-bind="item" />
|
|
70
|
+
</li>
|
|
71
|
+
</ul>
|
|
72
|
+
</div>
|
|
53
73
|
</div>
|
|
54
|
-
<div class="bk-library-
|
|
55
|
-
<
|
|
56
|
-
<ul ref="listEl" class="bk-library-dialog-list">
|
|
57
|
-
<li
|
|
58
|
-
v-for="item in items"
|
|
59
|
-
:key="item.uuid"
|
|
60
|
-
:class="{
|
|
61
|
-
'bk-is-selected': selectedItem === item.uuid,
|
|
62
|
-
}"
|
|
63
|
-
@click="selectedItem = item.uuid"
|
|
64
|
-
>
|
|
65
|
-
<LibraryListItem v-bind="item" />
|
|
66
|
-
</li>
|
|
67
|
-
</ul>
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
|
-
<div class="bk">
|
|
71
|
-
<div class="bk-pagination">
|
|
72
|
-
<button :disabled="page === 0" @click="page--">
|
|
73
|
-
<Icon name="arrow-left" />
|
|
74
|
-
</button>
|
|
75
|
-
<div>{{ page + 1 }} / {{ totalPages }}</div>
|
|
76
|
-
<button :disabled="page >= totalPages - 1" @click="page++">
|
|
77
|
-
<Icon name="arrow-right" />
|
|
78
|
-
</button>
|
|
74
|
+
<div class="bk bk-library-pagination">
|
|
75
|
+
<Pagination v-model="page" :total-pages />
|
|
79
76
|
</div>
|
|
80
77
|
</div>
|
|
78
|
+
|
|
81
79
|
<template #footer>
|
|
82
80
|
<button class="bk-button bk-is-primary" @click="onSubmit">
|
|
83
81
|
{{ $t('libraryPlaceDialogSubmit', 'Add reusable block') }}
|
|
@@ -91,7 +89,7 @@ import type {
|
|
|
91
89
|
BlokkliAdapterGetLibraryItemsData,
|
|
92
90
|
BlokkliAdapterGetLibraryItemsResult,
|
|
93
91
|
} from '#blokkli/adapter'
|
|
94
|
-
import { FormOverlay,
|
|
92
|
+
import { FormOverlay, Pagination } from '#blokkli/components'
|
|
95
93
|
import Loading from './../../../Loading/index.vue'
|
|
96
94
|
import type { BlokkliFieldElement, FieldConfig } from '#blokkli/types'
|
|
97
95
|
import { ref, useBlokkli, useAsyncData, computed, watch } from '#imports'
|
|
@@ -73,7 +73,7 @@ import { PluginItemAction, PluginAddAction } from '#blokkli/plugins'
|
|
|
73
73
|
import ReusableDialog from './ReusableDialog/index.vue'
|
|
74
74
|
import LibraryDialog from './LibraryDialog/index.vue'
|
|
75
75
|
import EditReusable from './EditReusable/index.vue'
|
|
76
|
-
import { getDefinition } from '#blokkli/definitions'
|
|
76
|
+
import { getDefinition } from '#blokkli-build/definitions'
|
|
77
77
|
import type { ActionPlacedEvent, LibraryEditItemEvent } from '#blokkli/types'
|
|
78
78
|
import onBlokkliEvent from '#blokkli/helpers/composables/onBlokkliEvent'
|
|
79
79
|
|
|
@@ -70,15 +70,7 @@
|
|
|
70
70
|
</button>
|
|
71
71
|
</div>
|
|
72
72
|
|
|
73
|
-
<
|
|
74
|
-
<button :disabled="page === 0" @click="page--">
|
|
75
|
-
<Icon name="arrow-left" />
|
|
76
|
-
</button>
|
|
77
|
-
<div>{{ page + 1 }} / {{ totalPages }}</div>
|
|
78
|
-
<button :disabled="page >= totalPages - 1" @click="page++">
|
|
79
|
-
<Icon name="arrow-right" />
|
|
80
|
-
</button>
|
|
81
|
-
</div>
|
|
73
|
+
<Pagination v-model="page" :total-pages />
|
|
82
74
|
</div>
|
|
83
75
|
</template>
|
|
84
76
|
|
|
@@ -91,9 +83,9 @@ import {
|
|
|
91
83
|
watch,
|
|
92
84
|
nextTick,
|
|
93
85
|
} from '#imports'
|
|
94
|
-
import { Sortli, Icon } from '#blokkli/components'
|
|
86
|
+
import { Sortli, Icon, Pagination } from '#blokkli/components'
|
|
95
87
|
import type { MediaLibraryFilter, MediaLibraryGetResults } from './../types'
|
|
96
|
-
import type { BlokkliIcon } from '#blokkli/icons'
|
|
88
|
+
import type { BlokkliIcon } from '#blokkli-build/icons'
|
|
97
89
|
import Item from './Item.vue'
|
|
98
90
|
import type { DraggableItem, DraggableMediaLibraryItem } from '#blokkli/types'
|
|
99
91
|
import { buildDraggableItem, falsy } from '#blokkli/helpers'
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
|
|
50
50
|
<script lang="ts" setup>
|
|
51
51
|
import { ref, computed, useBlokkli, onBeforeUnmount, onMounted } from '#imports'
|
|
52
|
-
import { globalOptions } from '#blokkli/definitions'
|
|
52
|
+
import { globalOptions } from '#blokkli-build/definitions'
|
|
53
53
|
import { falsy, onlyUnique } from '#blokkli/helpers'
|
|
54
54
|
import OptionsFormItem from './Item.vue'
|
|
55
55
|
import OptionsFormGroup from './Group.vue'
|
|
@@ -59,8 +59,7 @@ import type {
|
|
|
59
59
|
FragmentDefinitionInput,
|
|
60
60
|
} from '#blokkli/types'
|
|
61
61
|
import type { BlockOptionDefinition } from '#blokkli/types/blokkOptions'
|
|
62
|
-
import {
|
|
63
|
-
import { getRuntimeOptionValue } from '#blokkli/helpers/runtimeHelpers'
|
|
62
|
+
import { getRuntimeOptionValue } from '#blokkli/runtime-helpers'
|
|
64
63
|
import {
|
|
65
64
|
BK_HIDDEN_GLOBALLY,
|
|
66
65
|
BK_VISIBLE_LANGUAGES,
|
|
@@ -78,6 +77,32 @@ type OptionGroup = {
|
|
|
78
77
|
|
|
79
78
|
const activeGroup = ref('')
|
|
80
79
|
|
|
80
|
+
function optionValueToStorable(
|
|
81
|
+
definition: BlockOptionDefinition,
|
|
82
|
+
value: string | string[] | boolean | undefined | null | number,
|
|
83
|
+
): string {
|
|
84
|
+
if (definition.type === 'checkbox') {
|
|
85
|
+
if (typeof value === 'string' && (value === '1' || value === '0')) {
|
|
86
|
+
return value
|
|
87
|
+
} else if (typeof value === 'boolean') {
|
|
88
|
+
return value === true ? '1' : '0'
|
|
89
|
+
}
|
|
90
|
+
return '0'
|
|
91
|
+
} else if (definition.type === 'text' || definition.type === 'radios') {
|
|
92
|
+
if (typeof value === 'string') {
|
|
93
|
+
return value
|
|
94
|
+
}
|
|
95
|
+
} else if (definition.type === 'checkboxes') {
|
|
96
|
+
if (Array.isArray(value)) {
|
|
97
|
+
return value.join(',')
|
|
98
|
+
} else if (typeof value === 'string') {
|
|
99
|
+
return value
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return ''
|
|
104
|
+
}
|
|
105
|
+
|
|
81
106
|
function onToggleGroup(label: string) {
|
|
82
107
|
if (activeGroup.value === label) {
|
|
83
108
|
activeGroup.value = ''
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
<script lang="ts" setup>
|
|
13
13
|
import { computed, useBlokkli, defineBlokkliFeature } from '#imports'
|
|
14
14
|
import { falsy, onlyUnique } from '#blokkli/helpers'
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
getDefinition,
|
|
17
|
+
getFragmentDefinition,
|
|
18
|
+
} from '#blokkli-build/definitions'
|
|
16
19
|
import OptionsForm from './Form/index.vue'
|
|
17
20
|
import type {
|
|
18
21
|
BlockDefinitionInput,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<script lang="ts" setup>
|
|
15
15
|
import { useBlokkli, defineBlokkliFeature, computed, useRoute } from '#imports'
|
|
16
16
|
import { PluginMenuButton } from '#blokkli/plugins'
|
|
17
|
-
import type { BlokkliIcon } from '#blokkli/icons'
|
|
17
|
+
import type { BlokkliIcon } from '#blokkli-build/icons'
|
|
18
18
|
|
|
19
19
|
const { adapter, settings } = defineBlokkliFeature({
|
|
20
20
|
id: 'publish',
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
import { PluginSidebar } from '#blokkli/plugins'
|
|
74
74
|
import PreviewFrame from './Frame/index.vue'
|
|
75
75
|
import { Icon } from '#blokkli/components'
|
|
76
|
-
import type { BlokkliIcon } from '#blokkli/icons'
|
|
76
|
+
import type { BlokkliIcon } from '#blokkli-build/icons'
|
|
77
77
|
|
|
78
78
|
defineBlokkliFeature({
|
|
79
79
|
id: 'responsive-preview',
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<script lang="ts" setup>
|
|
67
67
|
import type { FeatureDefinitionSetting } from '#blokkli/types'
|
|
68
68
|
import { Icon } from '#blokkli/components'
|
|
69
|
-
import type { ValidFeatureKey } from '#blokkli-
|
|
69
|
+
import type { ValidFeatureKey } from '#blokkli-build/features'
|
|
70
70
|
import { useBlokkli, computed } from '#imports'
|
|
71
71
|
|
|
72
72
|
const props = defineProps<{
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
import { useBlokkli, computed } from '#imports'
|
|
31
31
|
import { DialogModal } from '#blokkli/components'
|
|
32
32
|
import FeatureSetting from './FeatureSetting/index.vue'
|
|
33
|
-
import type { ValidFeatureKey } from '#blokkli-
|
|
33
|
+
import type { ValidFeatureKey } from '#blokkli-build/features'
|
|
34
34
|
import type { FeatureDefinitionSetting } from '#blokkli/types'
|
|
35
35
|
import { SETTINGS_GROUP, type SettingsGroup } from '#blokkli/constants'
|
|
36
|
-
import type { BlokkliIcon } from '#blokkli/icons'
|
|
37
|
-
import { settingsOverride } from '#blokkli/config'
|
|
36
|
+
import type { BlokkliIcon } from '#blokkli-build/icons'
|
|
37
|
+
import { settingsOverride } from '#blokkli-build/config'
|
|
38
38
|
|
|
39
39
|
const { $t, features, ui } = useBlokkli()
|
|
40
40
|
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<script lang="ts" setup>
|
|
22
22
|
import { computed, useBlokkli } from '#imports'
|
|
23
23
|
import { Icon } from '#blokkli/components'
|
|
24
|
-
import { theme as configTheme } from '#blokkli/config'
|
|
24
|
+
import { theme as configTheme } from '#blokkli-build/config'
|
|
25
25
|
import type {
|
|
26
26
|
RGB,
|
|
27
27
|
ThemeColorGroup,
|
|
@@ -100,7 +100,7 @@ import type {
|
|
|
100
100
|
Language,
|
|
101
101
|
} from '#blokkli/types'
|
|
102
102
|
import Banner from './Banner/index.vue'
|
|
103
|
-
import { getDefinition } from '#blokkli/definitions'
|
|
103
|
+
import { getDefinition } from '#blokkli-build/definitions'
|
|
104
104
|
import onBlokkliEvent from '#blokkli/helpers/composables/onBlokkliEvent'
|
|
105
105
|
|
|
106
106
|
const { adapter } = defineBlokkliFeature({
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
<script lang="ts" setup>
|
|
10
10
|
import { useBlokkli, onMounted, nextTick, computed } from '#imports'
|
|
11
|
-
import { featureComponents } from '#blokkli-
|
|
11
|
+
import { featureComponents } from '#blokkli-build/features'
|
|
12
12
|
|
|
13
13
|
const emit = defineEmits(['loaded'])
|
|
14
14
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
<script lang="ts" setup>
|
|
28
28
|
import FormHeader from './Header/index.vue'
|
|
29
|
-
import type { BlokkliIcon } from '#blokkli/icons'
|
|
29
|
+
import type { BlokkliIcon } from '#blokkli-build/icons'
|
|
30
30
|
import { Resizable } from '#blokkli/components'
|
|
31
31
|
|
|
32
32
|
defineProps<{
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
<script lang="ts" setup>
|
|
6
6
|
import { computed } from '#imports'
|
|
7
|
-
import { icons } from '#blokkli/icons'
|
|
8
|
-
import type { BlokkliIcon } from '#blokkli/icons'
|
|
7
|
+
import { icons } from '#blokkli-build/icons'
|
|
8
|
+
import type { BlokkliIcon } from '#blokkli-build/icons'
|
|
9
9
|
|
|
10
10
|
const props = defineProps<{
|
|
11
11
|
name: BlokkliIcon
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="bk bk-pagination">
|
|
3
|
+
<button :disabled="page === 0" @click="page--">
|
|
4
|
+
<Icon name="arrow-left" />
|
|
5
|
+
</button>
|
|
6
|
+
<div>{{ page + 1 }} / {{ totalPages }}</div>
|
|
7
|
+
<button :disabled="page >= totalPages - 1" @click="page++">
|
|
8
|
+
<Icon name="arrow-right" />
|
|
9
|
+
</button>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { Icon } from '#blokkli/components'
|
|
15
|
+
|
|
16
|
+
defineProps<{
|
|
17
|
+
totalPages: number
|
|
18
|
+
}>()
|
|
19
|
+
|
|
20
|
+
const page = defineModel<number>({ default: 0 })
|
|
21
|
+
</script>
|
|
@@ -19,8 +19,8 @@ import type {
|
|
|
19
19
|
UpdateBlockOptionEvent,
|
|
20
20
|
ItemEditContext,
|
|
21
21
|
} from '#blokkli/types'
|
|
22
|
-
import '#blokkli/styles'
|
|
23
|
-
import getAdapter from '#blokkli/compiled-edit-adapter'
|
|
22
|
+
import '#blokkli-build/styles'
|
|
23
|
+
import getAdapter from '#blokkli-build/compiled-edit-adapter'
|
|
24
24
|
import {
|
|
25
25
|
INJECT_EDIT_CONTEXT,
|
|
26
26
|
INJECT_IS_PREVIEW,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div ref="
|
|
2
|
+
<div ref="rootEl" class="bk-scale-to-fit" :style="style">
|
|
3
3
|
<div ref="wrapper" class="bk-scale-to-fit-wrapper">
|
|
4
4
|
<div ref="inner" class="bk-scale-to-fit-wrapper-item" :style="innerStyle">
|
|
5
5
|
<slot />
|
|
@@ -14,9 +14,10 @@ import { ref, computed } from '#imports'
|
|
|
14
14
|
|
|
15
15
|
const props = defineProps<{
|
|
16
16
|
width?: number
|
|
17
|
+
maxHeight?: number
|
|
17
18
|
}>()
|
|
18
19
|
|
|
19
|
-
const
|
|
20
|
+
const rootEl = ref<HTMLDivElement | null>(null)
|
|
20
21
|
const inner = ref<HTMLDivElement | null>(null)
|
|
21
22
|
const wrapper = ref<HTMLDivElement | null>(null)
|
|
22
23
|
const rootWidth = ref(260)
|
|
@@ -24,22 +25,52 @@ const nativeWidth = ref(0)
|
|
|
24
25
|
const nativeHeight = ref(0)
|
|
25
26
|
const computedHeight = ref(0)
|
|
26
27
|
|
|
28
|
+
const scale = computed(() => {
|
|
29
|
+
const contentWidth = props.width || nativeWidth.value
|
|
30
|
+
const widthScale = Math.min(rootWidth.value, contentWidth) / contentWidth
|
|
31
|
+
|
|
32
|
+
if (!props.maxHeight) {
|
|
33
|
+
return widthScale
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const heightScale = props.maxHeight / nativeHeight.value
|
|
37
|
+
|
|
38
|
+
return Math.min(widthScale, heightScale)
|
|
39
|
+
})
|
|
40
|
+
|
|
27
41
|
const style = computed(() => {
|
|
42
|
+
const height = props.maxHeight
|
|
43
|
+
? Math.min(computedHeight.value, props.maxHeight)
|
|
44
|
+
: computedHeight.value
|
|
45
|
+
|
|
28
46
|
return {
|
|
29
|
-
height:
|
|
47
|
+
height: height + 'px',
|
|
30
48
|
}
|
|
31
49
|
})
|
|
32
50
|
|
|
33
51
|
const innerStyle = computed(() => {
|
|
52
|
+
const currentScale = scale.value
|
|
53
|
+
const contentWidth = props.width || nativeWidth.value
|
|
54
|
+
const scaledWidth = contentWidth * currentScale
|
|
55
|
+
const scaledHeight = nativeHeight.value * currentScale
|
|
56
|
+
|
|
57
|
+
const leftOffset = Math.max(0, (rootWidth.value - scaledWidth) / 2)
|
|
58
|
+
|
|
59
|
+
const useVerticalCentering =
|
|
60
|
+
props.maxHeight && nativeHeight.value * scale.value > props.maxHeight
|
|
61
|
+
const topOffset = useVerticalCentering
|
|
62
|
+
? (props.maxHeight - scaledHeight) / 2
|
|
63
|
+
: 0
|
|
64
|
+
|
|
34
65
|
return {
|
|
35
66
|
width: props.width ? props.width + 'px' : 'auto',
|
|
36
|
-
transform: `
|
|
67
|
+
transform: `translate(${leftOffset}px, ${topOffset}px) scale(${currentScale})`,
|
|
37
68
|
}
|
|
38
69
|
})
|
|
39
70
|
|
|
40
71
|
useAnimationFrame(() => {
|
|
41
|
-
if (
|
|
42
|
-
rootWidth.value =
|
|
72
|
+
if (rootEl.value) {
|
|
73
|
+
rootWidth.value = rootEl.value.offsetWidth
|
|
43
74
|
}
|
|
44
75
|
if (inner.value) {
|
|
45
76
|
const rect = inner.value.getBoundingClientRect()
|
|
@@ -13,4 +13,5 @@ import Highlight from './Highlight/index.vue.js';
|
|
|
13
13
|
import ViewportBlockingRect from './ViewportBlockingRect/index.vue.js';
|
|
14
14
|
import ScrollBoundary from './ScrollBoundary/index.vue.js';
|
|
15
15
|
import InfoBox from './InfoBox/index.vue.js';
|
|
16
|
-
|
|
16
|
+
import Pagination from './Pagination/index.vue.js';
|
|
17
|
+
export { ItemIcon, ShortcutIndicator, RelativeTime, Icon, Resizable, DialogModal, ScaleToFit, Sortli, FormOverlay, AddListItem, Loading, Highlight, ViewportBlockingRect, ScrollBoundary, InfoBox, Pagination, };
|
|
@@ -13,6 +13,7 @@ import Highlight from "./Highlight/index.vue";
|
|
|
13
13
|
import ViewportBlockingRect from "./ViewportBlockingRect/index.vue";
|
|
14
14
|
import ScrollBoundary from "./ScrollBoundary/index.vue";
|
|
15
15
|
import InfoBox from "./InfoBox/index.vue";
|
|
16
|
+
import Pagination from "./Pagination/index.vue";
|
|
16
17
|
export {
|
|
17
18
|
ItemIcon,
|
|
18
19
|
ShortcutIndicator,
|
|
@@ -28,5 +29,6 @@ export {
|
|
|
28
29
|
Highlight,
|
|
29
30
|
ViewportBlockingRect,
|
|
30
31
|
ScrollBoundary,
|
|
31
|
-
InfoBox
|
|
32
|
+
InfoBox,
|
|
33
|
+
Pagination
|
|
32
34
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BlockDefinitionInput, BlockDefinitionOptionsInput, DefineBlokkliContext } from '#blokkli/types';
|
|
2
|
-
import type { GlobalOptionsKey } from '#blokkli/generated-types';
|
|
2
|
+
import type { GlobalOptionsKey } from '#blokkli-build/generated-types';
|
|
3
3
|
/**
|
|
4
4
|
* Define a blokkli component.
|
|
5
5
|
*/
|
|
6
|
-
export declare function defineBlokkli<T extends BlockDefinitionOptionsInput = BlockDefinitionOptionsInput, G extends GlobalOptionsKey[] | undefined = undefined>(
|
|
6
|
+
export declare function defineBlokkli<T extends BlockDefinitionOptionsInput = BlockDefinitionOptionsInput, G extends GlobalOptionsKey[] | undefined = undefined>(arg: BlockDefinitionInput<T, G>): DefineBlokkliContext<T, G>;
|