@blokkli/editor 2.0.0-alpha.36 → 2.0.0-alpha.38
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/global/types/blockOptions.d.ts +4 -3
- package/dist/module.d.mts +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +71 -4
- package/dist/modules/agent/index.d.mts +1 -1
- package/dist/modules/agent/index.mjs +276 -6
- package/dist/modules/agent/runtime/app/composables/agentProvider.js +31 -14
- package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentTool.d.ts +2 -20
- package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentTool.js +0 -3
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Assistant/index.vue +2 -2
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/User/index.vue +1 -2
- package/dist/modules/agent/runtime/app/features/agent/Panel/DebugGallery/index.vue +1 -2
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.d.vue.ts +1 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue +66 -59
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue.d.ts +1 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/index.vue +10 -12
- package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/de.md +2 -2
- package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/en.md +2 -2
- package/dist/modules/agent/runtime/app/features/agent/Panel/index.vue +1 -5
- package/dist/modules/agent/runtime/app/features/agent/index.vue +89 -37
- package/dist/modules/agent/runtime/app/helpers/index.d.ts +16 -19
- package/dist/modules/agent/runtime/app/helpers/index.js +22 -46
- package/dist/modules/agent/runtime/app/helpers/pageStructure.js +1 -1
- package/dist/modules/agent/runtime/app/tools/add_content_search_paragraph/index.js +5 -9
- package/dist/modules/agent/runtime/app/tools/add_fragment/index.js +2 -6
- package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.js +2 -6
- package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.js +2 -3
- package/dist/modules/agent/runtime/app/tools/add_reusable_paragraph/index.js +2 -6
- package/dist/modules/agent/runtime/app/tools/add_template/index.js +2 -6
- package/dist/modules/agent/runtime/app/tools/analyze_content/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/analyze_content/index.js +120 -0
- package/dist/modules/agent/runtime/app/tools/check_readability/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/check_readability/index.js +57 -0
- package/dist/modules/agent/runtime/app/tools/duplicate_paragraphs/index.js +2 -6
- package/dist/modules/agent/runtime/app/tools/get_all_page_content/index.js +1 -1
- package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.js +2 -1
- package/dist/modules/agent/runtime/app/tools/get_content_fields/index.js +1 -1
- package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.js +2 -5
- package/dist/modules/agent/runtime/app/tools/get_paragraph_options/index.js +2 -1
- package/dist/modules/agent/runtime/app/tools/get_selected_paragraphs/index.js +2 -3
- package/dist/modules/agent/runtime/app/tools/helpers.d.ts +53 -0
- package/dist/modules/agent/runtime/app/tools/helpers.js +187 -0
- package/dist/modules/agent/runtime/app/tools/move_paragraphs/index.js +2 -6
- package/dist/modules/agent/runtime/app/tools/schemas.d.ts +0 -52
- package/dist/modules/agent/runtime/app/tools/schemas.js +0 -187
- package/dist/modules/agent/runtime/app/tools/search_content/index.js +40 -47
- package/dist/modules/agent/runtime/app/tools/set_paragraph_options/index.js +2 -5
- package/dist/modules/agent/runtime/app/types/index.d.ts +0 -61
- package/dist/modules/agent/runtime/server/Session.d.ts +25 -6
- package/dist/modules/agent/runtime/server/Session.js +109 -30
- package/dist/modules/agent/runtime/server/SessionManager.d.ts +3 -0
- package/dist/modules/agent/runtime/server/SessionManager.js +4 -1
- package/dist/modules/agent/runtime/server/agent.js +3 -2
- package/dist/modules/agent/runtime/server/default-skills/fixReadability.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-skills/fixReadability.js +69 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/page-context.js +28 -0
- package/dist/modules/agent/runtime/server/server-tools/index.d.ts +10 -2
- package/dist/modules/agent/runtime/server/server-tools/index.js +1 -1
- package/dist/modules/agent/runtime/server/server-tools/load_tools/index.js +1 -1
- package/dist/modules/agent/runtime/shared/types.d.ts +46 -11
- package/dist/modules/agent/runtime/shared/types.js +22 -10
- package/dist/modules/charts/index.d.mts +1 -1
- package/dist/modules/charts/index.mjs +21 -7
- package/dist/modules/charts/runtime/blokkli/skills/charts.js +6 -6
- package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.d.ts +25 -2
- package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.js +39 -1
- package/dist/modules/charts/runtime/blokkli/tools/create_chart/index.js +24 -17
- package/dist/modules/charts/runtime/blokkli/tools/get_chart_data/index.js +11 -19
- package/dist/modules/charts/runtime/blokkli/tools/get_chart_type_options/index.js +2 -4
- package/dist/modules/charts/runtime/blokkli/tools/update_chart/index.js +8 -20
- package/dist/modules/charts/runtime/chartTypes/area.d.ts +6 -1
- package/dist/modules/charts/runtime/chartTypes/bar.d.ts +7 -1
- package/dist/modules/charts/runtime/chartTypes/define.d.ts +1 -1
- package/dist/modules/charts/runtime/chartTypes/donut.d.ts +5 -1
- package/dist/modules/charts/runtime/chartTypes/heatmap.d.ts +3 -1
- package/dist/modules/charts/runtime/chartTypes/index.d.ts +18 -0
- package/dist/modules/charts/runtime/chartTypes/line.d.ts +6 -1
- package/dist/modules/charts/runtime/chartTypes/pie.d.ts +4 -1
- package/dist/modules/charts/runtime/chartTypes/radar.d.ts +6 -1
- package/dist/modules/charts/runtime/chartTypes/radialBar.d.ts +5 -1
- package/dist/modules/charts/runtime/chartTypes/shared.d.ts +20 -5
- package/dist/modules/charts/runtime/chartTypes/types.d.ts +6 -6
- package/dist/modules/charts/runtime/components/ChartRenderer/index.d.vue.ts +145 -2
- package/dist/modules/charts/runtime/components/ChartRenderer/index.vue +2 -2
- package/dist/modules/charts/runtime/components/ChartRenderer/index.vue.d.ts +145 -2
- package/dist/modules/charts/runtime/components/index.d.ts +1 -0
- package/dist/modules/charts/runtime/components/index.js +1 -0
- package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.d.vue.ts +3 -2
- package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.vue.d.ts +3 -2
- package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.vue +1 -2
- package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.vue +1 -1
- package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.d.vue.ts +2 -0
- package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue +35 -13
- package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue.d.ts +2 -0
- package/dist/modules/charts/runtime/features/charts/Editor/index.d.vue.ts +1 -0
- package/dist/modules/charts/runtime/features/charts/Editor/index.vue +9 -3
- package/dist/modules/charts/runtime/features/charts/Editor/index.vue.d.ts +1 -0
- package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.js +1 -1
- package/dist/modules/charts/runtime/features/charts/index.vue +6 -6
- package/dist/modules/charts/runtime/helpers/index.d.ts +25 -0
- package/dist/modules/charts/runtime/helpers/index.js +63 -0
- package/dist/modules/charts/runtime/types.d.ts +10 -28
- package/dist/modules/charts/runtime/types.js +0 -64
- package/dist/modules/drupal/index.d.mts +1 -1
- package/dist/modules/drupal/runtime/adapter/index.d.ts +3 -1
- package/dist/modules/drupal/runtime/adapter/index.js +4 -4
- package/dist/modules/table-of-contents/index.d.mts +1 -1
- package/dist/runtime/components/BlokkliItem.vue +1 -1
- package/dist/runtime/composables/defineBlokkli.js +1 -1
- package/dist/runtime/editor/components/AnimationCanvas/index.vue +13 -7
- package/dist/runtime/editor/components/Banner/index.d.vue.ts +1 -0
- package/dist/runtime/editor/components/Banner/index.vue +1 -1
- package/dist/runtime/editor/components/Banner/index.vue.d.ts +1 -0
- package/dist/runtime/editor/components/DropdownItem/index.d.vue.ts +1 -0
- package/dist/runtime/editor/components/DropdownItem/index.vue +3 -2
- package/dist/runtime/editor/components/DropdownItem/index.vue.d.ts +1 -0
- package/dist/runtime/editor/components/EditProvider.vue +7 -4
- package/dist/runtime/editor/components/FlexTextarea/index.d.vue.ts +4 -0
- package/dist/runtime/editor/components/FlexTextarea/index.vue +24 -101
- package/dist/runtime/editor/components/FlexTextarea/index.vue.d.ts +4 -0
- package/dist/runtime/editor/components/NestedEditorOverlay/index.vue +28 -9
- package/dist/runtime/editor/components/Popup/index.d.vue.ts +30 -0
- package/dist/runtime/editor/components/Popup/index.vue +82 -0
- package/dist/runtime/editor/components/Popup/index.vue.d.ts +30 -0
- package/dist/runtime/editor/components/Resizable/index.vue +4 -1
- package/dist/runtime/editor/components/Toolbar/index.vue +107 -6
- package/dist/runtime/editor/components/index.d.ts +4 -3
- package/dist/runtime/editor/components/index.js +6 -4
- package/dist/runtime/editor/composables/defineDropAreas.js +3 -3
- package/dist/runtime/editor/composables/defineDropHandler.d.ts +3 -0
- package/dist/runtime/editor/composables/defineDropHandler.js +10 -0
- package/dist/runtime/editor/composables/index.d.ts +1 -0
- package/dist/runtime/editor/composables/index.js +1 -0
- package/dist/runtime/editor/css/output.css +1 -1
- package/dist/runtime/editor/events/index.d.ts +9 -0
- package/dist/runtime/editor/features/add-list/index.vue +58 -1
- package/dist/runtime/editor/features/analyze/Main.d.vue.ts +3 -2
- package/dist/runtime/editor/features/analyze/Main.vue +28 -44
- package/dist/runtime/editor/features/analyze/Main.vue.d.ts +3 -2
- package/dist/runtime/editor/features/analyze/analyzers/readability.js +65 -0
- package/dist/runtime/editor/features/analyze/analyzers/types.d.ts +19 -0
- package/dist/runtime/editor/features/analyze/index.vue +18 -15
- package/dist/runtime/editor/features/clipboard/DropElement/Video.d.vue.ts +8 -0
- package/dist/runtime/editor/features/clipboard/{List/Item → DropElement}/Video.vue +1 -5
- package/dist/runtime/editor/features/clipboard/DropElement/Video.vue.d.ts +8 -0
- package/dist/runtime/editor/features/clipboard/DropElement/helpers.d.ts +1 -0
- package/dist/runtime/editor/features/clipboard/DropElement/helpers.js +14 -0
- package/dist/runtime/editor/features/clipboard/DropElement/index.d.vue.ts +16 -0
- package/dist/runtime/editor/features/clipboard/DropElement/index.vue +97 -0
- package/dist/runtime/editor/features/clipboard/DropElement/index.vue.d.ts +16 -0
- package/dist/runtime/editor/features/clipboard/helpers.d.ts +15 -0
- package/dist/runtime/editor/features/clipboard/helpers.js +62 -0
- package/dist/runtime/editor/features/clipboard/index.vue +585 -337
- package/dist/runtime/editor/features/clipboard/types.d.ts +14 -2
- package/dist/runtime/editor/features/dragging-overlay/DragItems/index.vue +17 -5
- package/dist/runtime/editor/features/dragging-overlay/Renderer/index.vue +2 -2
- package/dist/runtime/editor/features/dragging-overlay/index.vue +125 -219
- package/dist/runtime/editor/features/editable-field/Overlay/Plaintext/index.vue +4 -4
- package/dist/runtime/editor/features/editable-field/Overlay/index.vue +6 -0
- package/dist/runtime/editor/features/library/index.vue +14 -0
- package/dist/runtime/editor/features/media-library/index.vue +32 -1
- package/dist/runtime/editor/features/options/Form/ComplexType/index.d.vue.ts +11 -0
- package/dist/runtime/editor/features/options/Form/ComplexType/index.vue +36 -0
- package/dist/runtime/editor/features/options/Form/ComplexType/index.vue.d.ts +11 -0
- package/dist/runtime/editor/features/options/Form/Item.d.vue.ts +3 -2
- package/dist/runtime/editor/features/options/Form/Item.vue +10 -2
- package/dist/runtime/editor/features/options/Form/Item.vue.d.ts +3 -2
- package/dist/runtime/editor/features/options/Form/index.vue +5 -0
- package/dist/runtime/editor/features/search/index.vue +25 -1
- package/dist/runtime/editor/features/structure/index.vue +25 -1
- package/dist/runtime/editor/features/tour/index.vue +22 -12
- package/dist/runtime/editor/helpers/clipboardData/index.d.ts +11 -0
- package/dist/runtime/editor/helpers/clipboardData/index.js +157 -0
- package/dist/runtime/editor/helpers/options/index.js +5 -0
- package/dist/runtime/editor/icons/svg/stars.svg +5 -1
- package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +13 -2
- package/dist/runtime/editor/plugins/Sidebar/index.vue +4 -2
- package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +13 -2
- package/dist/runtime/editor/providers/analyze.d.ts +43 -0
- package/dist/runtime/editor/providers/analyze.js +78 -0
- package/dist/runtime/editor/providers/animation.d.ts +4 -0
- package/dist/runtime/editor/providers/animation.js +6 -0
- package/dist/runtime/editor/providers/dragdrop.d.ts +55 -0
- package/dist/runtime/editor/providers/dragdrop.js +37 -0
- package/dist/runtime/editor/providers/storage.js +15 -0
- package/dist/runtime/editor/providers/ui.d.ts +6 -0
- package/dist/runtime/editor/providers/ui.js +19 -0
- package/dist/runtime/editor/translations/de.json +73 -61
- package/dist/runtime/editor/translations/fr.json +67 -55
- package/dist/runtime/editor/translations/gsw_CH.json +71 -59
- package/dist/runtime/editor/translations/it.json +67 -55
- package/dist/runtime/editor/types/app.d.ts +4 -2
- package/dist/runtime/editor/types/draggable.d.ts +1 -0
- package/dist/runtime/editor/types/ui.d.ts +1 -1
- package/dist/runtime/helpers/injections.d.ts +1 -1
- package/dist/runtime/types/blockOptions.d.ts +2 -1
- package/dist/runtime/types/definitions.d.ts +4 -0
- package/dist/shared/{editor.CWQIFIEQ.d.mts → editor.BdBm1Z7C.d.mts} +12 -0
- package/dist/types.d.mts +1 -1
- package/package.json +5 -3
- package/dist/modules/charts/runtime/components/Fragment/BlokkliChart.d.vue.ts +0 -3
- package/dist/modules/charts/runtime/components/Fragment/BlokkliChart.vue +0 -29
- package/dist/modules/charts/runtime/components/Fragment/BlokkliChart.vue.d.ts +0 -3
- package/dist/runtime/editor/features/clipboard/List/Item/File.d.vue.ts +0 -4
- package/dist/runtime/editor/features/clipboard/List/Item/File.vue +0 -60
- package/dist/runtime/editor/features/clipboard/List/Item/File.vue.d.ts +0 -4
- package/dist/runtime/editor/features/clipboard/List/Item/Video.d.vue.ts +0 -4
- package/dist/runtime/editor/features/clipboard/List/Item/Video.vue.d.ts +0 -4
- package/dist/runtime/editor/features/clipboard/List/index.d.vue.ts +0 -11
- package/dist/runtime/editor/features/clipboard/List/index.vue +0 -72
- package/dist/runtime/editor/features/clipboard/List/index.vue.d.ts +0 -11
- package/dist/runtime/editor/features/tour/Popup/index.d.vue.ts +0 -9
- package/dist/runtime/editor/features/tour/Popup/index.vue +0 -34
- package/dist/runtime/editor/features/tour/Popup/index.vue.d.ts +0 -9
- package/dist/runtime/editor/providers/dropArea.d.ts +0 -48
- package/dist/runtime/editor/providers/dropArea.js +0 -22
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { ChartTypeOptionsMap } from './chartTypes/index.js';
|
|
1
2
|
export type ChartType = 'bar' | 'line' | 'pie' | 'area' | 'donut' | 'heatmap' | 'radialBar' | 'radar';
|
|
3
|
+
export type ChartTypeOptions = ChartTypeOptionsMap[ChartType];
|
|
2
4
|
export type ChartSeries = {
|
|
3
5
|
name: string;
|
|
4
6
|
/**
|
|
@@ -7,9 +9,8 @@ export type ChartSeries = {
|
|
|
7
9
|
color: string;
|
|
8
10
|
data: number[];
|
|
9
11
|
};
|
|
10
|
-
|
|
12
|
+
type ChartDataBase = {
|
|
11
13
|
title: string;
|
|
12
|
-
type: ChartType;
|
|
13
14
|
categories: string[];
|
|
14
15
|
series: ChartSeries[];
|
|
15
16
|
/**
|
|
@@ -18,34 +19,15 @@ export type BlokkliChartData = {
|
|
|
18
19
|
*/
|
|
19
20
|
categoryColors: string[];
|
|
20
21
|
footnotes: string[];
|
|
21
|
-
typeOptions?: Record<string, unknown>;
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
export type BlokkliChartData = {
|
|
24
|
+
[K in ChartType]: ChartDataBase & {
|
|
25
|
+
type: K;
|
|
26
|
+
typeOptions?: Partial<ChartTypeOptionsMap[K]>;
|
|
27
|
+
};
|
|
28
|
+
}[ChartType];
|
|
29
29
|
export type ChartColor = {
|
|
30
30
|
color: string;
|
|
31
31
|
label: string;
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
* Resolve a color ID to a concrete CSS color value that ApexCharts can use.
|
|
35
|
-
*
|
|
36
|
-
* Plain values like '#ff0000' or 'rgb(255, 0, 0)' are returned as-is.
|
|
37
|
-
* Values containing 'var(' (e.g. 'rgb(var(--theme-primary))') are resolved
|
|
38
|
-
* by setting the value on a DOM element and reading the computed color.
|
|
39
|
-
*
|
|
40
|
-
* Falls back to the first defined color if the ID is not found.
|
|
41
|
-
*/
|
|
42
|
-
export declare function resolveChartColor(colorId: string, colors: Record<string, ChartColor>, el?: HTMLElement | null): string;
|
|
43
|
-
/**
|
|
44
|
-
* Get the fallback color ID (first defined color).
|
|
45
|
-
*/
|
|
46
|
-
export declare function getFirstColorId(colors: Record<string, ChartColor>): string;
|
|
47
|
-
/**
|
|
48
|
-
* Get a color ID for the given index, cycling through available colors.
|
|
49
|
-
*/
|
|
50
|
-
export declare function getColorIdAtIndex(index: number, colors: Record<string, ChartColor>): string;
|
|
51
|
-
export declare function getDefaultChartData(colors: Record<string, ChartColor>): BlokkliChartData;
|
|
33
|
+
export {};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
const SUPERSCRIPTS = {
|
|
2
|
-
"1": "\xB9",
|
|
3
|
-
"2": "\xB2",
|
|
4
|
-
"3": "\xB3",
|
|
5
|
-
"4": "\u2074",
|
|
6
|
-
"5": "\u2075",
|
|
7
|
-
"6": "\u2076",
|
|
8
|
-
"7": "\u2077",
|
|
9
|
-
"8": "\u2078",
|
|
10
|
-
"9": "\u2079",
|
|
11
|
-
"0": "\u2070"
|
|
12
|
-
};
|
|
13
|
-
export { SUPERSCRIPTS };
|
|
14
|
-
export function applyFootnotes(text) {
|
|
15
|
-
return text.replace(
|
|
16
|
-
/\{(\d)\}/g,
|
|
17
|
-
(_, d) => SUPERSCRIPTS[d] || `{${d}}`
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
export function resolveChartColor(colorId, colors, el) {
|
|
21
|
-
const ids = Object.keys(colors);
|
|
22
|
-
const entry = colors[colorId] || colors[ids[0] || ""];
|
|
23
|
-
if (!entry) {
|
|
24
|
-
return "#888888";
|
|
25
|
-
}
|
|
26
|
-
const value = entry.color;
|
|
27
|
-
if (!value.includes("var(")) {
|
|
28
|
-
return value;
|
|
29
|
-
}
|
|
30
|
-
const target = el || document.documentElement;
|
|
31
|
-
const prev = target.style.color;
|
|
32
|
-
target.style.color = value;
|
|
33
|
-
const resolved = getComputedStyle(target).color;
|
|
34
|
-
target.style.color = prev;
|
|
35
|
-
return resolved || value;
|
|
36
|
-
}
|
|
37
|
-
export function getFirstColorId(colors) {
|
|
38
|
-
return Object.keys(colors)[0] || "";
|
|
39
|
-
}
|
|
40
|
-
export function getColorIdAtIndex(index, colors) {
|
|
41
|
-
const ids = Object.keys(colors);
|
|
42
|
-
return ids[index % ids.length] || ids[0] || "";
|
|
43
|
-
}
|
|
44
|
-
export function getDefaultChartData(colors) {
|
|
45
|
-
return {
|
|
46
|
-
title: "",
|
|
47
|
-
type: "bar",
|
|
48
|
-
categories: ["Category 1", "Category 2", "Category 3"],
|
|
49
|
-
series: [
|
|
50
|
-
{
|
|
51
|
-
name: "Series 1",
|
|
52
|
-
color: getColorIdAtIndex(0, colors),
|
|
53
|
-
data: [30, 40, 35]
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
categoryColors: [
|
|
57
|
-
getColorIdAtIndex(0, colors),
|
|
58
|
-
getColorIdAtIndex(1, colors),
|
|
59
|
-
getColorIdAtIndex(2, colors)
|
|
60
|
-
],
|
|
61
|
-
footnotes: [],
|
|
62
|
-
typeOptions: {}
|
|
63
|
-
};
|
|
64
|
-
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { type BlokkliAdapterFactory } from '#blokkli/editor/adapter';
|
|
2
|
+
import type { ParagraphsBlokkliEditStateFragment } from '#graphql-operations';
|
|
3
|
+
declare const _default: BlokkliAdapterFactory<ParagraphsBlokkliEditStateFragment>;
|
|
2
4
|
export default _default;
|
|
@@ -852,19 +852,19 @@ export default defineBlokkliEditAdapter(
|
|
|
852
852
|
}
|
|
853
853
|
}
|
|
854
854
|
return false;
|
|
855
|
-
})?.possibleParagraphBundles
|
|
855
|
+
})?.possibleParagraphBundles;
|
|
856
856
|
} else if (e.type === "plaintext") {
|
|
857
857
|
return config.clipboard.find((v) => {
|
|
858
858
|
return v?.__typename === "ParagraphsBlokkliSupportedClipboardRichText";
|
|
859
|
-
})?.possibleParagraphBundles
|
|
859
|
+
})?.possibleParagraphBundles;
|
|
860
860
|
} else if (e.type === "image") {
|
|
861
861
|
return config.clipboard.find((v) => {
|
|
862
862
|
return v?.__typename === "ParagraphsBlokkliSupportedClipboardImage";
|
|
863
|
-
})?.possibleParagraphBundles
|
|
863
|
+
})?.possibleParagraphBundles;
|
|
864
864
|
} else if (e.type === "file") {
|
|
865
865
|
return config.clipboard.find((v) => {
|
|
866
866
|
return v?.__typename === "ParagraphsBlokkliSupportedClipboardFile";
|
|
867
|
-
})?.possibleParagraphBundles
|
|
867
|
+
})?.possibleParagraphBundles;
|
|
868
868
|
}
|
|
869
869
|
};
|
|
870
870
|
}
|
|
@@ -56,7 +56,7 @@ const isGlobalProxyMode = inject(INJECT_GLOBAL_PROXY_MODE, null);
|
|
|
56
56
|
const fieldListType = inject(INJECT_FIELD_LIST_TYPE, void 0);
|
|
57
57
|
const providerType = inject(INJECT_PROVIDER_TYPE, void 0);
|
|
58
58
|
const itemProps = computed(() => {
|
|
59
|
-
if (mutatedItemProps) {
|
|
59
|
+
if (mutatedItemProps && componentProps.isEditing) {
|
|
60
60
|
const mutatedProps = mutatedItemProps[componentProps.uuid];
|
|
61
61
|
if (mutatedProps) {
|
|
62
62
|
return {
|
|
@@ -92,7 +92,7 @@ export function defineBlokkli(arg) {
|
|
|
92
92
|
}
|
|
93
93
|
if (editContext?.useBlockRegistration && editContext.dom && bundle !== fromLibraryBlockBundle && bundle !== fragmentBlockBundle) {
|
|
94
94
|
const isProxyMode = inject(INJECT_FIELD_USES_PROXY, false);
|
|
95
|
-
if (!isProxyMode) {
|
|
95
|
+
if (!isProxyMode && isEditing) {
|
|
96
96
|
editContext.useBlockRegistration(editContext.dom, reusableUuid ?? uuid);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
@@ -79,6 +79,7 @@ let pointerDownElement = null;
|
|
|
79
79
|
let mouseStartCoordinates = null;
|
|
80
80
|
let pointerDownTimestamp = 0;
|
|
81
81
|
let pointerUpTimestamp = 0;
|
|
82
|
+
let pointerDownOnCanvas = false;
|
|
82
83
|
function getInteractedElement(e) {
|
|
83
84
|
const { x, y } = getInteractionCoordinates(e);
|
|
84
85
|
const visibleUuids = dom.getVisibleBlocks();
|
|
@@ -144,7 +145,7 @@ function onPointerMove(e) {
|
|
|
144
145
|
if (!handlePointerMove) {
|
|
145
146
|
return;
|
|
146
147
|
}
|
|
147
|
-
if (keyboard.isPressingSpace.value || e.buttons
|
|
148
|
+
if (keyboard.isPressingSpace.value || e.buttons & MOUSE_BUTTONS.AUXILIARY) {
|
|
148
149
|
return;
|
|
149
150
|
}
|
|
150
151
|
e.preventDefault();
|
|
@@ -201,9 +202,10 @@ function onPointerMove(e) {
|
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
204
|
function onPointerDown(e) {
|
|
204
|
-
if (e.buttons
|
|
205
|
+
if (e.buttons & MOUSE_BUTTONS.AUXILIARY) {
|
|
205
206
|
return;
|
|
206
207
|
}
|
|
208
|
+
pointerDownOnCanvas = true;
|
|
207
209
|
if (canvasEl.value) {
|
|
208
210
|
canvasEl.value.focus();
|
|
209
211
|
}
|
|
@@ -251,15 +253,15 @@ function isClickInArtboard(coords) {
|
|
|
251
253
|
return isInsideRect(coords.x, coords.y, rect);
|
|
252
254
|
}
|
|
253
255
|
function onPointerUp(e) {
|
|
254
|
-
handlePointerMove = false;
|
|
255
256
|
if (e.button === MOUSE_BUTTON.AUXILIARY) {
|
|
256
257
|
e.preventDefault();
|
|
257
258
|
return;
|
|
258
259
|
}
|
|
260
|
+
handlePointerMove = false;
|
|
259
261
|
e.preventDefault();
|
|
260
262
|
e.stopPropagation();
|
|
261
263
|
e.stopImmediatePropagation();
|
|
262
|
-
if (ui.openTooltip.value) {
|
|
264
|
+
if (ui.openTooltip.value && !selection.activeEditableLabel.value) {
|
|
263
265
|
ui.openTooltip.value = "";
|
|
264
266
|
return;
|
|
265
267
|
}
|
|
@@ -289,8 +291,11 @@ function onPointerUp(e) {
|
|
|
289
291
|
return;
|
|
290
292
|
}
|
|
291
293
|
if (selection.activeEditableLabel.value) {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
+
if (pointerDownOnCanvas) {
|
|
295
|
+
eventBus.emit("window:clickAway");
|
|
296
|
+
lastInteractedElement = null;
|
|
297
|
+
}
|
|
298
|
+
pointerDownOnCanvas = false;
|
|
294
299
|
return;
|
|
295
300
|
}
|
|
296
301
|
if (animation.handleClick(e.clientX, e.clientY)) {
|
|
@@ -303,6 +308,7 @@ function onPointerUp(e) {
|
|
|
303
308
|
const deltaY = Math.abs(lastInteractedElement.y - e.clientY);
|
|
304
309
|
if (deltaTime < 400 && deltaX < 3 && deltaY < 3) {
|
|
305
310
|
if (clicked.editableFieldName) {
|
|
311
|
+
pointerDownOnCanvas = false;
|
|
306
312
|
eventBus.emit("editable:focus", {
|
|
307
313
|
fieldName: clicked.editableFieldName,
|
|
308
314
|
uuid: clicked.uuid
|
|
@@ -448,7 +454,7 @@ function onClick(e) {
|
|
|
448
454
|
e.preventDefault();
|
|
449
455
|
e.stopImmediatePropagation();
|
|
450
456
|
e.stopPropagation();
|
|
451
|
-
if (canvasEl.value) {
|
|
457
|
+
if (canvasEl.value && !selection.activeEditableLabel.value) {
|
|
452
458
|
canvasEl.value.focus();
|
|
453
459
|
}
|
|
454
460
|
}
|
|
@@ -16,6 +16,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
16
16
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
17
|
onClick?: (() => any) | undefined;
|
|
18
18
|
}>, {
|
|
19
|
+
text: string;
|
|
19
20
|
button: string;
|
|
20
21
|
scheme: ThemeColorName;
|
|
21
22
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
const props = defineProps({
|
|
27
27
|
id: { type: String, required: true },
|
|
28
28
|
icon: { type: null, required: true },
|
|
29
|
-
text: { type: String, required: false },
|
|
29
|
+
text: { type: String, required: false, default: void 0 },
|
|
30
30
|
button: { type: String, required: false, default: void 0 },
|
|
31
31
|
scheme: { type: String, required: false, default: "accent" }
|
|
32
32
|
});
|
|
@@ -16,6 +16,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
16
16
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
17
|
onClick?: (() => any) | undefined;
|
|
18
18
|
}>, {
|
|
19
|
+
text: string;
|
|
19
20
|
button: string;
|
|
20
21
|
scheme: ThemeColorName;
|
|
21
22
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -2,6 +2,7 @@ import type { BlokkliIcon } from '#blokkli-build/icons';
|
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
icon: BlokkliIcon;
|
|
4
4
|
text: string;
|
|
5
|
+
disabled?: boolean;
|
|
5
6
|
};
|
|
6
7
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
8
|
click: () => any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<button class="bk-dropdown-menu-item" @click="$emit('click')">
|
|
2
|
+
<button class="bk-dropdown-menu-item" :disabled @click="$emit('click')">
|
|
3
3
|
<Icon :name="icon" />
|
|
4
4
|
<span>{{ text }}</span>
|
|
5
5
|
</button>
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
import { Icon } from "#blokkli/editor/components";
|
|
10
10
|
defineProps({
|
|
11
11
|
icon: { type: null, required: true },
|
|
12
|
-
text: { type: String, required: true }
|
|
12
|
+
text: { type: String, required: true },
|
|
13
|
+
disabled: { type: Boolean, required: false }
|
|
13
14
|
});
|
|
14
15
|
defineEmits(["click"]);
|
|
15
16
|
</script>
|
|
@@ -2,6 +2,7 @@ import type { BlokkliIcon } from '#blokkli-build/icons';
|
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
icon: BlokkliIcon;
|
|
4
4
|
text: string;
|
|
5
|
+
disabled?: boolean;
|
|
5
6
|
};
|
|
6
7
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
8
|
click: () => any;
|
|
@@ -100,7 +100,6 @@ import commandsProvider from "#blokkli/editor/providers/commands";
|
|
|
100
100
|
import tourProvider from "#blokkli/editor/providers/tour";
|
|
101
101
|
import debugProvider from "#blokkli/editor/providers/debug";
|
|
102
102
|
import definitionProvider from "#blokkli/editor/providers/definition";
|
|
103
|
-
import dropAreasProvider from "#blokkli/editor/providers/dropArea";
|
|
104
103
|
import blocksProvider from "#blokkli/editor/providers/blocks";
|
|
105
104
|
import indicatorsProvider from "#blokkli/editor/providers/indicators";
|
|
106
105
|
import pluginProvider from "#blokkli/editor/providers/plugin";
|
|
@@ -109,6 +108,8 @@ import fieldsProvider from "#blokkli/editor/providers/fields";
|
|
|
109
108
|
import iconsProvider from "#blokkli/editor/providers/icons";
|
|
110
109
|
import permissionsProvider from "#blokkli/editor/providers/permissions";
|
|
111
110
|
import adaptersProvider from "#blokkli/editor/providers/adapters";
|
|
111
|
+
import analyzeProviderFn from "#blokkli/editor/providers/analyze";
|
|
112
|
+
import dragdropProvider from "#blokkli/editor/providers/dragdrop";
|
|
112
113
|
import { eventBus } from "#blokkli/editor/events";
|
|
113
114
|
import "#blokkli-build/styles.css";
|
|
114
115
|
import getAdapter from "#blokkli-build/edit-adapter";
|
|
@@ -186,7 +187,6 @@ const element = elementProvider(debug);
|
|
|
186
187
|
const features = featuresProvider(storage);
|
|
187
188
|
const commands = commandsProvider();
|
|
188
189
|
const tour = tourProvider();
|
|
189
|
-
const dropAreas = dropAreasProvider();
|
|
190
190
|
const broadcast = broadcastProvider();
|
|
191
191
|
const icons = iconsProvider();
|
|
192
192
|
const ui = uiProvider(
|
|
@@ -216,6 +216,8 @@ const indicators = indicatorsProvider();
|
|
|
216
216
|
const directive = directiveProvider(debug, ui);
|
|
217
217
|
const fields = fieldsProvider(dom, types, state);
|
|
218
218
|
const permissionsInstance = await permissionsProvider(adapter);
|
|
219
|
+
const analyze = analyzeProviderFn(adapters, state, ui, context, $t);
|
|
220
|
+
const dragdrop = dragdropProvider();
|
|
219
221
|
const mutatedEntityProps = computed(() => state.mutatedItemProps.HOST);
|
|
220
222
|
const mutatedEntity = computed(() => {
|
|
221
223
|
return {
|
|
@@ -283,7 +285,6 @@ const app = {
|
|
|
283
285
|
debug,
|
|
284
286
|
definitions,
|
|
285
287
|
dom,
|
|
286
|
-
dropAreas,
|
|
287
288
|
element,
|
|
288
289
|
eventBus,
|
|
289
290
|
directive,
|
|
@@ -301,7 +302,9 @@ const app = {
|
|
|
301
302
|
ui,
|
|
302
303
|
fields,
|
|
303
304
|
icons,
|
|
304
|
-
permissions: permissionsInstance
|
|
305
|
+
permissions: permissionsInstance,
|
|
306
|
+
analyze,
|
|
307
|
+
dragdrop
|
|
305
308
|
};
|
|
306
309
|
provide(INJECT_APP, app);
|
|
307
310
|
function textWithHighlight(title, text) {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { ClipboardData } from '#blokkli/editor/helpers/clipboardData';
|
|
1
2
|
type __VLS_Props = {
|
|
2
3
|
maxHeight?: number;
|
|
3
4
|
minHeight?: number;
|
|
4
5
|
submitOnEnter?: boolean;
|
|
5
6
|
/** When true, convert pasted HTML to markdown */
|
|
6
7
|
pasteMarkdown?: boolean;
|
|
8
|
+
/** Called before the built-in paste handling. Return true to skip it. */
|
|
9
|
+
onBeforePaste?: (data: ClipboardData) => boolean;
|
|
7
10
|
textareaClass?: boolean;
|
|
11
|
+
autofocus?: boolean;
|
|
8
12
|
};
|
|
9
13
|
type __VLS_ModelProps = {
|
|
10
14
|
modelValue: string;
|
|
@@ -15,14 +15,16 @@
|
|
|
15
15
|
}"
|
|
16
16
|
@keydown.capture.stop="onKeydown"
|
|
17
17
|
@keyup.capture.stop
|
|
18
|
+
@pointerdown="onPointerDown"
|
|
18
19
|
@paste="onPaste"
|
|
19
20
|
/>
|
|
20
21
|
</div>
|
|
21
22
|
</template>
|
|
22
23
|
|
|
23
24
|
<script setup>
|
|
24
|
-
import { useTemplateRef, ref, computed, watch } from "#imports";
|
|
25
|
+
import { useTemplateRef, ref, computed, watch, onMounted } from "#imports";
|
|
25
26
|
import { onBlokkliEvent } from "#blokkli/editor/composables";
|
|
27
|
+
import { ClipboardData } from "#blokkli/editor/helpers/clipboardData";
|
|
26
28
|
defineOptions({
|
|
27
29
|
inheritAttrs: false
|
|
28
30
|
});
|
|
@@ -31,7 +33,9 @@ const props = defineProps({
|
|
|
31
33
|
minHeight: { type: Number, required: false, default: 70 },
|
|
32
34
|
submitOnEnter: { type: Boolean, required: false },
|
|
33
35
|
pasteMarkdown: { type: Boolean, required: false },
|
|
34
|
-
|
|
36
|
+
onBeforePaste: { type: Function, required: false },
|
|
37
|
+
textareaClass: { type: Boolean, required: false },
|
|
38
|
+
autofocus: { type: Boolean, required: false }
|
|
35
39
|
});
|
|
36
40
|
const emit = defineEmits(["submit", "keydown"]);
|
|
37
41
|
const modelValue = defineModel({ type: String, ...{ required: true } });
|
|
@@ -41,6 +45,11 @@ const isScrollable = computed(() => {
|
|
|
41
45
|
if (!props.maxHeight) return false;
|
|
42
46
|
return height.value >= props.maxHeight;
|
|
43
47
|
});
|
|
48
|
+
function onPointerDown(e) {
|
|
49
|
+
if (e.target instanceof HTMLElement) {
|
|
50
|
+
e.target.setPointerCapture(e.pointerId);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
44
53
|
function onKeydown(e) {
|
|
45
54
|
emit("keydown", e);
|
|
46
55
|
if (props.submitOnEnter && e.key === "Enter" && !e.shiftKey) {
|
|
@@ -48,107 +57,16 @@ function onKeydown(e) {
|
|
|
48
57
|
emit("submit");
|
|
49
58
|
}
|
|
50
59
|
}
|
|
51
|
-
function convertNode(node) {
|
|
52
|
-
if (node.nodeType === Node.TEXT_NODE) {
|
|
53
|
-
return node.textContent || "";
|
|
54
|
-
}
|
|
55
|
-
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
56
|
-
return "";
|
|
57
|
-
}
|
|
58
|
-
const el = node;
|
|
59
|
-
const tag = el.tagName.toLowerCase();
|
|
60
|
-
const children = Array.from(el.childNodes).map(convertNode).join("");
|
|
61
|
-
switch (tag) {
|
|
62
|
-
case "br":
|
|
63
|
-
return "\n";
|
|
64
|
-
case "p":
|
|
65
|
-
case "div":
|
|
66
|
-
return children + "\n\n";
|
|
67
|
-
case "strong":
|
|
68
|
-
case "b":
|
|
69
|
-
return `**${children}**`;
|
|
70
|
-
case "em":
|
|
71
|
-
case "i":
|
|
72
|
-
return `*${children}*`;
|
|
73
|
-
case "del":
|
|
74
|
-
case "s":
|
|
75
|
-
return `~~${children}~~`;
|
|
76
|
-
case "code":
|
|
77
|
-
if (el.parentElement?.tagName.toLowerCase() === "pre") {
|
|
78
|
-
return children;
|
|
79
|
-
}
|
|
80
|
-
return `\`${children}\``;
|
|
81
|
-
case "pre": {
|
|
82
|
-
const codeEl = el.querySelector("code");
|
|
83
|
-
const content = codeEl ? convertNode(codeEl) : children;
|
|
84
|
-
return `
|
|
85
|
-
\`\`\`
|
|
86
|
-
${content}
|
|
87
|
-
\`\`\`
|
|
88
|
-
`;
|
|
89
|
-
}
|
|
90
|
-
case "h1":
|
|
91
|
-
return `# ${children}
|
|
92
|
-
|
|
93
|
-
`;
|
|
94
|
-
case "h2":
|
|
95
|
-
return `## ${children}
|
|
96
|
-
|
|
97
|
-
`;
|
|
98
|
-
case "h3":
|
|
99
|
-
return `### ${children}
|
|
100
|
-
|
|
101
|
-
`;
|
|
102
|
-
case "h4":
|
|
103
|
-
return `#### ${children}
|
|
104
|
-
|
|
105
|
-
`;
|
|
106
|
-
case "h5":
|
|
107
|
-
return `##### ${children}
|
|
108
|
-
|
|
109
|
-
`;
|
|
110
|
-
case "h6":
|
|
111
|
-
return `###### ${children}
|
|
112
|
-
|
|
113
|
-
`;
|
|
114
|
-
case "a": {
|
|
115
|
-
const href = el.getAttribute("href");
|
|
116
|
-
return href ? `[${children}](${href})` : children;
|
|
117
|
-
}
|
|
118
|
-
case "ul":
|
|
119
|
-
case "ol":
|
|
120
|
-
return "\n" + children + "\n";
|
|
121
|
-
case "li": {
|
|
122
|
-
const parent = el.parentElement;
|
|
123
|
-
if (parent?.tagName.toLowerCase() === "ol") {
|
|
124
|
-
const index = Array.from(parent.children).indexOf(el) + 1;
|
|
125
|
-
return `${index}. ${children.trim()}
|
|
126
|
-
`;
|
|
127
|
-
}
|
|
128
|
-
return `- ${children.trim()}
|
|
129
|
-
`;
|
|
130
|
-
}
|
|
131
|
-
case "blockquote":
|
|
132
|
-
return children.trim().split("\n").map((line) => `> ${line}`).join("\n") + "\n";
|
|
133
|
-
case "hr":
|
|
134
|
-
return "\n---\n";
|
|
135
|
-
case "style":
|
|
136
|
-
case "script":
|
|
137
|
-
return "";
|
|
138
|
-
default:
|
|
139
|
-
return children;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function htmlToMarkdown(html) {
|
|
143
|
-
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
144
|
-
return convertNode(doc.body).replace(/\n{3,}/g, "\n\n").trim();
|
|
145
|
-
}
|
|
146
60
|
function onPaste(e) {
|
|
147
|
-
if (!
|
|
148
|
-
const
|
|
149
|
-
if (
|
|
61
|
+
if (!e.clipboardData) return;
|
|
62
|
+
const data = new ClipboardData(e.clipboardData);
|
|
63
|
+
if (props.onBeforePaste?.(data)) {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (!props.pasteMarkdown || !data.hasHtml()) return;
|
|
150
68
|
e.preventDefault();
|
|
151
|
-
const markdown =
|
|
69
|
+
const markdown = data.toMarkdown();
|
|
152
70
|
const el = textarea.value;
|
|
153
71
|
if (!el) return;
|
|
154
72
|
const start = el.selectionStart;
|
|
@@ -171,6 +89,11 @@ onBlokkliEvent("animationFrame", () => {
|
|
|
171
89
|
const newHeight = Math.max(scrollHeight, props.minHeight);
|
|
172
90
|
height.value = props.maxHeight ? Math.min(newHeight, props.maxHeight) : newHeight;
|
|
173
91
|
});
|
|
92
|
+
onMounted(() => {
|
|
93
|
+
if (props.autofocus && textarea.value) {
|
|
94
|
+
textarea.value.focus();
|
|
95
|
+
}
|
|
96
|
+
});
|
|
174
97
|
defineExpose({
|
|
175
98
|
focus: () => textarea.value?.focus(),
|
|
176
99
|
blur: () => textarea.value?.blur(),
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { ClipboardData } from '#blokkli/editor/helpers/clipboardData';
|
|
1
2
|
type __VLS_Props = {
|
|
2
3
|
maxHeight?: number;
|
|
3
4
|
minHeight?: number;
|
|
4
5
|
submitOnEnter?: boolean;
|
|
5
6
|
/** When true, convert pasted HTML to markdown */
|
|
6
7
|
pasteMarkdown?: boolean;
|
|
8
|
+
/** Called before the built-in paste handling. Return true to skip it. */
|
|
9
|
+
onBeforePaste?: (data: ClipboardData) => boolean;
|
|
7
10
|
textareaClass?: boolean;
|
|
11
|
+
autofocus?: boolean;
|
|
8
12
|
};
|
|
9
13
|
type __VLS_ModelProps = {
|
|
10
14
|
modelValue: string;
|
|
@@ -132,19 +132,28 @@ function onEnter(el, done) {
|
|
|
132
132
|
const overlayRect = el.getBoundingClientRect();
|
|
133
133
|
const scaleX = originatingRect.width / overlayRect.width;
|
|
134
134
|
const scaleY = originatingRect.height / overlayRect.height;
|
|
135
|
-
const
|
|
136
|
-
const
|
|
135
|
+
const scale = Math.max(scaleX, scaleY);
|
|
136
|
+
const scaledW = overlayRect.width * scale;
|
|
137
|
+
const scaledH = overlayRect.height * scale;
|
|
138
|
+
const centerX = originatingRect.x + originatingRect.width / 2;
|
|
139
|
+
const centerY = originatingRect.y + originatingRect.height / 2;
|
|
140
|
+
const offsetX = centerX - scaledW / 2 - overlayRect.x;
|
|
141
|
+
const offsetY = centerY - scaledH / 2 - overlayRect.y;
|
|
142
|
+
const clipY = (overlayRect.height - originatingRect.height / scale) / 2;
|
|
143
|
+
const clipX = (overlayRect.width - originatingRect.width / scale) / 2;
|
|
137
144
|
el.style.transition = "none";
|
|
138
145
|
el.style.opacity = "0";
|
|
139
146
|
el.style.transformOrigin = "0px 0px";
|
|
140
|
-
el.style.transform = `translate(${offsetX}px, ${offsetY}px) scale(${
|
|
147
|
+
el.style.transform = `translate(${offsetX}px, ${offsetY}px) scale(${scale})`;
|
|
148
|
+
el.style.clipPath = `inset(${clipY}px ${clipX}px ${clipY}px ${clipX}px round 4px)`;
|
|
141
149
|
el.getBoundingClientRect();
|
|
142
150
|
raf = requestAnimationFrame(() => {
|
|
143
151
|
el.style.transition = `opacity ${FADE_DURATION}ms ease-out`;
|
|
144
152
|
el.style.opacity = "1";
|
|
145
153
|
withTimeout(() => {
|
|
146
|
-
el.style.transition = `transform ${DURATION}ms ${EASING}`;
|
|
147
|
-
el.style.transform = "translate(0px, 0px) scale(1
|
|
154
|
+
el.style.transition = `transform ${DURATION}ms ${EASING}, clip-path ${DURATION}ms ${EASING}`;
|
|
155
|
+
el.style.transform = "translate(0px, 0px) scale(1)";
|
|
156
|
+
el.style.clipPath = "inset(0px 0px 0px 0px round 0px)";
|
|
148
157
|
withTimeout(() => {
|
|
149
158
|
pendingTimeouts = [];
|
|
150
159
|
done();
|
|
@@ -158,6 +167,7 @@ function onAfter(el) {
|
|
|
158
167
|
el.style.transition = "";
|
|
159
168
|
el.style.opacity = "";
|
|
160
169
|
el.style.transformOrigin = "";
|
|
170
|
+
el.style.clipPath = "";
|
|
161
171
|
}
|
|
162
172
|
pendingTimeouts = [];
|
|
163
173
|
}
|
|
@@ -166,6 +176,7 @@ function onBeforeLeave(el) {
|
|
|
166
176
|
if (el instanceof HTMLElement) {
|
|
167
177
|
el.style.transform = "none";
|
|
168
178
|
el.style.opacity = "1";
|
|
179
|
+
el.style.clipPath = "inset(0px 0px 0px 0px round 0px)";
|
|
169
180
|
}
|
|
170
181
|
}
|
|
171
182
|
function onLeave(el, done) {
|
|
@@ -185,11 +196,19 @@ function onLeave(el, done) {
|
|
|
185
196
|
const overlayRect = el.getBoundingClientRect();
|
|
186
197
|
const scaleX = originatingRect.width / overlayRect.width;
|
|
187
198
|
const scaleY = originatingRect.height / overlayRect.height;
|
|
188
|
-
const
|
|
189
|
-
const
|
|
190
|
-
|
|
199
|
+
const scale = Math.max(scaleX, scaleY);
|
|
200
|
+
const scaledW = overlayRect.width * scale;
|
|
201
|
+
const scaledH = overlayRect.height * scale;
|
|
202
|
+
const centerX = originatingRect.x + originatingRect.width / 2;
|
|
203
|
+
const centerY = originatingRect.y + originatingRect.height / 2;
|
|
204
|
+
const offsetX = centerX - scaledW / 2 - overlayRect.x;
|
|
205
|
+
const offsetY = centerY - scaledH / 2 - overlayRect.y;
|
|
206
|
+
const clipY = (overlayRect.height - originatingRect.height / scale) / 2;
|
|
207
|
+
const clipX = (overlayRect.width - originatingRect.width / scale) / 2;
|
|
208
|
+
el.style.transition = `transform ${DURATION}ms ${EASING}, clip-path ${DURATION}ms ${EASING}`;
|
|
191
209
|
el.style.transformOrigin = "0px 0px";
|
|
192
|
-
el.style.transform = `translate(${offsetX}px, ${offsetY}px) scale(${
|
|
210
|
+
el.style.transform = `translate(${offsetX}px, ${offsetY}px) scale(${scale})`;
|
|
211
|
+
el.style.clipPath = `inset(${clipY}px ${clipX}px ${clipY}px ${clipX}px round 4px)`;
|
|
193
212
|
withTimeout(() => {
|
|
194
213
|
el.style.transition = `opacity ${FADE_DURATION}ms ease-out`;
|
|
195
214
|
el.style.opacity = "0";
|