@blokkli/editor 1.0.2 → 1.0.4
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/README.md +0 -6
- package/dist/module.json +1 -1
- package/dist/module.mjs +11 -3
- package/dist/runtime/components/BlokkliField.vue +1 -1
- package/dist/runtime/components/Edit/DragInteractions/index.vue +5 -3
- package/dist/runtime/components/Edit/DraggableList.vue +1 -1
- package/dist/runtime/components/Edit/Features/Edit/index.vue +3 -0
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +2 -4
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Translations/index.vue +18 -1
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/runtimeHelpers/index.d.ts +5 -0
- package/dist/runtime/helpers/runtimeHelpers/index.js +4 -6
- package/dist/runtime/types/index.d.ts +9 -2
- package/package.json +1 -1
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* This file should contain all helpers that are meant for runtime functionality, such as defineBlokkli composable or <BlokkliProvider>.
|
|
3
3
|
*/
|
|
4
4
|
import type { BlockOptionDefinition } from '#blokkli/types/blokkOptions';
|
|
5
|
+
/**
|
|
6
|
+
* Map all kinds of truthy values for a checkbox.
|
|
7
|
+
* Returns our "internal" value of a checkbox state.
|
|
8
|
+
*/
|
|
9
|
+
export declare function mapCheckboxTrue(v?: unknown): '1' | '0';
|
|
5
10
|
/**
|
|
6
11
|
* Get the runtime value for an option.
|
|
7
12
|
*
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
export function mapCheckboxTrue(v) {
|
|
2
|
+
return v === true || v === "1" || v === 1 || v === "true" ? "1" : "0";
|
|
3
|
+
}
|
|
1
4
|
export function getRuntimeOptionValue(definition, value) {
|
|
2
5
|
if (definition.type === "checkbox") {
|
|
3
|
-
|
|
4
|
-
return value === "1" || value === "true";
|
|
5
|
-
} else if (typeof value === "boolean") {
|
|
6
|
-
return value;
|
|
7
|
-
}
|
|
8
|
-
return false;
|
|
6
|
+
return mapCheckboxTrue(value) === "1";
|
|
9
7
|
} else if (definition.type === "radios") {
|
|
10
8
|
if (typeof value === "string") {
|
|
11
9
|
return value;
|
|
@@ -87,6 +87,7 @@ export type DefineBlokkliContext<T extends BlockDefinitionOptionsInput = BlockDe
|
|
|
87
87
|
type DetermineVisibleOptionsContext<T extends BlockDefinitionOptionsInput = BlockDefinitionOptionsInput, G extends GlobalOptionsKey[] | undefined = undefined> = {
|
|
88
88
|
options: (T extends BlockDefinitionOptionsInput ? WithOptions<T> : object) & (G extends ValidGlobalConfigKeys ? GlobalOptionsKeyTypes<G> : object);
|
|
89
89
|
parentType: BlockBundleWithNested | undefined;
|
|
90
|
+
fieldListType: ValidFieldListTypes;
|
|
90
91
|
props: Record<string, any>;
|
|
91
92
|
entity: AdapterContext;
|
|
92
93
|
};
|
|
@@ -195,10 +196,16 @@ export type BlokkliDefinitionInputEditor<Options extends BlockDefinitionOptionsI
|
|
|
195
196
|
export type BlockDefinitionRenderForParent = {
|
|
196
197
|
parentBundle: BlockBundleWithNested;
|
|
197
198
|
};
|
|
198
|
-
export type
|
|
199
|
+
export type BlockDefinitionRenderForFieldList = {
|
|
200
|
+
/**
|
|
201
|
+
* @deprecated Use `fieldListType` instead.
|
|
202
|
+
*/
|
|
199
203
|
fieldList: ValidFieldListTypes;
|
|
200
204
|
};
|
|
201
|
-
export type
|
|
205
|
+
export type BlockDefinitionRenderForFieldListType = {
|
|
206
|
+
fieldListType: ValidFieldListTypes;
|
|
207
|
+
};
|
|
208
|
+
export type BlockDefinitionRenderFor = BlockDefinitionRenderForParent | BlockDefinitionRenderForFieldList | BlockDefinitionRenderForFieldListType;
|
|
202
209
|
export type BlockDefinitionInput<Options extends BlockDefinitionOptionsInput = BlockDefinitionOptionsInput, GlobalOptions extends GlobalOptionsKey[] | undefined = undefined> = {
|
|
203
210
|
/**
|
|
204
211
|
* The bundle ID of the block, e.g. "text" or "section_title".
|