roamjs-components 0.79.9 → 0.79.10

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "roamjs-components",
3
3
  "description": "Expansive toolset, utilities, & components for developing RoamJS extensions.",
4
- "version": "0.79.9",
4
+ "version": "0.79.10",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "scripts": {
@@ -1,7 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const formatRoamNode = (n, v) => {
4
- const viewType = (typeof n[":children/view-type"] === "string" ? n[":children/view-type"] : v).replace(/^:/, "");
3
+ const formatRoamNode = (n) => {
4
+ var _a, _b, _c;
5
+ if (!n)
6
+ return {
7
+ text: "",
8
+ open: true,
9
+ order: 0,
10
+ uid: "",
11
+ children: [],
12
+ parents: [],
13
+ heading: 0,
14
+ viewType: "bullet",
15
+ editTime: new Date(0),
16
+ props: { imageResize: {}, iframe: {} },
17
+ textAlign: "left",
18
+ };
19
+ const viewType = ((_c = (_b = (_a = (n[":block/parents"] || [])
20
+ .find((a) => typeof a[":children/view-type"] === "string")) === null || _a === void 0 ? void 0 : _a[":children/view-type"]) === null || _b === void 0 ? void 0 : _b.replace) === null || _c === void 0 ? void 0 : _c.call(_b, /^:/, "")) || "bullet";
5
21
  return {
6
22
  text: n[":block/string"] || n[":node/title"] || "",
7
23
  open: typeof n[":block/open"] === "undefined" ? true : n[":block/open"],
@@ -14,13 +30,11 @@ const formatRoamNode = (n, v) => {
14
30
  textAlign: n[":block/text-align"] || "left",
15
31
  children: (n[":block/children"] || [])
16
32
  .sort((a, b) => (a[":block/order"] || 0) - (b[":block/order"] || 0))
17
- .map((r) => formatRoamNode(r, viewType)),
33
+ .map(formatRoamNode),
18
34
  parents: (n[":block/parents"] || []).map((n) => (n === null || n === void 0 ? void 0 : n[":db/id"]) || 0),
19
35
  };
20
36
  };
21
- const getFullTreeByParentUid = (uid) => {
22
- var _a, _b, _c, _d;
23
- return formatRoamNode((((_b = (_a = window.roamAlphaAPI.data.fast.q(`[:find (pull ?b [
37
+ const getFullTreeByParentUid = (uid) => formatRoamNode(window.roamAlphaAPI.pull(`[
24
38
  :block/string
25
39
  :node/title
26
40
  :block/uid
@@ -31,15 +45,8 @@ const getFullTreeByParentUid = (uid) => {
31
45
  :block/text-align
32
46
  :edit/time
33
47
  :block/props
34
- :block/parents
48
+ {:block/parents [:children/view-type]}
35
49
  {:block/children ...}
36
- ]) :where [?b :block/uid "${uid}"]]`)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b[0]) || {}), ((_d = (_c = window.roamAlphaAPI.data.fast.q(`[:find
37
- (pull ?p [:children/view-type]) :where
38
- [?c :block/uid "${uid}"] [?c :block/parents ?p]]`)
39
- .reverse()
40
- .map((a) => a[0])
41
- .map((a) => a && a[":children/view-type"])
42
- .find((a) => !!a)) === null || _c === void 0 ? void 0 : _c.replace) === null || _d === void 0 ? void 0 : _d.call(_c, /^:/, "")) || "bullet");
43
- };
50
+ ]`, [`:block/uid`, uid]));
44
51
  exports.default = getFullTreeByParentUid;
45
52
  //# sourceMappingURL=getFullTreeByParentUid.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getFullTreeByParentUid.js","sourceRoot":"","sources":["../../src/queries/getFullTreeByParentUid.ts"],"names":[],"mappings":";;AAEA,MAAM,cAAc,GAAG,CAAC,CAAY,EAAE,CAAW,EAAY,EAAE;IAC7D,MAAM,QAAQ,GAAG,CACf,OAAO,CAAC,CAAC,qBAAqB,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAC5E,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAa,CAAC;IAChC,OAAO;QACL,IAAI,EAAE,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,aAAa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,CAAC,CAC9B;;;;;;;;;;;;;gCAa0B,GAAG,KAAK,CACnC,0CAAG,CAAC,CAAC,0CAAG,CAAC,CAAC,KAAI,EAAE,CAAc,EAC/B,CAAC,MAAA,MACC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAC7B;;wBAEgB,GAAG,4BAA4B,CAElD;SACE,OAAO,EAAE;SACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAChB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,qBAAqB,CAAC,CAAC;SACzC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,0CACf,OAAO,mDAAG,IAAI,EAAE,EAAE,CAAc,KAAI,QAAQ,CACjD,CAAA;CAAA,CAAC;AAEJ,kBAAe,sBAAsB,CAAC","sourcesContent":["import type { PullBlock, TreeNode, ViewType } from \"../types\";\n\nconst formatRoamNode = (n: PullBlock, v: ViewType): TreeNode => {\n const viewType = (\n typeof n[\":children/view-type\"] === \"string\" ? n[\":children/view-type\"] : v\n ).replace(/^:/, \"\") as ViewType;\n return {\n text: n[\":block/string\"] || n[\":node/title\"] || \"\",\n open: typeof n[\":block/open\"] === \"undefined\" ? true : n[\":block/open\"],\n order: n[\":block/order\"] || 0,\n uid: n[\":block/uid\"] || \"\",\n heading: n[\":block/heading\"] || 0,\n viewType,\n editTime: new Date(n[\":edit/time\"] || 0),\n props: { imageResize: {}, iframe: {} },\n textAlign: n[\":block/text-align\"] || \"left\",\n children: (n[\":block/children\"] || [])\n .sort(\n (a: PullBlock, b: PullBlock) =>\n (a[\":block/order\"] || 0) - (b[\":block/order\"] || 0)\n )\n .map((r) => formatRoamNode(r, viewType)),\n parents: (n[\":block/parents\"] || []).map((n) => n?.[\":db/id\"] || 0),\n };\n};\n\nconst getFullTreeByParentUid = (uid: string): TreeNode =>\n formatRoamNode(\n (window.roamAlphaAPI.data.fast.q(\n `[:find (pull ?b [\n :block/string \n :node/title \n :block/uid \n :block/order \n :block/heading \n :block/open \n :children/view-type\n :block/text-align\n :edit/time \n :block/props\n :block/parents\n {:block/children ...}\n ]) :where [?b :block/uid \"${uid}\"]]`\n )?.[0]?.[0] || {}) as PullBlock,\n ((\n window.roamAlphaAPI.data.fast.q(\n `[:find\n (pull ?p [:children/view-type]) :where\n [?c :block/uid \"${uid}\"] [?c :block/parents ?p]]`\n ) as [PullBlock][]\n )\n .reverse()\n .map((a) => a[0])\n .map((a) => a && a[\":children/view-type\"])\n .find((a) => !!a)\n ?.replace?.(/^:/, \"\") as ViewType) || \"bullet\"\n );\n\nexport default getFullTreeByParentUid;\n"]}
1
+ {"version":3,"file":"getFullTreeByParentUid.js","sourceRoot":"","sources":["../../src/queries/getFullTreeByParentUid.ts"],"names":[],"mappings":";;AAEA,MAAM,cAAc,GAAG,CAAC,CAAmB,EAAY,EAAE;;IACvD,IAAI,CAAC,CAAC;QACJ,OAAO;YACL,IAAI,EAAE,EAAE;YACR,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,CAAC;YACR,GAAG,EAAE,EAAE;YACP,QAAQ,EAAE,EAAE;YACZ,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC;YACrB,KAAK,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YACtC,SAAS,EAAE,MAAM;SAClB,CAAC;IACJ,MAAM,QAAQ,GACZ,CAAC,MAAA,MAAA,MAAA,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;SACzB,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,qBAAqB,CAAC,KAAK,QAAQ,CAAC,0CACvD,qBAAqB,CAAC,0CAAE,OAAO,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YAAY,CAAC,IAAI,CACtB;;;;;;;;;;;;;MAaA,EACA,CAAC,YAAY,EAAE,GAAG,CAAC,CACpB,CACF,CAAC;AAEJ,kBAAe,sBAAsB,CAAC","sourcesContent":["import type { PullBlock, TreeNode, ViewType } from \"../types\";\n\nconst formatRoamNode = (n: PullBlock | null): TreeNode => {\n if (!n)\n return {\n text: \"\",\n open: true,\n order: 0,\n uid: \"\",\n children: [],\n parents: [],\n heading: 0,\n viewType: \"bullet\",\n editTime: new Date(0),\n props: { imageResize: {}, iframe: {} },\n textAlign: \"left\",\n };\n const viewType =\n ((n[\":block/parents\"] || [])\n .find((a) => typeof a[\":children/view-type\"] === \"string\")\n ?.[\":children/view-type\"]?.replace?.(/^:/, \"\") as ViewType) || \"bullet\";\n return {\n text: n[\":block/string\"] || n[\":node/title\"] || \"\",\n open: typeof n[\":block/open\"] === \"undefined\" ? true : n[\":block/open\"],\n order: n[\":block/order\"] || 0,\n uid: n[\":block/uid\"] || \"\",\n heading: n[\":block/heading\"] || 0,\n viewType,\n editTime: new Date(n[\":edit/time\"] || 0),\n props: { imageResize: {}, iframe: {} },\n textAlign: n[\":block/text-align\"] || \"left\",\n children: (n[\":block/children\"] || [])\n .sort((a, b) => (a[\":block/order\"] || 0) - (b[\":block/order\"] || 0))\n .map(formatRoamNode),\n parents: (n[\":block/parents\"] || []).map((n) => n?.[\":db/id\"] || 0),\n };\n};\n\nconst getFullTreeByParentUid = (uid: string): TreeNode =>\n formatRoamNode(\n window.roamAlphaAPI.pull(\n `[\n :block/string \n :node/title \n :block/uid \n :block/order \n :block/heading \n :block/open \n :children/view-type\n :block/text-align\n :edit/time \n :block/props\n {:block/parents [:children/view-type]}\n {:block/children ...}\n ]`,\n [`:block/uid`, uid]\n )\n );\n\nexport default getFullTreeByParentUid;\n"]}
package/types/native.d.ts CHANGED
@@ -119,9 +119,7 @@ export declare type RoamPull = {
119
119
  "node/title"?: string;
120
120
  } & RoamNode;
121
121
  export declare type PullBlock = {
122
- ":attrs/lookup"?: ({
123
- ":db/id": number;
124
- } | PullBlock)[];
122
+ ":attrs/lookup"?: PullBlock[];
125
123
  ":entity/attrs"?: [
126
124
  {
127
125
  ":source": [":block/uid", string];
@@ -1 +1 @@
1
- {"version":3,"file":"native.js","sourceRoot":"","sources":["../../src/types/native.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,4EAA4E","sourcesContent":["// emulating Datalog Grammar\n// https://docs.datomic.com/cloud/query/query-data-reference.html#or-clauses\n\nimport { ChangeEvent } from \"react\";\n\nexport type DatalogSrcVar = {\n type: \"src-var\";\n value: string;\n};\n\nexport type DatalogVariable = {\n type: \"variable\";\n value: string;\n};\n\nexport type DatalogAndClause = {\n type: \"and-clause\";\n clauses: DatalogClause[];\n};\n\nexport type DatalogExpressionClause =\n | DatalogDataPattern\n | DatalogPredExpr\n | DatalogFnExpr\n | DatalogRuleExpr;\n\nexport type DatalogRuleExpr = {\n type: \"rule-expr\";\n srcVar?: DatalogSrcVar;\n ruleName: DatalogRuleName;\n arguments: DatalogArgument[];\n};\n\nexport type DatalogNotClause = {\n type: \"not-clause\";\n srcVar?: DatalogSrcVar;\n clauses: DatalogClause[];\n};\n\nexport type DatalogNotJoinClause = {\n type: \"not-join-clause\";\n srcVar?: DatalogSrcVar;\n variables: DatalogVariable[];\n clauses: DatalogClause[];\n};\n\nexport type DatalogOrClause = {\n type: \"or-clause\";\n srcVar?: DatalogSrcVar;\n clauses: DatalogClause[];\n};\n\nexport type DatalogOrJoinClause = {\n type: \"or-join-clause\";\n srcVar?: DatalogSrcVar;\n variables: DatalogVariable[];\n clauses: DatalogClause[];\n};\n\nexport type DatalogClause =\n | DatalogNotClause\n | DatalogOrJoinClause\n | DatalogExpressionClause\n | DatalogOrClause\n | DatalogNotJoinClause\n | DatalogAndClause;\n\nexport type DatalogDataPattern = {\n type: \"data-pattern\";\n srcVar?: DatalogSrcVar;\n arguments: DatalogArgument[];\n};\n\nexport type DatalogArgument =\n | DatalogSrcVar\n | DatalogVariable\n | DatalogConstant\n | DatalogUnderscore;\n\nexport type DatalogConstant = {\n type: \"constant\";\n value: string;\n};\n\nexport type DatalogPredExpr = {\n type: \"pred-expr\";\n pred:\n | \"<\"\n | \">\"\n | \"re-matches\"\n | \"re-find\"\n | \"clojure.string/includes?\"\n | \"clojure.string/ends-with?\"\n | \"clojure.string/starts-with?\";\n arguments: DatalogArgument[];\n};\n\nexport type DatalogFnExpr = {\n type: \"fn-expr\";\n fn: \"re-pattern\" | \"get\";\n arguments: DatalogArgument[];\n binding: DatalogBinding;\n};\n\nexport type DatalogBinding =\n | DatalogBindScalar\n | DatalogBindTuple\n | DatalogBindColl\n | DatalogBindRel;\n\nexport type DatalogBindScalar = {\n type: \"bind-scalar\";\n variable: DatalogVariable;\n};\nexport type DatalogBindTuple = {\n type: \"bind-tuple\";\n args: (DatalogVariable | DatalogUnderscore)[];\n};\nexport type DatalogBindColl = {\n type: \"bind-col\";\n variable: DatalogVariable;\n};\n\nexport type DatalogBindRel = {\n type: \"bind-rel\";\n args: (DatalogVariable | DatalogUnderscore)[];\n};\n\nexport type DatalogUnderscore = {\n type: \"underscore\";\n value: \"_\";\n};\n\nexport type DatalogRuleName = {\n type: \"rulename\";\n value: string;\n};\n\nexport type RoamBasicBlock = {\n string: string;\n uid: string;\n};\n\nexport type RoamBasicPage = { title: string; uid: string };\n\nexport type RoamBasicNode = {\n text: string;\n uid: string;\n children: RoamBasicNode[];\n};\n\nexport type RoamPull = {\n \"block/children\"?: RoamNode[];\n \"block/heading\"?: number;\n \"block/open\"?: boolean;\n \"block/order\"?: number;\n \"block/page\"?: RoamNode;\n \"block/parents\"?: RoamNode[];\n \"block/refs\"?: RoamNode[];\n \"block/string\"?: string;\n \"block/uid\"?: string;\n \"children/view-type\"?: `:${ViewType}`;\n \"create/time\"?: number;\n \"create/user\"?: RoamNode;\n \"edit/time\"?: number;\n \"edit/user\"?: RoamNode;\n \"log/id\"?: number;\n \"node/title\"?: string;\n} & RoamNode;\n\nexport type PullBlock = {\n \":attrs/lookup\"?: ({ \":db/id\": number } | PullBlock)[];\n \":entity/attrs\"?: [\n { \":source\": [\":block/uid\", string]; \":value\": [\":block/uid\", string] },\n { \":source\": [\":block/uid\", string]; \":value\": [\":block/uid\", string] },\n {\n \":source\": [\":block/uid\", string];\n \":value\": string | [\":block/uid\", string];\n }\n ][];\n \":block/children\"?: PullBlock[];\n \":block/heading\"?: number;\n \":block/open\"?: boolean;\n \":block/order\"?: number;\n \":block/page\"?: { \":db/id\": number };\n \":block/parents\"?: PullBlock[];\n \":block/props\"?: {\n \":image-size\"?: {\n [p: string]: {\n \":height\": number;\n \":width\": number;\n };\n };\n \":iframe\"?: {\n [p: string]: {\n \":size\": {\n \":height\": number;\n \":width\": number;\n };\n };\n };\n [k: `:roamjs-${string}`]: Record<string, unknown>;\n };\n \":block/refs\"?: { \":db/id\": number }[];\n \":block/string\"?: string;\n \":block/view-type\"?: `:${BlockViewType}`;\n \":block/text-align\"?: TextAlignment;\n \":block/uid\"?: string;\n \":children/view-type\"?: `:${ViewType}`;\n \":create/time\"?: number;\n \":create/user\"?: { \":db/id\": number };\n \":edit/time\"?: number;\n \":edit/user\"?: { \":db/id\": number };\n \":db/id\"?: number;\n \":log/id\"?: number;\n \":node/title\"?: string;\n \":user/display-name\"?: string;\n \":user/display-page\"?: { \":db/id\": number };\n \":user/settings\"?: {\n \":namespace-options\": [\":none\", \":partial\", \":full\"];\n \":link-brackets?\": boolean;\n \":showing-inline-references?\": boolean;\n \":right-sidebar-pinned\": {\n [uuid: string]: SidebarWindow;\n };\n \":showing-own-icons?\": boolean;\n \":showing-user-icons?\": boolean;\n \":first-day-of-week\"?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n };\n \":user/uid\"?: string;\n \":user/email\"?: string;\n};\n\nexport type RoamPullResult = RoamPull | null;\n\nexport type ViewType = \"document\" | \"bullet\" | \"numbered\";\n\nexport type BlockViewType =\n | \"tabs\"\n | \"outline\"\n | \"horizontal\"\n | \"popout\"\n | \"comment\"\n | \"side\"\n | \"vertical\";\n\nexport type TextAlignment = \"left\" | \"center\" | \"right\" | \"justify\";\n\nexport type RoamBlock = {\n attrs?: { source: string[] }[][];\n children?: { id: number }[];\n id?: number;\n string?: string;\n title?: string;\n time?: number;\n uid?: string;\n order?: number;\n \"view-type\"?: ViewType;\n};\n\nexport type RoamError = {\n raw: string;\n \"status-code\": number;\n};\n\nexport type TreeNode = {\n text: string;\n order: number;\n children: TreeNode[];\n parents: number[];\n uid: string;\n heading: number;\n open: boolean;\n viewType: ViewType;\n editTime: Date;\n textAlign: TextAlignment;\n props: {\n imageResize: {\n [link: string]: {\n height: number;\n width: number;\n };\n };\n iframe: {\n [link: string]: {\n height: number;\n width: number;\n };\n };\n };\n};\n\nexport type TextNode = {\n text: string;\n children: TextNode[];\n};\n\nexport type InputTextNode = {\n text: string;\n children?: InputTextNode[];\n uid?: string;\n heading?: number;\n textAlign?: TextAlignment;\n viewType?: ViewType;\n open?: boolean;\n props?: Record<string, unknown>;\n};\n\ntype PlusType = [number, string];\n\nexport type RoamNode = { \"db/id\": number };\n\nexport type RoamQuery = RoamPull & {\n \"block/graph\"?: RoamNode;\n \"node/graph+title\"?: PlusType;\n \"block/graph+uid\"?: PlusType;\n \"node/graph\"?: RoamNode;\n \"edit/email\"?: string;\n \"entity/graph\"?: RoamNode;\n};\n\nexport type RoamQueryResult = number & RoamQuery;\n\nexport type ClientParams = {\n action:\n | \"pull\"\n | \"q\"\n | \"create-block\"\n | \"update-block\"\n | \"create-page\"\n | \"move-block\"\n | \"delete-block\"\n | \"delete-page\"\n | \"update-page\";\n selector?: string;\n uid?: string;\n query?: string;\n inputs?: string[];\n} & ActionParams;\n\nexport type ActionParams = {\n location?: {\n \"parent-uid\": string;\n order: number;\n };\n block?: {\n string?: string;\n uid?: string;\n open?: boolean;\n heading?: number;\n \"text-align\"?: TextAlignment;\n \"children-view-type\"?: ViewType;\n props?: Record<string, unknown>;\n };\n page?: {\n title?: string;\n uid?: string;\n };\n};\n\nexport type WriteAction = (a: ActionParams) => Promise<void>;\n\nexport type UserSettings = {\n \"global-filters\": {\n includes: string[];\n removes: string[];\n };\n};\n\ntype SidebarWindowType =\n | SidebarBlockWindow\n | SidebarMentionsWindow\n | SidebarGraphWindow\n | SidebarOutlineWindow;\n\nexport type SidebarWindowInput = {\n \"block-uid\": string;\n type: SidebarWindowType[\"type\"];\n};\n\ntype SidebarBlockWindow = {\n type: \"block\";\n \"block-uid\": string;\n};\n\ntype SidebarOutlineWindow = {\n type: \"outline\";\n \"page-uid\": string;\n};\n\ntype SidebarMentionsWindow = {\n type: \"mentions\";\n \"mentions-uid\": string;\n};\n\ntype SidebarGraphWindow = {\n type: \"graph\";\n // \"page-uid\": string; Currently not working despite documentation\n \"block-uid\": string;\n};\n\nexport type SidebarAction = (action: {\n window: SidebarWindowInput;\n}) => Promise<void>;\n\nexport type SidebarWindow = {\n \"collapsed?\": boolean;\n order: number;\n \"pinned?\": boolean;\n \"window-id\": string;\n} & SidebarWindowType;\n\nexport type AddPullWatch = (\n pullPattern: string,\n entityId: string,\n callback: (before: PullBlock | null, after: PullBlock | null) => void\n) => boolean;\n\ntype ButtonAction = {\n type: \"button\";\n onClick?: (e: MouseEvent) => void;\n content: string;\n};\n\ntype SwitchAction = {\n type: \"switch\";\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n};\n\ntype InputAction = {\n type: \"input\";\n placeholder: string;\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n};\n\ntype SelectAction = {\n type: \"select\";\n items: string[];\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n};\n\ntype CustomAction = {\n type: \"reactComponent\";\n component: React.FC;\n};\n\nexport type Action =\n | ButtonAction\n | SwitchAction\n | InputAction\n | SelectAction\n | CustomAction;\n\ntype PanelConfig = {\n tabTitle: string;\n settings: {\n id: string;\n name: string;\n description: string;\n action: Action;\n }[];\n};\n\nexport type AddCommandOptions = {\n label: string;\n callback: () => void;\n disableHotkey?: boolean;\n defaultHotkey?: string | string[];\n};\n\ntype RemoveCommandOptions = {\n label: string;\n};\n\nexport type OnloadArgs = {\n extensionAPI: {\n settings: {\n get: (k: string) => unknown;\n getAll: () => Record<string, unknown>;\n panel: {\n create: (c: PanelConfig) => void;\n };\n set: (k: string, v: unknown) => Promise<void>;\n };\n ui: {\n commandPalette: {\n addCommand: (c: AddCommandOptions) => Promise<void>;\n removeCommand: (c: RemoveCommandOptions) => Promise<void>;\n };\n };\n };\n extension: {\n version: string;\n };\n};\n"]}
1
+ {"version":3,"file":"native.js","sourceRoot":"","sources":["../../src/types/native.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,4EAA4E","sourcesContent":["// emulating Datalog Grammar\n// https://docs.datomic.com/cloud/query/query-data-reference.html#or-clauses\n\nimport { ChangeEvent } from \"react\";\n\nexport type DatalogSrcVar = {\n type: \"src-var\";\n value: string;\n};\n\nexport type DatalogVariable = {\n type: \"variable\";\n value: string;\n};\n\nexport type DatalogAndClause = {\n type: \"and-clause\";\n clauses: DatalogClause[];\n};\n\nexport type DatalogExpressionClause =\n | DatalogDataPattern\n | DatalogPredExpr\n | DatalogFnExpr\n | DatalogRuleExpr;\n\nexport type DatalogRuleExpr = {\n type: \"rule-expr\";\n srcVar?: DatalogSrcVar;\n ruleName: DatalogRuleName;\n arguments: DatalogArgument[];\n};\n\nexport type DatalogNotClause = {\n type: \"not-clause\";\n srcVar?: DatalogSrcVar;\n clauses: DatalogClause[];\n};\n\nexport type DatalogNotJoinClause = {\n type: \"not-join-clause\";\n srcVar?: DatalogSrcVar;\n variables: DatalogVariable[];\n clauses: DatalogClause[];\n};\n\nexport type DatalogOrClause = {\n type: \"or-clause\";\n srcVar?: DatalogSrcVar;\n clauses: DatalogClause[];\n};\n\nexport type DatalogOrJoinClause = {\n type: \"or-join-clause\";\n srcVar?: DatalogSrcVar;\n variables: DatalogVariable[];\n clauses: DatalogClause[];\n};\n\nexport type DatalogClause =\n | DatalogNotClause\n | DatalogOrJoinClause\n | DatalogExpressionClause\n | DatalogOrClause\n | DatalogNotJoinClause\n | DatalogAndClause;\n\nexport type DatalogDataPattern = {\n type: \"data-pattern\";\n srcVar?: DatalogSrcVar;\n arguments: DatalogArgument[];\n};\n\nexport type DatalogArgument =\n | DatalogSrcVar\n | DatalogVariable\n | DatalogConstant\n | DatalogUnderscore;\n\nexport type DatalogConstant = {\n type: \"constant\";\n value: string;\n};\n\nexport type DatalogPredExpr = {\n type: \"pred-expr\";\n pred:\n | \"<\"\n | \">\"\n | \"re-matches\"\n | \"re-find\"\n | \"clojure.string/includes?\"\n | \"clojure.string/ends-with?\"\n | \"clojure.string/starts-with?\";\n arguments: DatalogArgument[];\n};\n\nexport type DatalogFnExpr = {\n type: \"fn-expr\";\n fn: \"re-pattern\" | \"get\";\n arguments: DatalogArgument[];\n binding: DatalogBinding;\n};\n\nexport type DatalogBinding =\n | DatalogBindScalar\n | DatalogBindTuple\n | DatalogBindColl\n | DatalogBindRel;\n\nexport type DatalogBindScalar = {\n type: \"bind-scalar\";\n variable: DatalogVariable;\n};\nexport type DatalogBindTuple = {\n type: \"bind-tuple\";\n args: (DatalogVariable | DatalogUnderscore)[];\n};\nexport type DatalogBindColl = {\n type: \"bind-col\";\n variable: DatalogVariable;\n};\n\nexport type DatalogBindRel = {\n type: \"bind-rel\";\n args: (DatalogVariable | DatalogUnderscore)[];\n};\n\nexport type DatalogUnderscore = {\n type: \"underscore\";\n value: \"_\";\n};\n\nexport type DatalogRuleName = {\n type: \"rulename\";\n value: string;\n};\n\nexport type RoamBasicBlock = {\n string: string;\n uid: string;\n};\n\nexport type RoamBasicPage = { title: string; uid: string };\n\nexport type RoamBasicNode = {\n text: string;\n uid: string;\n children: RoamBasicNode[];\n};\n\nexport type RoamPull = {\n \"block/children\"?: RoamNode[];\n \"block/heading\"?: number;\n \"block/open\"?: boolean;\n \"block/order\"?: number;\n \"block/page\"?: RoamNode;\n \"block/parents\"?: RoamNode[];\n \"block/refs\"?: RoamNode[];\n \"block/string\"?: string;\n \"block/uid\"?: string;\n \"children/view-type\"?: `:${ViewType}`;\n \"create/time\"?: number;\n \"create/user\"?: RoamNode;\n \"edit/time\"?: number;\n \"edit/user\"?: RoamNode;\n \"log/id\"?: number;\n \"node/title\"?: string;\n} & RoamNode;\n\nexport type PullBlock = {\n \":attrs/lookup\"?: PullBlock[];\n \":entity/attrs\"?: [\n { \":source\": [\":block/uid\", string]; \":value\": [\":block/uid\", string] },\n { \":source\": [\":block/uid\", string]; \":value\": [\":block/uid\", string] },\n {\n \":source\": [\":block/uid\", string];\n \":value\": string | [\":block/uid\", string];\n }\n ][];\n \":block/children\"?: PullBlock[];\n \":block/heading\"?: number;\n \":block/open\"?: boolean;\n \":block/order\"?: number;\n \":block/page\"?: { \":db/id\": number };\n \":block/parents\"?: PullBlock[];\n \":block/props\"?: {\n \":image-size\"?: {\n [p: string]: {\n \":height\": number;\n \":width\": number;\n };\n };\n \":iframe\"?: {\n [p: string]: {\n \":size\": {\n \":height\": number;\n \":width\": number;\n };\n };\n };\n [k: `:roamjs-${string}`]: Record<string, unknown>;\n };\n \":block/refs\"?: { \":db/id\": number }[];\n \":block/string\"?: string;\n \":block/view-type\"?: `:${BlockViewType}`;\n \":block/text-align\"?: TextAlignment;\n \":block/uid\"?: string;\n \":children/view-type\"?: `:${ViewType}`;\n \":create/time\"?: number;\n \":create/user\"?: { \":db/id\": number };\n \":edit/time\"?: number;\n \":edit/user\"?: { \":db/id\": number };\n \":db/id\"?: number;\n \":log/id\"?: number;\n \":node/title\"?: string;\n \":user/display-name\"?: string;\n \":user/display-page\"?: { \":db/id\": number };\n \":user/settings\"?: {\n \":namespace-options\": [\":none\", \":partial\", \":full\"];\n \":link-brackets?\": boolean;\n \":showing-inline-references?\": boolean;\n \":right-sidebar-pinned\": {\n [uuid: string]: SidebarWindow;\n };\n \":showing-own-icons?\": boolean;\n \":showing-user-icons?\": boolean;\n \":first-day-of-week\"?: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n };\n \":user/uid\"?: string;\n \":user/email\"?: string;\n};\n\nexport type RoamPullResult = RoamPull | null;\n\nexport type ViewType = \"document\" | \"bullet\" | \"numbered\";\n\nexport type BlockViewType =\n | \"tabs\"\n | \"outline\"\n | \"horizontal\"\n | \"popout\"\n | \"comment\"\n | \"side\"\n | \"vertical\";\n\nexport type TextAlignment = \"left\" | \"center\" | \"right\" | \"justify\";\n\nexport type RoamBlock = {\n attrs?: { source: string[] }[][];\n children?: { id: number }[];\n id?: number;\n string?: string;\n title?: string;\n time?: number;\n uid?: string;\n order?: number;\n \"view-type\"?: ViewType;\n};\n\nexport type RoamError = {\n raw: string;\n \"status-code\": number;\n};\n\nexport type TreeNode = {\n text: string;\n order: number;\n children: TreeNode[];\n parents: number[];\n uid: string;\n heading: number;\n open: boolean;\n viewType: ViewType;\n editTime: Date;\n textAlign: TextAlignment;\n props: {\n imageResize: {\n [link: string]: {\n height: number;\n width: number;\n };\n };\n iframe: {\n [link: string]: {\n height: number;\n width: number;\n };\n };\n };\n};\n\nexport type TextNode = {\n text: string;\n children: TextNode[];\n};\n\nexport type InputTextNode = {\n text: string;\n children?: InputTextNode[];\n uid?: string;\n heading?: number;\n textAlign?: TextAlignment;\n viewType?: ViewType;\n open?: boolean;\n props?: Record<string, unknown>;\n};\n\ntype PlusType = [number, string];\n\nexport type RoamNode = { \"db/id\": number };\n\nexport type RoamQuery = RoamPull & {\n \"block/graph\"?: RoamNode;\n \"node/graph+title\"?: PlusType;\n \"block/graph+uid\"?: PlusType;\n \"node/graph\"?: RoamNode;\n \"edit/email\"?: string;\n \"entity/graph\"?: RoamNode;\n};\n\nexport type RoamQueryResult = number & RoamQuery;\n\nexport type ClientParams = {\n action:\n | \"pull\"\n | \"q\"\n | \"create-block\"\n | \"update-block\"\n | \"create-page\"\n | \"move-block\"\n | \"delete-block\"\n | \"delete-page\"\n | \"update-page\";\n selector?: string;\n uid?: string;\n query?: string;\n inputs?: string[];\n} & ActionParams;\n\nexport type ActionParams = {\n location?: {\n \"parent-uid\": string;\n order: number;\n };\n block?: {\n string?: string;\n uid?: string;\n open?: boolean;\n heading?: number;\n \"text-align\"?: TextAlignment;\n \"children-view-type\"?: ViewType;\n props?: Record<string, unknown>;\n };\n page?: {\n title?: string;\n uid?: string;\n };\n};\n\nexport type WriteAction = (a: ActionParams) => Promise<void>;\n\nexport type UserSettings = {\n \"global-filters\": {\n includes: string[];\n removes: string[];\n };\n};\n\ntype SidebarWindowType =\n | SidebarBlockWindow\n | SidebarMentionsWindow\n | SidebarGraphWindow\n | SidebarOutlineWindow;\n\nexport type SidebarWindowInput = {\n \"block-uid\": string;\n type: SidebarWindowType[\"type\"];\n};\n\ntype SidebarBlockWindow = {\n type: \"block\";\n \"block-uid\": string;\n};\n\ntype SidebarOutlineWindow = {\n type: \"outline\";\n \"page-uid\": string;\n};\n\ntype SidebarMentionsWindow = {\n type: \"mentions\";\n \"mentions-uid\": string;\n};\n\ntype SidebarGraphWindow = {\n type: \"graph\";\n // \"page-uid\": string; Currently not working despite documentation\n \"block-uid\": string;\n};\n\nexport type SidebarAction = (action: {\n window: SidebarWindowInput;\n}) => Promise<void>;\n\nexport type SidebarWindow = {\n \"collapsed?\": boolean;\n order: number;\n \"pinned?\": boolean;\n \"window-id\": string;\n} & SidebarWindowType;\n\nexport type AddPullWatch = (\n pullPattern: string,\n entityId: string,\n callback: (before: PullBlock | null, after: PullBlock | null) => void\n) => boolean;\n\ntype ButtonAction = {\n type: \"button\";\n onClick?: (e: MouseEvent) => void;\n content: string;\n};\n\ntype SwitchAction = {\n type: \"switch\";\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n};\n\ntype InputAction = {\n type: \"input\";\n placeholder: string;\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n};\n\ntype SelectAction = {\n type: \"select\";\n items: string[];\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n};\n\ntype CustomAction = {\n type: \"reactComponent\";\n component: React.FC;\n};\n\nexport type Action =\n | ButtonAction\n | SwitchAction\n | InputAction\n | SelectAction\n | CustomAction;\n\ntype PanelConfig = {\n tabTitle: string;\n settings: {\n id: string;\n name: string;\n description: string;\n action: Action;\n }[];\n};\n\nexport type AddCommandOptions = {\n label: string;\n callback: () => void;\n disableHotkey?: boolean;\n defaultHotkey?: string | string[];\n};\n\ntype RemoveCommandOptions = {\n label: string;\n};\n\nexport type OnloadArgs = {\n extensionAPI: {\n settings: {\n get: (k: string) => unknown;\n getAll: () => Record<string, unknown>;\n panel: {\n create: (c: PanelConfig) => void;\n };\n set: (k: string, v: unknown) => Promise<void>;\n };\n ui: {\n commandPalette: {\n addCommand: (c: AddCommandOptions) => Promise<void>;\n removeCommand: (c: RemoveCommandOptions) => Promise<void>;\n };\n };\n };\n extension: {\n version: string;\n };\n};\n"]}