@powerhousedao/notes-demo-package 1.0.0 → 1.0.2

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 (104) hide show
  1. package/dist/document-models/document-models.d.ts +3 -0
  2. package/dist/document-models/document-models.d.ts.map +1 -0
  3. package/dist/document-models/document-models.js +2 -0
  4. package/dist/document-models/index.d.ts +5 -2
  5. package/dist/document-models/index.d.ts.map +1 -1
  6. package/dist/document-models/index.js +5 -2
  7. package/dist/document-models/notes/actions.d.ts +18 -0
  8. package/dist/document-models/notes/actions.d.ts.map +1 -0
  9. package/dist/document-models/notes/actions.js +4 -0
  10. package/dist/document-models/notes/gen/creators.d.ts +1 -0
  11. package/dist/document-models/notes/gen/creators.d.ts.map +1 -1
  12. package/dist/document-models/notes/gen/creators.js +1 -0
  13. package/dist/document-models/notes/gen/document-model.js +49 -49
  14. package/dist/document-models/notes/gen/document-schema.d.ts +142 -0
  15. package/dist/document-models/notes/gen/document-schema.d.ts.map +1 -0
  16. package/dist/document-models/notes/gen/document-schema.js +33 -0
  17. package/dist/document-models/notes/gen/document-type.d.ts +2 -0
  18. package/dist/document-models/notes/gen/document-type.d.ts.map +1 -0
  19. package/dist/document-models/notes/gen/document-type.js +1 -0
  20. package/dist/document-models/notes/gen/index.d.ts +7 -1
  21. package/dist/document-models/notes/gen/index.d.ts.map +1 -1
  22. package/dist/document-models/notes/gen/index.js +7 -1
  23. package/dist/document-models/notes/gen/notes/creators.d.ts +2 -2
  24. package/dist/document-models/notes/gen/notes/creators.d.ts.map +1 -1
  25. package/dist/document-models/notes/gen/notes/creators.js +7 -8
  26. package/dist/document-models/notes/gen/reducer.d.ts +1 -3
  27. package/dist/document-models/notes/gen/reducer.d.ts.map +1 -1
  28. package/dist/document-models/notes/gen/reducer.js +15 -15
  29. package/dist/document-models/notes/gen/schema/index.d.ts +1 -1
  30. package/dist/document-models/notes/gen/schema/index.d.ts.map +1 -1
  31. package/dist/document-models/notes/gen/schema/index.js +1 -1
  32. package/dist/document-models/notes/gen/types.d.ts +1 -2
  33. package/dist/document-models/notes/gen/types.d.ts.map +1 -1
  34. package/dist/document-models/notes/gen/types.js +0 -1
  35. package/dist/document-models/notes/gen/utils.d.ts +5 -2
  36. package/dist/document-models/notes/gen/utils.d.ts.map +1 -1
  37. package/dist/document-models/notes/gen/utils.js +20 -3
  38. package/dist/document-models/notes/hooks.d.ts +11 -0
  39. package/dist/document-models/notes/hooks.d.ts.map +1 -0
  40. package/dist/document-models/notes/hooks.js +26 -0
  41. package/dist/document-models/notes/index.d.ts +5 -31
  42. package/dist/document-models/notes/index.d.ts.map +1 -1
  43. package/dist/document-models/notes/index.js +5 -18
  44. package/dist/document-models/notes/module.d.ts +5 -0
  45. package/dist/document-models/notes/module.d.ts.map +1 -0
  46. package/dist/document-models/notes/module.js +10 -0
  47. package/dist/document-models/notes/src/index.d.ts +2 -0
  48. package/dist/document-models/notes/src/index.d.ts.map +1 -0
  49. package/dist/document-models/notes/src/index.js +1 -0
  50. package/dist/document-models/notes/src/reducers/notes.d.ts +2 -2
  51. package/dist/document-models/notes/src/reducers/notes.d.ts.map +1 -1
  52. package/dist/document-models/notes/src/reducers/notes.js +1 -1
  53. package/dist/document-models/notes/src/tests/document-model.test.js +4 -4
  54. package/dist/document-models/notes/src/tests/notes.test.js +5 -5
  55. package/dist/document-models/notes/utils.d.ts +14 -0
  56. package/dist/document-models/notes/utils.d.ts.map +1 -0
  57. package/dist/document-models/notes/utils.js +7 -0
  58. package/dist/editors/editors.d.ts +3 -0
  59. package/dist/editors/editors.d.ts.map +1 -0
  60. package/dist/editors/editors.js +3 -0
  61. package/dist/editors/hooks/useNotesDocument.d.ts +2 -2
  62. package/dist/editors/hooks/useNotesDocument.d.ts.map +1 -1
  63. package/dist/editors/index.d.ts +2 -2
  64. package/dist/editors/index.d.ts.map +1 -1
  65. package/dist/editors/index.js +2 -2
  66. package/dist/editors/notes-app/components/CreateDocument.d.ts +6 -0
  67. package/dist/editors/notes-app/components/CreateDocument.d.ts.map +1 -0
  68. package/dist/editors/notes-app/components/CreateDocument.js +22 -0
  69. package/dist/editors/notes-app/components/DriveExplorer.d.ts +7 -0
  70. package/dist/editors/notes-app/components/DriveExplorer.d.ts.map +1 -0
  71. package/dist/editors/notes-app/components/DriveExplorer.js +46 -0
  72. package/dist/editors/notes-app/components/FolderTree.d.ts +6 -0
  73. package/dist/editors/notes-app/components/FolderTree.d.ts.map +1 -0
  74. package/dist/editors/notes-app/components/FolderTree.js +65 -0
  75. package/dist/editors/notes-app/config.d.ts +3 -0
  76. package/dist/editors/notes-app/config.d.ts.map +1 -0
  77. package/dist/editors/notes-app/config.js +4 -0
  78. package/dist/editors/notes-app/editor.d.ts +3 -0
  79. package/dist/editors/notes-app/editor.d.ts.map +1 -0
  80. package/dist/editors/notes-app/editor.js +8 -0
  81. package/dist/editors/notes-app/module.d.ts +3 -0
  82. package/dist/editors/notes-app/module.d.ts.map +1 -0
  83. package/dist/editors/notes-app/module.js +9 -0
  84. package/dist/editors/notes-editor/components/TodoNoteEditor.d.ts.map +1 -1
  85. package/dist/editors/notes-editor/components/TodoNoteEditor.js +1 -1
  86. package/dist/editors/notes-editor/config.d.ts +3 -0
  87. package/dist/editors/notes-editor/config.d.ts.map +1 -0
  88. package/dist/editors/notes-editor/config.js +3 -0
  89. package/dist/editors/notes-editor/editor.d.ts +1 -1
  90. package/dist/editors/notes-editor/editor.d.ts.map +1 -1
  91. package/dist/editors/notes-editor/editor.js +2 -2
  92. package/dist/editors/notes-editor/module.d.ts +3 -0
  93. package/dist/editors/notes-editor/module.d.ts.map +1 -0
  94. package/dist/editors/notes-editor/{index.js → module.js} +3 -3
  95. package/dist/index.d.ts +2 -2
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +2 -4
  98. package/dist/powerhouse.manifest.json +7 -1
  99. package/dist/style.css +51 -1
  100. package/dist/subgraphs/notes/resolvers.d.ts.map +1 -1
  101. package/dist/subgraphs/notes/resolvers.js +4 -4
  102. package/package.json +54 -43
  103. package/dist/editors/notes-editor/index.d.ts +0 -3
  104. package/dist/editors/notes-editor/index.d.ts.map +0 -1
@@ -0,0 +1,3 @@
1
+ import type { DocumentModelModule } from "document-model";
2
+ export declare const documentModels: DocumentModelModule<any>[];
3
+ //# sourceMappingURL=document-models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-models.d.ts","sourceRoot":"","sources":["../../document-models/document-models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,eAAO,MAAM,cAAc,EAAE,mBAAmB,CAAC,GAAG,CAAC,EAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Notes } from "./notes/module.js";
2
+ export const documentModels = [Notes];
@@ -1,3 +1,6 @@
1
- export {};
2
- export { module as Notes } from "./notes/index.js";
1
+ /**
2
+ * This is a scaffold file meant for customization.
3
+ * Delete the file and run the code generator again to have it reset
4
+ */
5
+ export { Notes } from "./notes/module.js";
3
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../document-models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AACV,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../document-models/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,2 +1,5 @@
1
- export {};
2
- export { module as Notes } from "./notes/index.js";
1
+ /**
2
+ * This is a scaffold file meant for customization.
3
+ * Delete the file and run the code generator again to have it reset
4
+ */
5
+ export { Notes } from "./notes/module.js";
@@ -0,0 +1,18 @@
1
+ /** Actions for the Notes document model */
2
+ export declare const actions: {
3
+ addText: (input: import("./index.js").AddTextInput) => import("./index.js").AddTextAction;
4
+ addTodo: (input: import("./index.js").AddTodoInput) => import("./index.js").AddTodoAction;
5
+ editNote: (input: import("./index.js").EditNoteInput) => import("./index.js").EditNoteAction;
6
+ editText: (input: import("./index.js").EditTextInput) => import("./index.js").EditTextAction;
7
+ editTodo: (input: import("./index.js").EditTodoInput) => import("./index.js").EditTodoAction;
8
+ deleteNote: (input: import("./index.js").DeleteNoteInput) => import("./index.js").DeleteNoteAction;
9
+ setName: (name: string) => import("document-model").SetNameAction;
10
+ undo: (skip?: number, scope?: string) => import("document-model").UndoAction;
11
+ redo: (count?: number, scope?: string) => import("document-model").RedoAction;
12
+ prune: (start?: number, end?: number, scope?: string) => import("document-model").SchemaPruneAction;
13
+ loadState: <TState extends import("document-model").PHBaseState = import("document-model").PHBaseState>(state: TState & {
14
+ name: string;
15
+ }, operations: number) => import("document-model").LoadStateAction;
16
+ noop: (scope?: string) => import("document-model").NOOPAction;
17
+ };
18
+ //# sourceMappingURL=actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../document-models/notes/actions.ts"],"names":[],"mappings":"AAGA,2CAA2C;AAC3C,eAAO,MAAM,OAAO;cACyT,wCAAmB;cAAyJ,wCAAmB;eAA0J,yCAAoB;eAA6J,yCAAoB;eAA6J,yCAAoB;iBAA+J,2CAAsB;;eAAquL,CAAC,eAAe,CAAC;gBAAkE,CAAC,eAAe,CAAC;iBAAmE,CAAC,aAAa,CAAC,eAAe,CAAC;;;;gBAAqS,CAAC;CADx2O,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { baseActions } from "document-model";
2
+ import { notesActions } from "./gen/creators.js";
3
+ /** Actions for the Notes document model */
4
+ export const actions = { ...baseActions, ...notesActions };
@@ -1,2 +1,3 @@
1
1
  export * from "./notes/creators.js";
2
+ export * as notesActions from "./notes/creators.js";
2
3
  //# sourceMappingURL=creators.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"creators.d.ts","sourceRoot":"","sources":["../../../../document-models/notes/gen/creators.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"creators.d.ts","sourceRoot":"","sources":["../../../../document-models/notes/gen/creators.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,OAAO,KAAK,YAAY,MAAM,qBAAqB,CAAC"}
@@ -1 +1,2 @@
1
1
  export * from "./notes/creators.js";
2
+ export * as notesActions from "./notes/creators.js";
@@ -1,103 +1,103 @@
1
1
  export const documentModel = {
2
+ id: "powerhouse/notes",
3
+ name: "Notes",
4
+ extension: ".note",
5
+ description: "",
2
6
  author: {
3
7
  name: "",
4
8
  website: "",
5
9
  },
6
- description: "",
7
- extension: ".note",
8
- id: "powerhouse/notes",
9
- name: "Notes",
10
10
  specifications: [
11
11
  {
12
+ version: 1,
12
13
  changeLog: [],
14
+ state: {
15
+ global: {
16
+ schema: "type NotesState {\n notes: [Note!]!\n}\n\ninterface INote {\n id: OID!\n title: String!\n date: Date!\n}\n\ntype Text implements INote {\n id: OID!\n title: String!\n date: Date!\n content: String!\n}\n\ntype Todo implements INote {\n id: OID!\n title: String!\n date: Date!\n done: Boolean!\n}\n\nunion Note = Text | Todo",
17
+ initialValue: '"{\\n \\"notes\\": []\\n}"',
18
+ examples: [],
19
+ },
20
+ local: {
21
+ schema: "",
22
+ initialValue: '""',
23
+ examples: [],
24
+ },
25
+ },
13
26
  modules: [
14
27
  {
15
- description: "",
16
- id: "5a6c5352-0d6c-4472-8fee-2322a299125c",
28
+ id: "33ffb48a-b125-43e5-88af-abd00f30903e",
17
29
  name: "notes",
30
+ description: "",
18
31
  operations: [
19
32
  {
33
+ id: "bb127d06-630f-40ec-8ad3-84e982e4e8aa",
34
+ name: "ADD_TEXT",
20
35
  description: "",
36
+ schema: "input AddTextInput {\n id: OID!\n title: String!\n date: Date!\n content: String!\n}",
37
+ template: "",
38
+ reducer: "",
21
39
  errors: [],
22
40
  examples: [],
23
- id: "cf2f1107-9f55-45a9-b7df-ac4ec6078011",
24
- name: "ADD_TEXT",
25
- reducer: "",
26
- schema: "input AddTextInput {\n id: OID!\n title: String!\n date: Date!\n content: String!\n}",
27
41
  scope: "global",
28
- template: "",
29
42
  },
30
43
  {
44
+ id: "6e0290c9-2025-4a2d-a4fa-5c96e2ed85a8",
45
+ name: "ADD_TODO",
31
46
  description: "",
47
+ schema: "input AddTodoInput {\n id: OID!\n title: String!\n date: Date!\n done: Boolean!\n}",
48
+ template: "",
49
+ reducer: "",
32
50
  errors: [],
33
51
  examples: [],
34
- id: "e406bb6d-0a98-4b6a-a727-2a82859d89bc",
35
- name: "ADD_TODO",
36
- reducer: "",
37
- schema: "input AddTodoInput {\n id: OID!\n title: String!\n date: Date!\n done: Boolean!\n}",
38
52
  scope: "global",
39
- template: "",
40
53
  },
41
54
  {
55
+ id: "ac832d86-a95b-4a2c-8bd0-7a99b3e90770",
56
+ name: "EDIT_NOTE",
42
57
  description: "",
58
+ schema: "input EditNoteInput {\n id: OID!\n title: String\n date: Date\n}",
59
+ template: "",
60
+ reducer: "",
43
61
  errors: [],
44
62
  examples: [],
45
- id: "576ea38a-fd5b-452c-aea8-5bddecaddc9d",
46
- name: "EDIT_NOTE",
47
- reducer: "",
48
- schema: "input EditNoteInput {\n id: OID!\n title: String\n date: Date\n}",
49
63
  scope: "global",
50
- template: "",
51
64
  },
52
65
  {
66
+ id: "1c5e8e97-3d05-48ff-9174-d4aa80e7bfe9",
67
+ name: "EDIT_TEXT",
53
68
  description: "",
69
+ schema: "input EditTextInput {\n id: OID!\n title: String\n date: Date\n content: String\n}",
70
+ template: "",
71
+ reducer: "",
54
72
  errors: [],
55
73
  examples: [],
56
- id: "bde848ad-30d7-49e4-a526-0d94dede4087",
57
- name: "EDIT_TEXT",
58
- reducer: "",
59
- schema: "input EditTextInput {\n id: OID!\n title: String\n date: Date\n content: String\n}",
60
74
  scope: "global",
61
- template: "",
62
75
  },
63
76
  {
77
+ id: "e3508664-77b4-45bc-8223-d097d00fb147",
78
+ name: "EDIT_TODO",
64
79
  description: "",
80
+ schema: "input EditTodoInput {\n id: OID!\n title: String\n date: Date\n done: Boolean\n}",
81
+ template: "",
82
+ reducer: "",
65
83
  errors: [],
66
84
  examples: [],
67
- id: "5cb85969-0450-426e-9f50-14fb0139e89b",
68
- name: "EDIT_TODO",
69
- reducer: "",
70
- schema: "input EditTodoInput {\n id: OID!\n title: String\n date: Date\n done: Boolean\n}",
71
85
  scope: "global",
72
- template: "",
73
86
  },
74
87
  {
88
+ id: "22eecab3-9b9a-4420-abce-eb355d7563f0",
89
+ name: "DELETE_NOTE",
75
90
  description: "",
91
+ schema: "input DeleteNoteInput {\n id: OID!\n}",
92
+ template: "",
93
+ reducer: "",
76
94
  errors: [],
77
95
  examples: [],
78
- id: "f0f46863-d036-4d95-8348-390dc81305b2",
79
- name: "DELETE_NOTE",
80
- reducer: "",
81
- schema: "input DeleteNoteInput {\n id: OID!\n}",
82
96
  scope: "global",
83
- template: "",
84
97
  },
85
98
  ],
86
99
  },
87
100
  ],
88
- state: {
89
- global: {
90
- examples: [],
91
- initialValue: '"{\\n \\"notes\\": []\\n}"',
92
- schema: "type NotesState {\n notes: [Note!]!\n}\n\ninterface INote {\n id: OID!\n title: String!\n date: Date!\n}\n\ntype Text implements INote {\n id: OID!\n title: String!\n date: Date!\n content: String!\n}\n\ntype Todo implements INote {\n id: OID!\n title: String!\n date: Date!\n done: Boolean!\n}\n\nunion Note = Text | Todo",
93
- },
94
- local: {
95
- examples: [],
96
- initialValue: '""',
97
- schema: "",
98
- },
99
- },
100
- version: 1,
101
101
  },
102
102
  ],
103
103
  };
@@ -0,0 +1,142 @@
1
+ import { z } from "zod";
2
+ import type { NotesDocument, NotesPHState } from "./types.js";
3
+ /** Schema for validating the header object of a Notes document */
4
+ export declare const NotesDocumentHeaderSchema: z.ZodObject<{
5
+ id: z.ZodString;
6
+ name: z.ZodString;
7
+ createdAtUtcIso: z.ZodString;
8
+ lastModifiedAtUtcIso: z.ZodString;
9
+ } & {
10
+ documentType: z.ZodLiteral<"powerhouse/notes">;
11
+ }, "strip", z.ZodTypeAny, {
12
+ id: string;
13
+ documentType: "powerhouse/notes";
14
+ name: string;
15
+ createdAtUtcIso: string;
16
+ lastModifiedAtUtcIso: string;
17
+ }, {
18
+ id: string;
19
+ documentType: "powerhouse/notes";
20
+ name: string;
21
+ createdAtUtcIso: string;
22
+ lastModifiedAtUtcIso: string;
23
+ }>;
24
+ /** Schema for validating the state object of a Notes document */
25
+ export declare const NotesPHStateSchema: z.ZodObject<{} & {
26
+ global: z.ZodObject<Required<{
27
+ notes: z.ZodType<import("./types.js").Note[], any, import("./types.js").Note[]>;
28
+ }>, z.UnknownKeysParam, z.ZodTypeAny, {
29
+ notes: Array<import("./types.js").Note>;
30
+ }, {
31
+ notes: Array<import("./types.js").Note>;
32
+ }>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ global: {
35
+ notes: Array<import("./types.js").Note>;
36
+ };
37
+ }, {
38
+ global: {
39
+ notes: Array<import("./types.js").Note>;
40
+ };
41
+ }>;
42
+ export declare const NotesDocumentSchema: z.ZodObject<{
43
+ header: z.ZodObject<{
44
+ id: z.ZodString;
45
+ name: z.ZodString;
46
+ createdAtUtcIso: z.ZodString;
47
+ lastModifiedAtUtcIso: z.ZodString;
48
+ } & {
49
+ documentType: z.ZodLiteral<"powerhouse/notes">;
50
+ }, "strip", z.ZodTypeAny, {
51
+ id: string;
52
+ documentType: "powerhouse/notes";
53
+ name: string;
54
+ createdAtUtcIso: string;
55
+ lastModifiedAtUtcIso: string;
56
+ }, {
57
+ id: string;
58
+ documentType: "powerhouse/notes";
59
+ name: string;
60
+ createdAtUtcIso: string;
61
+ lastModifiedAtUtcIso: string;
62
+ }>;
63
+ state: z.ZodObject<{} & {
64
+ global: z.ZodObject<Required<{
65
+ notes: z.ZodType<import("./types.js").Note[], any, import("./types.js").Note[]>;
66
+ }>, z.UnknownKeysParam, z.ZodTypeAny, {
67
+ notes: Array<import("./types.js").Note>;
68
+ }, {
69
+ notes: Array<import("./types.js").Note>;
70
+ }>;
71
+ }, "strip", z.ZodTypeAny, {
72
+ global: {
73
+ notes: Array<import("./types.js").Note>;
74
+ };
75
+ }, {
76
+ global: {
77
+ notes: Array<import("./types.js").Note>;
78
+ };
79
+ }>;
80
+ initialState: z.ZodObject<{} & {
81
+ global: z.ZodObject<Required<{
82
+ notes: z.ZodType<import("./types.js").Note[], any, import("./types.js").Note[]>;
83
+ }>, z.UnknownKeysParam, z.ZodTypeAny, {
84
+ notes: Array<import("./types.js").Note>;
85
+ }, {
86
+ notes: Array<import("./types.js").Note>;
87
+ }>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ global: {
90
+ notes: Array<import("./types.js").Note>;
91
+ };
92
+ }, {
93
+ global: {
94
+ notes: Array<import("./types.js").Note>;
95
+ };
96
+ }>;
97
+ }, "strip", z.ZodTypeAny, {
98
+ header: {
99
+ id: string;
100
+ documentType: "powerhouse/notes";
101
+ name: string;
102
+ createdAtUtcIso: string;
103
+ lastModifiedAtUtcIso: string;
104
+ };
105
+ state: {
106
+ global: {
107
+ notes: Array<import("./types.js").Note>;
108
+ };
109
+ };
110
+ initialState: {
111
+ global: {
112
+ notes: Array<import("./types.js").Note>;
113
+ };
114
+ };
115
+ }, {
116
+ header: {
117
+ id: string;
118
+ documentType: "powerhouse/notes";
119
+ name: string;
120
+ createdAtUtcIso: string;
121
+ lastModifiedAtUtcIso: string;
122
+ };
123
+ state: {
124
+ global: {
125
+ notes: Array<import("./types.js").Note>;
126
+ };
127
+ };
128
+ initialState: {
129
+ global: {
130
+ notes: Array<import("./types.js").Note>;
131
+ };
132
+ };
133
+ }>;
134
+ /** Simple helper function to check if a state object is a Notes document state object */
135
+ export declare function isNotesState(state: unknown): state is NotesPHState;
136
+ /** Simple helper function to assert that a document state object is a Notes document state object */
137
+ export declare function assertIsNotesState(state: unknown): asserts state is NotesPHState;
138
+ /** Simple helper function to check if a document is a Notes document */
139
+ export declare function isNotesDocument(document: unknown): document is NotesDocument;
140
+ /** Simple helper function to assert that a document is a Notes document */
141
+ export declare function assertIsNotesDocument(document: unknown): asserts document is NotesDocument;
142
+ //# sourceMappingURL=document-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-schema.d.ts","sourceRoot":"","sources":["../../../../document-models/notes/gen/document-schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE9D,kEAAkE;AAClE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;EAEpC,CAAC;AAEH,iEAAiE;AACjE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;EAE7B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI9B,CAAC;AAEH,yFAAyF;AACzF,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAElE;AAED,qGAAqG;AACrG,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,KAAK,IAAI,YAAY,CAE/B;AAED,wEAAwE;AACxE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,aAAa,CAE5E;AAED,2EAA2E;AAC3E,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,QAAQ,IAAI,aAAa,CAEnC"}
@@ -0,0 +1,33 @@
1
+ import { BaseDocumentHeaderSchema, BaseDocumentStateSchema, } from "document-model";
2
+ import { z } from "zod";
3
+ import { notesDocumentType } from "./document-type.js";
4
+ import { NotesStateSchema } from "./schema/zod.js";
5
+ /** Schema for validating the header object of a Notes document */
6
+ export const NotesDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({
7
+ documentType: z.literal(notesDocumentType),
8
+ });
9
+ /** Schema for validating the state object of a Notes document */
10
+ export const NotesPHStateSchema = BaseDocumentStateSchema.extend({
11
+ global: NotesStateSchema(),
12
+ });
13
+ export const NotesDocumentSchema = z.object({
14
+ header: NotesDocumentHeaderSchema,
15
+ state: NotesPHStateSchema,
16
+ initialState: NotesPHStateSchema,
17
+ });
18
+ /** Simple helper function to check if a state object is a Notes document state object */
19
+ export function isNotesState(state) {
20
+ return NotesPHStateSchema.safeParse(state).success;
21
+ }
22
+ /** Simple helper function to assert that a document state object is a Notes document state object */
23
+ export function assertIsNotesState(state) {
24
+ NotesPHStateSchema.parse(state);
25
+ }
26
+ /** Simple helper function to check if a document is a Notes document */
27
+ export function isNotesDocument(document) {
28
+ return NotesDocumentSchema.safeParse(document).success;
29
+ }
30
+ /** Simple helper function to assert that a document is a Notes document */
31
+ export function assertIsNotesDocument(document) {
32
+ NotesDocumentSchema.parse(document);
33
+ }
@@ -0,0 +1,2 @@
1
+ export declare const notesDocumentType = "powerhouse/notes";
2
+ //# sourceMappingURL=document-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-type.d.ts","sourceRoot":"","sources":["../../../../document-models/notes/gen/document-type.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,qBAAqB,CAAC"}
@@ -0,0 +1 @@
1
+ export const notesDocumentType = "powerhouse/notes";
@@ -1,6 +1,12 @@
1
1
  export * from "./actions.js";
2
2
  export * from "./document-model.js";
3
3
  export * from "./types.js";
4
- export * as actions from "./creators.js";
4
+ export * from "./creators.js";
5
5
  export { createNotesDocument, createState, defaultPHState, defaultGlobalState, defaultLocalState, } from "./ph-factories.js";
6
+ export * from "./utils.js";
7
+ export * from "./reducer.js";
8
+ export * from "./schema/index.js";
9
+ export * from "./document-type.js";
10
+ export * from "./document-schema.js";
11
+ export * from "./notes/operations.js";
6
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../document-models/notes/gen/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../document-models/notes/gen/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
@@ -1,5 +1,11 @@
1
1
  export * from "./actions.js";
2
2
  export * from "./document-model.js";
3
3
  export * from "./types.js";
4
- export * as actions from "./creators.js";
4
+ export * from "./creators.js";
5
5
  export { createNotesDocument, createState, defaultPHState, defaultGlobalState, defaultLocalState, } from "./ph-factories.js";
6
+ export * from "./utils.js";
7
+ export * from "./reducer.js";
8
+ export * from "./schema/index.js";
9
+ export * from "./document-type.js";
10
+ export * from "./document-schema.js";
11
+ export * from "./notes/operations.js";
@@ -1,5 +1,5 @@
1
- import { type AddTextInput, type AddTodoInput, type EditNoteInput, type EditTextInput, type EditTodoInput, type DeleteNoteInput } from "../types.js";
2
- import { type AddTextAction, type AddTodoAction, type EditNoteAction, type EditTextAction, type EditTodoAction, type DeleteNoteAction } from "./actions.js";
1
+ import type { AddTextInput, AddTodoInput, EditNoteInput, EditTextInput, EditTodoInput, DeleteNoteInput } from "../types.js";
2
+ import type { AddTextAction, AddTodoAction, EditNoteAction, EditTextAction, EditTodoAction, DeleteNoteAction } from "./actions.js";
3
3
  export declare const addText: (input: AddTextInput) => AddTextAction;
4
4
  export declare const addTodo: (input: AddTodoInput) => AddTodoAction;
5
5
  export declare const editNote: (input: EditNoteInput) => EditNoteAction;
@@ -1 +1 @@
1
- {"version":3,"file":"creators.d.ts","sourceRoot":"","sources":["../../../../../document-models/notes/gen/notes/creators.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AAEtB,eAAO,MAAM,OAAO,GAAI,OAAO,YAAY,kBAOxC,CAAC;AAEJ,eAAO,MAAM,OAAO,GAAI,OAAO,YAAY,kBAOxC,CAAC;AAEJ,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,mBAO1C,CAAC;AAEJ,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,mBAO1C,CAAC;AAEJ,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,mBAO1C,CAAC;AAEJ,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,qBAO9C,CAAC"}
1
+ {"version":3,"file":"creators.d.ts","sourceRoot":"","sources":["../../../../../document-models/notes/gen/notes/creators.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAEtB,eAAO,MAAM,OAAO,GAAI,OAAO,YAAY,kBAOxC,CAAC;AAEJ,eAAO,MAAM,OAAO,GAAI,OAAO,YAAY,kBAOxC,CAAC;AAEJ,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,mBAO1C,CAAC;AAEJ,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,mBAO1C,CAAC;AAEJ,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,mBAO1C,CAAC;AAEJ,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,qBAO9C,CAAC"}
@@ -1,9 +1,8 @@
1
1
  import { createAction } from "document-model/core";
2
- import { z, } from "../types.js";
3
- import {} from "./actions.js";
4
- export const addText = (input) => createAction("ADD_TEXT", { ...input }, undefined, z.AddTextInputSchema, "global");
5
- export const addTodo = (input) => createAction("ADD_TODO", { ...input }, undefined, z.AddTodoInputSchema, "global");
6
- export const editNote = (input) => createAction("EDIT_NOTE", { ...input }, undefined, z.EditNoteInputSchema, "global");
7
- export const editText = (input) => createAction("EDIT_TEXT", { ...input }, undefined, z.EditTextInputSchema, "global");
8
- export const editTodo = (input) => createAction("EDIT_TODO", { ...input }, undefined, z.EditTodoInputSchema, "global");
9
- export const deleteNote = (input) => createAction("DELETE_NOTE", { ...input }, undefined, z.DeleteNoteInputSchema, "global");
2
+ import { AddTextInputSchema, AddTodoInputSchema, EditNoteInputSchema, EditTextInputSchema, EditTodoInputSchema, DeleteNoteInputSchema, } from "../schema/zod.js";
3
+ export const addText = (input) => createAction("ADD_TEXT", { ...input }, undefined, AddTextInputSchema, "global");
4
+ export const addTodo = (input) => createAction("ADD_TODO", { ...input }, undefined, AddTodoInputSchema, "global");
5
+ export const editNote = (input) => createAction("EDIT_NOTE", { ...input }, undefined, EditNoteInputSchema, "global");
6
+ export const editText = (input) => createAction("EDIT_TEXT", { ...input }, undefined, EditTextInputSchema, "global");
7
+ export const editTodo = (input) => createAction("EDIT_TODO", { ...input }, undefined, EditTodoInputSchema, "global");
8
+ export const deleteNote = (input) => createAction("DELETE_NOTE", { ...input }, undefined, DeleteNoteInputSchema, "global");
@@ -1,5 +1,3 @@
1
- import type { StateReducer } from "document-model";
2
- import type { NotesPHState } from "./types.js";
3
- export declare const stateReducer: StateReducer<NotesPHState>;
1
+ import type { NotesPHState } from "@powerhousedao/notes-demo-package/document-models/notes";
4
2
  export declare const reducer: import("document-model").Reducer<NotesPHState>;
5
3
  //# sourceMappingURL=reducer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../../../document-models/notes/gen/reducer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAK/C,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,YAAY,CAmEnD,CAAC;AAEF,eAAO,MAAM,OAAO,gDAA4C,CAAC"}
1
+ {"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../../../document-models/notes/gen/reducer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yDAAyD,CAAC;AA8E5F,eAAO,MAAM,OAAO,gDAA4C,CAAC"}
@@ -1,34 +1,34 @@
1
1
  import { isDocumentAction, createReducer } from "document-model/core";
2
- import { z } from "./types.js";
3
- import { reducer as NotesReducer } from "../src/reducers/notes.js";
4
- export const stateReducer = (state, action, dispatch) => {
2
+ import { notesNotesOperations } from "../src/reducers/notes.js";
3
+ import { AddTextInputSchema, AddTodoInputSchema, EditNoteInputSchema, EditTextInputSchema, EditTodoInputSchema, DeleteNoteInputSchema, } from "./schema/zod.js";
4
+ const stateReducer = (state, action, dispatch) => {
5
5
  if (isDocumentAction(action)) {
6
6
  return state;
7
7
  }
8
8
  switch (action.type) {
9
9
  case "ADD_TEXT":
10
- z.AddTextInputSchema().parse(action.input);
11
- NotesReducer.addTextOperation(state[action.scope], action, dispatch);
10
+ AddTextInputSchema().parse(action.input);
11
+ notesNotesOperations.addTextOperation(state[action.scope], action, dispatch);
12
12
  break;
13
13
  case "ADD_TODO":
14
- z.AddTodoInputSchema().parse(action.input);
15
- NotesReducer.addTodoOperation(state[action.scope], action, dispatch);
14
+ AddTodoInputSchema().parse(action.input);
15
+ notesNotesOperations.addTodoOperation(state[action.scope], action, dispatch);
16
16
  break;
17
17
  case "EDIT_NOTE":
18
- z.EditNoteInputSchema().parse(action.input);
19
- NotesReducer.editNoteOperation(state[action.scope], action, dispatch);
18
+ EditNoteInputSchema().parse(action.input);
19
+ notesNotesOperations.editNoteOperation(state[action.scope], action, dispatch);
20
20
  break;
21
21
  case "EDIT_TEXT":
22
- z.EditTextInputSchema().parse(action.input);
23
- NotesReducer.editTextOperation(state[action.scope], action, dispatch);
22
+ EditTextInputSchema().parse(action.input);
23
+ notesNotesOperations.editTextOperation(state[action.scope], action, dispatch);
24
24
  break;
25
25
  case "EDIT_TODO":
26
- z.EditTodoInputSchema().parse(action.input);
27
- NotesReducer.editTodoOperation(state[action.scope], action, dispatch);
26
+ EditTodoInputSchema().parse(action.input);
27
+ notesNotesOperations.editTodoOperation(state[action.scope], action, dispatch);
28
28
  break;
29
29
  case "DELETE_NOTE":
30
- z.DeleteNoteInputSchema().parse(action.input);
31
- NotesReducer.deleteNoteOperation(state[action.scope], action, dispatch);
30
+ DeleteNoteInputSchema().parse(action.input);
31
+ notesNotesOperations.deleteNoteOperation(state[action.scope], action, dispatch);
32
32
  break;
33
33
  default:
34
34
  return state;
@@ -1,3 +1,3 @@
1
1
  export * from "./types.js";
2
- export * as z from "./zod.js";
2
+ export * from "./zod.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../document-models/notes/gen/schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../document-models/notes/gen/schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
@@ -1,2 +1,2 @@
1
1
  export * from "./types.js";
2
- export * as z from "./zod.js";
2
+ export * from "./zod.js";
@@ -1,13 +1,12 @@
1
1
  import type { PHDocument, PHBaseState } from "document-model";
2
2
  import type { NotesAction } from "./actions.js";
3
3
  import type { NotesState as NotesGlobalState } from "./schema/types.js";
4
- export { z } from "./schema/index.js";
5
- export * from "./schema/types.js";
6
4
  type NotesLocalState = Record<PropertyKey, never>;
7
5
  type NotesPHState = PHBaseState & {
8
6
  global: NotesGlobalState;
9
7
  local: NotesLocalState;
10
8
  };
11
9
  type NotesDocument = PHDocument<NotesPHState>;
10
+ export * from "./schema/types.js";
12
11
  export type { NotesGlobalState, NotesLocalState, NotesPHState, NotesAction, NotesDocument, };
13
12
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../document-models/notes/gen/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,KAAK,eAAe,GAAG,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AAClD,KAAK,YAAY,GAAG,WAAW,GAAG;IAChC,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AACF,KAAK,aAAa,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;AAE9C,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../document-models/notes/gen/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAExE,KAAK,eAAe,GAAG,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AAClD,KAAK,YAAY,GAAG,WAAW,GAAG;IAChC,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AACF,KAAK,aAAa,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;AAE9C,cAAc,mBAAmB,CAAC;AAElC,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAC"}
@@ -1,2 +1 @@
1
- export { z } from "./schema/index.js";
2
1
  export * from "./schema/types.js";
@@ -3,10 +3,13 @@ import type { NotesGlobalState, NotesLocalState } from "./types.js";
3
3
  import type { NotesPHState } from "./types.js";
4
4
  export declare const initialGlobalState: NotesGlobalState;
5
5
  export declare const initialLocalState: NotesLocalState;
6
- declare const utils: DocumentModelUtils<NotesPHState>;
6
+ export declare const utils: DocumentModelUtils<NotesPHState>;
7
7
  export declare const createDocument: import("document-model").CreateDocument<NotesPHState>;
8
8
  export declare const createState: import("document-model").CreateState<NotesPHState>;
9
9
  export declare const saveToFileHandle: import("document-model").SaveToFileHandle;
10
10
  export declare const loadFromInput: import("document-model").LoadFromInput<NotesPHState>;
11
- export default utils;
11
+ export declare const isStateOfType: import("document-model").IsStateOfType<NotesPHState>;
12
+ export declare const assertIsStateOfType: import("document-model").AssertIsStateOfType<NotesPHState>;
13
+ export declare const isDocumentOfType: import("document-model").IsDocumentOfType<NotesPHState>;
14
+ export declare const assertIsDocumentOfType: import("document-model").AssertIsDocumentOfType<NotesPHState>;
12
15
  //# sourceMappingURL=utils.d.ts.map