diff --git a/package-lock.json b/package-lock.json index c69552e..a57dbf2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "eslint": "^7.32.0", "react": "^17.0.2", "react-dom": "^17.0.2", - "roam-client": "^1.90.0", + "roam-client": "^1.91.0", "roamjs-components": "^0.25.1" }, "devDependencies": { @@ -3544,9 +3544,9 @@ } }, "node_modules/core-js-pure": { - "version": "3.18.0", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.18.0.tgz", - "integrity": "sha512-ZnK+9vyuMhKulIGqT/7RHGRok8RtkHMEX/BGPHkHx+ouDkq+MUvf9mfIgdqhpmPDu8+V5UtRn/CbCRc9I4lX4w==", + "version": "3.18.2", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.18.2.tgz", + "integrity": "sha512-4hMMLUlZhKJKOWbbGD1/VDUxGPEhEoN/T01k7bx271WiBKCvCfkgPzy0IeRS4PB50p6/N1q/SZL4B/TRsTE5bA==", "hasInstallScript": true, "funding": { "type": "opencollective", @@ -8913,20 +8913,20 @@ } }, "node_modules/roam-client": { - "version": "1.90.0", - "resolved": "https://registry.npmjs.org/roam-client/-/roam-client-1.90.0.tgz", - "integrity": "sha512-IfhNwowAuAtjvV92w6Yxc+NLIQnqCqER4gQyzSjovwDHrQ+YynON2yXM1tLBn3sDRiP+r/QL11HgDtw1fYcAWQ==", + "version": "1.91.0", + "resolved": "https://registry.npmjs.org/roam-client/-/roam-client-1.91.0.tgz", + "integrity": "sha512-rtf2HzMX9fViuZVFtusw/hgPqJ75Q0yW0U8bJ6t1tzTNEXjk2EQfdvq5nwF0baA0hi5NFS0OTjnGOb3BlSn7kg==", "dependencies": { "axios": "^0.21.1", "date-fns": "^2.16.1", "randomstring": "^1.1.5", - "roam-marked": "^0.10.16" + "roam-marked": "^0.10.19" } }, "node_modules/roam-marked": { - "version": "0.10.16", - "resolved": "https://registry.npmjs.org/roam-marked/-/roam-marked-0.10.16.tgz", - "integrity": "sha512-n/1cv5b/SJqfhyh2sZYrpX2Z54OCR3wZYppRNxAG9rlNWFM10Npwg/i1OOb6ST8YtF80CcvEjbqSWYHRejIfNw==", + "version": "0.10.19", + "resolved": "https://registry.npmjs.org/roam-marked/-/roam-marked-0.10.19.tgz", + "integrity": "sha512-bk43Lbh78x2WWnaJoedBTSf2MOP2zZXtYEVWbnRzTQohbWZO/549oY0ZKA6e6/iD7xRa/R1JeqA7rUMUIR9xcQ==", "dependencies": { "hast-util-to-html": "^7.1.3", "marked": "^2.0.0", @@ -14217,9 +14217,9 @@ } }, "core-js-pure": { - "version": "3.18.0", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.18.0.tgz", - "integrity": "sha512-ZnK+9vyuMhKulIGqT/7RHGRok8RtkHMEX/BGPHkHx+ouDkq+MUvf9mfIgdqhpmPDu8+V5UtRn/CbCRc9I4lX4w==" + "version": "3.18.2", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.18.2.tgz", + "integrity": "sha512-4hMMLUlZhKJKOWbbGD1/VDUxGPEhEoN/T01k7bx271WiBKCvCfkgPzy0IeRS4PB50p6/N1q/SZL4B/TRsTE5bA==" }, "core-util-is": { "version": "1.0.3", @@ -18365,20 +18365,20 @@ } }, "roam-client": { - "version": "1.90.0", - "resolved": "https://registry.npmjs.org/roam-client/-/roam-client-1.90.0.tgz", - "integrity": "sha512-IfhNwowAuAtjvV92w6Yxc+NLIQnqCqER4gQyzSjovwDHrQ+YynON2yXM1tLBn3sDRiP+r/QL11HgDtw1fYcAWQ==", + "version": "1.91.0", + "resolved": "https://registry.npmjs.org/roam-client/-/roam-client-1.91.0.tgz", + "integrity": "sha512-rtf2HzMX9fViuZVFtusw/hgPqJ75Q0yW0U8bJ6t1tzTNEXjk2EQfdvq5nwF0baA0hi5NFS0OTjnGOb3BlSn7kg==", "requires": { "axios": "^0.21.1", "date-fns": "^2.16.1", "randomstring": "^1.1.5", - "roam-marked": "^0.10.16" + "roam-marked": "^0.10.19" } }, "roam-marked": { - "version": "0.10.16", - "resolved": "https://registry.npmjs.org/roam-marked/-/roam-marked-0.10.16.tgz", - "integrity": "sha512-n/1cv5b/SJqfhyh2sZYrpX2Z54OCR3wZYppRNxAG9rlNWFM10Npwg/i1OOb6ST8YtF80CcvEjbqSWYHRejIfNw==", + "version": "0.10.19", + "resolved": "https://registry.npmjs.org/roam-marked/-/roam-marked-0.10.19.tgz", + "integrity": "sha512-bk43Lbh78x2WWnaJoedBTSf2MOP2zZXtYEVWbnRzTQohbWZO/549oY0ZKA6e6/iD7xRa/R1JeqA7rUMUIR9xcQ==", "requires": { "hast-util-to-html": "^7.1.3", "marked": "^2.0.0", diff --git a/package.json b/package.json index e964fb2..942a02f 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "./build/main.js", "scripts": { "build": "roamjs-scripts build", - "dev": "roamjs-scripts dev" + "dev": "roamjs-scripts dev", + "publish": "roamjs-scripts publish" }, "license": "MIT", "devDependencies": { @@ -20,7 +21,7 @@ "eslint": "^7.32.0", "react": "^17.0.2", "react-dom": "^17.0.2", - "roam-client": "^1.90.0", + "roam-client": "^1.91.0", "roamjs-components": "^0.25.1" } } diff --git a/src/StarRating.tsx b/src/StarRating.tsx index 4a77499..24c4253 100644 --- a/src/StarRating.tsx +++ b/src/StarRating.tsx @@ -12,7 +12,7 @@ function StarIcon({ className: string; }) { return ( - + ); } @@ -55,10 +55,14 @@ function StarIcon({ // This one also has an explicit return const StarRating = ({ initialValue, - blockUid + maximumStars, + blockUid, + smartBlockTemplate }: { initialValue: number; - blockUid: string + maximumStars: number; + blockUid: string; + smartBlockTemplate: string; }) : JSX.Element => { const [rating, setRating] = useState(initialValue); const [hoverRating, setHoverRating] = useState(initialValue); @@ -73,14 +77,30 @@ function StarIcon({ window.roamAlphaAPI.updateBlock({ block: { uid: blockUid, string: index.toString() }, }); - + console.log(`StarRating: blockUid ${blockUid} smartBlockTemplate ${smartBlockTemplate}`) + if( smartBlockTemplate ) { + const valueBlockUid: string = window.roamAlphaAPI.util.generateUID(); + window.roamAlphaAPI.createBlock({ + location: { "parent-uid": blockUid, order: 1000 /* at end */ }, + block: { string: '' , uid: valueBlockUid}, + }); + window.roamjs.extension.smartblocks.triggerSmartblock({ + srcName: smartBlockTemplate, + targetUid: valueBlockUid, + variables: { + 'rating': index.toString(), + 'wow': 'Wee' + } + }) + }; }; return(