@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.
@@ -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
- if (typeof value === "string") {
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 BlockDefinitionRenderForFieldListType = {
199
+ export type BlockDefinitionRenderForFieldList = {
200
+ /**
201
+ * @deprecated Use `fieldListType` instead.
202
+ */
199
203
  fieldList: ValidFieldListTypes;
200
204
  };
201
- export type BlockDefinitionRenderFor = BlockDefinitionRenderForParent | BlockDefinitionRenderForFieldListType;
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".
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blokkli/editor",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Interactive page building experience for Nuxt",
5
5
  "repository": "blokkli/editor",
6
6
  "type": "module",