roamjs-components 0.52.12 → 0.52.13

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.
@@ -1,12 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ let nextPort = 3000;
3
4
  const addOldRoamJSDependency = (extension, source) => {
4
5
  var _a;
5
6
  const id = `roamjs-${extension.replace(/\/main$/, "")}`;
6
7
  const existing = document.getElementById(id);
7
8
  if (!existing) {
8
9
  const script = document.createElement("script");
9
- script.src = `https://roamjs.com/${extension}.js`;
10
+ script.src = `${process.env.NODE_ENV === "development"
11
+ ? `http://localhost:${nextPort += 100}`
12
+ : "https://roamjs.com"}/${extension}.js`;
10
13
  script.async = true;
11
14
  script.type = "text/javascript";
12
15
  script.id = id;
@@ -1 +1 @@
1
- {"version":3,"file":"addOldRoamJSDependency.js","sourceRoot":"","sources":["../src/dom/addOldRoamJSDependency.ts"],"names":[],"mappings":";;AAAA,MAAM,sBAAsB,GAAG,CAAC,SAAiB,EAAE,MAAe,EAAQ,EAAE;;IAC1E,MAAM,EAAE,GAAG,UAAU,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC;IACxD,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAC7C,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,MAAM,CAAC,GAAG,GAAG,sBAAsB,SAAS,KAAK,CAAC;QAClD,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,MAAM,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAChC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;QACf,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;SAC5C;QACD,MAAA,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,0CAAE,WAAW,CAAC,MAAM,CAAC,CAAC;KACrD;AACH,CAAC,CAAC;AAEF,kBAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"addOldRoamJSDependency.js","sourceRoot":"","sources":["../src/dom/addOldRoamJSDependency.ts"],"names":[],"mappings":";;AAAA,IAAI,QAAQ,GAAG,IAAI,CAAC;AAEpB,MAAM,sBAAsB,GAAG,CAAC,SAAiB,EAAE,MAAe,EAAQ,EAAE;;IAC1E,MAAM,EAAE,GAAG,UAAU,SAAS,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC;IACxD,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAC7C,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,MAAM,CAAC,GAAG,GAAG,GACX,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;YACpC,CAAC,CAAC,oBAAoB,QAAQ,IAAE,GAAG,EAAE;YACrC,CAAC,CAAC,oBACN,IAAI,SAAS,KAAK,CAAC;QACnB,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,MAAM,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAChC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;QACf,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;SAC5C;QACD,MAAA,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,0CAAE,WAAW,CAAC,MAAM,CAAC,CAAC;KACrD;AACH,CAAC,CAAC;AAEF,kBAAe,sBAAsB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "roamjs-components",
3
3
  "description": "Description for roamjs-components",
4
- "version": "0.52.12",
4
+ "version": "0.52.13",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "scripts": {
package/types/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { Condition as QueryBuilderCondition, Selection as QueryBuilderSelection, Result as QueryBuilderResult } from "./query-builder";
1
3
  export declare type RoamBasicBlock = {
2
4
  string: string;
3
5
  uid: string;
@@ -389,6 +391,38 @@ declare global {
389
391
  enable: () => void;
390
392
  disable: () => void;
391
393
  };
394
+ queryBuilder?: {
395
+ QueryEditor: (props: {
396
+ parentUid: string;
397
+ defaultQuery: string[];
398
+ onQuery: (query: {
399
+ returnNode: string;
400
+ conditions: QueryBuilderCondition[];
401
+ selections: QueryBuilderSelection[];
402
+ }) => Promise<void>;
403
+ }) => JSX.Element;
404
+ QueryPage: (props: {
405
+ pageUid: string;
406
+ configUid?: string;
407
+ }) => JSX.Element;
408
+ ResultsView: (props: {
409
+ parentUid: string;
410
+ header?: React.ReactNode;
411
+ results: QueryBuilderResult[];
412
+ resultContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
413
+ }) => JSX.Element;
414
+ fireQuery: (query: {
415
+ returnNode: string;
416
+ conditions: QueryBuilderCondition[];
417
+ selections: QueryBuilderSelection[];
418
+ }) => QueryBuilderResult[];
419
+ parseQuery: (q: string[]) => {
420
+ returnNode: string;
421
+ conditionNodes: QueryBuilderCondition[];
422
+ selectionNodes: QueryBuilderSelection[];
423
+ };
424
+ conditionToDatalog: (condition: QueryBuilderCondition) => string;
425
+ };
392
426
  [id: string]: {
393
427
  [method: string]: (args?: any) => void;
394
428
  } | undefined;
@@ -0,0 +1,16 @@
1
+ export declare type Condition = {
2
+ relation: string;
3
+ source: string;
4
+ target: string;
5
+ uid: string;
6
+ not: boolean;
7
+ };
8
+ export declare type Selection = {
9
+ text: string;
10
+ label: string;
11
+ uid: string;
12
+ };
13
+ export declare type Result = {
14
+ text: string;
15
+ uid: string;
16
+ } & Record<string, string | number | Date>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=query-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-builder.js","sourceRoot":"","sources":["../src/types/query-builder.ts"],"names":[],"mappings":""}