@blokkli/editor 1.4.0-alpha.0 → 1.4.0-alpha.1

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 (79) hide show
  1. package/dist/module.d.mts +71 -2
  2. package/dist/module.d.ts +71 -2
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +293 -115
  5. package/dist/runtime/blokkliPlugins/AddAction/index.vue +1 -1
  6. package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +1 -1
  7. package/dist/runtime/blokkliPlugins/ItemAction/index.vue +1 -1
  8. package/dist/runtime/blokkliPlugins/MenuButton/index.vue +1 -1
  9. package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +1 -1
  10. package/dist/runtime/blokkliPlugins/Sidebar/index.vue +1 -1
  11. package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +1 -1
  12. package/dist/runtime/blokkliPlugins/ViewOption/index.vue +1 -1
  13. package/dist/runtime/components/Blocks/Fragment/index.vue +7 -4
  14. package/dist/runtime/components/Blocks/FromLibrary/index.vue +8 -5
  15. package/dist/runtime/components/BlokkliField.vue +2 -2
  16. package/dist/runtime/components/BlokkliItem.vue +2 -2
  17. package/dist/runtime/components/Edit/Actions/index.vue +1 -1
  18. package/dist/runtime/components/Edit/AddListItem/index.vue +1 -1
  19. package/dist/runtime/components/Edit/AppMenu/index.vue +1 -1
  20. package/dist/runtime/components/Edit/BlockProxy/index.vue +3 -5
  21. package/dist/runtime/components/Edit/Dialog/index.vue +1 -1
  22. package/dist/runtime/components/Edit/DraggableList.vue +2 -2
  23. package/dist/runtime/components/Edit/EditIndicator.vue +2 -2
  24. package/dist/runtime/components/Edit/EditProvider.vue +3 -4
  25. package/dist/runtime/components/Edit/Features/Artboard/index.vue +9 -8
  26. package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +1 -1
  27. package/dist/runtime/components/Edit/Features/Debug/index.vue +2 -2
  28. package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue +1 -1
  29. package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +1 -1
  30. package/dist/runtime/components/Edit/Features/Edit/index.vue +1 -1
  31. package/dist/runtime/components/Edit/Features/EditForm/index.vue +1 -1
  32. package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue +2 -2
  33. package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +38 -32
  34. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/Item/index.vue +13 -6
  35. package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +65 -67
  36. package/dist/runtime/components/Edit/Features/Library/index.vue +1 -1
  37. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/Item.vue +1 -1
  38. package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +3 -11
  39. package/dist/runtime/components/Edit/Features/MediaLibrary/types.d.ts +1 -1
  40. package/dist/runtime/components/Edit/Features/Options/Form/index.vue +28 -3
  41. package/dist/runtime/components/Edit/Features/Options/index.vue +4 -1
  42. package/dist/runtime/components/Edit/Features/Publish/index.vue +1 -1
  43. package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +1 -1
  44. package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue +1 -1
  45. package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +3 -3
  46. package/dist/runtime/components/Edit/Features/Theme/Color/index.vue +1 -1
  47. package/dist/runtime/components/Edit/Features/Theme/index.vue +1 -1
  48. package/dist/runtime/components/Edit/Features/Translations/index.vue +1 -1
  49. package/dist/runtime/components/Edit/Features/index.vue +1 -1
  50. package/dist/runtime/components/Edit/FormOverlay/Header/index.vue +1 -1
  51. package/dist/runtime/components/Edit/FormOverlay/index.vue +1 -1
  52. package/dist/runtime/components/Edit/Icon/index.vue +2 -2
  53. package/dist/runtime/components/Edit/ItemIcon/index.vue +1 -1
  54. package/dist/runtime/components/Edit/Pagination/index.vue +21 -0
  55. package/dist/runtime/components/Edit/PreviewProvider.vue +2 -2
  56. package/dist/runtime/components/Edit/ScaleToFit/index.vue +37 -6
  57. package/dist/runtime/components/Edit/index.d.ts +2 -1
  58. package/dist/runtime/components/Edit/index.js +3 -1
  59. package/dist/runtime/composables/defineBlokkli.d.ts +2 -2
  60. package/dist/runtime/composables/defineBlokkli.js +17 -22
  61. package/dist/runtime/composables/defineBlokkliFeature.d.ts +1 -1
  62. package/dist/runtime/composables/defineBlokkliFeature.js +1 -1
  63. package/dist/runtime/composables/defineBlokkliFragment.d.ts +1 -1
  64. package/dist/runtime/composables/defineBlokkliFragment.js +1 -1
  65. package/dist/runtime/css/output.css +1 -1
  66. package/dist/runtime/helpers/domProvider.js +1 -1
  67. package/dist/runtime/helpers/featuresProvider.d.ts +1 -1
  68. package/dist/runtime/helpers/featuresProvider.js +1 -1
  69. package/dist/runtime/helpers/index.d.ts +1 -0
  70. package/dist/runtime/helpers/index.js +7 -1
  71. package/dist/runtime/helpers/runtimeHelpers/index.d.ts +23 -2
  72. package/dist/runtime/helpers/runtimeHelpers/index.js +83 -10
  73. package/dist/runtime/helpers/storageProvider.js +1 -1
  74. package/dist/runtime/helpers/textProvider.js +2 -2
  75. package/dist/runtime/helpers/themeProvider.js +1 -1
  76. package/dist/runtime/types/index.d.ts +7 -4
  77. package/package.json +2 -2
  78. package/dist/runtime/helpers/options.d.ts +0 -2
  79. package/dist/runtime/helpers/options.js +0 -21
package/dist/module.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { FeatureDefinition, BlockDefinitionOptionsInput } from '../dist/runtime/types/index.js';
2
+ import { FeatureDefinition, BlockDefinitionInput, BlockDefinitionOptionsInput } from '../dist/runtime/types/index.js';
3
3
  import { AdapterMethods } from '../dist/runtime/adapter/index.js';
4
4
  import { ThemeName, Theme } from '../dist/runtime/types/theme.js';
5
- import { ModuleOptionsSettings } from '#blokkli/types/generatedModuleTypes';
5
+ import { ModuleOptionsSettings } from '../dist/runtime/types/generatedModuleTypes.js';
6
6
 
7
7
  type ExtractedFeatureDefinition = {
8
8
  id: string;
@@ -13,6 +13,25 @@ type ExtractedFeatureDefinition = {
13
13
  source: string;
14
14
  };
15
15
 
16
+ type ExtractedBlockDefinitionInput = BlockDefinitionInput;
17
+ type ExtractedDefinition = {
18
+ filePath: string;
19
+ icon?: string;
20
+ chunkName: string;
21
+ componentName: string;
22
+ proxyComponent?: string;
23
+ diffComponent?: string;
24
+ definition: ExtractedBlockDefinitionInput;
25
+ source: string;
26
+ fileSource: string;
27
+ hasBlokkliField: boolean;
28
+ };
29
+ type GetBundlePropsTypeResult = {
30
+ typeName: string;
31
+ from: string;
32
+ };
33
+ type GetBundlePropsType = (name: string, definition: ExtractedDefinition) => GetBundlePropsTypeResult;
34
+
16
35
  type AlterFeatures = {
17
36
  features: ExtractedFeatureDefinition[];
18
37
  };
@@ -123,6 +142,56 @@ type ModuleOptions = {
123
142
  * bundles.
124
143
  */
125
144
  storageDefaults?: ModuleOptionsStorageDefaults;
145
+ /**
146
+ * Method that is called for each block bundle component to generate the
147
+ * prop types.
148
+ *
149
+ * These types are used if you access a block item with the generated
150
+ * FieldListItemTyped type, for example through:
151
+ * const { rootBlocks } = defineBlokkli().
152
+ *
153
+ * or using <BlokkliField v-slot="{ items }">.
154
+ *
155
+ * The method receives the name of the bundle and the extracted block
156
+ * definition as the second argument.
157
+ * The return value should be an object with these properties:
158
+ *
159
+ * - typeName: The name of the type
160
+ * - from: Where the type can be imported from
161
+ *
162
+ * For example, if the method returns this object:
163
+ * ```typescript
164
+ * {
165
+ * typeName: 'ParagraphTextWithImageFragment',
166
+ * from: '#graphql-operations'
167
+ * }
168
+ * ```
169
+ *
170
+ * Then the module will generate this TypeScript code:
171
+ *
172
+ * ```typescript
173
+ * import type { ParagraphTextWithImageFragment } from '#graphql-operations'
174
+ * ```
175
+ *
176
+ * And assign the imported type as the type for the `props` property for this bundle.
177
+ *
178
+ * Then, for example in a block component:
179
+ *
180
+ * ```typescript
181
+ * const { siblings, index } = defineBlokkli()
182
+ *
183
+ * const previousBlock = computed(() => siblings.value[index.value - 1])
184
+ *
185
+ * const previousTitle = computed(() => {
186
+ * // The previous block in the list is a title.
187
+ * if (previousBlock.value?.bundle === 'title') {
188
+ * // The type of the props are now typed correctly.
189
+ * const title = previousBlock.value.props.title
190
+ * }
191
+ * })
192
+ * ```
193
+ */
194
+ getBundlePropsType?: GetBundlePropsType;
126
195
  };
127
196
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
128
197
 
package/dist/module.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { FeatureDefinition, BlockDefinitionOptionsInput } from '../dist/runtime/types/index.js';
2
+ import { FeatureDefinition, BlockDefinitionInput, BlockDefinitionOptionsInput } from '../dist/runtime/types/index.js';
3
3
  import { AdapterMethods } from '../dist/runtime/adapter/index.js';
4
4
  import { ThemeName, Theme } from '../dist/runtime/types/theme.js';
5
- import { ModuleOptionsSettings } from '#blokkli/types/generatedModuleTypes';
5
+ import { ModuleOptionsSettings } from '../dist/runtime/types/generatedModuleTypes.js';
6
6
 
7
7
  type ExtractedFeatureDefinition = {
8
8
  id: string;
@@ -13,6 +13,25 @@ type ExtractedFeatureDefinition = {
13
13
  source: string;
14
14
  };
15
15
 
16
+ type ExtractedBlockDefinitionInput = BlockDefinitionInput;
17
+ type ExtractedDefinition = {
18
+ filePath: string;
19
+ icon?: string;
20
+ chunkName: string;
21
+ componentName: string;
22
+ proxyComponent?: string;
23
+ diffComponent?: string;
24
+ definition: ExtractedBlockDefinitionInput;
25
+ source: string;
26
+ fileSource: string;
27
+ hasBlokkliField: boolean;
28
+ };
29
+ type GetBundlePropsTypeResult = {
30
+ typeName: string;
31
+ from: string;
32
+ };
33
+ type GetBundlePropsType = (name: string, definition: ExtractedDefinition) => GetBundlePropsTypeResult;
34
+
16
35
  type AlterFeatures = {
17
36
  features: ExtractedFeatureDefinition[];
18
37
  };
@@ -123,6 +142,56 @@ type ModuleOptions = {
123
142
  * bundles.
124
143
  */
125
144
  storageDefaults?: ModuleOptionsStorageDefaults;
145
+ /**
146
+ * Method that is called for each block bundle component to generate the
147
+ * prop types.
148
+ *
149
+ * These types are used if you access a block item with the generated
150
+ * FieldListItemTyped type, for example through:
151
+ * const { rootBlocks } = defineBlokkli().
152
+ *
153
+ * or using <BlokkliField v-slot="{ items }">.
154
+ *
155
+ * The method receives the name of the bundle and the extracted block
156
+ * definition as the second argument.
157
+ * The return value should be an object with these properties:
158
+ *
159
+ * - typeName: The name of the type
160
+ * - from: Where the type can be imported from
161
+ *
162
+ * For example, if the method returns this object:
163
+ * ```typescript
164
+ * {
165
+ * typeName: 'ParagraphTextWithImageFragment',
166
+ * from: '#graphql-operations'
167
+ * }
168
+ * ```
169
+ *
170
+ * Then the module will generate this TypeScript code:
171
+ *
172
+ * ```typescript
173
+ * import type { ParagraphTextWithImageFragment } from '#graphql-operations'
174
+ * ```
175
+ *
176
+ * And assign the imported type as the type for the `props` property for this bundle.
177
+ *
178
+ * Then, for example in a block component:
179
+ *
180
+ * ```typescript
181
+ * const { siblings, index } = defineBlokkli()
182
+ *
183
+ * const previousBlock = computed(() => siblings.value[index.value - 1])
184
+ *
185
+ * const previousTitle = computed(() => {
186
+ * // The previous block in the list is a title.
187
+ * if (previousBlock.value?.bundle === 'title') {
188
+ * // The type of the props are now typed correctly.
189
+ * const title = previousBlock.value.props.title
190
+ * }
191
+ * })
192
+ * ```
193
+ */
194
+ getBundlePropsType?: GetBundlePropsType;
126
195
  };
127
196
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
128
197
 
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "blokkli",
3
3
  "configKey": "blokkli",
4
- "version": "1.4.0-alpha.0",
4
+ "version": "1.4.0-alpha.1",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.12.0"
7
7
  },