@blokkli/editor 2.0.0-alpha.24 → 2.0.0-alpha.25

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.
Files changed (182) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +191 -27
  3. package/dist/runtime/blokkliPlugins/BlockIndicator/index.vue.d.ts +38 -0
  4. package/dist/runtime/blokkliPlugins/ContextMenu/index.vue.d.ts +15 -0
  5. package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue.d.ts +6 -0
  6. package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +28 -3
  7. package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +6 -4
  8. package/dist/runtime/blokkliPlugins/Sidebar/index.vue +11 -3
  9. package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +138 -3
  10. package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +114 -0
  11. package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +21 -0
  12. package/dist/runtime/blokkliPlugins/ViewOption/index.vue.d.ts +98 -0
  13. package/dist/runtime/components/Blocks/NotImplemented/index.vue +24 -0
  14. package/dist/runtime/components/Blocks/NotImplemented/index.vue.d.ts +6 -0
  15. package/dist/runtime/components/BlokkliEditable.vue.d.ts +11 -0
  16. package/dist/runtime/components/BlokkliItem.vue +16 -3
  17. package/dist/runtime/components/BlokkliItem.vue.d.ts +2 -0
  18. package/dist/runtime/components/Edit/Actions/index.vue +1 -1
  19. package/dist/runtime/components/Edit/AddListItem/index.vue +1 -6
  20. package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +5 -13
  21. package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +6 -0
  22. package/dist/runtime/components/Edit/BlockProxy/index.vue +2 -2
  23. package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +3 -0
  24. package/dist/runtime/components/Edit/BlokkliRootErrorBoundary.vue +4 -1
  25. package/dist/runtime/components/Edit/Dialog/index.vue +15 -50
  26. package/dist/runtime/components/Edit/DraggableList.vue +12 -9
  27. package/dist/runtime/components/Edit/EditIndicator.vue +11 -4
  28. package/dist/runtime/components/Edit/EditProvider.vue +27 -24
  29. package/dist/runtime/components/Edit/Features/AddList/Actions/Action.vue +1 -0
  30. package/dist/runtime/components/Edit/Features/AddList/Blocks/index.vue +2 -3
  31. package/dist/runtime/components/Edit/Features/AddList/index.vue +17 -5
  32. package/dist/runtime/components/Edit/Features/Analyze/Icon.vue +85 -0
  33. package/dist/runtime/components/Edit/Features/Analyze/Icon.vue.d.ts +5 -0
  34. package/dist/runtime/components/Edit/Features/Analyze/Main.vue +288 -59
  35. package/dist/runtime/components/Edit/Features/Analyze/Main.vue.d.ts +8 -1
  36. package/dist/runtime/components/Edit/Features/Analyze/Renderer/fragment.glsl +25 -13
  37. package/dist/runtime/components/Edit/Features/Analyze/Renderer/index.vue +114 -52
  38. package/dist/runtime/components/Edit/Features/Analyze/Renderer/index.vue.d.ts +16 -2
  39. package/dist/runtime/components/Edit/Features/Analyze/Renderer/vertex.glsl +31 -11
  40. package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue +2 -0
  41. package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue.d.ts +8 -1
  42. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue +4 -4
  43. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue.d.ts +20 -2
  44. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue +11 -18
  45. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue.d.ts +10 -3
  46. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +46 -40
  47. package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue.d.ts +10 -4
  48. package/dist/runtime/components/Edit/Features/Analyze/Summary/Chart.vue +8 -4
  49. package/dist/runtime/components/Edit/Features/Analyze/analyzers/axe.js +1 -0
  50. package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.d.ts +4 -3
  51. package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.js +2 -1
  52. package/dist/runtime/components/Edit/Features/Analyze/analyzers/readability.js +61 -20
  53. package/dist/runtime/components/Edit/Features/Analyze/analyzers/types.d.ts +15 -1
  54. package/dist/runtime/components/Edit/Features/Analyze/index.vue +23 -2
  55. package/dist/runtime/components/Edit/Features/Artboard/Overview/index.vue +22 -8
  56. package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +1 -1
  57. package/dist/runtime/components/Edit/Features/Artboard/Scrollbar/index.vue +8 -3
  58. package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +10 -1
  59. package/dist/runtime/components/Edit/Features/Debug/Main.vue.d.ts +1 -1
  60. package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +2 -2
  61. package/dist/runtime/components/Edit/Features/Debug/Section/Logging.vue.d.ts +1 -1
  62. package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +8 -2
  63. package/dist/runtime/components/Edit/Features/EditForm/index.vue +1 -7
  64. package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +1 -1
  65. package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +4 -3
  66. package/dist/runtime/components/Edit/Features/EditableMask/index.vue +1 -1
  67. package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +7 -2
  68. package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +2 -2
  69. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +9 -2
  70. package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +12 -3
  71. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +3 -2
  72. package/dist/runtime/components/Edit/Features/Options/Form/Item.vue.d.ts +1 -1
  73. package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +1 -0
  74. package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +9 -0
  75. package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue +3 -2
  76. package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +3 -2
  77. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +8 -2
  78. package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +12 -2
  79. package/dist/runtime/components/Edit/Features/Search/Overlay/index.vue +11 -3
  80. package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +126 -33
  81. package/dist/runtime/components/Edit/Features/Selection/Renderer/index.vue +1 -1
  82. package/dist/runtime/components/Edit/Features/Settings/index.vue +1 -1
  83. package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +3 -3
  84. package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +2 -2
  85. package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue +7 -1
  86. package/dist/runtime/components/Edit/Form/Textarea/index.vue +1 -1
  87. package/dist/runtime/components/Edit/FormOverlay/index.vue +1 -1
  88. package/dist/runtime/components/Edit/Indicators/index.vue +1 -1
  89. package/dist/runtime/components/Edit/InfoBox/index.vue +3 -2
  90. package/dist/runtime/components/Edit/InfoBox/index.vue.d.ts +6 -1
  91. package/dist/runtime/components/Edit/Overlay/index.vue +4 -0
  92. package/dist/runtime/components/Edit/PreviewProvider.vue +3 -3
  93. package/dist/runtime/components/Edit/ScaleToFit/index.vue +4 -4
  94. package/dist/runtime/composables/defineBlokkliFeature.d.ts +1 -1
  95. package/dist/runtime/composables/useBlokkli.d.ts +6 -1
  96. package/dist/runtime/composables/useBlokkli.js +4 -1
  97. package/dist/runtime/css/output.css +1 -1
  98. package/dist/runtime/helpers/composables/defineItemDropdownAction.d.ts +1 -1
  99. package/dist/runtime/helpers/composables/defineMenuButton.d.ts +1 -1
  100. package/dist/runtime/helpers/composables/defineRenderer.d.ts +1 -1
  101. package/dist/runtime/helpers/composables/onBroadcastEvent.d.ts +1 -1
  102. package/dist/runtime/helpers/composables/useBlockRegistration.d.ts +1 -1
  103. package/dist/runtime/helpers/composables/useBlockRegistration.js +12 -1
  104. package/dist/runtime/helpers/composables/useDebugLogger.d.ts +1 -1
  105. package/dist/runtime/helpers/composables/useFocusTrap.d.ts +52 -0
  106. package/dist/runtime/helpers/composables/useFocusTrap.js +59 -0
  107. package/dist/runtime/helpers/composables/useGlobalBlokkliObject.d.ts +1 -1
  108. package/dist/runtime/helpers/{useTransitionedValue.js → composables/useTransitionedValue.js} +1 -1
  109. package/dist/runtime/helpers/imports/index.d.ts +2 -1
  110. package/dist/runtime/helpers/imports/index.js +10 -1
  111. package/dist/runtime/helpers/{animationProvider.d.ts → providers/animation.d.ts} +100 -7
  112. package/dist/runtime/helpers/{animationProvider.js → providers/animation.js} +21 -11
  113. package/dist/runtime/helpers/providers/blocks.d.ts +25 -3
  114. package/dist/runtime/helpers/providers/blocks.js +9 -0
  115. package/dist/runtime/helpers/providers/commands.d.ts +41 -0
  116. package/dist/runtime/helpers/{commandsProvider.js → providers/commands.js} +1 -1
  117. package/dist/runtime/helpers/providers/debug.d.ts +125 -0
  118. package/dist/runtime/helpers/{debugProvider.js → providers/debug.js} +2 -2
  119. package/dist/runtime/helpers/providers/definition.d.ts +87 -0
  120. package/dist/runtime/helpers/providers/directive.d.ts +88 -2
  121. package/dist/runtime/helpers/providers/directive.js +18 -2
  122. package/dist/runtime/helpers/providers/dom.d.ts +225 -0
  123. package/dist/runtime/helpers/{domProvider.js → providers/dom.js} +27 -74
  124. package/dist/runtime/helpers/providers/dropArea.d.ts +47 -0
  125. package/dist/runtime/helpers/{dropAreaProvider.js → providers/dropArea.js} +1 -1
  126. package/dist/runtime/helpers/providers/element.d.ts +58 -1
  127. package/dist/runtime/helpers/providers/features.d.ts +56 -0
  128. package/dist/runtime/helpers/{featuresProvider.js → providers/features.js} +1 -1
  129. package/dist/runtime/helpers/providers/fields.d.ts +18 -11
  130. package/dist/runtime/helpers/providers/fields.js +1 -1
  131. package/dist/runtime/helpers/providers/indicators.d.ts +44 -0
  132. package/dist/runtime/helpers/providers/keyboard.d.ts +76 -0
  133. package/dist/runtime/helpers/{keyboardProvider.js → providers/keyboard.js} +1 -8
  134. package/dist/runtime/helpers/{pluginProvider.d.ts → providers/plugin.d.ts} +36 -0
  135. package/dist/runtime/helpers/{selectionProvider.d.ts → providers/selection.d.ts} +4 -1
  136. package/dist/runtime/helpers/{selectionProvider.js → providers/selection.js} +1 -1
  137. package/dist/runtime/helpers/providers/state.d.ts +227 -0
  138. package/dist/runtime/helpers/{stateProvider.js → providers/state.js} +3 -3
  139. package/dist/runtime/helpers/providers/storage.d.ts +64 -0
  140. package/dist/runtime/helpers/{textProvider.d.ts → providers/texts.d.ts} +1 -1
  141. package/dist/runtime/helpers/providers/theme.d.ts +119 -0
  142. package/dist/runtime/helpers/{themeProvider.js → providers/theme.js} +3 -3
  143. package/dist/runtime/helpers/providers/tour.d.ts +49 -0
  144. package/dist/runtime/helpers/{tourProvider.js → providers/tour.js} +1 -1
  145. package/dist/runtime/helpers/providers/types.d.ts +170 -0
  146. package/dist/runtime/helpers/{typesProvider.js → providers/types.js} +45 -1
  147. package/dist/runtime/helpers/providers/ui.d.ts +339 -0
  148. package/dist/runtime/helpers/{uiProvider.js → providers/ui.js} +11 -5
  149. package/dist/runtime/helpers/runtimeHelpers/index.d.ts +1 -1
  150. package/dist/runtime/helpers/symbols.d.ts +1 -0
  151. package/dist/runtime/helpers/symbols.js +3 -0
  152. package/dist/runtime/types/blockOptions.d.ts +349 -0
  153. package/dist/runtime/types/index.d.ts +22 -26
  154. package/package.json +2 -2
  155. package/dist/runtime/helpers/commandsProvider.d.ts +0 -9
  156. package/dist/runtime/helpers/debugProvider.d.ts +0 -33
  157. package/dist/runtime/helpers/definitionProvider.d.ts +0 -19
  158. package/dist/runtime/helpers/domProvider.d.ts +0 -91
  159. package/dist/runtime/helpers/dropAreaProvider.d.ts +0 -9
  160. package/dist/runtime/helpers/featuresProvider.d.ts +0 -17
  161. package/dist/runtime/helpers/indicatorsProvider.d.ts +0 -10
  162. package/dist/runtime/helpers/keyboardProvider.d.ts +0 -20
  163. package/dist/runtime/helpers/stateProvider.d.ts +0 -47
  164. package/dist/runtime/helpers/storageProvider.d.ts +0 -17
  165. package/dist/runtime/helpers/themeProvider.d.ts +0 -30
  166. package/dist/runtime/helpers/tourProvider.d.ts +0 -11
  167. package/dist/runtime/helpers/typesProvider.d.ts +0 -36
  168. package/dist/runtime/helpers/uiProvider.d.ts +0 -57
  169. package/dist/runtime/types/blokkOptions.d.ts +0 -100
  170. /package/dist/runtime/helpers/{addElementClasses.d.ts → composables/addElementClasses.d.ts} +0 -0
  171. /package/dist/runtime/helpers/{addElementClasses.js → composables/addElementClasses.js} +0 -0
  172. /package/dist/runtime/helpers/{defineElementStyle.d.ts → composables/defineElementStyle.d.ts} +0 -0
  173. /package/dist/runtime/helpers/{defineElementStyle.js → composables/defineElementStyle.js} +0 -0
  174. /package/dist/runtime/helpers/{useTransitionedValue.d.ts → composables/useTransitionedValue.d.ts} +0 -0
  175. /package/dist/runtime/helpers/{broadcastProvider.d.ts → providers/broadcast.d.ts} +0 -0
  176. /package/dist/runtime/helpers/{broadcastProvider.js → providers/broadcast.js} +0 -0
  177. /package/dist/runtime/helpers/{definitionProvider.js → providers/definition.js} +0 -0
  178. /package/dist/runtime/helpers/{indicatorsProvider.js → providers/indicators.js} +0 -0
  179. /package/dist/runtime/helpers/{pluginProvider.js → providers/plugin.js} +0 -0
  180. /package/dist/runtime/helpers/{storageProvider.js → providers/storage.js} +0 -0
  181. /package/dist/runtime/helpers/{textProvider.js → providers/texts.js} +0 -0
  182. /package/dist/runtime/types/{blokkOptions.js → blockOptions.js} +0 -0
@@ -1,8 +1,14 @@
1
+ import type { AnalyzeNodeTargetMapped } from '#blokkli/analyzer/types';
1
2
  type __VLS_Props = {
2
3
  resultId: string;
3
- target: string | HTMLElement | {
4
- uuid: string;
5
- };
4
+ target: AnalyzeNodeTargetMapped;
6
5
  };
7
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ type __VLS_PublicProps = __VLS_Props & {
7
+ modelValue?: string;
8
+ };
9
+ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ "update:modelValue": (value: string) => any;
11
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
12
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
14
  export default _default;
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <svg :width="size" :height="size" :viewBox="`0 0 ${size} ${size}`">
3
3
  <circle
4
- v-if="data.length === 1"
4
+ v-if="dataWithValues.length === 1"
5
5
  :cx="radius"
6
6
  :cy="radius"
7
7
  :r="radius"
8
- :fill="data[0]?.color"
8
+ :fill="dataWithValues[0]?.color"
9
9
  />
10
10
  <g v-else :transform="`translate(${radius}, ${radius})`">
11
11
  <path
@@ -40,11 +40,14 @@ const props = defineProps({
40
40
  percentage: { type: Number, required: false, default: void 0 }
41
41
  });
42
42
  const size = computed(() => props.radius * 2);
43
+ const dataWithValues = computed(
44
+ () => props.data.filter((item) => item.value > 0)
45
+ );
43
46
  const segments = computed(() => {
44
47
  const total = props.data.reduce((sum, item) => sum + item.value, 0);
45
48
  if (total === 0) return [];
46
49
  let currentAngle = -90;
47
- return props.data.map((item) => {
50
+ return props.data.filter((item) => item.value > 0).map((item) => {
48
51
  const percentage = item.value / total;
49
52
  const angle = percentage * 360;
50
53
  const startAngle = currentAngle;
@@ -77,7 +80,8 @@ function createPieSegment(cx, cy, radius, startAngle, endAngle) {
77
80
  const largeArc = endAngle - startAngle > 180 ? 1 : 0;
78
81
  if (endAngle - startAngle >= 360) {
79
82
  return `
80
- M ${cx + radius} ${cy}
83
+ M ${cx} ${cy}
84
+ L ${cx + radius} ${cy}
81
85
  A ${radius} ${radius} 0 1 1 ${cx + radius} ${cy + 1e-3}
82
86
  Z
83
87
  `;
@@ -54,6 +54,7 @@ export default defineAnalyzer((options) => {
54
54
  };
55
55
  return {
56
56
  id: "axe",
57
+ label: "Axe (Accessibility Check)",
57
58
  requireRawPage: true,
58
59
  init: function(context) {
59
60
  const locale = getLocale(context.interfaceLangcode) ?? {};
@@ -1,6 +1,6 @@
1
1
  import type { FieldListItemTyped } from '#blokkli-build/generated-types';
2
- import type { StateProvider } from '#blokkli/helpers/stateProvider';
3
- import type { TextProvider } from '#blokkli/helpers/textProvider';
2
+ import type { StateProvider } from '#blokkli/helpers/providers/state';
3
+ import type { TextProvider } from '#blokkli/helpers/providers/texts';
4
4
  import type { MutatedField } from '#blokkli/types';
5
5
  import type { AnalyzeCategory, AnalyzeNode, AnalyzeResult, AnalyzeStatus } from '../types.js';
6
6
  import { type TextElement } from './collectTextElements.js';
@@ -10,12 +10,13 @@ export declare class AnalyzerContext {
10
10
  readonly providerRootElement: HTMLElement;
11
11
  private state;
12
12
  readonly $t: TextProvider;
13
+ readonly signal?: AbortSignal | undefined;
13
14
  readonly mutatedFields: Readonly<MutatedField[]>;
14
15
  /**
15
16
  * The collected text elements.
16
17
  */
17
18
  private textElements;
18
- constructor(langcode: string, interfaceLangcode: string, providerRootElement: HTMLElement, state: StateProvider, $t: TextProvider);
19
+ constructor(langcode: string, interfaceLangcode: string, providerRootElement: HTMLElement, state: StateProvider, $t: TextProvider, signal?: AbortSignal | undefined);
19
20
  /**
20
21
  * Get the field list item for a block UUID.
21
22
  */
@@ -1,11 +1,12 @@
1
1
  import { collectTextElements } from "./collectTextElements.js";
2
2
  export class AnalyzerContext {
3
- constructor(langcode, interfaceLangcode, providerRootElement, state, $t) {
3
+ constructor(langcode, interfaceLangcode, providerRootElement, state, $t, signal) {
4
4
  this.langcode = langcode;
5
5
  this.interfaceLangcode = interfaceLangcode;
6
6
  this.providerRootElement = providerRootElement;
7
7
  this.state = state;
8
8
  this.$t = $t;
9
+ this.signal = signal;
9
10
  this.mutatedFields = JSON.parse(JSON.stringify(state.mutatedFields.value));
10
11
  }
11
12
  mutatedFields;
@@ -10,7 +10,7 @@ const LIX_BANDS = { easyMax: 40, okMax: 59 };
10
10
  const CLI_HARD_MIN = 12;
11
11
  const ARI_HARD_MIN = 12;
12
12
  const GULPEASE_BANDS = { easyMin: 80, okMin: 60 };
13
- const MIN_WORDS_FOR_CONFIDENCE = 30;
13
+ const MIN_WORDS_FOR_CONFIDENCE = 5;
14
14
  function mapLang(langcode) {
15
15
  const lc = (langcode || "").toLowerCase();
16
16
  if (lc.startsWith("de")) return "de_CH";
@@ -70,22 +70,48 @@ function summarizeImpact(nodes) {
70
70
  function format(n, d = 1) {
71
71
  return typeof n === "number" && Number.isFinite(n) ? n.toFixed(d) : "\u2014";
72
72
  }
73
- function analyzeReadability(tr, blocks, langcode, $t) {
73
+ function analyzeReadability(tr, blocks, langcode, $t, cache) {
74
74
  const lang = langcode ?? "en";
75
75
  const nodes = [];
76
76
  for (const b of blocks) {
77
77
  const text = (b.text || "").trim();
78
78
  if (!text) continue;
79
79
  const words = segmentWords(text);
80
- if (words.length < MIN_WORDS_FOR_CONFIDENCE) continue;
81
- const sentences = Math.max(1, countSentences(text));
82
- const avgSentLen = words.length / sentences;
83
- const lix = safe(() => tr.lix(text));
84
- const cli = safe(() => tr.colemanLiauIndex(text));
85
- const ari = safe(() => tr.automatedReadabilityIndex(text));
86
- const gulpease = lang === "it" ? safe(() => tr.gulpeaseIndex(text)) : void 0;
87
- const band = toBand(lang, { lix, cli, ari, gulpease });
88
- if (band !== "hard") continue;
80
+ if (words.length < MIN_WORDS_FOR_CONFIDENCE) {
81
+ continue;
82
+ }
83
+ const cacheKey = `${langcode}:${text}`;
84
+ let scores;
85
+ const cached = cache.get(cacheKey);
86
+ if (cached) {
87
+ scores = cached;
88
+ } else {
89
+ const sentences = Math.max(1, countSentences(text));
90
+ const avgSentLen = words.length / sentences;
91
+ const lix = safe(() => tr.lix(text));
92
+ const cli = safe(() => tr.colemanLiauIndex(text));
93
+ const ari = safe(() => tr.automatedReadabilityIndex(text));
94
+ const gulpease = lang === "it" ? safe(() => tr.gulpeaseIndex(text)) : void 0;
95
+ scores = {
96
+ lix,
97
+ cli,
98
+ ari,
99
+ gulpease,
100
+ words: words.length,
101
+ sentences,
102
+ avgSentLen
103
+ };
104
+ cache.set(cacheKey, scores);
105
+ }
106
+ const band = toBand(lang, {
107
+ lix: scores.lix,
108
+ cli: scores.cli,
109
+ ari: scores.ari,
110
+ gulpease: scores.gulpease
111
+ });
112
+ if (band !== "hard") {
113
+ continue;
114
+ }
89
115
  const parts = [];
90
116
  parts.push(
91
117
  $t("analyzerReadabiliyHardToRead", `Hard to read (@lang).`).replace(
@@ -93,16 +119,21 @@ function analyzeReadability(tr, blocks, langcode, $t) {
93
119
  lang.toUpperCase()
94
120
  )
95
121
  );
96
- if (lix != null) parts.push(`LIX ${format(lix)}`);
97
- if (lang === "it" && gulpease != null)
98
- parts.push(`Gulpease ${format(gulpease)}`);
99
- if (cli != null) parts.push(`CLI ${format(cli)}`);
100
- if (avgSentLen > 25) {
122
+ if (scores.lix != null) {
123
+ parts.push(`LIX ${format(scores.lix)}`);
124
+ }
125
+ if (lang === "it" && scores.gulpease != null) {
126
+ parts.push(`Gulpease ${format(scores.gulpease)}`);
127
+ }
128
+ if (scores.cli != null) {
129
+ parts.push(`CLI ${format(scores.cli)}`);
130
+ }
131
+ if (scores.avgSentLen > 25) {
101
132
  parts.push(
102
133
  $t(
103
134
  "analyzerReadabiliyAverageSentenceLength",
104
135
  `Average sentence length @length \u2192 split sentences.`
105
- ).replace("@length", format(avgSentLen))
136
+ ).replace("@length", format(scores.avgSentLen))
106
137
  );
107
138
  } else {
108
139
  parts.push(
@@ -114,7 +145,7 @@ function analyzeReadability(tr, blocks, langcode, $t) {
114
145
  }
115
146
  nodes.push({
116
147
  description: parts.join(" \xB7 "),
117
- impact: impactFor(lix),
148
+ impact: impactFor(scores.lix),
118
149
  targets: [b.element]
119
150
  });
120
151
  }
@@ -142,8 +173,16 @@ function safe(fn) {
142
173
  }
143
174
  export default defineAnalyzer(() => {
144
175
  let textReadability = null;
176
+ const cache = /* @__PURE__ */ new Map();
145
177
  return {
146
178
  id: "readability",
179
+ label: (langcode) => {
180
+ if (langcode === "de") {
181
+ return "Lesbarkeit";
182
+ }
183
+ return "Readability";
184
+ },
185
+ continuous: true,
147
186
  init: function(context) {
148
187
  textReadability = new TextReadability({
149
188
  lang: mapLang(context.langcode),
@@ -154,11 +193,13 @@ export default defineAnalyzer(() => {
154
193
  if (!isSupportedLangcode(context.langcode)) {
155
194
  return;
156
195
  }
196
+ const elements = context.getTextElements();
157
197
  return analyzeReadability(
158
198
  textReadability,
159
- context.getTextElements(),
199
+ elements,
160
200
  context.langcode,
161
- context.$t
201
+ context.$t,
202
+ cache
162
203
  );
163
204
  }
164
205
  };
@@ -5,6 +5,10 @@ export type AnalyzeCategory = 'accessibility' | 'seo' | 'text' | 'content';
5
5
  export type AnalyzeNodeTarget = string | HTMLElement | {
6
6
  uuid: string;
7
7
  };
8
+ export type AnalyzeNodeTargetMapped = {
9
+ target: AnalyzeNodeTarget;
10
+ globalIndex: number;
11
+ };
8
12
  export type AnalyzeNode = {
9
13
  description?: string;
10
14
  impact?: AnalyzeImpact;
@@ -16,6 +20,9 @@ export type AnalyzeNode = {
16
20
  */
17
21
  targets: AnalyzeNodeTarget | AnalyzeNodeTarget[];
18
22
  };
23
+ export type AnalyzeNodeMapped = Omit<AnalyzeNode, 'targets'> & {
24
+ targets: AnalyzeNodeTargetMapped[];
25
+ };
19
26
  export type AnalyzeResult = {
20
27
  id: string;
21
28
  title: string;
@@ -30,15 +37,22 @@ export type AnalyzeResult = {
30
37
  */
31
38
  scoreTargets?: boolean;
32
39
  };
33
- export type AnalyzeResultMapped = AnalyzeResult & {
40
+ export type AnalyzeResultMapped = Omit<AnalyzeResult, 'nodes'> & {
34
41
  plugin: string;
42
+ nodes: AnalyzeNodeMapped[];
35
43
  };
36
44
  export type Analyzer = {
37
45
  id: string;
46
+ label?: string | ((langcode: string) => string);
38
47
  /**
39
48
  * If true, the raw page (without editor UI) is required for this analyzer.
40
49
  */
41
50
  requireRawPage?: boolean;
51
+ /**
52
+ * If true, the analyzer is called automatically. This assumes it runs without
53
+ * blocking the main thread.
54
+ */
55
+ continuous?: boolean;
42
56
  init?: (context: AnalyzerContext) => void | Promise<void>;
43
57
  run: (context: AnalyzerContext) => undefined | null | AnalyzeResult | AnalyzeResult[] | Promise<undefined | null | AnalyzeResult | AnalyzeResult[]>;
44
58
  };
@@ -4,9 +4,27 @@
4
4
  :title="$t('analyzeSidebarTitle', 'Analyze')"
5
5
  :tour-text="$t('analyzeTourText', 'Analyze the content of your page')"
6
6
  icon="speedometer"
7
+ weight="10"
8
+ :is-loading="isRunning"
7
9
  >
10
+ <template #icon>
11
+ <AnalyzeIcon :is-running />
12
+ </template>
13
+ <div v-if="ui.isProxyMode.value" class="bk-sidebar-padding bk">
14
+ <InfoBox
15
+ :text="
16
+ $t(
17
+ 'analyzeNotAvailableInStructureView',
18
+ 'Analyze is not available in structure view.'
19
+ )
20
+ "
21
+ icon="tree"
22
+ />
23
+ </div>
8
24
  <AnalyzerMain
25
+ v-else
9
26
  :key="animation.renderKey.value"
27
+ v-model="isRunning"
10
28
  :langcode="context.language"
11
29
  :analyzers
12
30
  />
@@ -14,9 +32,11 @@
14
32
  </template>
15
33
 
16
34
  <script setup>
17
- import { useBlokkli, defineBlokkliFeature } from "#imports";
35
+ import { useBlokkli, defineBlokkliFeature, ref } from "#imports";
18
36
  import { PluginSidebar } from "#blokkli/plugins";
37
+ import { InfoBox } from "#blokkli/components";
19
38
  import AnalyzerMain from "./Main.vue";
39
+ import AnalyzeIcon from "./Icon.vue";
20
40
  const { adapter } = defineBlokkliFeature({
21
41
  id: "analyze",
22
42
  label: "Analyze",
@@ -25,6 +45,8 @@ const { adapter } = defineBlokkliFeature({
25
45
  description: "Analyze blocks and page for SEO, accessibility, etc.",
26
46
  viewports: []
27
47
  });
48
+ const { $t, context, animation, ui } = useBlokkli();
49
+ const isRunning = ref(false);
28
50
  function getAdapterAnalyzers() {
29
51
  const result = adapter.getAnalyzers();
30
52
  if (Array.isArray(result)) {
@@ -38,7 +60,6 @@ function getAdapterAnalyzers() {
38
60
  });
39
61
  }
40
62
  const analyzers = await getAdapterAnalyzers();
41
- const { $t, context, animation } = useBlokkli();
42
63
  </script>
43
64
 
44
65
  <script>
@@ -18,14 +18,16 @@
18
18
  </template>
19
19
 
20
20
  <script setup>
21
- import { overview } from "artboard-deluxe";
21
+ import {
22
+ overview
23
+ } from "artboard-deluxe";
22
24
  import {
23
25
  onBeforeUnmount,
24
26
  onMounted,
25
- ref,
26
27
  useBlokkli,
27
28
  computed,
28
- useTemplateRef
29
+ useTemplateRef,
30
+ watch
29
31
  } from "#imports";
30
32
  import { ViewportBlockingRect } from "#blokkli/components";
31
33
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
@@ -40,9 +42,9 @@ const selectedColor = computed(() => {
40
42
  return theme.getColorString("accent", "700", 1);
41
43
  });
42
44
  const overviewEl = useTemplateRef("overviewEl");
43
- const overviewArtboardEl = ref();
44
- const overviewVisibleEl = ref();
45
- const canvas = ref();
45
+ const overviewArtboardEl = useTemplateRef("overviewArtboardEl");
46
+ const overviewVisibleEl = useTemplateRef("overviewVisibleEl");
47
+ const canvas = useTemplateRef("canvas");
46
48
  let pluginOverview = null;
47
49
  function updateCanvas() {
48
50
  const ctx = canvas.value?.getContext("2d");
@@ -78,6 +80,13 @@ function updateCanvas() {
78
80
  }
79
81
  }
80
82
  onBlokkliEvent("animationFrame", updateCanvas);
83
+ const overviewOptions = computed(() => {
84
+ return {
85
+ padding: 15,
86
+ autoHeight: true,
87
+ maxHeight: ui.visibleViewportPadded.value.height
88
+ };
89
+ });
81
90
  onMounted(() => {
82
91
  if (overviewEl.value && overviewArtboardEl.value && overviewVisibleEl.value) {
83
92
  const el = overviewEl.value.$el;
@@ -87,13 +96,18 @@ onMounted(() => {
87
96
  element: el,
88
97
  artboardElement: overviewArtboardEl.value,
89
98
  visibleAreaElement: overviewVisibleEl.value,
90
- padding: 20,
91
- autoHeight: true
99
+ ...overviewOptions.value
92
100
  })
93
101
  );
94
102
  }
95
103
  }
96
104
  });
105
+ watch(overviewOptions, (newOptions) => {
106
+ if (!pluginOverview) {
107
+ return;
108
+ }
109
+ pluginOverview.options.setMultiple(newOptions);
110
+ });
97
111
  onBeforeUnmount(() => {
98
112
  if (pluginOverview) {
99
113
  props.artboard.removePlugin(pluginOverview);
@@ -71,7 +71,7 @@ import {
71
71
  mouse,
72
72
  dom as domPlugin
73
73
  } from "artboard-deluxe";
74
- import { addElementClasses } from "#blokkli/helpers/addElementClasses";
74
+ import { addElementClasses } from "#blokkli/helpers/composables/addElementClasses";
75
75
  const props = defineProps({
76
76
  persist: { type: Boolean, required: true },
77
77
  momentum: { type: Boolean, required: true },
@@ -13,14 +13,19 @@
13
13
 
14
14
  <script setup>
15
15
  import { scrollbar } from "artboard-deluxe";
16
- import { onBeforeUnmount, onMounted, ref, useBlokkli } from "#imports";
16
+ import {
17
+ onBeforeUnmount,
18
+ onMounted,
19
+ useBlokkli,
20
+ useTemplateRef
21
+ } from "#imports";
17
22
  const props = defineProps({
18
23
  artboard: { type: Object, required: true },
19
24
  orientation: { type: String, required: true }
20
25
  });
21
26
  const { ui } = useBlokkli();
22
- const el = ref();
23
- const thumb = ref();
27
+ const el = useTemplateRef("el");
28
+ const thumb = useTemplateRef("thumb");
24
29
  let scrollbarPlugin = null;
25
30
  onMounted(() => {
26
31
  if (el.value && thumb.value) {
@@ -68,7 +68,7 @@
68
68
 
69
69
  <script setup>
70
70
  import { falsy } from "#blokkli/helpers";
71
- import { computed, useBlokkli, ref } from "#imports";
71
+ import { computed, useBlokkli, ref, watch } from "#imports";
72
72
  import ScheduleSection from "./ScheduleSection.vue";
73
73
  import { DialogModal } from "#blokkli/components";
74
74
  const props = defineProps({
@@ -142,6 +142,15 @@ const publishOn = ref(
142
142
  const unpublishOn = ref(
143
143
  getCommonDate(unpublishOnItems.value, props.bundlesWithUnpublish)
144
144
  );
145
+ watch(
146
+ () => [publishOn.value, unpublishOn.value],
147
+ () => {
148
+ ui.requireDialogCloseConfirm();
149
+ },
150
+ {
151
+ once: true
152
+ }
153
+ );
145
154
  const tableRows = computed(() => {
146
155
  return items.value.map((item) => {
147
156
  const bundleDef = types.getBlockBundleDefinition(item.bundle);
@@ -1,4 +1,4 @@
1
- import type { DebugLogger } from '#blokkli/helpers/debugProvider';
1
+ import type { DebugLogger } from '#blokkli/helpers/providers/debug';
2
2
  type __VLS_Props = {
3
3
  logger: DebugLogger;
4
4
  };
@@ -11,11 +11,11 @@
11
11
  </template>
12
12
 
13
13
  <script setup>
14
- import { useBlokkli, ref } from "#imports";
14
+ import { useBlokkli, useTemplateRef } from "#imports";
15
15
  import { falsy, intersects } from "#blokkli/helpers";
16
16
  import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
17
17
  const { ui, dom, directive } = useBlokkli();
18
- const canvasRects = ref(null);
18
+ const canvasRects = useTemplateRef("canvasRects");
19
19
  function drawRects(ctx, rects, scale, offset, viewport) {
20
20
  for (let i = 0; i < rects.length; i++) {
21
21
  const rect = rects[i];
@@ -1,4 +1,4 @@
1
- import type { DebugLogger } from '#blokkli/helpers/debugProvider';
1
+ import type { DebugLogger } from '#blokkli/helpers/providers/debug';
2
2
  type __VLS_Props = {
3
3
  logger: DebugLogger;
4
4
  };
@@ -13,10 +13,16 @@
13
13
  </template>
14
14
 
15
15
  <script setup>
16
- import { ref, useBlokkli, onUnmounted, onMounted } from "#imports";
16
+ import {
17
+ ref,
18
+ useBlokkli,
19
+ onUnmounted,
20
+ onMounted,
21
+ useTemplateRef
22
+ } from "#imports";
17
23
  import { Loading, BlokkliTransition } from "#blokkli/components";
18
24
  const { eventBus } = useBlokkli();
19
- const iframe = ref(null);
25
+ const iframe = useTemplateRef("iframe");
20
26
  const isLoaded = ref(false);
21
27
  const emit = defineEmits(["close"]);
22
28
  const props = defineProps({
@@ -1,13 +1,7 @@
1
1
  <template>
2
2
  <Teleport :to="ui.mainLayoutElement.value">
3
3
  <BlokkliTransition name="slide-in">
4
- <FormOverlay
5
- v-if="form"
6
- id="edit-form"
7
- :bundle="bundle"
8
- :title="title"
9
- @close="onClose"
10
- >
4
+ <FormOverlay v-if="form" id="edit-form" :bundle :title @close="onClose">
11
5
  <FormFrame
12
6
  v-if="formUrl"
13
7
  :url="formUrl"
@@ -12,7 +12,7 @@
12
12
  enterkeyhint="done"
13
13
  rows="2"
14
14
  v-bind="inputAttributes"
15
- @keydown.stop.capture="onKeyDown"
15
+ @keydown.capture="onKeyDown"
16
16
  @blur="onBlur"
17
17
  @input="
18
18
  $emit('update:modelValue', $event.target.value)
@@ -64,7 +64,8 @@ import {
64
64
  onMounted,
65
65
  onBeforeUnmount,
66
66
  useBlokkli,
67
- nextTick
67
+ nextTick,
68
+ useTemplateRef
68
69
  } from "#imports";
69
70
  import { falsy } from "#blokkli/helpers";
70
71
  import InputPlaintext from "./Plaintext/index.vue";
@@ -108,8 +109,8 @@ const loaded = ref(false);
108
109
  const originalText = ref(props.value || "");
109
110
  const modelValue = ref("");
110
111
  const inputStyle = ref({});
111
- const form = ref(null);
112
- const input = ref(null);
112
+ const form = useTemplateRef("form");
113
+ const input = useTemplateRef("input");
113
114
  const hasChanged = computed(() => modelValue.value !== originalText.value);
114
115
  const itemBundle = computed(() => props.host.bundle);
115
116
  const maxlength = computed(() => props.config.maxLength);
@@ -19,7 +19,7 @@
19
19
  <script setup>
20
20
  import { useBlokkli, defineBlokkliFeature, ref } from "#imports";
21
21
  import { PluginViewOption } from "#blokkli/plugins";
22
- import { addElementClasses } from "#blokkli/helpers/addElementClasses";
22
+ import { addElementClasses } from "#blokkli/helpers/composables/addElementClasses";
23
23
  defineBlokkliFeature({
24
24
  id: "editable-mask",
25
25
  icon: "texturebox",
@@ -51,7 +51,12 @@
51
51
 
52
52
  <script setup>
53
53
  import defineCommands from "#blokkli/helpers/composables/defineCommands";
54
- import { useBlokkli, defineBlokkliFeature, ref, computed } from "#imports";
54
+ import {
55
+ useBlokkli,
56
+ defineBlokkliFeature,
57
+ computed,
58
+ useTemplateRef
59
+ } from "#imports";
55
60
  import defineTourItem from "#blokkli/helpers/composables/defineTourItem";
56
61
  import { Icon } from "#blokkli/components";
57
62
  defineBlokkliFeature({
@@ -62,7 +67,7 @@ defineBlokkliFeature({
62
67
  });
63
68
  const { state, eventBus, $t, ui } = useBlokkli();
64
69
  const { entity, mutations } = state;
65
- const buttonEl = ref(null);
70
+ const buttonEl = useTemplateRef("buttonEl");
66
71
  const scheduledDate = computed(() => state.publishOptions.value?.publishOn);
67
72
  const formattedScheduledDate = computed(() => {
68
73
  if (!scheduledDate.value) {
@@ -38,7 +38,7 @@
38
38
 
39
39
  <script setup>
40
40
  import onBroadcastEvent from "#blokkli/helpers/composables/onBroadcastEvent";
41
- import { ref, useBlokkli } from "#imports";
41
+ import { ref, useBlokkli, useTemplateRef } from "#imports";
42
42
  import { Icon } from "#blokkli/components";
43
43
  import Loading from "./../../../Loading/index.vue";
44
44
  const props = defineProps({
@@ -124,7 +124,7 @@ function onAfterLeave(el) {
124
124
  emit("close");
125
125
  }
126
126
  }
127
- const iframe = ref(null);
127
+ const iframe = useTemplateRef("iframe");
128
128
  const isLoaded = ref(false);
129
129
  const isLoading = ref(true);
130
130
  const hasPublished = ref(false);
@@ -79,7 +79,14 @@ import {
79
79
  FormSelect
80
80
  } from "#blokkli/components";
81
81
  import Loading from "./../../../Loading/index.vue";
82
- import { ref, useBlokkli, useAsyncData, computed, watch } from "#imports";
82
+ import {
83
+ ref,
84
+ useBlokkli,
85
+ useAsyncData,
86
+ computed,
87
+ watch,
88
+ useTemplateRef
89
+ } from "#imports";
83
90
  import LibraryListItem from "./Item/index.vue";
84
91
  const props = defineProps({
85
92
  field: { type: Object, required: true }
@@ -88,7 +95,7 @@ const { $t, adapter, types } = useBlokkli();
88
95
  const emit = defineEmits(["close", "submit"]);
89
96
  const searchText = ref("");
90
97
  const selectedBundle = ref("all");
91
- const listEl = ref(null);
98
+ const listEl = useTemplateRef("listEl");
92
99
  const selectedItem = ref("");
93
100
  const page = ref(0);
94
101
  const allowedBundles = computed(() => {