@platecms/delta-vue 0.4.1 → 0.7.0

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 (62) hide show
  1. package/.env.example +7 -0
  2. package/__generated__/fragment-masking.ts +87 -0
  3. package/__generated__/gql.ts +24 -0
  4. package/__generated__/graphql.ts +3125 -0
  5. package/__generated__/index.ts +2 -0
  6. package/codegen.config.ts +23 -0
  7. package/eslint.config.mjs +43 -0
  8. package/package.json +6 -6
  9. package/project.json +54 -0
  10. package/src/components/ExperienceComponent.vue +26 -0
  11. package/src/components/GridPlacement.vue +16 -0
  12. package/src/components/RenderLibraryComponent.vue +30 -0
  13. package/src/components/RootExperienceComponentProvider.vue +16 -0
  14. package/src/components/atoms/icon/FontAwesomeIcon.vue +21 -0
  15. package/src/components/editor/EditorExperienceComponent.vue +36 -0
  16. package/src/components/editor/EditorGridPlacement.vue +86 -0
  17. package/src/components/editor/EditorRootExperienceComponent.vue +17 -0
  18. package/src/components/editor/controls/EditorControlsContainer.vue +120 -0
  19. package/src/components/placeholders/EmptyGridPlacements.vue +62 -0
  20. package/src/components/placeholders/MissingExperienceComponent.vue +21 -0
  21. package/src/createDelta.ts +16 -0
  22. package/src/defineComponent.ts +37 -0
  23. package/src/index.ts +69 -0
  24. package/src/router/index.ts +19 -0
  25. package/src/styles.css +1 -0
  26. package/src/views/ExperienceEditorView.vue +137 -0
  27. package/src/views/ExperiencePreviewView.vue +32 -0
  28. package/src/views/ExperienceView.vue +61 -0
  29. package/src/views/NotFoundView.vue +27 -0
  30. package/src/vue-shims.d.ts +5 -0
  31. package/tsconfig.json +25 -0
  32. package/tsconfig.lib.json +25 -0
  33. package/tsconfig.spec.json +22 -0
  34. package/vite.config.ts +59 -0
  35. package/ExperienceEditorView-EkCJdeah.js +0 -4
  36. package/ExperienceEditorView-RJb7Vinf.cjs +0 -1
  37. package/ExperiencePreviewView-BnPvMCAn.js +0 -4
  38. package/ExperiencePreviewView-Bx0rYgZ0.cjs +0 -1
  39. package/ExperienceView-C0KQHjrZ.js +0 -4
  40. package/ExperienceView-DJZtUHn2.cjs +0 -1
  41. package/components/ExperienceComponent.vue.d.ts +0 -22
  42. package/components/GridPlacement.vue.d.ts +0 -6
  43. package/components/RenderLibraryComponent.vue.d.ts +0 -26
  44. package/components/RootExperienceComponentProvider.vue.d.ts +0 -21
  45. package/components/atoms/icon/FontAwesomeIcon.vue.d.ts +0 -8
  46. package/components/editor/EditorExperienceComponent.vue.d.ts +0 -9
  47. package/components/editor/EditorGridPlacement.vue.d.ts +0 -10
  48. package/components/editor/EditorRootExperienceComponent.vue.d.ts +0 -7
  49. package/components/editor/controls/EditorControlsContainer.vue.d.ts +0 -24
  50. package/components/placeholders/EmptyGridPlacements.vue.d.ts +0 -9
  51. package/components/placeholders/MissingExperienceComponent.vue.d.ts +0 -6
  52. package/createDelta.d.ts +0 -2
  53. package/defineComponent.d.ts +0 -10
  54. package/index.cjs +0 -53
  55. package/index.css +0 -1
  56. package/index.d.ts +0 -31
  57. package/index.js +0 -10869
  58. package/router/index.d.ts +0 -4
  59. package/views/ExperienceEditorView.vue.d.ts +0 -2
  60. package/views/ExperiencePreviewView.vue.d.ts +0 -2
  61. package/views/ExperienceView.vue.d.ts +0 -2
  62. package/views/NotFoundView.vue.d.ts +0 -2
package/.env.example ADDED
@@ -0,0 +1,7 @@
1
+ VITE_ORY_ENDPOINT=http://localhost:4000
2
+ VITE_OATHKEEPER_ENDPOINT=http://localhost:4455/graphql
3
+
4
+ #Used only for codegen when generating types from the GraphqQL API, instructions for getting the cookie can be found in the root readme
5
+ CODEGEN_COOKIE=
6
+
7
+ NODE_ENV=development
@@ -0,0 +1,87 @@
1
+ /* eslint-disable */
2
+ import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';
3
+ import { FragmentDefinitionNode } from 'graphql';
4
+ import { Incremental } from './graphql';
5
+
6
+
7
+ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<
8
+ infer TType,
9
+ any
10
+ >
11
+ ? [TType] extends [{ ' $fragmentName'?: infer TKey }]
12
+ ? TKey extends string
13
+ ? { ' $fragmentRefs'?: { [key in TKey]: TType } }
14
+ : never
15
+ : never
16
+ : never;
17
+
18
+ // return non-nullable if `fragmentType` is non-nullable
19
+ export function useFragment<TType>(
20
+ _documentNode: DocumentTypeDecoration<TType, any>,
21
+ fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>
22
+ ): TType;
23
+ // return nullable if `fragmentType` is undefined
24
+ export function useFragment<TType>(
25
+ _documentNode: DocumentTypeDecoration<TType, any>,
26
+ fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | undefined
27
+ ): TType | undefined;
28
+ // return nullable if `fragmentType` is nullable
29
+ export function useFragment<TType>(
30
+ _documentNode: DocumentTypeDecoration<TType, any>,
31
+ fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null
32
+ ): TType | null;
33
+ // return nullable if `fragmentType` is nullable or undefined
34
+ export function useFragment<TType>(
35
+ _documentNode: DocumentTypeDecoration<TType, any>,
36
+ fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined
37
+ ): TType | null | undefined;
38
+ // return array of non-nullable if `fragmentType` is array of non-nullable
39
+ export function useFragment<TType>(
40
+ _documentNode: DocumentTypeDecoration<TType, any>,
41
+ fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>>
42
+ ): Array<TType>;
43
+ // return array of nullable if `fragmentType` is array of nullable
44
+ export function useFragment<TType>(
45
+ _documentNode: DocumentTypeDecoration<TType, any>,
46
+ fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
47
+ ): Array<TType> | null | undefined;
48
+ // return readonly array of non-nullable if `fragmentType` is array of non-nullable
49
+ export function useFragment<TType>(
50
+ _documentNode: DocumentTypeDecoration<TType, any>,
51
+ fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
52
+ ): ReadonlyArray<TType>;
53
+ // return readonly array of nullable if `fragmentType` is array of nullable
54
+ export function useFragment<TType>(
55
+ _documentNode: DocumentTypeDecoration<TType, any>,
56
+ fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
57
+ ): ReadonlyArray<TType> | null | undefined;
58
+ export function useFragment<TType>(
59
+ _documentNode: DocumentTypeDecoration<TType, any>,
60
+ fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | Array<FragmentType<DocumentTypeDecoration<TType, any>>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
61
+ ): TType | Array<TType> | ReadonlyArray<TType> | null | undefined {
62
+ return fragmentType as any;
63
+ }
64
+
65
+
66
+ export function makeFragmentData<
67
+ F extends DocumentTypeDecoration<any, any>,
68
+ FT extends ResultOf<F>
69
+ >(data: FT, _fragment: F): FragmentType<F> {
70
+ return data as FragmentType<F>;
71
+ }
72
+ export function isFragmentReady<TQuery, TFrag>(
73
+ queryNode: DocumentTypeDecoration<TQuery, any>,
74
+ fragmentNode: TypedDocumentNode<TFrag>,
75
+ data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined
76
+ ): data is FragmentType<typeof fragmentNode> {
77
+ const deferredFields = (queryNode as { __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> } }).__meta__
78
+ ?.deferredFields;
79
+
80
+ if (!deferredFields) return true;
81
+
82
+ const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined;
83
+ const fragName = fragDef?.name?.value;
84
+
85
+ const fields = (fragName && deferredFields[fragName]) || [];
86
+ return fields.length > 0 && fields.every(field => data && field in data);
87
+ }
@@ -0,0 +1,24 @@
1
+ /* eslint-disable */
2
+ import * as types from './graphql';
3
+ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
4
+
5
+ const documents = [];
6
+ /**
7
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
8
+ *
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
13
+ * ```
14
+ *
15
+ * The query argument is unknown!
16
+ * Please regenerate the types.
17
+ */
18
+ export function graphql(source: string): unknown;
19
+
20
+ export function graphql(source: string) {
21
+ return (documents as any)[source] ?? {};
22
+ }
23
+
24
+ export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;