roamjs-components 0.82.5 → 0.82.6

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.82.5",
4
+ "version": "0.82.6",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "scripts": {
@@ -2,7 +2,7 @@ import type { InputTextNode, ActionParams } from "../types";
2
2
  export declare const gatherActions: ({ node: { text, children, uid, heading, viewType, textAlign, open, props, }, parentUid, order, }: {
3
3
  node: InputTextNode;
4
4
  parentUid: string;
5
- order?: number | undefined;
5
+ order?: number | "last" | undefined;
6
6
  }) => ActionParams[];
7
7
  declare const createBlock: (params: Parameters<typeof gatherActions>[0]) => Promise<string>;
8
8
  export default createBlock;
@@ -1 +1 @@
1
- {"version":3,"file":"createBlock.js","sourceRoot":"","sources":["../../src/writes/createBlock.ts"],"names":[],"mappings":";;;;AACA,4EAA4C;AAErC,MAAM,aAAa,GAAG,CAAC,EAC5B,IAAI,EAAE,EACJ,IAAI,EACJ,QAAQ,GAAG,EAAE,EACb,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,EAC5C,OAAO,EACP,QAAQ,EACR,SAAS,EACT,IAAI,GAAG,IAAI,EACX,KAAK,GACN,EACD,SAAS,EACT,KAAK,GAAG,CAAC,GAKV,EAAkB,EAAE;IACnB,OAAO;QACL;YACE,QAAQ,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE;YAC5C,KAAK,EAAE;gBACL,GAAG;gBACH,MAAM,EAAE,IAAI;gBACZ,OAAO;gBACP,YAAY,EAAE,SAAS;gBACvB,oBAAoB,EAAE,QAAQ;gBAC9B,IAAI;gBACJ,KAAK;aACN;SACF;QACD,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAClC,IAAA,qBAAa,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAC/C;KACF,CAAC;AACJ,CAAC,CAAC;AAnCW,QAAA,aAAa,iBAmCxB;AAEF,MAAM,WAAW,GAAG,CAClB,MAA2C,EAC1B,EAAE;IACnB,MAAM,OAAO,GAAG,IAAA,qBAAa,EAAC,MAAM,CAAC,CAAC;IACtC,OAAO,IAAA,uBAAa,EAClB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC,CAC3D,CAAC,IAAI,CAAC,GAAG,EAAE,WAAC,OAAA,CAAA,MAAA,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,0CAAE,GAAG,KAAI,EAAE,CAAA,EAAA,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC","sourcesContent":["import type { InputTextNode, ActionParams } from \"../types\";\nimport submitActions from \"./submitActions\";\n\nexport const gatherActions = ({\n node: {\n text,\n children = [],\n uid = window.roamAlphaAPI.util.generateUID(),\n heading,\n viewType,\n textAlign,\n open = true,\n props,\n },\n parentUid,\n order = 0,\n}: {\n node: InputTextNode;\n parentUid: string;\n order?: number;\n}): ActionParams[] => {\n return [\n {\n location: { \"parent-uid\": parentUid, order },\n block: {\n uid,\n string: text,\n heading,\n \"text-align\": textAlign,\n \"children-view-type\": viewType,\n open,\n props,\n },\n },\n ...children.flatMap((node, order) =>\n gatherActions({ node, parentUid: uid, order })\n ),\n ];\n};\n\nconst createBlock = (\n params: Parameters<typeof gatherActions>[0]\n): Promise<string> => {\n const actions = gatherActions(params);\n return submitActions(\n actions.map((params) => ({ params, type: \"createBlock\" }))\n ).then(() => actions[0].block?.uid || \"\");\n};\n\nexport default createBlock;\n"]}
1
+ {"version":3,"file":"createBlock.js","sourceRoot":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AAW,CAAC","sourcesContent":["import type { InputTextNode, ActionParams } from \"../types\";\nimport submitActions from \"./submitActions\";\n\nexport const gatherActions = ({\n node: {\n text,\n children = [],\n uid = window.roamAlphaAPI.util.generateUID(),\n heading,\n viewType,\n textAlign,\n open = true,\n props,\n },\n parentUid,\n order = 0,\n}: {\n node: InputTextNode;\n parentUid: string;\n order?: number | \"last\";\n}): ActionParams[] => {\n return [\n {\n location: { \"parent-uid\": parentUid, order },\n block: {\n uid,\n string: text,\n heading,\n \"text-align\": textAlign,\n \"children-view-type\": viewType,\n open,\n props,\n },\n },\n ...children.flatMap((node, order) =>\n gatherActions({ node, parentUid: uid, order })\n ),\n ];\n};\n\nconst createBlock = (\n params: Parameters<typeof gatherActions>[0]\n): Promise<string> => {\n const actions = gatherActions(params);\n return submitActions(\n actions.map((params) => ({ params, type: \"createBlock\" }))\n ).then(() => actions[0].block?.uid || \"\");\n};\n\nexport default createBlock;\n"]}