@adminide-stack/yantra-mobile 12.0.137 → 12.0.139-alpha.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 (96) hide show
  1. package/lib/components/CustomDrawer.js +17 -1
  2. package/lib/components/CustomDrawer.js.map +1 -1
  3. package/lib/compute.js +106 -1
  4. package/lib/compute.js.map +1 -1
  5. package/lib/config/env-config.js +12 -0
  6. package/lib/config/env-config.js.map +1 -1
  7. package/lib/features/chat/ChatTranscript.js +2 -2
  8. package/lib/features/chat/ChatTranscript.js.map +1 -1
  9. package/lib/features/chat/surfaceNotes.js +4 -0
  10. package/lib/features/chat/surfaceNotes.js.map +1 -0
  11. package/lib/features/devices/readings.js.map +1 -1
  12. package/lib/features/devices/session.js +2 -22
  13. package/lib/features/devices/session.js.map +1 -1
  14. package/lib/features/dictate/backgroundRecording.js.map +1 -1
  15. package/lib/features/dictate/useDictationRecorder.js +42 -1
  16. package/lib/features/dictate/useDictationRecorder.js.map +1 -1
  17. package/lib/features/home/useHomeWeather.js +85 -0
  18. package/lib/features/home/useHomeWeather.js.map +1 -0
  19. package/lib/features/home/weather.js +139 -0
  20. package/lib/features/home/weather.js.map +1 -0
  21. package/lib/features/notion/NotionPageView.js +819 -0
  22. package/lib/features/notion/NotionPageView.js.map +1 -0
  23. package/lib/features/notion/NotionSheets.js +452 -0
  24. package/lib/features/notion/NotionSheets.js.map +1 -0
  25. package/lib/features/notion/NotionTrashSheet.js +415 -0
  26. package/lib/features/notion/NotionTrashSheet.js.map +1 -0
  27. package/lib/features/notion/NotionWorkspaceView.js +837 -0
  28. package/lib/features/notion/NotionWorkspaceView.js.map +1 -0
  29. package/lib/features/notion/notionBlocks.js +203 -0
  30. package/lib/features/notion/notionBlocks.js.map +1 -0
  31. package/lib/features/notion/notionDocuments.js +182 -0
  32. package/lib/features/notion/notionDocuments.js.map +1 -0
  33. package/lib/features/notion/notionEditorModel.js +180 -0
  34. package/lib/features/notion/notionEditorModel.js.map +1 -0
  35. package/lib/features/notion/notionTemplates.js +406 -0
  36. package/lib/features/notion/notionTemplates.js.map +1 -0
  37. package/lib/features/notion/notionTheme.js +34 -0
  38. package/lib/features/notion/notionTheme.js.map +1 -0
  39. package/lib/features/notion/notionTrash.js +100 -0
  40. package/lib/features/notion/notionTrash.js.map +1 -0
  41. package/lib/features/notion/notionUi.js +310 -0
  42. package/lib/features/notion/notionUi.js.map +1 -0
  43. package/lib/features/notion/useNotionWorkspace.js +181 -0
  44. package/lib/features/notion/useNotionWorkspace.js.map +1 -0
  45. package/lib/features/webbuilder/buildFragments.js +15 -9
  46. package/lib/features/webbuilder/buildFragments.js.map +1 -1
  47. package/lib/features/webbuilder/buildJob.js +3 -3
  48. package/lib/features/webbuilder/buildJob.js.map +1 -1
  49. package/lib/features/webbuilder/publicSandboxDomain.js +5 -0
  50. package/lib/features/webbuilder/publicSandboxDomain.js.map +1 -0
  51. package/lib/features/webbuilder/sandboxPublicHost.js +74 -0
  52. package/lib/features/webbuilder/sandboxPublicHost.js.map +1 -0
  53. package/lib/features/webbuilder/siteAddress.js +2 -1
  54. package/lib/features/webbuilder/siteAddress.js.map +1 -1
  55. package/lib/features/webbuilder/webbuilderPrompts.js +3 -2
  56. package/lib/features/webbuilder/webbuilderPrompts.js.map +1 -1
  57. package/lib/features/webbuilder/workflow.js +2 -2
  58. package/lib/features/webbuilder/workflow.js.map +1 -1
  59. package/lib/hooks/useChatApi.js +15 -3
  60. package/lib/hooks/useChatApi.js.map +1 -1
  61. package/lib/hooks/usePrerequisiteIds.js +15 -2
  62. package/lib/hooks/usePrerequisiteIds.js.map +1 -1
  63. package/lib/routes.json +107 -0
  64. package/lib/screens/Devices/index.js +3 -205
  65. package/lib/screens/Devices/index.js.map +1 -1
  66. package/lib/screens/Home/HomeScreen.js +20 -5
  67. package/lib/screens/Home/HomeScreen.js.map +1 -1
  68. package/lib/screens/Home/components/HomeHero.js +117 -0
  69. package/lib/screens/Home/components/HomeHero.js.map +1 -0
  70. package/lib/screens/Home/components/HomeSuggestions.js +108 -85
  71. package/lib/screens/Home/components/HomeSuggestions.js.map +1 -1
  72. package/lib/screens/Home/components/HomeWash.js +44 -0
  73. package/lib/screens/Home/components/HomeWash.js.map +1 -0
  74. package/lib/screens/Home/components/homeCatalog.js +125 -0
  75. package/lib/screens/Home/components/homeCatalog.js.map +1 -0
  76. package/lib/screens/Notion/index.js +18 -0
  77. package/lib/screens/Notion/index.js.map +1 -0
  78. package/lib/screens/NotionPage/index.js +19 -0
  79. package/lib/screens/NotionPage/index.js.map +1 -0
  80. package/lib/screens/WebBuilderNative/sandboxProxyApi.js +2 -2
  81. package/lib/screens/WebBuilderNative/sandboxProxyApi.js.map +1 -1
  82. package/lib/screens/WebBuilderNative/useRestoredSandboxes.js +16 -8
  83. package/lib/screens/WebBuilderNative/useRestoredSandboxes.js.map +1 -1
  84. package/lib/screens/WebBuilderNative/useWebBuilderGallery.js +6 -5
  85. package/lib/screens/WebBuilderNative/useWebBuilderGallery.js.map +1 -1
  86. package/lib/screens/WebBuilderNative/useWebBuilderHost.js +5 -4
  87. package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
  88. package/lib/screens/WebBuilderNative/webbuilderTransport.js +4 -3
  89. package/lib/screens/WebBuilderNative/webbuilderTransport.js.map +1 -1
  90. package/lib/services/savedWorkspace.js +44 -0
  91. package/lib/services/savedWorkspace.js.map +1 -0
  92. package/lib/theme/mobileTokens.js +1 -0
  93. package/lib/theme/mobileTokens.js.map +1 -1
  94. package/package.json +4 -4
  95. package/lib/features/devices/bodyComposition.js +0 -116
  96. package/lib/features/devices/bodyComposition.js.map +0 -1
@@ -0,0 +1,180 @@
1
+ import {isPageBlock,blockTitle}from'./notionBlocks.js';var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ const TEXT_TYPES = ["paragraph", "text", "heading_1", "heading_2", "heading_3", "bulleted_list", "numbered_list", "todo", "toggle", "quote", "callout", "code"];
21
+ const TURN_INTO = [{
22
+ type: "paragraph",
23
+ label: "Text",
24
+ short: "Aa"
25
+ }, {
26
+ type: "heading_1",
27
+ label: "Heading 1",
28
+ short: "H1"
29
+ }, {
30
+ type: "heading_2",
31
+ label: "Heading 2",
32
+ short: "H2"
33
+ }, {
34
+ type: "heading_3",
35
+ label: "Heading 3",
36
+ short: "H3"
37
+ }, {
38
+ type: "bulleted_list",
39
+ label: "Bulleted list",
40
+ short: "\u2022"
41
+ }, {
42
+ type: "numbered_list",
43
+ label: "Numbered list",
44
+ short: "1."
45
+ }, {
46
+ type: "todo",
47
+ label: "To-do",
48
+ short: "\u2610"
49
+ }, {
50
+ type: "toggle",
51
+ label: "Toggle",
52
+ short: "\u25B8"
53
+ }, {
54
+ type: "quote",
55
+ label: "Quote",
56
+ short: "\u275D"
57
+ }, {
58
+ type: "callout",
59
+ label: "Callout",
60
+ short: "\u{1F4A1}"
61
+ }, {
62
+ type: "code",
63
+ label: "Code",
64
+ short: "</>"
65
+ }];
66
+ function isTextType(type) {
67
+ return TEXT_TYPES.includes(type);
68
+ }
69
+ function nextTypeAfter(type) {
70
+ return type === "bulleted_list" || type === "numbered_list" || type === "todo" ? type : "paragraph";
71
+ }
72
+ function modelFromTree(tree) {
73
+ const rootId = tree.block.id;
74
+ const model = {
75
+ rootId,
76
+ blocks: {},
77
+ children: {}
78
+ };
79
+ const walk = (nodes, parentId) => {
80
+ const ids = [];
81
+ (nodes != null ? nodes : []).forEach((node) => {
82
+ const b = node == null ? void 0 : node.block;
83
+ if (!b || b.inTrash || b.archived) return;
84
+ ids.push(b.id);
85
+ model.blocks[b.id] = toEditorBlock(b, parentId);
86
+ if (!isPageBlock(b)) walk(node.children, b.id);
87
+ });
88
+ model.children[parentId] = ids;
89
+ };
90
+ walk(tree.children, rootId);
91
+ return model;
92
+ }
93
+ function toEditorBlock(b, parentId) {
94
+ var _a;
95
+ return {
96
+ id: b.id,
97
+ type: b.type,
98
+ parentId,
99
+ text: blockTitle(b),
100
+ properties: (_a = b.properties) != null ? _a : {}
101
+ };
102
+ }
103
+ function flattenModel(model) {
104
+ const lines = [];
105
+ const walk = (parentId, depth) => {
106
+ var _a;
107
+ let run = 0;
108
+ ((_a = model.children[parentId]) != null ? _a : []).forEach((id) => {
109
+ const block = model.blocks[id];
110
+ if (!block) return;
111
+ run = block.type === "numbered_list" ? run + 1 : 0;
112
+ lines.push(__spreadValues({
113
+ block,
114
+ depth
115
+ }, block.type === "numbered_list" ? {
116
+ number: run
117
+ } : {}));
118
+ if (!isPageBlock(block)) walk(id, depth + 1);
119
+ });
120
+ };
121
+ walk(model.rootId, 0);
122
+ return lines;
123
+ }
124
+ function insertAfter(model, block, afterId) {
125
+ var _a;
126
+ const siblings = [...(_a = model.children[block.parentId]) != null ? _a : []];
127
+ const at = afterId ? siblings.indexOf(afterId) : -1;
128
+ if (at >= 0) siblings.splice(at + 1, 0, block.id);
129
+ else siblings.push(block.id);
130
+ return __spreadProps(__spreadValues({}, model), {
131
+ blocks: __spreadProps(__spreadValues({}, model.blocks), {
132
+ [block.id]: block
133
+ }),
134
+ children: __spreadProps(__spreadValues({}, model.children), {
135
+ [block.parentId]: siblings
136
+ })
137
+ });
138
+ }
139
+ function removeBlock(model, id) {
140
+ var _a;
141
+ const block = model.blocks[id];
142
+ if (!block) return model;
143
+ const blocks = __spreadValues({}, model.blocks);
144
+ const children = __spreadValues({}, model.children);
145
+ const drop = (bid) => {
146
+ var _a2;
147
+ ((_a2 = children[bid]) != null ? _a2 : []).forEach(drop);
148
+ delete children[bid];
149
+ delete blocks[bid];
150
+ };
151
+ drop(id);
152
+ children[block.parentId] = ((_a = children[block.parentId]) != null ? _a : []).filter((x) => x !== id);
153
+ return __spreadProps(__spreadValues({}, model), {
154
+ blocks,
155
+ children
156
+ });
157
+ }
158
+ function patchBlock(model, id, patch) {
159
+ const block = model.blocks[id];
160
+ if (!block) return model;
161
+ return __spreadProps(__spreadValues({}, model), {
162
+ blocks: __spreadProps(__spreadValues({}, model.blocks), {
163
+ [id]: __spreadValues(__spreadValues({}, block), patch)
164
+ })
165
+ });
166
+ }
167
+ function previousLineId(model, id) {
168
+ const lines = flattenModel(model);
169
+ const at = lines.findIndex((l) => l.block.id === id);
170
+ for (let i = at - 1; i >= 0; i -= 1) if (isTextType(lines[i].block.type)) return lines[i].block.id;
171
+ return null;
172
+ }
173
+ function newBlockId() {
174
+ const c = globalThis.crypto;
175
+ if (c == null ? void 0 : c.randomUUID) return c.randomUUID();
176
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (ch) => {
177
+ const r = Math.random() * 16 | 0;
178
+ return (ch === "x" ? r : r & 3 | 8).toString(16);
179
+ });
180
+ }export{TEXT_TYPES,TURN_INTO,flattenModel,insertAfter,isTextType,modelFromTree,newBlockId,nextTypeAfter,patchBlock,previousLineId,removeBlock};//# sourceMappingURL=notionEditorModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notionEditorModel.js","sources":["../../../src/features/notion/notionEditorModel.ts"],"sourcesContent":["/**\n * Local, optimistic model of an open page for the native editor: blocks by\n * id plus each parent's ordered child ids. Edits apply here first and are\n * sent to the server in the background, so typing never waits on the network.\n *\n * Pure: no RN imports, so it runs under jest as-is.\n */\nimport { blockTitle, isPageBlock, type NotionBlock, type NotionBlockTree } from './notionBlocks';\n\nexport interface EditorBlock {\n id: string;\n type: string;\n parentId: string;\n text: string;\n properties: Record<string, unknown>;\n}\n\nexport interface EditorModel {\n rootId: string;\n blocks: Record<string, EditorBlock>;\n children: Record<string, string[]>;\n}\n\nexport interface EditorLine {\n block: EditorBlock;\n depth: number;\n number?: number;\n}\n\n/** Block types the editor edits as text. */\nexport const TEXT_TYPES: readonly string[] = [\n 'paragraph',\n 'text',\n 'heading_1',\n 'heading_2',\n 'heading_3',\n 'bulleted_list',\n 'numbered_list',\n 'todo',\n 'toggle',\n 'quote',\n 'callout',\n 'code',\n];\n\n/** Types a block can be turned into from the editor toolbar (web slash menu basics). */\nexport const TURN_INTO: ReadonlyArray<{ type: string; label: string; short: string }> = [\n { type: 'paragraph', label: 'Text', short: 'Aa' },\n { type: 'heading_1', label: 'Heading 1', short: 'H1' },\n { type: 'heading_2', label: 'Heading 2', short: 'H2' },\n { type: 'heading_3', label: 'Heading 3', short: 'H3' },\n { type: 'bulleted_list', label: 'Bulleted list', short: '•' },\n { type: 'numbered_list', label: 'Numbered list', short: '1.' },\n { type: 'todo', label: 'To-do', short: '☐' },\n { type: 'toggle', label: 'Toggle', short: '▸' },\n { type: 'quote', label: 'Quote', short: '❝' },\n { type: 'callout', label: 'Callout', short: '💡' },\n { type: 'code', label: 'Code', short: '</>' },\n];\n\nexport function isTextType(type: string): boolean {\n return TEXT_TYPES.includes(type);\n}\n\n/** Return in a list / to-do continues it; anything else starts a paragraph. */\nexport function nextTypeAfter(type: string): string {\n return type === 'bulleted_list' || type === 'numbered_list' || type === 'todo' ? type : 'paragraph';\n}\n\nexport function modelFromTree(tree: NotionBlockTree): EditorModel {\n const rootId = tree.block.id;\n const model: EditorModel = { rootId, blocks: {}, children: {} };\n const walk = (nodes: readonly NotionBlockTree[] | null | undefined, parentId: string) => {\n const ids: string[] = [];\n (nodes ?? []).forEach((node) => {\n const b = node?.block;\n if (!b || b.inTrash || b.archived) return;\n ids.push(b.id);\n model.blocks[b.id] = toEditorBlock(b, parentId);\n if (!isPageBlock(b)) walk(node.children, b.id);\n });\n model.children[parentId] = ids;\n };\n walk(tree.children, rootId);\n return model;\n}\n\nfunction toEditorBlock(b: NotionBlock, parentId: string): EditorBlock {\n return {\n id: b.id,\n type: b.type,\n parentId,\n text: blockTitle(b),\n properties: (b.properties ?? {}) as Record<string, unknown>,\n };\n}\n\n/** Depth-first lines in reading order, numbering runs of numbered_list siblings. */\nexport function flattenModel(model: EditorModel): EditorLine[] {\n const lines: EditorLine[] = [];\n const walk = (parentId: string, depth: number) => {\n let run = 0;\n (model.children[parentId] ?? []).forEach((id) => {\n const block = model.blocks[id];\n if (!block) return;\n run = block.type === 'numbered_list' ? run + 1 : 0;\n lines.push({ block, depth, ...(block.type === 'numbered_list' ? { number: run } : {}) });\n if (!isPageBlock(block)) walk(id, depth + 1);\n });\n };\n walk(model.rootId, 0);\n return lines;\n}\n\n/** Insert `block` under its parent right after `afterId` (end when absent or not found). */\nexport function insertAfter(model: EditorModel, block: EditorBlock, afterId?: string | null): EditorModel {\n const siblings = [...(model.children[block.parentId] ?? [])];\n const at = afterId ? siblings.indexOf(afterId) : -1;\n if (at >= 0) siblings.splice(at + 1, 0, block.id);\n else siblings.push(block.id);\n return {\n ...model,\n blocks: { ...model.blocks, [block.id]: block },\n children: { ...model.children, [block.parentId]: siblings },\n };\n}\n\n/** Remove a block and its subtree. */\nexport function removeBlock(model: EditorModel, id: string): EditorModel {\n const block = model.blocks[id];\n if (!block) return model;\n const blocks = { ...model.blocks };\n const children = { ...model.children };\n const drop = (bid: string) => {\n (children[bid] ?? []).forEach(drop);\n delete children[bid];\n delete blocks[bid];\n };\n drop(id);\n children[block.parentId] = (children[block.parentId] ?? []).filter((x) => x !== id);\n return { ...model, blocks, children };\n}\n\nexport function patchBlock(model: EditorModel, id: string, patch: Partial<EditorBlock>): EditorModel {\n const block = model.blocks[id];\n if (!block) return model;\n return { ...model, blocks: { ...model.blocks, [id]: { ...block, ...patch } } };\n}\n\n/** The line before `id` in reading order (where focus goes after deleting it). */\nexport function previousLineId(model: EditorModel, id: string): string | null {\n const lines = flattenModel(model);\n const at = lines.findIndex((l) => l.block.id === id);\n for (let i = at - 1; i >= 0; i -= 1) if (isTextType(lines[i].block.type)) return lines[i].block.id;\n return null;\n}\n\n/** Client-chosen block id (the server accepts `input.id` on create). */\nexport function newBlockId(): string {\n const c = (globalThis as { crypto?: { randomUUID?: () => string } }).crypto;\n if (c?.randomUUID) return c.randomUUID();\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (ch) => {\n // eslint-disable-next-line no-bitwise\n const r = (Math.random() * 16) | 0;\n // eslint-disable-next-line no-bitwise\n return (ch === 'x' ? r : (r & 0x3) | 0x8).toString(16);\n });\n}\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;AA2BO,MAAM,UAAgC,GAAA,CAAC,WAAa,EAAA,MAAA,EAAQ,WAAa,EAAA,WAAA,EAAa,WAAa,EAAA,eAAA,EAAiB,eAAiB,EAAA,MAAA,EAAQ,QAAU,EAAA,OAAA,EAAS,WAAW,MAAM;AAGjL,MAAM,YAIR,CAAC;AAAA,EACJ,IAAM,EAAA,WAAA;AAAA,EACN,KAAO,EAAA,MAAA;AAAA,EACP,KAAO,EAAA;AACT,CAAG,EAAA;AAAA,EACD,IAAM,EAAA,WAAA;AAAA,EACN,KAAO,EAAA,WAAA;AAAA,EACP,KAAO,EAAA;AACT,CAAG,EAAA;AAAA,EACD,IAAM,EAAA,WAAA;AAAA,EACN,KAAO,EAAA,WAAA;AAAA,EACP,KAAO,EAAA;AACT,CAAG,EAAA;AAAA,EACD,IAAM,EAAA,WAAA;AAAA,EACN,KAAO,EAAA,WAAA;AAAA,EACP,KAAO,EAAA;AACT,CAAG,EAA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,0 +1,406 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __restKey = (key) => key + "";
21
+ var __objRest = (source, exclude) => {
22
+ var target = {};
23
+ for (var prop in source)
24
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
+ target[prop] = source[prop];
26
+ if (source != null && __getOwnPropSymbols)
27
+ for (var prop of __getOwnPropSymbols(source)) {
28
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
+ target[prop] = source[prop];
30
+ }
31
+ return target;
32
+ };
33
+ const TEMPLATE_LIBRARY_FLAG = "notesTemplateLibrary";
34
+ const TEMPLATE_MARKER = "notesTemplate";
35
+ function rt(text, annotations = {}) {
36
+ return {
37
+ type: "text",
38
+ text: {
39
+ content: text
40
+ },
41
+ plainText: text,
42
+ annotations
43
+ };
44
+ }
45
+ const title = (text) => typeof text === "string" ? [rt(text)] : text;
46
+ const block = (type) => (text, extra = {}) => ({
47
+ type,
48
+ properties: __spreadValues({
49
+ title: title(text)
50
+ }, extra)
51
+ });
52
+ const p = block("paragraph");
53
+ const h1 = block("heading_1");
54
+ const h2 = block("heading_2");
55
+ const h3 = block("heading_3");
56
+ const bullet = block("bulleted_list");
57
+ const numbered = block("numbered_list");
58
+ const quote = block("quote");
59
+ const todo = (text, checked = false) => block("todo")(text, {
60
+ checked
61
+ });
62
+ const callout = (text, emoji) => block("callout")(text, {
63
+ icon: {
64
+ emoji
65
+ }
66
+ });
67
+ const toggle = (text, children) => __spreadProps(__spreadValues({}, block("toggle")(text)), {
68
+ children
69
+ });
70
+ const code = (text, language = "plain text") => block("code")(text, {
71
+ language
72
+ });
73
+ const divider = () => ({
74
+ type: "divider",
75
+ properties: {}
76
+ });
77
+ const page = (name, emoji, children) => ({
78
+ type: "page",
79
+ properties: {
80
+ title: title(name),
81
+ icon: {
82
+ type: "emoji",
83
+ emoji
84
+ }
85
+ },
86
+ children
87
+ });
88
+ const BUILT_IN_TEMPLATES = [{
89
+ id: "meeting-notes",
90
+ name: "Meeting notes",
91
+ description: "Agenda, notes, decisions and action items for any meeting.",
92
+ icon: "\u{1F4DD}",
93
+ category: "work",
94
+ root: page("Meeting notes \u2014 {{date}}", "\u{1F4DD}", [callout("Date: {{date}} \xB7 Attendees: @someone, @someone else", "\u{1F5D3}\uFE0F"), h2("Agenda"), numbered("Topic one"), numbered("Topic two"), h2("Notes"), p(""), h2("Decisions"), bullet(""), h2("Action items"), todo("Owner \u2014 task \u2014 due date"), todo("")])
95
+ }, {
96
+ id: "project-brief",
97
+ name: "Project brief",
98
+ description: "One page to align on the problem, goals, scope and milestones.",
99
+ icon: "\u{1F3AF}",
100
+ category: "work",
101
+ root: page("Project brief", "\u{1F3AF}", [callout("Status: Draft \xB7 Owner: you \xB7 Last updated {{date}}", "\u{1F4CC}"), h2("Problem"), p("What problem are we solving, and for whom? Why now?"), h2("Goals"), bullet("Goal one \u2014 how we will measure it"), bullet("Goal two"), h2("Non-goals"), bullet("What this project will deliberately not do"), h2("Scope"), toggle("In scope", [bullet("")]), toggle("Out of scope", [bullet("")]), h2("Milestones"), {
102
+ type: "table",
103
+ properties: {
104
+ rows: [["Milestone", "Owner", "Target date"], ["Kick-off", "", ""], ["Beta", "", ""], ["Launch", "", ""]]
105
+ }
106
+ }, h2("Risks & open questions"), bullet("")])
107
+ }, {
108
+ id: "weekly-plan",
109
+ name: "Weekly plan",
110
+ description: "Top priorities and a day-by-day plan for the week.",
111
+ icon: "\u{1F5D3}\uFE0F",
112
+ category: "personal",
113
+ root: page("Week of {{date}}", "\u{1F5D3}\uFE0F", [h2("Top 3 priorities"), todo(""), todo(""), todo(""), divider(), ...["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"].map((day) => toggle(day, [todo("")])), toggle("Weekend", [todo("")]), divider(), h2("Reflection"), p("What went well? What will I change next week?")])
114
+ }, {
115
+ id: "todo-list",
116
+ name: "To-do list",
117
+ description: "A simple checklist grouped by urgency.",
118
+ icon: "\u2705",
119
+ category: "personal",
120
+ root: page("To-do list", "\u2705", [h3("Today"), todo(""), h3("This week"), todo(""), h3("Later"), todo(""), h3("Done"), todo("Create a to-do list", true)])
121
+ }, {
122
+ id: "reading-list",
123
+ name: "Reading list",
124
+ description: "A database of books and articles with status, rating and type.",
125
+ icon: "\u{1F4DA}",
126
+ category: "personal",
127
+ root: {
128
+ type: "database",
129
+ properties: {
130
+ title: title("Reading list"),
131
+ icon: {
132
+ type: "emoji",
133
+ emoji: "\u{1F4DA}"
134
+ },
135
+ schema: {
136
+ title: {
137
+ type: "title"
138
+ },
139
+ Author: {
140
+ type: "text"
141
+ },
142
+ Type: {
143
+ type: "select",
144
+ options: [{
145
+ name: "Book",
146
+ color: "blue"
147
+ }, {
148
+ name: "Article",
149
+ color: "purple"
150
+ }, {
151
+ name: "Paper",
152
+ color: "orange"
153
+ }]
154
+ },
155
+ Status: {
156
+ type: "select",
157
+ options: [{
158
+ name: "Want to read",
159
+ color: "gray"
160
+ }, {
161
+ name: "Reading",
162
+ color: "yellow"
163
+ }, {
164
+ name: "Finished",
165
+ color: "green"
166
+ }]
167
+ },
168
+ Rating: {
169
+ type: "number"
170
+ },
171
+ Link: {
172
+ type: "url"
173
+ }
174
+ }
175
+ },
176
+ rows: [{
177
+ type: "database_row",
178
+ properties: {
179
+ title: title("Designing Data-Intensive Applications"),
180
+ Author: "Martin Kleppmann",
181
+ Type: {
182
+ name: "Book"
183
+ },
184
+ Status: {
185
+ name: "Reading"
186
+ }
187
+ }
188
+ }, {
189
+ type: "database_row",
190
+ properties: {
191
+ title: title("The Pragmatic Programmer"),
192
+ Author: "Hunt & Thomas",
193
+ Type: {
194
+ name: "Book"
195
+ },
196
+ Status: {
197
+ name: "Want to read"
198
+ }
199
+ }
200
+ }, {
201
+ type: "database_row",
202
+ properties: {
203
+ title: title("Out of the Tar Pit"),
204
+ Author: "Moseley & Marks",
205
+ Type: {
206
+ name: "Paper"
207
+ },
208
+ Status: {
209
+ name: "Finished"
210
+ },
211
+ Rating: 5
212
+ }
213
+ }]
214
+ }
215
+ }, {
216
+ id: "journal-entry",
217
+ name: "Journal entry",
218
+ description: "A daily page for gratitude, highlights and reflection.",
219
+ icon: "\u{1F4D3}",
220
+ category: "personal",
221
+ root: page("Journal \u2014 {{date}}", "\u{1F4D3}", [quote("How am I feeling today?"), p(""), h3("Grateful for"), bullet(""), h3("Highlights"), bullet(""), h3("What I learned"), p(""), h3("Tomorrow"), todo("")])
222
+ }, {
223
+ id: "bug-report",
224
+ name: "Bug report",
225
+ description: "Steps to reproduce, expected vs actual behaviour, environment.",
226
+ icon: "\u{1F41E}",
227
+ category: "engineering",
228
+ root: page("Bug: short description", "\u{1F41E}", [callout("Severity: Medium \xB7 Reported {{date}} \xB7 Assignee: unassigned", "\u{1F6A6}"), h2("Summary"), p("One or two sentences describing the problem."), h2("Steps to reproduce"), numbered("Go to \u2026"), numbered("Click \u2026"), numbered("See error"), h2("Expected behaviour"), p(""), h2("Actual behaviour"), p(""), h2("Environment"), bullet("Browser / OS:"), bullet("Version / commit:"), toggle("Logs", [code("Paste logs or a stack trace here")])])
229
+ }, {
230
+ id: "one-on-one",
231
+ name: "1:1 notes",
232
+ description: "A running agenda for one-on-one meetings.",
233
+ icon: "\u{1F91D}",
234
+ category: "work",
235
+ root: page("1:1 \u2014 {{date}}", "\u{1F91D}", [h2("Check-in"), p("How are things going?"), h2("Their topics"), bullet(""), h2("My topics"), bullet(""), h2("Feedback"), toggle("Things going well", [p("")]), toggle("Things to improve", [p("")]), h2("Action items"), todo("")])
236
+ }, {
237
+ id: "engineering-spec",
238
+ name: "Technical spec",
239
+ description: "Context, proposal, alternatives and rollout for a design review.",
240
+ icon: "\u{1F6E0}\uFE0F",
241
+ category: "engineering",
242
+ root: page("Technical spec", "\u{1F6E0}\uFE0F", [callout("Author: you \xB7 Reviewers: \xB7 Status: Draft", "\u{1F4DD}"), h1("Context"), p("Background and the problem this design solves."), h1("Proposal"), p("The approach in detail. Diagrams welcome."), h2("API / data model"), code("// interfaces, schemas, endpoints", "typescript"), h1("Alternatives considered"), bullet(""), h1("Rollout & testing"), todo("Feature flag"), todo("Tests"), todo("Docs")])
243
+ }];
244
+ const TEMPLATE_CATEGORIES = [{
245
+ id: "all",
246
+ label: "All"
247
+ }, {
248
+ id: "work",
249
+ label: "Work"
250
+ }, {
251
+ id: "personal",
252
+ label: "Personal"
253
+ }, {
254
+ id: "engineering",
255
+ label: "Engineering"
256
+ }, {
257
+ id: "mine",
258
+ label: "My templates"
259
+ }];
260
+ function templateTokens(now) {
261
+ const iso = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")}`;
262
+ let pretty;
263
+ try {
264
+ pretty = now.toLocaleDateString("en-US", {
265
+ month: "short",
266
+ day: "numeric",
267
+ year: "numeric"
268
+ });
269
+ } catch (e) {
270
+ pretty = iso;
271
+ }
272
+ return {
273
+ date: pretty,
274
+ isoDate: iso
275
+ };
276
+ }
277
+ function fillTokens(text, tokens) {
278
+ return text.replace(/\{\{(\w+)\}\}/g, (m, key) => {
279
+ var _a;
280
+ return (_a = tokens[key]) != null ? _a : m;
281
+ });
282
+ }
283
+ function fillDeep(value, tokens) {
284
+ if (typeof value === "string") return fillTokens(value, tokens);
285
+ if (Array.isArray(value)) return value.map((v) => fillDeep(v, tokens));
286
+ if (value && typeof value === "object") {
287
+ const out = {};
288
+ for (const [k, v] of Object.entries(value)) out[k] = fillDeep(v, tokens);
289
+ return out;
290
+ }
291
+ return value;
292
+ }
293
+ function newBlockId() {
294
+ const c = globalThis.crypto;
295
+ if (c == null ? void 0 : c.randomUUID) return c.randomUUID();
296
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (ch) => {
297
+ const r = Math.random() * 16 | 0;
298
+ return (ch === "x" ? r : r & 3 | 8).toString(16);
299
+ });
300
+ }
301
+ function buildTemplateCreatePlan(template, parent, opts = {}) {
302
+ var _a, _b;
303
+ const newId = (_a = opts.newId) != null ? _a : newBlockId;
304
+ const tokens = templateTokens((_b = opts.now) != null ? _b : /* @__PURE__ */ new Date());
305
+ const rows = [];
306
+ let blockCount = 0;
307
+ const build = (node, parentRef) => {
308
+ var _a2, _b2, _c2, _d;
309
+ const id = newId();
310
+ blockCount += 1;
311
+ const properties = (_b2 = fillDeep((_a2 = node.properties) != null ? _a2 : {}, tokens)) != null ? _b2 : {};
312
+ const out = {
313
+ id,
314
+ type: node.type,
315
+ properties,
316
+ parent: parentRef
317
+ };
318
+ const kids = ((_c2 = node.children) != null ? _c2 : []).map((c) => build(c, {
319
+ type: "block",
320
+ id
321
+ }));
322
+ if (kids.length) out.children = kids;
323
+ if (node.type === "database") for (const row of (_d = node.rows) != null ? _d : []) rows.push(build(row, {
324
+ type: "database",
325
+ id
326
+ }));
327
+ return out;
328
+ };
329
+ const root = build(template.root, parent);
330
+ if (opts.title !== void 0 && opts.title.trim()) root.properties = __spreadProps(__spreadValues({}, root.properties), {
331
+ title: [rt(opts.title.trim())]
332
+ });
333
+ if (TEMPLATE_MARKER in root.properties) {
334
+ const _c = root.properties, {
335
+ [TEMPLATE_MARKER]: _drop
336
+ } = _c, rest = __objRest(_c, [
337
+ __restKey(TEMPLATE_MARKER)
338
+ ]);
339
+ root.properties = rest;
340
+ }
341
+ return {
342
+ rootId: root.id,
343
+ rootType: root.type,
344
+ root,
345
+ rows,
346
+ blockCount
347
+ };
348
+ }
349
+ const NON_TEMPLATE_KEYS = /* @__PURE__ */ new Set([TEMPLATE_LIBRARY_FLAG, "pageSettings"]);
350
+ function cleanProperties(props) {
351
+ const out = {};
352
+ for (const [k, v] of Object.entries(props != null ? props : {})) if (!NON_TEMPLATE_KEYS.has(k)) out[k] = v;
353
+ return JSON.parse(JSON.stringify(out));
354
+ }
355
+ function templateRootFromTree(tree, rowsByDatabase = {}) {
356
+ const convert = (node) => {
357
+ var _a, _b;
358
+ const out = {
359
+ type: node.block.type,
360
+ properties: cleanProperties(node.block.properties)
361
+ };
362
+ const kids = ((_a = node.children) != null ? _a : []).filter((c) => !c.block.inTrash && c.block.type !== "database_row").map(convert);
363
+ if (kids.length) out.children = kids;
364
+ const id = node.block.id;
365
+ if (node.block.type === "database" && id && ((_b = rowsByDatabase[id]) == null ? void 0 : _b.length)) out.rows = rowsByDatabase[id].map((r) => ({
366
+ type: "database_row",
367
+ properties: cleanProperties(r.properties)
368
+ }));
369
+ return out;
370
+ };
371
+ return convert(tree);
372
+ }
373
+ function plainText(value) {
374
+ if (typeof value === "string") return value;
375
+ if (!Array.isArray(value)) return "";
376
+ return value.map((r) => {
377
+ var _a, _b, _c;
378
+ return (_c = (_b = r == null ? void 0 : r.plainText) != null ? _b : (_a = r == null ? void 0 : r.text) == null ? void 0 : _a.content) != null ? _c : "";
379
+ }).join("");
380
+ }
381
+ function filterTemplates(templates, category, query) {
382
+ const q = query.trim().toLowerCase();
383
+ return templates.filter((t) => (category === "all" || !category || t.category === category) && (!q || t.name.toLowerCase().includes(q) || t.description.toLowerCase().includes(q)));
384
+ }
385
+ function userTemplateEntry(block2) {
386
+ var _a, _b;
387
+ const props = (_a = block2.properties) != null ? _a : {};
388
+ const marker = props[TEMPLATE_MARKER];
389
+ const icon = (_b = props.icon) == null ? void 0 : _b.emoji;
390
+ return {
391
+ id: `user:${block2.id}`,
392
+ name: plainText(props.title).trim() || "Untitled",
393
+ description: (marker == null ? void 0 : marker.description) || "Saved from one of your pages.",
394
+ icon: icon || (block2.type === "database" ? "\u{1F5C3}\uFE0F" : "\u{1F4C4}"),
395
+ category: "mine",
396
+ // Content is fetched on use (the library page's tree); the root here is only a stub.
397
+ root: {
398
+ type: block2.type,
399
+ properties: cleanProperties(props)
400
+ },
401
+ sourceBlockId: block2.id
402
+ };
403
+ }
404
+ function isTemplateLibrary(properties) {
405
+ return !!properties && properties[TEMPLATE_LIBRARY_FLAG] === true;
406
+ }export{BUILT_IN_TEMPLATES,TEMPLATE_CATEGORIES,TEMPLATE_LIBRARY_FLAG,TEMPLATE_MARKER,buildTemplateCreatePlan,filterTemplates,isTemplateLibrary,newBlockId,plainText,rt,templateRootFromTree,templateTokens,userTemplateEntry};//# sourceMappingURL=notionTemplates.js.map