Compare commits
10 Commits
fix_typing
...
@portaljs/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a1ccd2f8d | ||
|
|
728d5b1465 | ||
|
|
a43d4a3b86 | ||
|
|
4bc7ce5ce7 | ||
|
|
8c5c6a2112 | ||
|
|
8e896138c6 | ||
|
|
b2b4fbdf12 | ||
|
|
099f3c5204 | ||
|
|
17ad9558e1 | ||
|
|
6418dbb7e2 |
@@ -1,5 +0,0 @@
|
||||
---
|
||||
'@portaljs/ckan': patch
|
||||
---
|
||||
|
||||
added package_count to organization type
|
||||
@@ -1,5 +1,17 @@
|
||||
# @portaljs/ckan
|
||||
|
||||
## 0.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1009](https://github.com/datopian/portaljs/pull/1009) [`88ccee6f`](https://github.com/datopian/portaljs/commit/88ccee6f0aa05decd3efbe7279925340ae817127) Thanks [@luccasmmg](https://github.com/luccasmmg)! - added package_count to organization type
|
||||
|
||||
## 0.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1009](https://github.com/datopian/portaljs/pull/1009) [`099f3c52`](https://github.com/datopian/portaljs/commit/099f3c520407a7215b5b41f67dc8ea5ac73d07c4) Thanks [@luccasmmg](https://github.com/luccasmmg)! - added package_count to organization type
|
||||
|
||||
## 0.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@portaljs/ckan",
|
||||
"version": "0.0.3",
|
||||
"version": "0.0.5",
|
||||
"type": "module",
|
||||
"description": "https://portaljs.org",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @portaljs/components
|
||||
|
||||
## 0.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1011](https://github.com/datopian/portaljs/pull/1011) [`8e896138`](https://github.com/datopian/portaljs/commit/8e896138c622615d9bd9bd1d4a18de0cf38d85ec) Thanks [@luccasmmg](https://github.com/luccasmmg)! - fix bug when there were multiple flatuitable components at the same time
|
||||
|
||||
## 0.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@portaljs/components",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"type": "module",
|
||||
"description": "https://portaljs.org",
|
||||
"keywords": [
|
||||
|
||||
Binary file not shown.
@@ -42,6 +42,7 @@ export interface FlatUiTableProps {
|
||||
data?: { [key: string]: number | string }[];
|
||||
rawCsv?: string;
|
||||
corsProxy?: string;
|
||||
randomId?: number;
|
||||
}
|
||||
export const FlatUiTable: React.FC<FlatUiTableProps> = ({
|
||||
url,
|
||||
@@ -49,10 +50,17 @@ export const FlatUiTable: React.FC<FlatUiTableProps> = ({
|
||||
rawCsv,
|
||||
corsProxy,
|
||||
}) => {
|
||||
const randomId = Math.random();
|
||||
return (
|
||||
// Provide the client to your App
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<TableInner corsProxy={corsProxy} url={url} data={data} rawCsv={rawCsv} />
|
||||
<TableInner
|
||||
corsProxy={corsProxy}
|
||||
url={url}
|
||||
data={data}
|
||||
rawCsv={rawCsv}
|
||||
randomId={randomId}
|
||||
/>
|
||||
</QueryClientProvider>
|
||||
);
|
||||
};
|
||||
@@ -62,6 +70,7 @@ const TableInner: React.FC<FlatUiTableProps> = ({
|
||||
data,
|
||||
rawCsv,
|
||||
corsProxy,
|
||||
randomId,
|
||||
}) => {
|
||||
if (data) {
|
||||
return (
|
||||
@@ -71,12 +80,12 @@ const TableInner: React.FC<FlatUiTableProps> = ({
|
||||
);
|
||||
}
|
||||
const { data: csvString, isLoading: isDownloadingCSV } = useQuery(
|
||||
['dataCsv', url],
|
||||
['dataCsv', url, randomId],
|
||||
() => getCsv(url as string, corsProxy),
|
||||
{ enabled: !!url }
|
||||
);
|
||||
const { data: parsedData, isLoading: isParsing } = useQuery(
|
||||
['dataPreview', csvString],
|
||||
['dataPreview', csvString, randomId],
|
||||
() => parseCsv(rawCsv ? (rawCsv as string) : (csvString as string)),
|
||||
{ enabled: rawCsv ? true : !!csvString }
|
||||
);
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @portaljs/remark-wiki-link
|
||||
|
||||
## 1.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1006](https://github.com/datopian/portaljs/pull/1006) [`6418dbb7`](https://github.com/datopian/portaljs/commit/6418dbb7e246fa17b56840c64daa043112dc9189) Thanks [@olayway](https://github.com/olayway)! - Parse note embeds as regular wiki links (until we add proper support for note embeds).
|
||||
|
||||
## 1.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@portaljs/remark-wiki-link",
|
||||
"version": "1.0.4",
|
||||
"version": "1.1.0",
|
||||
"description": "Parse and render wiki-style links in markdown especially Obsidian style links.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -15,9 +15,9 @@ const defaultWikiLinkResolver = (target: string) => {
|
||||
|
||||
export interface FromMarkdownOptions {
|
||||
pathFormat?:
|
||||
| "raw" // default; use for regular relative or absolute paths
|
||||
| "obsidian-absolute" // use for Obsidian-style absolute paths (with no leading slash)
|
||||
| "obsidian-short"; // use for Obsidian-style shortened paths (shortest path possible)
|
||||
| "raw" // default; use for regular relative or absolute paths
|
||||
| "obsidian-absolute" // use for Obsidian-style absolute paths (with no leading slash)
|
||||
| "obsidian-short"; // use for Obsidian-style shortened paths (shortest path possible)
|
||||
permalinks?: string[]; // list of permalinks to match possible permalinks of a wiki link against
|
||||
wikiLinkResolver?: (name: string) => string[]; // function to resolve wiki links to an array of possible permalinks
|
||||
newClassName?: string; // class name to add to links that don't have a matching permalink
|
||||
@@ -125,13 +125,24 @@ function fromMarkdown(opts: FromMarkdownOptions = {}) {
|
||||
if (isEmbed) {
|
||||
const [isSupportedFormat, format] = isSupportedFileFormat(target);
|
||||
if (!isSupportedFormat) {
|
||||
wikiLink.data.hName = "p";
|
||||
wikiLink.data.hChildren = [
|
||||
{
|
||||
type: "text",
|
||||
value: `![[${target}]]`,
|
||||
},
|
||||
];
|
||||
// Temporarily render note transclusion as a regular wiki link
|
||||
if (!format) {
|
||||
wikiLink.data.hName = "a";
|
||||
wikiLink.data.hProperties = {
|
||||
className: classNames + " " + "transclusion",
|
||||
href: hrefTemplate(link) + headingId,
|
||||
};
|
||||
wikiLink.data.hChildren = [{ type: "text", value: displayName }];
|
||||
|
||||
} else {
|
||||
wikiLink.data.hName = "p";
|
||||
wikiLink.data.hChildren = [
|
||||
{
|
||||
type: "text",
|
||||
value: `![[${target}]]`,
|
||||
},
|
||||
];
|
||||
}
|
||||
} else if (format === "pdf") {
|
||||
wikiLink.data.hName = "iframe";
|
||||
wikiLink.data.hProperties = {
|
||||
|
||||
@@ -15,9 +15,9 @@ const defaultWikiLinkResolver = (target: string) => {
|
||||
|
||||
export interface HtmlOptions {
|
||||
pathFormat?:
|
||||
| "raw" // default; use for regular relative or absolute paths
|
||||
| "obsidian-absolute" // use for Obsidian-style absolute paths (with no leading slash)
|
||||
| "obsidian-short"; // use for Obsidian-style shortened paths (shortest path possible)
|
||||
| "raw" // default; use for regular relative or absolute paths
|
||||
| "obsidian-absolute" // use for Obsidian-style absolute paths (with no leading slash)
|
||||
| "obsidian-short"; // use for Obsidian-style shortened paths (shortest path possible)
|
||||
permalinks?: string[]; // list of permalinks to match possible permalinks of a wiki link against
|
||||
wikiLinkResolver?: (name: string) => string[]; // function to resolve wiki links to an array of possible permalinks
|
||||
newClassName?: string; // class name to add to links that don't have a matching permalink
|
||||
@@ -108,7 +108,16 @@ function html(opts: HtmlOptions = {}) {
|
||||
if (isEmbed) {
|
||||
const [isSupportedFormat, format] = isSupportedFileFormat(target);
|
||||
if (!isSupportedFormat) {
|
||||
this.raw(`![[${target}]]`);
|
||||
// Temporarily render note transclusion as a regular wiki link
|
||||
if (!format) {
|
||||
this.tag(
|
||||
`<a href="${hrefTemplate(link + headingId)}" class="${classNames} transclusion">`
|
||||
);
|
||||
this.raw(displayName);
|
||||
this.tag("</a>");
|
||||
} else {
|
||||
this.raw(`![[${target}]]`);
|
||||
}
|
||||
} else if (format === "pdf") {
|
||||
this.tag(
|
||||
`<iframe width="100%" src="${hrefTemplate(
|
||||
|
||||
@@ -309,4 +309,16 @@ describe("micromark-extension-wiki-link", () => {
|
||||
expect(serialized).toBe('<p><a href="/" class="internal">/index</a></p>');
|
||||
});
|
||||
});
|
||||
|
||||
describe("transclusions", () => {
|
||||
test("parsers a transclusion as a regular wiki link", () => {
|
||||
const serialized = micromark("![[Some Page]]", "ascii", {
|
||||
extensions: [syntax()],
|
||||
htmlExtensions: [html() as any], // TODO type fix
|
||||
});
|
||||
expect(serialized).toBe(
|
||||
'<p><a href="Some Page" class="internal new transclusion">Some Page</a></p>'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -535,4 +535,28 @@ describe("remark-wiki-link", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("transclusions", () => {
|
||||
test("replaces a transclusion with a regular wiki link", () => {
|
||||
const processor = unified().use(markdown).use(wikiLinkPlugin);
|
||||
|
||||
let ast = processor.parse("![[Some Page]]");
|
||||
ast = processor.runSync(ast);
|
||||
|
||||
expect(select("wikiLink", ast)).not.toEqual(null);
|
||||
|
||||
visit(ast, "wikiLink", (node: Node) => {
|
||||
expect(node.data?.isEmbed).toEqual(true);
|
||||
expect(node.data?.exists).toEqual(false);
|
||||
expect(node.data?.permalink).toEqual("Some Page");
|
||||
expect(node.data?.alias).toEqual(null);
|
||||
expect(node.data?.hName).toEqual("a");
|
||||
expect((node.data?.hProperties as any).className).toEqual(
|
||||
"internal new transclusion"
|
||||
);
|
||||
expect((node.data?.hProperties as any).href).toEqual("Some Page");
|
||||
expect((node.data?.hChildren as any)[0].value).toEqual("Some Page");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,31 +3,6 @@ import ButtonLink from './ButtonLink';
|
||||
import NewsletterForm from './NewsletterForm';
|
||||
import Image from 'next/image';
|
||||
import DatahubExampleImg from '@/public/images/showcases/datahub.webp';
|
||||
|
||||
const codeLanguage = 'javascript';
|
||||
const code = `export default {
|
||||
strategy: 'predictive',
|
||||
engine: {
|
||||
cpus: 12,
|
||||
backups: ['./storage/cache.wtf'],
|
||||
},
|
||||
}`;
|
||||
|
||||
const tabs = [
|
||||
{ name: 'cache-advance.config.js', isActive: true },
|
||||
{ name: 'package.json', isActive: false },
|
||||
];
|
||||
|
||||
function TrafficLightsIcon(props) {
|
||||
return (
|
||||
<svg aria-hidden="true" viewBox="0 0 42 10" fill="none" {...props}>
|
||||
<circle cx="5" cy="5" r="4.5" />
|
||||
<circle cx="21" cy="5" r="4.5" />
|
||||
<circle cx="37" cy="5" r="4.5" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
/* eslint jsx-a11y/label-has-associated-control: off */
|
||||
export function Hero() {
|
||||
const el = useRef(null);
|
||||
@@ -50,7 +25,7 @@ export function Hero() {
|
||||
Rapidly build rich data portals using a modern frontend framework.
|
||||
</p>
|
||||
|
||||
<ButtonLink className="mt-8" href="/docs">
|
||||
<ButtonLink style="secondary" className="mt-8" href="/docs">
|
||||
Get started
|
||||
</ButtonLink>
|
||||
|
||||
|
||||
@@ -1,14 +1,37 @@
|
||||
import { loadScripts } from '@/lib/loadNewsletterScripts';
|
||||
import Script from 'next/script';
|
||||
import { useEffect } from 'react';
|
||||
import { CloudIcon } from '@heroicons/react/solid';
|
||||
|
||||
export default function NewsletterForm() {
|
||||
useEffect(() => {
|
||||
/*
|
||||
* The newsletter scripts MUST be loaded after
|
||||
* the document is loaded, as they depend on
|
||||
* the presence of some elements
|
||||
*
|
||||
*/
|
||||
if (document.readyState === 'complete') {
|
||||
const { resetElements } = loadScripts();
|
||||
|
||||
return () => {
|
||||
resetElements();
|
||||
};
|
||||
} else {
|
||||
window.addEventListener('load', loadScripts);
|
||||
return () => window.removeEventListener('load', loadScripts);
|
||||
}
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div
|
||||
id="sib-form-container"
|
||||
className="mt-8 sm:mx-auto sm:text-center lg:text-left lg:mx-0"
|
||||
>
|
||||
<p className="text-base font-medium text-slate-400 dark:text-slate-400">
|
||||
Sign up to get notified about updates
|
||||
<p className="text-base font-medium flex items-center">
|
||||
<CloudIcon className="w-6 h-6 mr-1" />
|
||||
Join the PortalJS Cloud waitlist and get early access!
|
||||
</p>
|
||||
<div id="sib-container" className="!bg-transparent !p-0 !pb-5">
|
||||
<form
|
||||
@@ -47,7 +70,7 @@ export default function NewsletterForm() {
|
||||
>
|
||||
<path d="M460.116 373.846l-20.823-12.022c-5.541-3.199-7.54-10.159-4.663-15.874 30.137-59.886 28.343-131.652-5.386-189.946-33.641-58.394-94.896-95.833-161.827-99.676C261.028 55.961 256 50.751 256 44.352V20.309c0-6.904 5.808-12.337 12.703-11.982 83.556 4.306 160.163 50.864 202.11 123.677 42.063 72.696 44.079 162.316 6.031 236.832-3.14 6.148-10.75 8.461-16.728 5.01z" />
|
||||
</svg>
|
||||
Notify Me
|
||||
Join now
|
||||
</button>
|
||||
<input
|
||||
type="text"
|
||||
@@ -88,37 +111,6 @@ export default function NewsletterForm() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Script
|
||||
id="newsletter-form-validation-message"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
window.REQUIRED_CODE_ERROR_MESSAGE = 'Please choose a country code';
|
||||
window.LOCALE = 'en';
|
||||
window.EMAIL_INVALID_MESSAGE = window.SMS_INVALID_MESSAGE = "The information provided is invalid. Please review the field format and try again.";
|
||||
|
||||
window.REQUIRED_ERROR_MESSAGE = "This field cannot be left blank. ";
|
||||
|
||||
window.GENERIC_INVALID_MESSAGE = "The information provided is invalid. Please review the field format and try again.";
|
||||
|
||||
|
||||
|
||||
|
||||
window.translation = {
|
||||
common: {
|
||||
selectedList: '{quantity} list selected',
|
||||
selectedLists: '{quantity} lists selected'
|
||||
}
|
||||
};
|
||||
|
||||
var AUTOHIDE = Boolean(0);
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
<Script
|
||||
strategy="worker"
|
||||
id="newsletter-submit-form"
|
||||
src="https://sibforms.com/forms/end-form/build/main.js"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
45
site/lib/loadNewsletterScripts.ts
Normal file
45
site/lib/loadNewsletterScripts.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
import { HTMLProps } from "react";
|
||||
|
||||
const loadScript = (
|
||||
props: HTMLProps<HTMLScriptElement> & { textContent?: string }
|
||||
): (() => void) => {
|
||||
const script = document.createElement("script");
|
||||
Object.assign(script, props);
|
||||
document.head.appendChild(script);
|
||||
return () => document.head.removeChild(script);
|
||||
};
|
||||
|
||||
export const loadScripts = () => {
|
||||
const formValidationScript = loadScript({
|
||||
id: "newsletter-form-validation-message",
|
||||
textContent: `
|
||||
window.LOCALE = 'en';
|
||||
window.EMAIL_INVALID_MESSAGE = "The information provided is invalid. Please review the field format and try again.";
|
||||
window.REQUIRED_ERROR_MESSAGE = "This field cannot be left blank. ";
|
||||
window.GENERIC_INVALID_MESSAGE = "The information provided is invalid. Please review the field format and try again.";
|
||||
window.translation = {
|
||||
common: {
|
||||
selectedList: '{quantity} list selected',
|
||||
selectedLists: '{quantity} lists selected'
|
||||
}
|
||||
};
|
||||
var AUTOHIDE = Boolean(0);
|
||||
`,
|
||||
});
|
||||
|
||||
const formSubmitScript = loadScript({
|
||||
id: "newsletter-submit-form",
|
||||
src: "https://sibforms.com/forms/end-form/build/main.js",
|
||||
async: true,
|
||||
defer: true,
|
||||
});
|
||||
|
||||
return {
|
||||
resetElements: () => {
|
||||
formSubmitScript();
|
||||
formValidationScript();
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
8
site/package-lock.json
generated
8
site/package-lock.json
generated
@@ -9,7 +9,7 @@
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@headlessui/react": "^1.3.0",
|
||||
"@heroicons/react": "^1.0.3",
|
||||
"@heroicons/react": "^1.0.6",
|
||||
"@mdx-js/loader": "^2.3.0",
|
||||
"@portaljs/core": "^1.0.6",
|
||||
"@portaljs/remark-callouts": "^1.0.5",
|
||||
@@ -367,9 +367,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@heroicons/react": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@heroicons/react/-/react-1.0.3.tgz",
|
||||
"integrity": "sha512-wdzWbDiFKzeL6xFJsgY2PqvDkx4hFmQDpEFRVj872EA71XOjr8g0DQj5rHWm0y7LwfGOFL0eQmEiMbTyGNOnTQ==",
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@heroicons/react/-/react-1.0.6.tgz",
|
||||
"integrity": "sha512-JJCXydOFWMDpCP4q13iEplA503MQO3xLoZiKum+955ZCtHINWnx26CUxVxxFQu/uLb4LW3ge15ZpzIkXKkJ8oQ==",
|
||||
"peerDependencies": {
|
||||
"react": ">= 16"
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@headlessui/react": "^1.3.0",
|
||||
"@heroicons/react": "^1.0.3",
|
||||
"@heroicons/react": "^1.0.6",
|
||||
"@mdx-js/loader": "^2.3.0",
|
||||
"@portaljs/core": "^1.0.6",
|
||||
"@portaljs/remark-callouts": "^1.0.5",
|
||||
|
||||
Reference in New Issue
Block a user