@supatype/common 0.1.0-alpha.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/.turbo/turbo-build.log +4 -0
- package/.turbo/turbo-typecheck.log +4 -0
- package/dist/analytics.d.ts +10 -0
- package/dist/analytics.d.ts.map +1 -0
- package/dist/analytics.js +42 -0
- package/dist/analytics.js.map +1 -0
- package/dist/auth.d.ts +10 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +24 -0
- package/dist/auth.js.map +1 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +27 -0
- package/dist/config.js.map +1 -0
- package/dist/content.d.ts +6 -0
- package/dist/content.d.ts.map +1 -0
- package/dist/content.js +22 -0
- package/dist/content.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/richtext.d.ts +72 -0
- package/dist/richtext.d.ts.map +1 -0
- package/dist/richtext.js +89 -0
- package/dist/richtext.js.map +1 -0
- package/package.json +41 -0
- package/src/analytics.ts +55 -0
- package/src/auth.ts +28 -0
- package/src/config.ts +26 -0
- package/src/content.ts +24 -0
- package/src/index.ts +5 -0
- package/src/posthog-js.d.ts +11 -0
- package/src/richtext.ts +127 -0
- package/tsconfig.json +13 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface AnalyticsClient {
|
|
2
|
+
capture(event: string, properties?: Record<string, unknown>): void;
|
|
3
|
+
identify(userId: string, properties?: Record<string, unknown>): void;
|
|
4
|
+
pageView(path?: string): void;
|
|
5
|
+
optIn(): void;
|
|
6
|
+
optOut(): void;
|
|
7
|
+
}
|
|
8
|
+
export declare const analytics: AnalyticsClient;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAEA,UAAU,eAAe;IACvB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAClE,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IACpE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,KAAK,IAAI,IAAI,CAAA;IACb,MAAM,IAAI,IAAI,CAAA;CACf;AA8CD,eAAO,MAAM,SAAS,EAAE,eAAwC,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { config } from "./config.js";
|
|
2
|
+
class PostHogAnalytics {
|
|
3
|
+
posthog = null;
|
|
4
|
+
initialized = false;
|
|
5
|
+
async init() {
|
|
6
|
+
if (this.initialized || typeof window === "undefined")
|
|
7
|
+
return;
|
|
8
|
+
if (!config.posthogKey)
|
|
9
|
+
return;
|
|
10
|
+
this.initialized = true;
|
|
11
|
+
try {
|
|
12
|
+
const ph = await import("posthog-js");
|
|
13
|
+
ph.default.init(config.posthogKey, {
|
|
14
|
+
api_host: config.posthogHost,
|
|
15
|
+
capture_pageview: false, // Manual page views
|
|
16
|
+
persistence: "localStorage+cookie",
|
|
17
|
+
respect_dnt: true,
|
|
18
|
+
});
|
|
19
|
+
this.posthog = ph.default;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// PostHog not available — analytics disabled
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
capture(event, properties) {
|
|
26
|
+
this.init().then(() => this.posthog?.capture(event, properties)).catch(() => { });
|
|
27
|
+
}
|
|
28
|
+
identify(userId, properties) {
|
|
29
|
+
this.init().then(() => this.posthog?.identify(userId, properties)).catch(() => { });
|
|
30
|
+
}
|
|
31
|
+
pageView(path) {
|
|
32
|
+
this.capture("$pageview", { $current_url: path ?? window.location.href });
|
|
33
|
+
}
|
|
34
|
+
optIn() {
|
|
35
|
+
this.init().then(() => this.posthog?.opt_in_capturing()).catch(() => { });
|
|
36
|
+
}
|
|
37
|
+
optOut() {
|
|
38
|
+
this.init().then(() => this.posthog?.opt_out_capturing()).catch(() => { });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export const analytics = new PostHogAnalytics();
|
|
42
|
+
//# sourceMappingURL=analytics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAUpC,MAAM,gBAAgB;IACZ,OAAO,GAA8G,IAAI,CAAA;IACzH,WAAW,GAAG,KAAK,CAAA;IAEnB,KAAK,CAAC,IAAI;QAChB,IAAI,IAAI,CAAC,WAAW,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAM;QAC7D,IAAI,CAAC,MAAM,CAAC,UAAU;YAAE,OAAM;QAC9B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;QAEvB,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAA;YACrC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;gBACjC,QAAQ,EAAE,MAAM,CAAC,WAAW;gBAC5B,gBAAgB,EAAE,KAAK,EAAE,oBAAoB;gBAC7C,WAAW,EAAE,qBAAqB;gBAClC,WAAW,EAAE,IAAI;aAClB,CAAC,CAAA;YACF,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC,OAAyC,CAAA;QAC7D,CAAC;QAAC,MAAM,CAAC;YACP,6CAA6C;QAC/C,CAAC;IACH,CAAC;IAED,OAAO,CAAC,KAAa,EAAE,UAAoC;QACzD,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IAClF,CAAC;IAED,QAAQ,CAAC,MAAc,EAAE,UAAoC;QAC3D,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IACpF,CAAC;IAED,QAAQ,CAAC,IAAa;QACpB,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;IAC3E,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IAC1E,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IAC3E,CAAC;CACF;AAED,MAAM,CAAC,MAAM,SAAS,GAAoB,IAAI,gBAAgB,EAAE,CAAA"}
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface PlatformUser {
|
|
2
|
+
name: string;
|
|
3
|
+
email: string;
|
|
4
|
+
avatar?: string;
|
|
5
|
+
}
|
|
6
|
+
/** Supatype client initialised with the platform project's URL and anon key. */
|
|
7
|
+
export declare const platformClient: import("@supatype/client").SupatypeClient<import("@supatype/client").AugmentedDatabase>;
|
|
8
|
+
/** Read the st-platform-user cookie for display info. */
|
|
9
|
+
export declare function getPlatformUser(): PlatformUser | null;
|
|
10
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,gFAAgF;AAChF,eAAO,MAAM,cAAc,yFAGzB,CAAA;AAEF,yDAAyD;AACzD,wBAAgB,eAAe,IAAI,YAAY,GAAG,IAAI,CAWrD"}
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createClient } from "@supatype/client";
|
|
2
|
+
import { config } from "./config.js";
|
|
3
|
+
/** Supatype client initialised with the platform project's URL and anon key. */
|
|
4
|
+
export const platformClient = createClient({
|
|
5
|
+
url: config.platformUrl,
|
|
6
|
+
anonKey: config.platformAnonKey,
|
|
7
|
+
});
|
|
8
|
+
/** Read the st-platform-user cookie for display info. */
|
|
9
|
+
export function getPlatformUser() {
|
|
10
|
+
if (typeof document === "undefined")
|
|
11
|
+
return null;
|
|
12
|
+
const cookie = document.cookie
|
|
13
|
+
.split("; ")
|
|
14
|
+
.find((c) => c.startsWith("st-platform-user="));
|
|
15
|
+
if (!cookie)
|
|
16
|
+
return null;
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(decodeURIComponent(cookie.split("=")[1]));
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAQpC,gFAAgF;AAChF,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;IACzC,GAAG,EAAE,MAAM,CAAC,WAAW;IACvB,OAAO,EAAE,MAAM,CAAC,eAAe;CAChC,CAAC,CAAA;AAEF,yDAAyD;AACzD,MAAM,UAAU,eAAe;IAC7B,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO,IAAI,CAAA;IAChD,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM;SAC3B,KAAK,CAAC,IAAI,CAAC;SACX,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAA;IACjD,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IACxB,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC,CAAiB,CAAA;IAC9E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type AppEnvironment = "development" | "staging" | "production";
|
|
2
|
+
export declare const config: {
|
|
3
|
+
environment: AppEnvironment;
|
|
4
|
+
platformUrl: string;
|
|
5
|
+
platformAnonKey: string;
|
|
6
|
+
posthogKey: string;
|
|
7
|
+
posthogHost: string;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,SAAS,GAAG,YAAY,CAAA;AAmBrE,eAAO,MAAM,MAAM;;;;;;CAMlB,CAAA"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function detectEnvironment() {
|
|
2
|
+
if (typeof window === "undefined")
|
|
3
|
+
return "production";
|
|
4
|
+
const host = window.location.hostname;
|
|
5
|
+
if (host === "localhost" || host === "127.0.0.1")
|
|
6
|
+
return "development";
|
|
7
|
+
if (host.includes("staging"))
|
|
8
|
+
return "staging";
|
|
9
|
+
return "production";
|
|
10
|
+
}
|
|
11
|
+
function getEnvVar(name, fallback) {
|
|
12
|
+
// Vite-style env vars
|
|
13
|
+
if (typeof import.meta !== "undefined") {
|
|
14
|
+
const env = import.meta.env;
|
|
15
|
+
if (env?.[name])
|
|
16
|
+
return env[name];
|
|
17
|
+
}
|
|
18
|
+
return fallback;
|
|
19
|
+
}
|
|
20
|
+
export const config = {
|
|
21
|
+
environment: detectEnvironment(),
|
|
22
|
+
platformUrl: getEnvVar("PUBLIC_SUPATYPE_PLATFORM_URL", "https://api.supatype.com"),
|
|
23
|
+
platformAnonKey: getEnvVar("PUBLIC_SUPATYPE_PLATFORM_ANON_KEY", ""),
|
|
24
|
+
posthogKey: getEnvVar("PUBLIC_POSTHOG_KEY", ""),
|
|
25
|
+
posthogHost: getEnvVar("PUBLIC_POSTHOG_HOST", "https://eu.posthog.com"),
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,SAAS,iBAAiB;IACxB,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,YAAY,CAAA;IACtD,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAA;IACrC,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,WAAW;QAAE,OAAO,aAAa,CAAA;IACtE,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAA;IAC9C,OAAO,YAAY,CAAA;AACrB,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,QAAgB;IAC/C,sBAAsB;IACtB,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACvC,MAAM,GAAG,GAAI,MAAM,CAAC,IAAoD,CAAC,GAAG,CAAA;QAC5E,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;YAAE,OAAO,GAAG,CAAC,IAAI,CAAC,CAAA;IACnC,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,WAAW,EAAE,iBAAiB,EAAE;IAChC,WAAW,EAAE,SAAS,CAAC,8BAA8B,EAAE,0BAA0B,CAAC;IAClF,eAAe,EAAE,SAAS,CAAC,mCAAmC,EAAE,EAAE,CAAC;IACnE,UAAU,EAAE,SAAS,CAAC,oBAAoB,EAAE,EAAE,CAAC;IAC/C,WAAW,EAAE,SAAS,CAAC,qBAAqB,EAAE,wBAAwB,CAAC;CACxE,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supatype client configured for the supatype-content project.
|
|
3
|
+
* Intended for build-time use only (SSG data fetching).
|
|
4
|
+
*/
|
|
5
|
+
export declare const contentClient: import("@supatype/client").SupatypeClient<import("@supatype/client").AugmentedDatabase>;
|
|
6
|
+
//# sourceMappingURL=content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../src/content.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,eAAO,MAAM,aAAa,yFAGxB,CAAA"}
|
package/dist/content.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createClient } from "@supatype/client";
|
|
2
|
+
function getContentEnv(name) {
|
|
3
|
+
const proc = globalThis.process;
|
|
4
|
+
if (proc?.env?.[name]) {
|
|
5
|
+
return proc.env[name];
|
|
6
|
+
}
|
|
7
|
+
if (typeof import.meta !== "undefined") {
|
|
8
|
+
const env = import.meta.env;
|
|
9
|
+
if (env?.[name])
|
|
10
|
+
return env[name];
|
|
11
|
+
}
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Supatype client configured for the supatype-content project.
|
|
16
|
+
* Intended for build-time use only (SSG data fetching).
|
|
17
|
+
*/
|
|
18
|
+
export const contentClient = createClient({
|
|
19
|
+
url: getContentEnv("CONTENT_PROJECT_URL"),
|
|
20
|
+
anonKey: getContentEnv("CONTENT_ANON_KEY"),
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../src/content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAI/C,SAAS,aAAa,CAAC,IAAY;IACjC,MAAM,IAAI,GAAI,UAAyE,CAAC,OAAO,CAAA;IAC/F,IAAI,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAE,CAAA;IACxB,CAAC;IACD,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACvC,MAAM,GAAG,GAAI,MAAM,CAAC,IAAoD,CAAC,GAAG,CAAA;QAC5E,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;YAAE,OAAO,GAAG,CAAC,IAAI,CAAC,CAAA;IACnC,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;IACxC,GAAG,EAAE,aAAa,CAAC,qBAAqB,CAAC;IACzC,OAAO,EAAE,aAAa,CAAC,kBAAkB,CAAC;CAC3C,CAAC,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { platformClient, getPlatformUser, type PlatformUser } from "./auth.js";
|
|
2
|
+
export { config, type AppEnvironment } from "./config.js";
|
|
3
|
+
export { analytics } from "./analytics.js";
|
|
4
|
+
export { contentClient } from "./content.js";
|
|
5
|
+
export { renderRichText, type RichTextNode } from "./richtext.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAA;AAC9E,OAAO,EAAE,MAAM,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { platformClient, getPlatformUser } from "./auth.js";
|
|
2
|
+
export { config } from "./config.js";
|
|
3
|
+
export { analytics } from "./analytics.js";
|
|
4
|
+
export { contentClient } from "./content.js";
|
|
5
|
+
export { renderRichText } from "./richtext.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAqB,MAAM,WAAW,CAAA;AAC9E,OAAO,EAAE,MAAM,EAAuB,MAAM,aAAa,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAqB,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rich text rendering — converts Lexical JSON to HTML.
|
|
3
|
+
*/
|
|
4
|
+
export type RichTextNode = {
|
|
5
|
+
type: "heading";
|
|
6
|
+
tag: "h2" | "h3" | "h4";
|
|
7
|
+
children: RichTextNode[];
|
|
8
|
+
} | {
|
|
9
|
+
type: "paragraph";
|
|
10
|
+
children: RichTextNode[];
|
|
11
|
+
} | {
|
|
12
|
+
type: "text";
|
|
13
|
+
text: string;
|
|
14
|
+
format?: {
|
|
15
|
+
bold?: boolean;
|
|
16
|
+
italic?: boolean;
|
|
17
|
+
code?: boolean;
|
|
18
|
+
};
|
|
19
|
+
} | {
|
|
20
|
+
type: "link";
|
|
21
|
+
url: string;
|
|
22
|
+
children: RichTextNode[];
|
|
23
|
+
} | {
|
|
24
|
+
type: "code";
|
|
25
|
+
language: string;
|
|
26
|
+
code: string;
|
|
27
|
+
} | {
|
|
28
|
+
type: "image";
|
|
29
|
+
src: string;
|
|
30
|
+
alt: string;
|
|
31
|
+
width?: number;
|
|
32
|
+
height?: number;
|
|
33
|
+
} | {
|
|
34
|
+
type: "blockquote";
|
|
35
|
+
children: RichTextNode[];
|
|
36
|
+
} | {
|
|
37
|
+
type: "list";
|
|
38
|
+
listType: "ordered" | "unordered";
|
|
39
|
+
children: RichTextNode[];
|
|
40
|
+
} | {
|
|
41
|
+
type: "listitem";
|
|
42
|
+
children: RichTextNode[];
|
|
43
|
+
} | {
|
|
44
|
+
type: "horizontalrule";
|
|
45
|
+
} | {
|
|
46
|
+
type: "root";
|
|
47
|
+
children: RichTextNode[];
|
|
48
|
+
} | {
|
|
49
|
+
type: "callout";
|
|
50
|
+
variant: "tip" | "warning" | "danger";
|
|
51
|
+
children: RichTextNode[];
|
|
52
|
+
} | {
|
|
53
|
+
type: "code-tabs";
|
|
54
|
+
tabs: Array<{
|
|
55
|
+
label: string;
|
|
56
|
+
language: string;
|
|
57
|
+
code: string;
|
|
58
|
+
}>;
|
|
59
|
+
} | {
|
|
60
|
+
type: "cta";
|
|
61
|
+
text: string;
|
|
62
|
+
url: string;
|
|
63
|
+
} | {
|
|
64
|
+
type: "embed";
|
|
65
|
+
provider: "youtube" | "codesandbox";
|
|
66
|
+
embedId: string;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Convert a Lexical JSON node tree into an HTML string.
|
|
70
|
+
*/
|
|
71
|
+
export declare function renderRichText(node: RichTextNode): string;
|
|
72
|
+
//# sourceMappingURL=richtext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"richtext.d.ts","sourceRoot":"","sources":["../src/richtext.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,GACtE;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,GAC7F;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5E;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,GAAG,WAAW,CAAC;IAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,GAC7E;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAC1B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC;IAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,GACpF;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GACrF;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,SAAS,GAAG,aAAa,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAqB3E;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAmFzD"}
|
package/dist/richtext.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rich text rendering — converts Lexical JSON to HTML.
|
|
3
|
+
*/
|
|
4
|
+
const CALLOUT_ICONS = {
|
|
5
|
+
tip: "\u{1F4A1}",
|
|
6
|
+
warning: "\u26A0\uFE0F",
|
|
7
|
+
danger: "\u{1F6AB}",
|
|
8
|
+
};
|
|
9
|
+
function escapeHtml(text) {
|
|
10
|
+
return text
|
|
11
|
+
.replace(/&/g, "&")
|
|
12
|
+
.replace(/</g, "<")
|
|
13
|
+
.replace(/>/g, ">")
|
|
14
|
+
.replace(/"/g, """)
|
|
15
|
+
.replace(/'/g, "'");
|
|
16
|
+
}
|
|
17
|
+
function renderChildren(children) {
|
|
18
|
+
return children.map(renderRichText).join("");
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Convert a Lexical JSON node tree into an HTML string.
|
|
22
|
+
*/
|
|
23
|
+
export function renderRichText(node) {
|
|
24
|
+
switch (node.type) {
|
|
25
|
+
case "root":
|
|
26
|
+
return renderChildren(node.children);
|
|
27
|
+
case "heading":
|
|
28
|
+
return `<${node.tag}>${renderChildren(node.children)}</${node.tag}>`;
|
|
29
|
+
case "paragraph":
|
|
30
|
+
return `<p>${renderChildren(node.children)}</p>`;
|
|
31
|
+
case "text": {
|
|
32
|
+
let html = escapeHtml(node.text);
|
|
33
|
+
if (node.format?.code)
|
|
34
|
+
html = `<code>${html}</code>`;
|
|
35
|
+
if (node.format?.bold)
|
|
36
|
+
html = `<strong>${html}</strong>`;
|
|
37
|
+
if (node.format?.italic)
|
|
38
|
+
html = `<em>${html}</em>`;
|
|
39
|
+
return html;
|
|
40
|
+
}
|
|
41
|
+
case "link":
|
|
42
|
+
return `<a href="${escapeHtml(node.url)}">${renderChildren(node.children)}</a>`;
|
|
43
|
+
case "code":
|
|
44
|
+
return `<pre><code class="language-${escapeHtml(node.language)}">${escapeHtml(node.code)}</code></pre>`;
|
|
45
|
+
case "image": {
|
|
46
|
+
const attrs = [
|
|
47
|
+
`src="${escapeHtml(node.src)}"`,
|
|
48
|
+
`alt="${escapeHtml(node.alt)}"`,
|
|
49
|
+
...(node.width !== undefined ? [`width="${node.width}"`] : []),
|
|
50
|
+
...(node.height !== undefined ? [`height="${node.height}"`] : []),
|
|
51
|
+
];
|
|
52
|
+
return `<img ${attrs.join(" ")} />`;
|
|
53
|
+
}
|
|
54
|
+
case "blockquote":
|
|
55
|
+
return `<blockquote>${renderChildren(node.children)}</blockquote>`;
|
|
56
|
+
case "list": {
|
|
57
|
+
const tag = node.listType === "ordered" ? "ol" : "ul";
|
|
58
|
+
return `<${tag}>${renderChildren(node.children)}</${tag}>`;
|
|
59
|
+
}
|
|
60
|
+
case "listitem":
|
|
61
|
+
return `<li>${renderChildren(node.children)}</li>`;
|
|
62
|
+
case "horizontalrule":
|
|
63
|
+
return `<hr />`;
|
|
64
|
+
case "callout":
|
|
65
|
+
return `<div class="callout callout-${node.variant}">${CALLOUT_ICONS[node.variant]} ${renderChildren(node.children)}</div>`;
|
|
66
|
+
case "code-tabs": {
|
|
67
|
+
const buttons = node.tabs
|
|
68
|
+
.map((tab, i) => `<button class="code-tab-button${i === 0 ? " active" : ""}" data-tab="${i}">${escapeHtml(tab.label)}</button>`)
|
|
69
|
+
.join("");
|
|
70
|
+
const panels = node.tabs
|
|
71
|
+
.map((tab, i) => `<div class="code-tab-panel${i === 0 ? " active" : ""}" data-tab="${i}"><pre><code class="language-${escapeHtml(tab.language)}">${escapeHtml(tab.code)}</code></pre></div>`)
|
|
72
|
+
.join("");
|
|
73
|
+
return `<div class="code-tabs"><div class="code-tabs-buttons">${buttons}</div>${panels}</div>`;
|
|
74
|
+
}
|
|
75
|
+
case "cta":
|
|
76
|
+
return `<a class="cta-button" href="${escapeHtml(node.url)}">${escapeHtml(node.text)}</a>`;
|
|
77
|
+
case "embed": {
|
|
78
|
+
if (node.provider === "youtube") {
|
|
79
|
+
return `<iframe src="https://www.youtube-nocookie.com/embed/${escapeHtml(node.embedId)}" frameborder="0" allowfullscreen loading="lazy"></iframe>`;
|
|
80
|
+
}
|
|
81
|
+
return `<iframe src="https://codesandbox.io/embed/${escapeHtml(node.embedId)}" frameborder="0" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts" loading="lazy"></iframe>`;
|
|
82
|
+
}
|
|
83
|
+
default: {
|
|
84
|
+
const _exhaustive = node;
|
|
85
|
+
return "";
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=richtext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"richtext.js","sourceRoot":"","sources":["../src/richtext.ts"],"names":[],"mappings":"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"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@supatype/common",
|
|
3
|
+
"version": "0.1.0-alpha.10",
|
|
4
|
+
"description": "Shared auth, config, and analytics for Supatype web apps",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./auth": {
|
|
14
|
+
"import": "./dist/auth.js",
|
|
15
|
+
"types": "./dist/auth.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./config": {
|
|
18
|
+
"import": "./dist/config.js",
|
|
19
|
+
"types": "./dist/config.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./analytics": {
|
|
22
|
+
"import": "./dist/analytics.js",
|
|
23
|
+
"types": "./dist/analytics.d.ts"
|
|
24
|
+
},
|
|
25
|
+
"./richtext": {
|
|
26
|
+
"import": "./dist/richtext.js",
|
|
27
|
+
"types": "./dist/richtext.d.ts"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@supatype/client": "0.1.0-alpha.10"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"typescript": "^5"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc --project tsconfig.json",
|
|
38
|
+
"typecheck": "tsc --project tsconfig.json --noEmit",
|
|
39
|
+
"clean": "rm -rf dist *.tsbuildinfo"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/analytics.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { config } from "./config.js"
|
|
2
|
+
|
|
3
|
+
interface AnalyticsClient {
|
|
4
|
+
capture(event: string, properties?: Record<string, unknown>): void
|
|
5
|
+
identify(userId: string, properties?: Record<string, unknown>): void
|
|
6
|
+
pageView(path?: string): void
|
|
7
|
+
optIn(): void
|
|
8
|
+
optOut(): void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
class PostHogAnalytics implements AnalyticsClient {
|
|
12
|
+
private posthog: { capture: Function; identify: Function; opt_in_capturing: Function; opt_out_capturing: Function } | null = null
|
|
13
|
+
private initialized = false
|
|
14
|
+
|
|
15
|
+
private async init(): Promise<void> {
|
|
16
|
+
if (this.initialized || typeof window === "undefined") return
|
|
17
|
+
if (!config.posthogKey) return
|
|
18
|
+
this.initialized = true
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
const ph = await import("posthog-js")
|
|
22
|
+
ph.default.init(config.posthogKey, {
|
|
23
|
+
api_host: config.posthogHost,
|
|
24
|
+
capture_pageview: false, // Manual page views
|
|
25
|
+
persistence: "localStorage+cookie",
|
|
26
|
+
respect_dnt: true,
|
|
27
|
+
})
|
|
28
|
+
this.posthog = ph.default as unknown as typeof this.posthog
|
|
29
|
+
} catch {
|
|
30
|
+
// PostHog not available — analytics disabled
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
capture(event: string, properties?: Record<string, unknown>): void {
|
|
35
|
+
this.init().then(() => this.posthog?.capture(event, properties)).catch(() => {})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
identify(userId: string, properties?: Record<string, unknown>): void {
|
|
39
|
+
this.init().then(() => this.posthog?.identify(userId, properties)).catch(() => {})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
pageView(path?: string): void {
|
|
43
|
+
this.capture("$pageview", { $current_url: path ?? window.location.href })
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
optIn(): void {
|
|
47
|
+
this.init().then(() => this.posthog?.opt_in_capturing()).catch(() => {})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
optOut(): void {
|
|
51
|
+
this.init().then(() => this.posthog?.opt_out_capturing()).catch(() => {})
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const analytics: AnalyticsClient = new PostHogAnalytics()
|
package/src/auth.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createClient } from "@supatype/client"
|
|
2
|
+
import { config } from "./config.js"
|
|
3
|
+
|
|
4
|
+
export interface PlatformUser {
|
|
5
|
+
name: string
|
|
6
|
+
email: string
|
|
7
|
+
avatar?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Supatype client initialised with the platform project's URL and anon key. */
|
|
11
|
+
export const platformClient = createClient({
|
|
12
|
+
url: config.platformUrl,
|
|
13
|
+
anonKey: config.platformAnonKey,
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
/** Read the st-platform-user cookie for display info. */
|
|
17
|
+
export function getPlatformUser(): PlatformUser | null {
|
|
18
|
+
if (typeof document === "undefined") return null
|
|
19
|
+
const cookie = document.cookie
|
|
20
|
+
.split("; ")
|
|
21
|
+
.find((c) => c.startsWith("st-platform-user="))
|
|
22
|
+
if (!cookie) return null
|
|
23
|
+
try {
|
|
24
|
+
return JSON.parse(decodeURIComponent(cookie.split("=")[1]!)) as PlatformUser
|
|
25
|
+
} catch {
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type AppEnvironment = "development" | "staging" | "production"
|
|
2
|
+
|
|
3
|
+
function detectEnvironment(): AppEnvironment {
|
|
4
|
+
if (typeof window === "undefined") return "production"
|
|
5
|
+
const host = window.location.hostname
|
|
6
|
+
if (host === "localhost" || host === "127.0.0.1") return "development"
|
|
7
|
+
if (host.includes("staging")) return "staging"
|
|
8
|
+
return "production"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function getEnvVar(name: string, fallback: string): string {
|
|
12
|
+
// Vite-style env vars
|
|
13
|
+
if (typeof import.meta !== "undefined") {
|
|
14
|
+
const env = (import.meta as unknown as { env?: Record<string, string> }).env
|
|
15
|
+
if (env?.[name]) return env[name]
|
|
16
|
+
}
|
|
17
|
+
return fallback
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const config = {
|
|
21
|
+
environment: detectEnvironment(),
|
|
22
|
+
platformUrl: getEnvVar("PUBLIC_SUPATYPE_PLATFORM_URL", "https://api.supatype.com"),
|
|
23
|
+
platformAnonKey: getEnvVar("PUBLIC_SUPATYPE_PLATFORM_ANON_KEY", ""),
|
|
24
|
+
posthogKey: getEnvVar("PUBLIC_POSTHOG_KEY", ""),
|
|
25
|
+
posthogHost: getEnvVar("PUBLIC_POSTHOG_HOST", "https://eu.posthog.com"),
|
|
26
|
+
}
|
package/src/content.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createClient } from "@supatype/client"
|
|
2
|
+
|
|
3
|
+
declare const process: { env?: Record<string, string | undefined> } | undefined
|
|
4
|
+
|
|
5
|
+
function getContentEnv(name: string): string {
|
|
6
|
+
const proc = (globalThis as { process?: { env?: Record<string, string | undefined> } }).process
|
|
7
|
+
if (proc?.env?.[name]) {
|
|
8
|
+
return proc.env[name]!
|
|
9
|
+
}
|
|
10
|
+
if (typeof import.meta !== "undefined") {
|
|
11
|
+
const env = (import.meta as unknown as { env?: Record<string, string> }).env
|
|
12
|
+
if (env?.[name]) return env[name]
|
|
13
|
+
}
|
|
14
|
+
return ""
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Supatype client configured for the supatype-content project.
|
|
19
|
+
* Intended for build-time use only (SSG data fetching).
|
|
20
|
+
*/
|
|
21
|
+
export const contentClient = createClient({
|
|
22
|
+
url: getContentEnv("CONTENT_PROJECT_URL"),
|
|
23
|
+
anonKey: getContentEnv("CONTENT_ANON_KEY"),
|
|
24
|
+
})
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { platformClient, getPlatformUser, type PlatformUser } from "./auth.js"
|
|
2
|
+
export { config, type AppEnvironment } from "./config.js"
|
|
3
|
+
export { analytics } from "./analytics.js"
|
|
4
|
+
export { contentClient } from "./content.js"
|
|
5
|
+
export { renderRichText, type RichTextNode } from "./richtext.js"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare module "posthog-js" {
|
|
2
|
+
interface PostHog {
|
|
3
|
+
init(token: string, config?: Record<string, unknown>): void
|
|
4
|
+
capture(event: string, properties?: Record<string, unknown>): void
|
|
5
|
+
identify(userId: string, properties?: Record<string, unknown>): void
|
|
6
|
+
opt_in_capturing(): void
|
|
7
|
+
opt_out_capturing(): void
|
|
8
|
+
}
|
|
9
|
+
const posthog: PostHog
|
|
10
|
+
export default posthog
|
|
11
|
+
}
|
package/src/richtext.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rich text rendering — converts Lexical JSON to HTML.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export type RichTextNode =
|
|
6
|
+
| { type: "heading"; tag: "h2" | "h3" | "h4"; children: RichTextNode[] }
|
|
7
|
+
| { type: "paragraph"; children: RichTextNode[] }
|
|
8
|
+
| { type: "text"; text: string; format?: { bold?: boolean; italic?: boolean; code?: boolean } }
|
|
9
|
+
| { type: "link"; url: string; children: RichTextNode[] }
|
|
10
|
+
| { type: "code"; language: string; code: string }
|
|
11
|
+
| { type: "image"; src: string; alt: string; width?: number; height?: number }
|
|
12
|
+
| { type: "blockquote"; children: RichTextNode[] }
|
|
13
|
+
| { type: "list"; listType: "ordered" | "unordered"; children: RichTextNode[] }
|
|
14
|
+
| { type: "listitem"; children: RichTextNode[] }
|
|
15
|
+
| { type: "horizontalrule" }
|
|
16
|
+
| { type: "root"; children: RichTextNode[] }
|
|
17
|
+
| { type: "callout"; variant: "tip" | "warning" | "danger"; children: RichTextNode[] }
|
|
18
|
+
| { type: "code-tabs"; tabs: Array<{ label: string; language: string; code: string }> }
|
|
19
|
+
| { type: "cta"; text: string; url: string }
|
|
20
|
+
| { type: "embed"; provider: "youtube" | "codesandbox"; embedId: string }
|
|
21
|
+
|
|
22
|
+
const CALLOUT_ICONS: Record<"tip" | "warning" | "danger", string> = {
|
|
23
|
+
tip: "\u{1F4A1}",
|
|
24
|
+
warning: "\u26A0\uFE0F",
|
|
25
|
+
danger: "\u{1F6AB}",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function escapeHtml(text: string): string {
|
|
29
|
+
return text
|
|
30
|
+
.replace(/&/g, "&")
|
|
31
|
+
.replace(/</g, "<")
|
|
32
|
+
.replace(/>/g, ">")
|
|
33
|
+
.replace(/"/g, """)
|
|
34
|
+
.replace(/'/g, "'")
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function renderChildren(children: RichTextNode[]): string {
|
|
38
|
+
return children.map(renderRichText).join("")
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Convert a Lexical JSON node tree into an HTML string.
|
|
43
|
+
*/
|
|
44
|
+
export function renderRichText(node: RichTextNode): string {
|
|
45
|
+
switch (node.type) {
|
|
46
|
+
case "root":
|
|
47
|
+
return renderChildren(node.children)
|
|
48
|
+
|
|
49
|
+
case "heading":
|
|
50
|
+
return `<${node.tag}>${renderChildren(node.children)}</${node.tag}>`
|
|
51
|
+
|
|
52
|
+
case "paragraph":
|
|
53
|
+
return `<p>${renderChildren(node.children)}</p>`
|
|
54
|
+
|
|
55
|
+
case "text": {
|
|
56
|
+
let html = escapeHtml(node.text)
|
|
57
|
+
if (node.format?.code) html = `<code>${html}</code>`
|
|
58
|
+
if (node.format?.bold) html = `<strong>${html}</strong>`
|
|
59
|
+
if (node.format?.italic) html = `<em>${html}</em>`
|
|
60
|
+
return html
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
case "link":
|
|
64
|
+
return `<a href="${escapeHtml(node.url)}">${renderChildren(node.children)}</a>`
|
|
65
|
+
|
|
66
|
+
case "code":
|
|
67
|
+
return `<pre><code class="language-${escapeHtml(node.language)}">${escapeHtml(node.code)}</code></pre>`
|
|
68
|
+
|
|
69
|
+
case "image": {
|
|
70
|
+
const attrs = [
|
|
71
|
+
`src="${escapeHtml(node.src)}"`,
|
|
72
|
+
`alt="${escapeHtml(node.alt)}"`,
|
|
73
|
+
...(node.width !== undefined ? [`width="${node.width}"`] : []),
|
|
74
|
+
...(node.height !== undefined ? [`height="${node.height}"`] : []),
|
|
75
|
+
]
|
|
76
|
+
return `<img ${attrs.join(" ")} />`
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
case "blockquote":
|
|
80
|
+
return `<blockquote>${renderChildren(node.children)}</blockquote>`
|
|
81
|
+
|
|
82
|
+
case "list": {
|
|
83
|
+
const tag = node.listType === "ordered" ? "ol" : "ul"
|
|
84
|
+
return `<${tag}>${renderChildren(node.children)}</${tag}>`
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
case "listitem":
|
|
88
|
+
return `<li>${renderChildren(node.children)}</li>`
|
|
89
|
+
|
|
90
|
+
case "horizontalrule":
|
|
91
|
+
return `<hr />`
|
|
92
|
+
|
|
93
|
+
case "callout":
|
|
94
|
+
return `<div class="callout callout-${node.variant}">${CALLOUT_ICONS[node.variant]} ${renderChildren(node.children)}</div>`
|
|
95
|
+
|
|
96
|
+
case "code-tabs": {
|
|
97
|
+
const buttons = node.tabs
|
|
98
|
+
.map(
|
|
99
|
+
(tab, i) =>
|
|
100
|
+
`<button class="code-tab-button${i === 0 ? " active" : ""}" data-tab="${i}">${escapeHtml(tab.label)}</button>`,
|
|
101
|
+
)
|
|
102
|
+
.join("")
|
|
103
|
+
const panels = node.tabs
|
|
104
|
+
.map(
|
|
105
|
+
(tab, i) =>
|
|
106
|
+
`<div class="code-tab-panel${i === 0 ? " active" : ""}" data-tab="${i}"><pre><code class="language-${escapeHtml(tab.language)}">${escapeHtml(tab.code)}</code></pre></div>`,
|
|
107
|
+
)
|
|
108
|
+
.join("")
|
|
109
|
+
return `<div class="code-tabs"><div class="code-tabs-buttons">${buttons}</div>${panels}</div>`
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
case "cta":
|
|
113
|
+
return `<a class="cta-button" href="${escapeHtml(node.url)}">${escapeHtml(node.text)}</a>`
|
|
114
|
+
|
|
115
|
+
case "embed": {
|
|
116
|
+
if (node.provider === "youtube") {
|
|
117
|
+
return `<iframe src="https://www.youtube-nocookie.com/embed/${escapeHtml(node.embedId)}" frameborder="0" allowfullscreen loading="lazy"></iframe>`
|
|
118
|
+
}
|
|
119
|
+
return `<iframe src="https://codesandbox.io/embed/${escapeHtml(node.embedId)}" frameborder="0" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts" loading="lazy"></iframe>`
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
default: {
|
|
123
|
+
const _exhaustive: never = node
|
|
124
|
+
return ""
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","./src/config.ts","./src/analytics.ts","../client/dist/types.d.ts","../client/dist/auth.d.ts","../client/dist/query.d.ts","../client/dist/storage.d.ts","../client/dist/realtime.d.ts","../client/dist/errors.d.ts","../client/dist/fetch-with-retry.d.ts","../client/dist/retry.d.ts","../client/dist/error-codes-doc.d.ts","../client/dist/serverless-docs.d.ts","../client/dist/index.d.ts","./src/auth.ts","./src/content.ts","./src/richtext.ts","./src/index.ts","./src/posthog-js.d.ts"],"fileIdsList":[[61],[61,62,63,64,65,66,67,68,69,70],[67],[59,76],[59,71],[71],[59,60,72,73,74]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"a18c0c44351316e5b13f7f92d1232770a4fda8b3bad5487f893949acfd4ee024","signature":"1961146e2170bad5c73e6d3508319844ea4c5e3b3453c8b845b3fc2886dbffdc","impliedFormat":99},{"version":"45bed8a23579db10d80b78b1fd9749e89349f573c7365c4d6ed1a2d5210c80a0","signature":"b8c8535d571007fddb8221a888a9f04b2425c88ce580573e4bab6f30b18e5142","impliedFormat":99},{"version":"d3ed160939e7f93a97a35a37c42cad50799885f564a7b3957c9e9f1221ced9e7","impliedFormat":99},{"version":"d58e244c6d3aa676939aaa26e7bc5c6de22e408c195f69ee118eddd68377d17c","impliedFormat":99},{"version":"20fac2f073582881eeccdd3b04819084684fd296f3d6a0fa53e48ed3de83d35a","impliedFormat":99},{"version":"e5363db20ce3327d96a0e8c9a326259764eaf94e2b34eee3c74e5e6a988e5532","impliedFormat":99},{"version":"00f9fbcf8c7f9957b087eb4922fc153085c112d7f386c2cc211995a47fe7e07e","impliedFormat":99},{"version":"1600ade5611547c843e1da83f4180fa9d63e76f86503ac94e10ae55d87bfda02","impliedFormat":99},{"version":"ccbb4f957666793ea28e67b0748ba838841e641330b661bae31a5974612c73fd","impliedFormat":99},{"version":"9143a4409f10ae9f6362706e00e3b7ed082d4b2af0125aab31ecd30a6fefab13","impliedFormat":99},{"version":"6c9f37788061375db19a85ad684e2e08c5d0517200fae8479226ed1e82034ed1","impliedFormat":99},{"version":"e0856e33bfa821d4ab90b555ec6311122f178620eceb8effcaf6344abdb0bb75","impliedFormat":99},{"version":"509349be18cb0f2a92947dca43f5cd0af31ba579ebf8c75d2d2abb48a82f9042","impliedFormat":99},{"version":"018a1bf7cdd80aa62a8283559d5528f23b9f4a28d2dcd228b5edf6f3b1f9257b","signature":"36d4ec965584d61923a94fa31a1d27ea482e6a0b5a9bacba2874c7128b720812","impliedFormat":99},{"version":"50b5e9a0413c0ff99815f17ae55856749336dc72a7a82933b4f2e1b44bbb2923","signature":"2044428805e25aac0658d1a6a26b96c18c9c76282ec4db07994ad131834a9321","impliedFormat":99},{"version":"8515e6f7445dd06bbc30bbe4620111743d3a90e83574a2009907f3f6f2ade4fc","signature":"7bbe9cbb32187cf2a13609fc52dee76a1410d6370bbe631ac10ae84cc0b9d2ce","impliedFormat":99},{"version":"b3fb6c4247c1e0179f78758cee5bf99e84252ffc3d7912c4c721f4106e1ccd9e","signature":"6b064614b72bd3eb44e5700eb9b90cbdb4fba1951f332d8b149ccac42216514f","impliedFormat":99},{"version":"348265388dbc2e1dede6c6ed965f9144c07cbc7e4d78315cd829e33ac3481c46","impliedFormat":99}],"root":[59,60,[72,76]],"options":{"composite":true,"declaration":true,"declarationMap":true,"esModuleInterop":true,"exactOptionalPropertyTypes":true,"module":199,"noUncheckedIndexedAccess":true,"outDir":"./dist","rootDir":"./src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9},"referencedMap":[[62,1],[71,2],[63,1],[68,3],[64,1],[60,4],[72,5],[73,6],[75,7]],"latestChangedDtsFile":"./dist/index.d.ts","version":"5.9.3"}
|