@blokkli/editor 2.0.0-alpha.13 → 2.0.0-alpha.14
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 +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +4003 -1162
- package/dist/modules/drupal/graphql/base/fragment.ParagraphsBlokkliConfigInput.graphql +31 -0
- package/dist/modules/drupal/graphql/base/fragment.blokkliProps.graphql +1 -0
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliEditState.graphql +1 -0
- package/dist/modules/drupal/graphql/base/query.pbEntityConfig.graphql +5 -0
- package/dist/modules/drupal/graphql/features/transform.graphql +9 -1
- package/dist/modules/drupal/graphql/features/transform_host.graphql +38 -0
- package/dist/modules/drupal/graphql/mutations/update_host_options.graphql +15 -0
- package/dist/modules/drupal/index.d.mts +1 -1
- package/dist/modules/drupal/index.mjs +20 -7
- package/dist/modules/drupal/runtime/adapter/index.js +109 -4
- package/dist/runtime/adapter/index.d.ts +54 -1
- package/dist/runtime/blokkliPlugins/AddAction/index.vue +27 -3
- package/dist/runtime/blokkliPlugins/BlockIndicator/index.vue +65 -0
- package/dist/runtime/blokkliPlugins/BlockIndicator/index.vue.d.ts +26 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue +3 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +3 -2
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +3 -3
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue +49 -11
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue.d.ts +29 -15
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +6 -7
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue +2 -9
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +1 -1
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue +6 -3
- package/dist/runtime/blokkliPlugins/index.d.ts +8 -7
- package/dist/runtime/blokkliPlugins/index.js +15 -13
- package/dist/runtime/components/Blocks/Fragment/icon.svg +1 -1
- package/dist/runtime/components/BlokkliProvider.vue +1 -0
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +1 -0
- package/dist/runtime/components/Edit/Actions/index.vue +39 -67
- package/dist/runtime/components/Edit/AddListItem/index.vue +2 -5
- package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/AddListItemIcon/index.vue +19 -0
- package/dist/runtime/components/Edit/AddListItemIcon/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/AppMenu/index.vue +5 -5
- package/dist/runtime/components/Edit/Dialog/index.vue +5 -1
- package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/DiffViewer/State.vue +276 -0
- package/dist/runtime/components/Edit/DiffViewer/State.vue.d.ts +16 -0
- package/dist/runtime/components/Edit/DragInteractions/index.vue +35 -6
- package/dist/runtime/components/Edit/EditProvider.vue +46 -35
- package/dist/runtime/components/Edit/Features/AddList/index.vue +15 -25
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/fragment.glsl +58 -0
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue +168 -0
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/vertex.glsl +72 -0
- package/dist/runtime/components/Edit/Features/Analyze/Renderer.vue +159 -0
- package/dist/runtime/components/Edit/Features/Analyze/Renderer.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue +100 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue +56 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue.d.ts +3 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue +87 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +101 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue.d.ts +8 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/Status.vue +18 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/Status.vue.d.ts +8 -0
- package/dist/runtime/components/Edit/Features/Analyze/Summary/Chart.vue +92 -0
- package/dist/runtime/components/Edit/Features/Analyze/Summary/Chart.vue.d.ts +17 -0
- package/dist/runtime/components/Edit/Features/Analyze/Summary/index.vue +77 -0
- package/dist/runtime/components/Edit/Features/Analyze/Summary/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/axe.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/axe.js +75 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/defineAnalyzer.d.ts +4 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/defineAnalyzer.js +5 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.d.ts +32 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.js +45 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/collectTextElements.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/collectTextElements.js +95 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/normalizeArray.d.ts +3 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/normalizeArray.js +13 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/index.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/index.js +2 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/readability.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/readability.js +165 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/types.d.ts +44 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/types.js +0 -0
- package/dist/runtime/components/Edit/Features/Analyze/helper.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/Analyze/helper.js +28 -0
- package/dist/runtime/components/Edit/Features/Analyze/index.vue +44 -0
- package/dist/runtime/components/Edit/Features/Anchors/Renderer.vue +136 -0
- package/dist/runtime/components/Edit/Features/Anchors/index.vue +32 -0
- package/dist/runtime/components/Edit/Features/Anchors/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Artboard/Overview/index.vue +25 -13
- package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +296 -0
- package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/Artboard/index.vue +10 -245
- package/dist/runtime/components/Edit/Features/Assistant/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +4 -4
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +161 -28
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +16 -4
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue.d.ts +0 -1
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +4 -53
- package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Conversions/index.vue +12 -14
- package/dist/runtime/components/Edit/Features/Debug/Viewport/index.vue +14 -0
- package/dist/runtime/components/Edit/Features/Debug/index.vue +27 -24
- package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue +13 -190
- package/dist/runtime/components/Edit/Features/Diff/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +4 -4
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +35 -71
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/vertex.glsl +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +62 -48
- package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +6 -2
- package/dist/runtime/components/Edit/Features/EditableMask/index.vue +3 -20
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/History/index.vue +35 -12
- package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +6 -2
- package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Library/index.vue +11 -9
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +5 -8
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/fragment.glsl +1 -1
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +9 -4
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/vertex.glsl +1 -1
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +8 -14
- package/dist/runtime/components/Edit/Features/Options/Form/Checkbox/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Options/Form/Checkbox/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +9 -3
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue.d.ts +0 -1
- package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue +37 -19
- package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue.d.ts +8 -2
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +81 -37
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue.d.ts +5 -5
- package/dist/runtime/components/Edit/Features/Options/index.vue +30 -6
- package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Publish/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Revert/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/Search/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/AddButtonsField.vue +54 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/AddButtonsField.vue.d.ts +14 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +120 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +459 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Selection/Overlay/fragment.glsl +14 -9
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +32 -11
- package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +1 -1
- package/dist/runtime/components/Edit/Features/Selection/index.vue +76 -7
- package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue +12 -17
- package/dist/runtime/components/Edit/Features/Settings/index.vue +11 -25
- package/dist/runtime/components/Edit/Features/Theme/Color/index.vue +5 -1
- package/dist/runtime/components/Edit/Features/Theme/index.vue +2 -1
- package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue +198 -0
- package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue.d.ts +13 -0
- package/dist/runtime/components/Edit/Features/Transform/index.vue +155 -44
- package/dist/runtime/components/Edit/Form/Radio/index.vue +33 -0
- package/dist/runtime/components/Edit/Form/Radio/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/Form/RadioTabs/index.vue +37 -0
- package/dist/runtime/components/Edit/Form/RadioTabs/index.vue.d.ts +22 -0
- package/dist/runtime/components/Edit/Form/Select/index.vue +29 -0
- package/dist/runtime/components/Edit/Form/Select/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/Form/Text/index.vue +33 -0
- package/dist/runtime/components/Edit/Form/Text/index.vue.d.ts +19 -0
- package/dist/runtime/components/Edit/Form/Textarea/index.vue +13 -6
- package/dist/runtime/components/Edit/Form/Textarea/index.vue.d.ts +4 -0
- package/dist/runtime/components/Edit/FormOverlay/index.vue +1 -1
- package/dist/runtime/components/Edit/Indicators/index.vue +123 -0
- package/dist/runtime/components/Edit/Indicators/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/ItemIcon/index.vue +2 -1
- package/dist/runtime/components/Edit/Konami/Game/PixelGrid.vue +66 -0
- package/dist/runtime/components/Edit/Konami/Game/PixelGrid.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Konami/Game/blokkli.png +0 -0
- package/dist/runtime/components/Edit/Konami/Game/charmap.d.ts +2 -0
- package/dist/runtime/components/Edit/Konami/Game/charmap.js +168 -0
- package/dist/runtime/components/Edit/Konami/Game/index.vue +745 -0
- package/dist/runtime/components/Edit/Konami/Game/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Konami/Game/textRendering.d.ts +8 -0
- package/dist/runtime/components/Edit/Konami/Game/textRendering.js +138 -0
- package/dist/runtime/components/Edit/Konami/Game/useIconRendering.d.ts +9 -0
- package/dist/runtime/components/Edit/Konami/Game/useIconRendering.js +130 -0
- package/dist/runtime/components/Edit/Konami/index.vue +44 -0
- package/dist/runtime/components/Edit/Konami/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Loading/index.vue +6 -2
- package/dist/runtime/components/Edit/Loading/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Messages/index.vue +8 -3
- package/dist/runtime/components/Edit/PluginConfigForm/Checkbox/index.vue +17 -0
- package/dist/runtime/components/Edit/PluginConfigForm/Checkbox/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/PluginConfigForm/Options/index.vue +37 -0
- package/dist/runtime/components/Edit/PluginConfigForm/Options/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/PluginConfigForm/Text/index.vue +43 -0
- package/dist/runtime/components/Edit/PluginConfigForm/Text/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/PluginConfigForm/index.vue +57 -0
- package/dist/runtime/components/Edit/PluginConfigForm/index.vue.d.ts +16 -0
- package/dist/runtime/components/Edit/PreviewProvider.vue +3 -4
- package/dist/runtime/components/Edit/RelativeTime/index.vue +3 -2
- package/dist/runtime/components/Edit/ShortcutIndicator/index.vue +8 -3
- package/dist/runtime/components/Edit/SystemRequirements/index.vue +3 -3
- package/dist/runtime/components/Edit/Toolbar/index.vue +3 -2
- package/dist/runtime/components/Edit/Transition/index.vue +41 -0
- package/dist/runtime/components/Edit/Transition/index.vue.d.ts +19 -0
- package/dist/runtime/components/Edit/index.d.ts +23 -15
- package/dist/runtime/components/Edit/index.js +44 -28
- package/dist/runtime/composables/defineBlokkli.js +7 -3
- package/dist/runtime/composables/defineBlokkliFeature.d.ts +4 -7
- package/dist/runtime/composables/defineBlokkliProvider.d.ts +11 -0
- package/dist/runtime/composables/defineBlokkliProvider.js +46 -0
- package/dist/runtime/composables/useBlokkliHelper.js +1 -1
- package/dist/runtime/constants/index.d.ts +3 -0
- package/dist/runtime/constants/index.js +3 -0
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/addElementClasses.d.ts +2 -0
- package/dist/runtime/helpers/addElementClasses.js +24 -0
- package/dist/runtime/helpers/animationProvider.d.ts +4 -2
- package/dist/runtime/helpers/animationProvider.js +7 -2
- package/dist/runtime/helpers/bundles/index.d.ts +1 -0
- package/dist/runtime/helpers/bundles/index.js +4 -0
- package/dist/runtime/helpers/composables/useStickyToolbar.d.ts +20 -0
- package/dist/runtime/helpers/composables/useStickyToolbar.js +215 -0
- package/dist/runtime/helpers/definitionProvider.d.ts +2 -1
- package/dist/runtime/helpers/definitionProvider.js +17 -0
- package/dist/runtime/helpers/domProvider.d.ts +2 -1
- package/dist/runtime/helpers/domProvider.js +89 -43
- package/dist/runtime/helpers/dropTargets/index.d.ts +6 -0
- package/dist/runtime/helpers/dropTargets/index.js +49 -0
- package/dist/runtime/helpers/eventBus.d.ts +1 -1
- package/dist/runtime/helpers/eventBus.js +2 -2
- package/dist/runtime/helpers/index.d.ts +10 -1
- package/dist/runtime/helpers/index.js +57 -0
- package/dist/runtime/helpers/indicatorsProvider.d.ts +10 -0
- package/dist/runtime/helpers/indicatorsProvider.js +23 -0
- package/dist/runtime/helpers/keyboardProvider.d.ts +2 -0
- package/dist/runtime/helpers/keyboardProvider.js +17 -1
- package/dist/runtime/helpers/pluginProvider.d.ts +10 -0
- package/dist/runtime/helpers/pluginProvider.js +33 -0
- package/dist/runtime/helpers/renderCycle.d.ts +1 -0
- package/dist/runtime/helpers/renderCycle.js +10 -0
- package/dist/runtime/helpers/runtimeHelpers/index.js +14 -11
- package/dist/runtime/helpers/selectionProvider.d.ts +16 -0
- package/dist/runtime/helpers/selectionProvider.js +47 -35
- package/dist/runtime/helpers/stateProvider.d.ts +6 -2
- package/dist/runtime/helpers/stateProvider.js +58 -14
- package/dist/runtime/helpers/storageProvider.d.ts +4 -3
- package/dist/runtime/helpers/storageProvider.js +56 -3
- package/dist/runtime/helpers/symbols.d.ts +1 -0
- package/dist/runtime/helpers/symbols.js +1 -0
- package/dist/runtime/helpers/textProvider.js +6 -0
- package/dist/runtime/helpers/themeProvider.d.ts +2 -0
- package/dist/runtime/helpers/themeProvider.js +4 -1
- package/dist/runtime/helpers/transform.js +1 -3
- package/dist/runtime/helpers/uiProvider.d.ts +7 -2
- package/dist/runtime/helpers/uiProvider.js +49 -47
- package/dist/runtime/helpers/useTransitionedValue.d.ts +18 -0
- package/dist/runtime/helpers/useTransitionedValue.js +57 -0
- package/dist/runtime/icons/anchor.svg +1 -0
- package/dist/runtime/icons/arrow-left.svg +1 -1
- package/dist/runtime/icons/arrow-right.svg +1 -1
- package/dist/runtime/icons/arrow-top-right.svg +1 -0
- package/dist/runtime/icons/chart.svg +1 -0
- package/dist/runtime/icons/copy.svg +1 -0
- package/dist/runtime/icons/cursor-move.svg +1 -1
- package/dist/runtime/icons/diff.svg +1 -1
- package/dist/runtime/icons/eye.svg +1 -1
- package/dist/runtime/icons/info.svg +1 -1
- package/dist/runtime/icons/link.svg +1 -0
- package/dist/runtime/icons/speedometer.svg +1 -0
- package/dist/runtime/types/blokkOptions.d.ts +8 -0
- package/dist/runtime/types/index.d.ts +163 -5
- package/dist/runtime/types/theme.d.ts +2 -1
- package/dist/shared/{editor.gz_ac6uT.d.mts → editor.CKsrTpc1.d.mts} +1 -1
- package/package.json +20 -5
- package/dist/runtime/components/Edit/Features/FieldAreas/Overlay/index.vue +0 -22
- package/dist/runtime/components/Edit/Features/FieldAreas/index.vue +0 -41
- /package/dist/runtime/components/Edit/Features/{FieldAreas/Overlay → Analyze}/index.vue.d.ts +0 -0
- /package/dist/runtime/components/Edit/Features/{FieldAreas/index.vue.d.ts → Anchors/Renderer.vue.d.ts} +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
2
|
+
close: () => any;
|
|
3
|
+
}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
|
|
4
|
+
onClose?: (() => any) | undefined;
|
|
5
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type TextAlign = 'left' | 'center' | 'right';
|
|
2
|
+
type UseTextRendering = {
|
|
3
|
+
drawTextPixels: (ctx: CanvasRenderingContext2D, text: string, x: number, y: number, color: string, align?: TextAlign, scale?: number) => void;
|
|
4
|
+
drawText: (ctx: CanvasRenderingContext2D, text: string, x: number, y: number, color: string, backgroundColor?: string, borderSize?: number, padding?: number, scale?: number) => void;
|
|
5
|
+
getTextWidth: (text: string) => number;
|
|
6
|
+
};
|
|
7
|
+
export declare function useTextRendering(): UseTextRendering;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import charData from "./charmap.js";
|
|
2
|
+
function decodeFontData(encodedData) {
|
|
3
|
+
const patterns = /* @__PURE__ */ new Map();
|
|
4
|
+
const lines = encodedData.trim().split("\n");
|
|
5
|
+
for (const line of lines) {
|
|
6
|
+
const [char, widthStr, binary] = line.split(",");
|
|
7
|
+
if (!char || !widthStr || !binary) continue;
|
|
8
|
+
const width = Number.parseInt(widthStr, 10);
|
|
9
|
+
const expectedLength = width * 8;
|
|
10
|
+
const paddedBinary = binary.padEnd(expectedLength, "0");
|
|
11
|
+
const pattern = [];
|
|
12
|
+
for (let row = 0; row < 8; row++) {
|
|
13
|
+
pattern[row] = [];
|
|
14
|
+
for (let col = 0; col < width; col++) {
|
|
15
|
+
const index = row * width + col;
|
|
16
|
+
pattern[row][col] = paddedBinary[index] === "1";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
patterns.set(char, { pattern, width });
|
|
20
|
+
}
|
|
21
|
+
return patterns;
|
|
22
|
+
}
|
|
23
|
+
export function useTextRendering() {
|
|
24
|
+
const fontPatterns = decodeFontData(charData);
|
|
25
|
+
const charHeight = 8;
|
|
26
|
+
const charAtlas = /* @__PURE__ */ new Map();
|
|
27
|
+
const atlasCanvas = document.createElement("canvas");
|
|
28
|
+
let totalWidth = 0;
|
|
29
|
+
fontPatterns.forEach((data) => {
|
|
30
|
+
totalWidth += data.width + 1;
|
|
31
|
+
});
|
|
32
|
+
atlasCanvas.width = totalWidth;
|
|
33
|
+
atlasCanvas.height = charHeight;
|
|
34
|
+
const atlasCtx = atlasCanvas.getContext("2d");
|
|
35
|
+
let currentX = 0;
|
|
36
|
+
fontPatterns.forEach((data, char) => {
|
|
37
|
+
charAtlas.set(char, {
|
|
38
|
+
x: currentX,
|
|
39
|
+
y: 0,
|
|
40
|
+
width: data.width
|
|
41
|
+
});
|
|
42
|
+
atlasCtx.fillStyle = "black";
|
|
43
|
+
for (let py = 0; py < charHeight; py++) {
|
|
44
|
+
for (let px = 0; px < data.width; px++) {
|
|
45
|
+
const isPixelOn = data.pattern[py]?.[px] ?? false;
|
|
46
|
+
if (isPixelOn) {
|
|
47
|
+
atlasCtx.fillRect(currentX + px, py, 1, 1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
currentX += data.width + 1;
|
|
52
|
+
});
|
|
53
|
+
function drawTextPixels(ctx, text, x, y, color, align = "left", scale = 1) {
|
|
54
|
+
const textWidth = getTextWidth(text) * scale;
|
|
55
|
+
let startX = x;
|
|
56
|
+
if (align === "right") {
|
|
57
|
+
startX = x - textWidth;
|
|
58
|
+
} else if (align === "center") {
|
|
59
|
+
startX = x - Math.floor(textWidth / 2);
|
|
60
|
+
}
|
|
61
|
+
ctx.fillStyle = color;
|
|
62
|
+
let currentX2 = startX;
|
|
63
|
+
ctx.imageSmoothingEnabled = false;
|
|
64
|
+
text.split("").forEach((char) => {
|
|
65
|
+
if (char === " ") {
|
|
66
|
+
currentX2 += 3 * scale;
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const atlasData = charAtlas.get(char);
|
|
70
|
+
if (!atlasData) return;
|
|
71
|
+
ctx.drawImage(
|
|
72
|
+
atlasCanvas,
|
|
73
|
+
atlasData.x,
|
|
74
|
+
atlasData.y,
|
|
75
|
+
atlasData.width,
|
|
76
|
+
charHeight,
|
|
77
|
+
// source
|
|
78
|
+
currentX2,
|
|
79
|
+
y,
|
|
80
|
+
atlasData.width * scale,
|
|
81
|
+
charHeight * scale
|
|
82
|
+
// destination
|
|
83
|
+
);
|
|
84
|
+
currentX2 += (atlasData.width + 1) * scale;
|
|
85
|
+
});
|
|
86
|
+
ctx.imageSmoothingEnabled = true;
|
|
87
|
+
}
|
|
88
|
+
function getTextWidth(text) {
|
|
89
|
+
let width = 0;
|
|
90
|
+
text.split("").forEach((char, index) => {
|
|
91
|
+
if (char === " ") {
|
|
92
|
+
width += 3;
|
|
93
|
+
} else {
|
|
94
|
+
const atlasData = charAtlas.get(char);
|
|
95
|
+
if (atlasData) {
|
|
96
|
+
width += atlasData.width;
|
|
97
|
+
if (index < text.length - 1) {
|
|
98
|
+
width += 1;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return width;
|
|
104
|
+
}
|
|
105
|
+
function drawText(ctx, text, x, y, color, backgroundColor, borderSize = 0, padding = 0, scale = 1) {
|
|
106
|
+
const charHeight2 = 8;
|
|
107
|
+
const textWidth = getTextWidth(text) * scale;
|
|
108
|
+
const textHeight = charHeight2 * scale;
|
|
109
|
+
if (backgroundColor || borderSize > 0) {
|
|
110
|
+
const totalWidth2 = textWidth + padding * 2 + borderSize * 2;
|
|
111
|
+
const totalHeight = textHeight + padding * 2 + borderSize * 2;
|
|
112
|
+
if (borderSize > 0) {
|
|
113
|
+
ctx.fillStyle = "black";
|
|
114
|
+
ctx.fillRect(
|
|
115
|
+
x - padding - borderSize,
|
|
116
|
+
y - (padding + borderSize),
|
|
117
|
+
totalWidth2,
|
|
118
|
+
totalHeight
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
if (backgroundColor) {
|
|
122
|
+
ctx.fillStyle = backgroundColor;
|
|
123
|
+
ctx.fillRect(
|
|
124
|
+
x - padding - borderSize + borderSize,
|
|
125
|
+
y - (padding + borderSize) + borderSize,
|
|
126
|
+
totalWidth2 - borderSize * 2,
|
|
127
|
+
totalHeight - borderSize * 2
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
drawTextPixels(ctx, text, x, y, color, "left", scale);
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
getTextWidth,
|
|
135
|
+
drawTextPixels,
|
|
136
|
+
drawText
|
|
137
|
+
};
|
|
138
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const ICON_NAMES: readonly ["upload", "tutor", "bug", "chart", "eye", "user", "plus", "robot", "cursor-move", "check", "tools", "revert", "puzzle", "group", "file", "comment", "command", "close", "button-pointer"];
|
|
2
|
+
type IconName = (typeof ICON_NAMES)[number];
|
|
3
|
+
type UseIconRendering = {
|
|
4
|
+
initIcons: () => Promise<void>;
|
|
5
|
+
drawIcon: (ctx: CanvasRenderingContext2D, icon: IconName | number, x: number, y: number, large?: boolean) => void;
|
|
6
|
+
getIconCount: () => number;
|
|
7
|
+
};
|
|
8
|
+
export declare function useIconRendering(cellSize: number, largeSize: number): UseIconRendering;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { icons } from "#blokkli-build/icons";
|
|
2
|
+
const ICON_NAMES = [
|
|
3
|
+
"upload",
|
|
4
|
+
"tutor",
|
|
5
|
+
"bug",
|
|
6
|
+
"chart",
|
|
7
|
+
"eye",
|
|
8
|
+
"user",
|
|
9
|
+
"plus",
|
|
10
|
+
"robot",
|
|
11
|
+
"cursor-move",
|
|
12
|
+
"check",
|
|
13
|
+
"tools",
|
|
14
|
+
"revert",
|
|
15
|
+
"puzzle",
|
|
16
|
+
"group",
|
|
17
|
+
"file",
|
|
18
|
+
"comment",
|
|
19
|
+
"command",
|
|
20
|
+
"close",
|
|
21
|
+
"button-pointer"
|
|
22
|
+
];
|
|
23
|
+
export function useIconRendering(cellSize, largeSize) {
|
|
24
|
+
const iconList = ICON_NAMES.map((name) => ({
|
|
25
|
+
name,
|
|
26
|
+
svg: icons[name]
|
|
27
|
+
}));
|
|
28
|
+
const iconAtlas = /* @__PURE__ */ new Map();
|
|
29
|
+
const iconAtlasLarge = /* @__PURE__ */ new Map();
|
|
30
|
+
const atlasCanvas = document.createElement("canvas");
|
|
31
|
+
atlasCanvas.width = cellSize * iconList.length;
|
|
32
|
+
atlasCanvas.height = cellSize;
|
|
33
|
+
const atlasCanvasLarge = document.createElement("canvas");
|
|
34
|
+
atlasCanvasLarge.width = largeSize * iconList.length;
|
|
35
|
+
atlasCanvasLarge.height = largeSize;
|
|
36
|
+
async function initIcons() {
|
|
37
|
+
const ctx = atlasCanvas.getContext("2d", { willReadFrequently: true });
|
|
38
|
+
const ctxLarge = atlasCanvasLarge.getContext("2d", {
|
|
39
|
+
willReadFrequently: true
|
|
40
|
+
});
|
|
41
|
+
if (!ctx || !ctxLarge) return;
|
|
42
|
+
const imagePromises = iconList.map(({ name, svg }) => {
|
|
43
|
+
return new Promise((resolve) => {
|
|
44
|
+
const img = new Image();
|
|
45
|
+
const svgBlob = new Blob([svg], { type: "image/svg+xml" });
|
|
46
|
+
const url = URL.createObjectURL(svgBlob);
|
|
47
|
+
img.onload = () => {
|
|
48
|
+
URL.revokeObjectURL(url);
|
|
49
|
+
resolve({ name, img });
|
|
50
|
+
};
|
|
51
|
+
img.src = url;
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
const loadedImages = await Promise.all(imagePromises);
|
|
55
|
+
const processIcon = (img, name, index, size, targetCtx, atlasMap) => {
|
|
56
|
+
const tempCanvas = document.createElement("canvas");
|
|
57
|
+
tempCanvas.width = size;
|
|
58
|
+
tempCanvas.height = size;
|
|
59
|
+
const tempCtx = tempCanvas.getContext("2d", { willReadFrequently: true });
|
|
60
|
+
if (!tempCtx) return;
|
|
61
|
+
tempCtx.clearRect(0, 0, size, size);
|
|
62
|
+
tempCtx.drawImage(img, 0, 0, size, size);
|
|
63
|
+
const imageData = tempCtx.getImageData(0, 0, size, size);
|
|
64
|
+
const data = imageData.data;
|
|
65
|
+
for (let i = 0; i < data.length; i += 4) {
|
|
66
|
+
const r = data[i];
|
|
67
|
+
const g = data[i + 1];
|
|
68
|
+
const b = data[i + 2];
|
|
69
|
+
const a = data[i + 3];
|
|
70
|
+
const brightness = (r + g + b) / 3;
|
|
71
|
+
if (a > 128 && brightness < 128) {
|
|
72
|
+
data[i] = 0;
|
|
73
|
+
data[i + 1] = 0;
|
|
74
|
+
data[i + 2] = 0;
|
|
75
|
+
data[i + 3] = 255;
|
|
76
|
+
} else {
|
|
77
|
+
data[i] = 0;
|
|
78
|
+
data[i + 1] = 0;
|
|
79
|
+
data[i + 2] = 0;
|
|
80
|
+
data[i + 3] = 0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
tempCtx.putImageData(imageData, 0, 0);
|
|
84
|
+
const atlasX = index * size;
|
|
85
|
+
targetCtx.drawImage(tempCanvas, 0, 0, size, size, atlasX, 0, size, size);
|
|
86
|
+
atlasMap.set(name, { x: atlasX, y: 0 });
|
|
87
|
+
};
|
|
88
|
+
loadedImages.forEach(({ name, img }, index) => {
|
|
89
|
+
processIcon(img, name, index, cellSize, ctx, iconAtlas);
|
|
90
|
+
processIcon(img, name, index, largeSize, ctxLarge, iconAtlasLarge);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function drawIcon(ctx, icon, x, y, large = false) {
|
|
94
|
+
let iconName;
|
|
95
|
+
if (typeof icon === "number") {
|
|
96
|
+
const iconData = iconList[icon];
|
|
97
|
+
if (!iconData) return;
|
|
98
|
+
iconName = iconData.name;
|
|
99
|
+
} else {
|
|
100
|
+
iconName = icon;
|
|
101
|
+
}
|
|
102
|
+
const atlas = large ? iconAtlasLarge : iconAtlas;
|
|
103
|
+
const canvas = large ? atlasCanvasLarge : atlasCanvas;
|
|
104
|
+
const size = large ? largeSize : cellSize;
|
|
105
|
+
const atlasData = atlas.get(iconName);
|
|
106
|
+
if (!atlasData) return;
|
|
107
|
+
const prevSmoothing = ctx.imageSmoothingEnabled;
|
|
108
|
+
ctx.imageSmoothingEnabled = false;
|
|
109
|
+
ctx.drawImage(
|
|
110
|
+
canvas,
|
|
111
|
+
atlasData.x,
|
|
112
|
+
atlasData.y,
|
|
113
|
+
size,
|
|
114
|
+
size,
|
|
115
|
+
x,
|
|
116
|
+
y,
|
|
117
|
+
size,
|
|
118
|
+
size
|
|
119
|
+
);
|
|
120
|
+
ctx.imageSmoothingEnabled = prevSmoothing;
|
|
121
|
+
}
|
|
122
|
+
function getIconCount() {
|
|
123
|
+
return iconList.length;
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
initIcons,
|
|
127
|
+
drawIcon,
|
|
128
|
+
getIconCount
|
|
129
|
+
};
|
|
130
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<BlokkliTransition name="slide-up">
|
|
4
|
+
<Game v-if="isEnabled" @close="isEnabled = false" />
|
|
5
|
+
</BlokkliTransition>
|
|
6
|
+
</Teleport>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup>
|
|
10
|
+
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
11
|
+
import Game from "./Game/index.vue";
|
|
12
|
+
import { ref } from "#imports";
|
|
13
|
+
import { BlokkliTransition } from "#blokkli/components";
|
|
14
|
+
const isEnabled = ref(false);
|
|
15
|
+
const KONAMI_CODE = [
|
|
16
|
+
"ArrowUp",
|
|
17
|
+
"ArrowUp",
|
|
18
|
+
"ArrowDown",
|
|
19
|
+
"ArrowDown",
|
|
20
|
+
"ArrowLeft",
|
|
21
|
+
"ArrowRight",
|
|
22
|
+
"ArrowLeft",
|
|
23
|
+
"ArrowRight",
|
|
24
|
+
"b",
|
|
25
|
+
"a"
|
|
26
|
+
];
|
|
27
|
+
const sequence = ref([]);
|
|
28
|
+
onBlokkliEvent("keyPressed", (e) => {
|
|
29
|
+
const key = e.code;
|
|
30
|
+
sequence.value.push(key);
|
|
31
|
+
if (sequence.value.length > KONAMI_CODE.length) {
|
|
32
|
+
sequence.value.shift();
|
|
33
|
+
}
|
|
34
|
+
if (sequence.value.length === KONAMI_CODE.length) {
|
|
35
|
+
const matches = KONAMI_CODE.every((code, index) => {
|
|
36
|
+
return sequence.value[index] === code;
|
|
37
|
+
});
|
|
38
|
+
if (matches) {
|
|
39
|
+
isEnabled.value = true;
|
|
40
|
+
sequence.value = [];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
</script>
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="bk bk-loading-overlay"
|
|
4
|
+
:class="{ 'bk-is-screen': screen, 'bk-is-white': white }"
|
|
5
|
+
>
|
|
3
6
|
<Icon name="spinner" />
|
|
4
7
|
</div>
|
|
5
8
|
</template>
|
|
@@ -7,7 +10,8 @@
|
|
|
7
10
|
<script setup>
|
|
8
11
|
import { Icon } from "#blokkli/components";
|
|
9
12
|
defineProps({
|
|
10
|
-
screen: { type: Boolean, required: false }
|
|
13
|
+
screen: { type: Boolean, required: false },
|
|
14
|
+
white: { type: Boolean, required: false }
|
|
11
15
|
});
|
|
12
16
|
</script>
|
|
13
17
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{
|
|
2
2
|
screen?: boolean;
|
|
3
|
+
white?: boolean;
|
|
3
4
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
4
5
|
screen?: boolean;
|
|
6
|
+
white?: boolean;
|
|
5
7
|
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
8
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="bk bk-messages">
|
|
3
|
-
<TransitionGroup name="bk-message">
|
|
3
|
+
<TransitionGroup :name="ui.useAnimations.value ? 'bk-message' : void 0">
|
|
4
4
|
<Item
|
|
5
5
|
v-for="(message, index) in messages"
|
|
6
6
|
v-bind="message"
|
|
@@ -12,15 +12,20 @@
|
|
|
12
12
|
</template>
|
|
13
13
|
|
|
14
14
|
<script setup>
|
|
15
|
-
import { ref } from "#imports";
|
|
15
|
+
import { ref, useBlokkli } from "#imports";
|
|
16
16
|
import Item from "./Item/index.vue";
|
|
17
17
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
18
|
+
const { ui } = useBlokkli();
|
|
18
19
|
const messages = ref([]);
|
|
19
20
|
function removeMessage(index) {
|
|
20
21
|
messages.value = messages.value.filter((_v, i) => i !== index);
|
|
21
22
|
}
|
|
22
23
|
onBlokkliEvent("message", (message) => {
|
|
23
|
-
|
|
24
|
+
if (message.replace) {
|
|
25
|
+
messages.value = [message];
|
|
26
|
+
} else {
|
|
27
|
+
messages.value.push(message);
|
|
28
|
+
}
|
|
24
29
|
});
|
|
25
30
|
</script>
|
|
26
31
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FormToggle v-model="value" :label :description />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { FormToggle } from "#blokkli/components";
|
|
7
|
+
defineProps({
|
|
8
|
+
type: { type: String, required: true },
|
|
9
|
+
name: { type: String, required: true },
|
|
10
|
+
label: { type: String, required: true },
|
|
11
|
+
description: { type: String, required: false },
|
|
12
|
+
required: { type: Boolean, required: true },
|
|
13
|
+
checkboxLabel: { type: String, required: false },
|
|
14
|
+
defaultValue: { type: Boolean, required: true }
|
|
15
|
+
});
|
|
16
|
+
const value = defineModel({ type: Boolean });
|
|
17
|
+
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PluginConfigInputCheckbox } from '#blokkli/types';
|
|
2
|
+
type __VLS_Props = PluginConfigInputCheckbox;
|
|
3
|
+
type __VLS_PublicProps = __VLS_Props & {
|
|
4
|
+
modelValue?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
+
"update:modelValue": (value: boolean | undefined) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
9
|
+
"onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FormSelect
|
|
3
|
+
v-if="variant === 'select'"
|
|
4
|
+
:id
|
|
5
|
+
v-model="value"
|
|
6
|
+
:label
|
|
7
|
+
:description
|
|
8
|
+
:required
|
|
9
|
+
:options
|
|
10
|
+
/>
|
|
11
|
+
<FormRadio
|
|
12
|
+
v-else
|
|
13
|
+
:id
|
|
14
|
+
v-model="value"
|
|
15
|
+
:label
|
|
16
|
+
:description
|
|
17
|
+
:required
|
|
18
|
+
:options
|
|
19
|
+
/>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup>
|
|
23
|
+
import { computed } from "#imports";
|
|
24
|
+
import { FormSelect, FormRadio } from "#blokkli/components";
|
|
25
|
+
const props = defineProps({
|
|
26
|
+
type: { type: String, required: true },
|
|
27
|
+
name: { type: String, required: true },
|
|
28
|
+
label: { type: String, required: true },
|
|
29
|
+
description: { type: String, required: false },
|
|
30
|
+
required: { type: Boolean, required: true },
|
|
31
|
+
defaultValue: { type: String, required: false },
|
|
32
|
+
variant: { type: String, required: true },
|
|
33
|
+
options: { type: Array, required: true }
|
|
34
|
+
});
|
|
35
|
+
const value = defineModel({ type: String });
|
|
36
|
+
const id = computed(() => "plugin-form-item-" + props.name);
|
|
37
|
+
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PluginConfigInputOptions } from '#blokkli/types';
|
|
2
|
+
type __VLS_Props = PluginConfigInputOptions;
|
|
3
|
+
type __VLS_PublicProps = __VLS_Props & {
|
|
4
|
+
modelValue?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
+
"update:modelValue": (value: string | undefined) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
9
|
+
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FormTextarea
|
|
3
|
+
v-if="multiline"
|
|
4
|
+
:id="name"
|
|
5
|
+
v-model="value"
|
|
6
|
+
:label
|
|
7
|
+
:required
|
|
8
|
+
:placeholder
|
|
9
|
+
:description
|
|
10
|
+
:minlength="minLength"
|
|
11
|
+
:maxlength="maxLength"
|
|
12
|
+
/>
|
|
13
|
+
<FormText
|
|
14
|
+
v-else
|
|
15
|
+
:id="name"
|
|
16
|
+
v-model="value"
|
|
17
|
+
:label
|
|
18
|
+
:required
|
|
19
|
+
:description
|
|
20
|
+
:placeholder
|
|
21
|
+
:minlength="minLength"
|
|
22
|
+
:maxlength="maxLength"
|
|
23
|
+
/>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script setup>
|
|
27
|
+
import { FormText, FormTextarea } from "#blokkli/components";
|
|
28
|
+
defineProps({
|
|
29
|
+
type: { type: String, required: true },
|
|
30
|
+
name: { type: String, required: true },
|
|
31
|
+
label: { type: String, required: true },
|
|
32
|
+
description: { type: String, required: false },
|
|
33
|
+
required: { type: Boolean, required: true },
|
|
34
|
+
defaultValue: { type: String, required: false },
|
|
35
|
+
minLength: { type: Number, required: false },
|
|
36
|
+
maxLength: { type: Number, required: false },
|
|
37
|
+
placeholder: { type: String, required: false },
|
|
38
|
+
pattern: { type: String, required: false },
|
|
39
|
+
multiline: { type: Boolean, required: false },
|
|
40
|
+
rows: { type: Number, required: false }
|
|
41
|
+
});
|
|
42
|
+
const value = defineModel({ type: String });
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PluginConfigInputText } from '#blokkli/types';
|
|
2
|
+
type __VLS_Props = PluginConfigInputText;
|
|
3
|
+
type __VLS_PublicProps = __VLS_Props & {
|
|
4
|
+
modelValue?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
+
"update:modelValue": (value: string | undefined) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
9
|
+
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ol>
|
|
3
|
+
<li v-for="item in renderedConfig" :key="item.name" class="bk-form-item">
|
|
4
|
+
<FormCheckbox
|
|
5
|
+
v-if="item.type === 'checkbox'"
|
|
6
|
+
v-bind="item"
|
|
7
|
+
v-model="value[item.name]"
|
|
8
|
+
/>
|
|
9
|
+
<FormText
|
|
10
|
+
v-else-if="item.type === 'text'"
|
|
11
|
+
v-bind="item"
|
|
12
|
+
v-model="value[item.name]"
|
|
13
|
+
/>
|
|
14
|
+
<FormOptions
|
|
15
|
+
v-else-if="item.type === 'options'"
|
|
16
|
+
v-bind="item"
|
|
17
|
+
v-model="value[item.name]"
|
|
18
|
+
/>
|
|
19
|
+
</li>
|
|
20
|
+
</ol>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup>
|
|
24
|
+
import FormCheckbox from "./Checkbox/index.vue";
|
|
25
|
+
import FormText from "./Text/index.vue";
|
|
26
|
+
import FormOptions from "./Options/index.vue";
|
|
27
|
+
import { computed } from "#imports";
|
|
28
|
+
const props = defineProps({
|
|
29
|
+
config: { type: Array, required: true }
|
|
30
|
+
});
|
|
31
|
+
const renderedConfig = computed(
|
|
32
|
+
() => props.config.filter((v) => v.type !== "seed")
|
|
33
|
+
);
|
|
34
|
+
const value = defineModel({ type: Object, ...{
|
|
35
|
+
default: () => {
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
38
|
+
} });
|
|
39
|
+
function updateSeed() {
|
|
40
|
+
props.config.forEach((config) => {
|
|
41
|
+
if (config.type === "seed") {
|
|
42
|
+
value.value[config.name] = Math.round(
|
|
43
|
+
Date.now() * Math.random()
|
|
44
|
+
).toString();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
props.config.forEach((config) => {
|
|
49
|
+
if ("defaultValue" in config) {
|
|
50
|
+
value.value[config.name] = config.defaultValue;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
updateSeed();
|
|
54
|
+
defineExpose({
|
|
55
|
+
updateSeed
|
|
56
|
+
});
|
|
57
|
+
</script>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PluginConfigInput } from '#blokkli/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
config: PluginConfigInput[];
|
|
4
|
+
};
|
|
5
|
+
declare function updateSeed(): void;
|
|
6
|
+
type __VLS_PublicProps = __VLS_Props & {
|
|
7
|
+
modelValue?: Record<string, any>;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
10
|
+
updateSeed: typeof updateSeed;
|
|
11
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:modelValue": (value: Record<string, any>) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
|
+
"onUpdate:modelValue"?: ((value: Record<string, any>) => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
export default _default;
|
|
@@ -25,6 +25,7 @@ import broadcastProvider from "#blokkli/helpers/broadcastProvider";
|
|
|
25
25
|
import { getFieldKey, intersects } from "#blokkli/helpers";
|
|
26
26
|
import { eventBus } from "#blokkli/helpers/eventBus";
|
|
27
27
|
import definitionProvider from "../../helpers/definitionProvider";
|
|
28
|
+
import { addElementClasses } from "#blokkli/helpers/addElementClasses";
|
|
28
29
|
const props = defineProps({
|
|
29
30
|
entity: { type: null, required: false },
|
|
30
31
|
entityType: { type: String, required: true },
|
|
@@ -147,13 +148,13 @@ const onUpdateOption = (option) => {
|
|
|
147
148
|
}
|
|
148
149
|
mutatedOptions[uuid][key] = value;
|
|
149
150
|
};
|
|
151
|
+
addElementClasses(document.body, "bk-body-preview");
|
|
152
|
+
addElementClasses(document.documentElement, "bk-html-preview");
|
|
150
153
|
onMounted(() => {
|
|
151
154
|
if (isInIframe()) {
|
|
152
155
|
frameEventBus.on("mutatedFields", updateMutatedFields);
|
|
153
156
|
frameEventBus.on("focus", onFocusItem);
|
|
154
157
|
frameEventBus.on("updateOption", onUpdateOption);
|
|
155
|
-
document.body.classList.add("bk-body-preview");
|
|
156
|
-
document.documentElement.classList.add("bk-html-preview");
|
|
157
158
|
window.addEventListener("message", onMessage);
|
|
158
159
|
window.addEventListener("wheel", onWheel, { passive: false });
|
|
159
160
|
document.documentElement.addEventListener("mousedown", onMouseDown);
|
|
@@ -165,8 +166,6 @@ onMounted(() => {
|
|
|
165
166
|
});
|
|
166
167
|
onBeforeUnmount(() => {
|
|
167
168
|
clearTimeout(timeout);
|
|
168
|
-
document.body.classList.remove("bk-body-preview");
|
|
169
|
-
document.documentElement.classList.remove("bk-html-preview");
|
|
170
169
|
window.removeEventListener("wheel", onWheel);
|
|
171
170
|
window.removeEventListener("message", onMessage);
|
|
172
171
|
document.documentElement.removeEventListener("mousedown", onMouseDown);
|
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { ref, computed, onMounted, onBeforeUnmount } from "#imports";
|
|
6
|
+
import { ref, computed, onMounted, onBeforeUnmount, useBlokkli } from "#imports";
|
|
7
7
|
import { getRelativeTimeString } from "#blokkli/helpers";
|
|
8
8
|
const props = defineProps({
|
|
9
9
|
timestamp: { type: Number, required: true }
|
|
10
10
|
});
|
|
11
|
+
const { ui } = useBlokkli();
|
|
11
12
|
const incrementToggle = ref(0);
|
|
12
13
|
let interval = null;
|
|
13
14
|
const formatted = computed(() => {
|
|
14
15
|
const date = new Date(props.timestamp * 1e3 + incrementToggle.value);
|
|
15
|
-
return getRelativeTimeString(date);
|
|
16
|
+
return getRelativeTimeString(date, ui.interfaceLanguage.value);
|
|
16
17
|
});
|
|
17
18
|
onMounted(() => {
|
|
18
19
|
interval = setInterval(() => {
|