@upstart.gg/sdk 0.0.103 → 0.0.105
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/dist/shared/ajv.js +1 -1
- package/dist/shared/attributes.js +1 -1
- package/dist/shared/bricks/manifests/accordion.manifest.js +1 -1
- package/dist/shared/bricks/manifests/all-manifests.js +1 -1
- package/dist/shared/bricks/manifests/button.manifest.js +1 -1
- package/dist/shared/bricks/manifests/card.manifest.js +1 -1
- package/dist/shared/bricks/manifests/carousel.manifest.js +1 -1
- package/dist/shared/bricks/manifests/container.manifest.js +1 -1
- package/dist/shared/bricks/manifests/divider.manifest.js +1 -1
- package/dist/shared/bricks/manifests/footer.manifest.js +1 -1
- package/dist/shared/bricks/manifests/form.manifest.js +1 -1
- package/dist/shared/bricks/manifests/hero.manifest.js +1 -1
- package/dist/shared/bricks/manifests/icon.manifest.js +1 -1
- package/dist/shared/bricks/manifests/image.manifest.js +1 -1
- package/dist/shared/bricks/manifests/images-gallery.manifest.js +1 -1
- package/dist/shared/bricks/manifests/map.manifest.js +1 -1
- package/dist/shared/bricks/manifests/navbar.manifest.js +1 -1
- package/dist/shared/bricks/manifests/sidebar.manifest.js +1 -1
- package/dist/shared/bricks/manifests/social-links.manifest.js +1 -1
- package/dist/shared/bricks/manifests/testimonials.manifest.js +1 -1
- package/dist/shared/bricks/manifests/text.manifest.js +1 -1
- package/dist/shared/bricks/manifests/timeline.manifest.js +1 -1
- package/dist/shared/bricks/manifests/video.manifest.js +1 -1
- package/dist/shared/bricks.js +1 -1
- package/dist/shared/chunk-245ZLDVB.js +3 -0
- package/dist/shared/{chunk-QALNFBY7.js → chunk-2D6ZEIDX.js} +1 -1
- package/dist/shared/{chunk-CW5FWW5W.js → chunk-4BLCQRF5.js} +1 -1
- package/dist/shared/{chunk-TEPFFY32.js → chunk-5MGYT6FI.js} +1 -1
- package/dist/shared/{chunk-HQQYIKTE.js → chunk-CS5N4UQU.js} +1 -1
- package/dist/shared/{chunk-5IEGQ7YT.js → chunk-FRWB3BF3.js} +1 -1
- package/dist/shared/{chunk-I5S2MPPR.js → chunk-HYXCHFS5.js} +1 -1
- package/dist/shared/{chunk-TCZBR3ZU.js → chunk-IKSRCRZZ.js} +1 -1
- package/dist/shared/{chunk-LJQXN32B.js → chunk-ISF6EBPX.js} +1 -1
- package/dist/shared/{chunk-UK6H3FDX.js → chunk-JDBVMPSI.js} +1 -1
- package/dist/shared/{chunk-UISES3HA.js → chunk-M3Z3XDUC.js} +1 -1
- package/dist/shared/{chunk-22KRCQK5.js → chunk-MWP5IU33.js} +1 -1
- package/dist/shared/{chunk-7L3UOEMR.js → chunk-NCSLTHKN.js} +1 -1
- package/dist/shared/{chunk-O22VV7YR.js → chunk-OWON727Q.js} +1 -1
- package/dist/shared/{chunk-CEXHD4BO.js → chunk-P5RC56CL.js} +2 -2
- package/dist/shared/{chunk-ZFTWLZ3G.js → chunk-QI3BZDXL.js} +1 -1
- package/dist/shared/{chunk-F6MLW6DO.js → chunk-RDSK2G6V.js} +1 -1
- package/dist/shared/{chunk-I43NIQ2K.js → chunk-RXRPFXDF.js} +1 -1
- package/dist/shared/{chunk-POYVTV5F.js → chunk-VFGMOA4M.js} +1 -1
- package/dist/shared/{chunk-VDHLON5R.js → chunk-VPD626ML.js} +1 -1
- package/dist/shared/{chunk-WCNVFVDK.js → chunk-VROOAFFW.js} +1 -1
- package/dist/shared/{chunk-E2EBTWJI.js → chunk-WB4PGCZQ.js} +1 -1
- package/dist/shared/chunk-X2RJL33B.js +3 -0
- package/dist/shared/{chunk-OQIFFJ7I.js → chunk-X4ZBUWUL.js} +1 -1
- package/dist/shared/datasources/external/rss/fetcher.d.ts +1 -1
- package/dist/shared/datasources/external/rss/fetcher.d.ts.map +1 -1
- package/dist/shared/page.js +1 -1
- package/dist/shared/site.js +1 -1
- package/package.json +5 -9
- package/dist/shared/chunk-GPKRRX3D.js +0 -3
- package/dist/shared/chunk-JFDOR3UH.js +0 -3
- package/src/node/cli/api.ts +0 -101
- package/src/node/cli/commands/cmd-build.ts +0 -64
- package/src/node/cli/commands/login/cmd-login.ts +0 -111
- package/src/node/cli/commands/logout/cmd-logout.ts +0 -11
- package/src/node/cli/commands/publish/cmd-publish.ts +0 -135
- package/src/node/cli/commands/publish/parse-gitignore.ts +0 -278
- package/src/node/cli/commands/publish/uploader.ts +0 -333
- package/src/node/cli/constants.ts +0 -14
- package/src/node/cli/is-logged-in.ts +0 -28
- package/src/node/cli/program.ts +0 -77
- package/src/node/cli/store.ts +0 -64
- package/src/node/cli/tests/api.test.ts +0 -161
- package/src/node/cli/types.ts +0 -34
- package/src/node/cli/utils.ts +0 -20
- package/src/node/shared/config.ts +0 -69
- package/src/node/shared/logger.ts +0 -44
- package/src/shared/ajv.ts +0 -103
- package/src/shared/analytics/init.ts +0 -14
- package/src/shared/analytics/track.ts +0 -21
- package/src/shared/analytics/types.ts +0 -13
- package/src/shared/attributes.ts +0 -211
- package/src/shared/brick-manifest.ts +0 -110
- package/src/shared/bricks/manifests/accordion.manifest.ts +0 -179
- package/src/shared/bricks/manifests/all-manifests.ts +0 -92
- package/src/shared/bricks/manifests/button.manifest.ts +0 -145
- package/src/shared/bricks/manifests/card.manifest.ts +0 -269
- package/src/shared/bricks/manifests/carousel.manifest.ts +0 -106
- package/src/shared/bricks/manifests/container.manifest.ts +0 -357
- package/src/shared/bricks/manifests/divider.manifest.ts +0 -121
- package/src/shared/bricks/manifests/footer.manifest.ts +0 -487
- package/src/shared/bricks/manifests/form.manifest.ts +0 -112
- package/src/shared/bricks/manifests/hero.manifest.ts +0 -132
- package/src/shared/bricks/manifests/icon.manifest.ts +0 -130
- package/src/shared/bricks/manifests/image.manifest.ts +0 -203
- package/src/shared/bricks/manifests/images-gallery.manifest.ts +0 -227
- package/src/shared/bricks/manifests/map.manifest.ts +0 -75
- package/src/shared/bricks/manifests/navbar.manifest.ts +0 -344
- package/src/shared/bricks/manifests/sidebar.manifest.ts +0 -90
- package/src/shared/bricks/manifests/social-links.manifest.ts +0 -370
- package/src/shared/bricks/manifests/testimonials.manifest.ts +0 -397
- package/src/shared/bricks/manifests/tests/header.manifest.test.ts +0 -10
- package/src/shared/bricks/manifests/text.manifest.ts +0 -164
- package/src/shared/bricks/manifests/timeline.manifest.ts +0 -456
- package/src/shared/bricks/manifests/video.manifest.ts +0 -59
- package/src/shared/bricks/props/_style-presets.ts +0 -352
- package/src/shared/bricks/props/align.ts +0 -59
- package/src/shared/bricks/props/background.ts +0 -118
- package/src/shared/bricks/props/boolean.ts +0 -11
- package/src/shared/bricks/props/border.ts +0 -84
- package/src/shared/bricks/props/color.ts +0 -24
- package/src/shared/bricks/props/common.ts +0 -37
- package/src/shared/bricks/props/container.ts +0 -356
- package/src/shared/bricks/props/css-length.ts +0 -25
- package/src/shared/bricks/props/datasource.ts +0 -60
- package/src/shared/bricks/props/date.ts +0 -24
- package/src/shared/bricks/props/effects.ts +0 -123
- package/src/shared/bricks/props/enum.ts +0 -42
- package/src/shared/bricks/props/file.ts +0 -12
- package/src/shared/bricks/props/geolocation.ts +0 -30
- package/src/shared/bricks/props/helpers.ts +0 -101
- package/src/shared/bricks/props/image.ts +0 -90
- package/src/shared/bricks/props/number.ts +0 -16
- package/src/shared/bricks/props/padding.ts +0 -21
- package/src/shared/bricks/props/position.ts +0 -27
- package/src/shared/bricks/props/preset.ts +0 -136
- package/src/shared/bricks/props/string.ts +0 -56
- package/src/shared/bricks/props/tests/align.test.ts +0 -37
- package/src/shared/bricks/props/tests/background.test.ts +0 -102
- package/src/shared/bricks/props/tests/border.test.ts +0 -38
- package/src/shared/bricks/props/tests/effects.test.ts +0 -37
- package/src/shared/bricks/props/tests/helpers.test.ts +0 -133
- package/src/shared/bricks/props/tests/image.test.ts +0 -71
- package/src/shared/bricks/props/tests/padding.ts +0 -12
- package/src/shared/bricks/props/tests/string.test.ts +0 -79
- package/src/shared/bricks/props/text.ts +0 -66
- package/src/shared/bricks/props/types.ts +0 -57
- package/src/shared/bricks.ts +0 -232
- package/src/shared/context.ts +0 -39
- package/src/shared/datarecords/external/airtable/handler.ts +0 -21
- package/src/shared/datarecords/external/airtable/options.ts +0 -22
- package/src/shared/datarecords/external/generic-webhook/handler.ts +0 -10
- package/src/shared/datarecords/external/generic-webhook/options.ts +0 -13
- package/src/shared/datarecords/external/google/oauth/config.ts +0 -30
- package/src/shared/datarecords/external/google/sheets/handler.ts +0 -26
- package/src/shared/datarecords/external/google/sheets/options.ts +0 -9
- package/src/shared/datarecords/types.ts +0 -120
- package/src/shared/datarecords.ts +0 -5
- package/src/shared/datasources/README.md +0 -3
- package/src/shared/datasources/external/facebook/posts/fetcher.ts +0 -52
- package/src/shared/datasources/external/facebook/posts/sample.ts +0 -35
- package/src/shared/datasources/external/facebook/posts/schema.ts +0 -33
- package/src/shared/datasources/external/facebook/posts/tests/fetcher.test.ts +0 -73
- package/src/shared/datasources/external/http-json/fetcher.ts +0 -28
- package/src/shared/datasources/external/http-json/options.ts +0 -12
- package/src/shared/datasources/external/http-json/schema.ts +0 -6
- package/src/shared/datasources/external/http-json/tests/fetcher.test.ts +0 -70
- package/src/shared/datasources/external/instagram/feed/fetcher.ts +0 -33
- package/src/shared/datasources/external/instagram/feed/sample.ts +0 -22
- package/src/shared/datasources/external/instagram/feed/schema.ts +0 -23
- package/src/shared/datasources/external/instagram/feed/tests/fetcher.test.ts +0 -64
- package/src/shared/datasources/external/mastodon/account/fetcher.ts +0 -24
- package/src/shared/datasources/external/mastodon/account/sample.ts +0 -33
- package/src/shared/datasources/external/mastodon/account/schema.ts +0 -45
- package/src/shared/datasources/external/mastodon/account/tests/fetcher.test.ts +0 -47
- package/src/shared/datasources/external/mastodon/options.ts +0 -11
- package/src/shared/datasources/external/mastodon/status/fetcher.ts +0 -35
- package/src/shared/datasources/external/mastodon/status/sample.array.ts +0 -59
- package/src/shared/datasources/external/mastodon/status/sample.single.ts +0 -55
- package/src/shared/datasources/external/mastodon/status/schema.ts +0 -130
- package/src/shared/datasources/external/mastodon/status/tests/fetcher.test.ts +0 -74
- package/src/shared/datasources/external/meta/oauth/config.ts +0 -16
- package/src/shared/datasources/external/meta/options.ts +0 -11
- package/src/shared/datasources/external/rss/fetcher.ts +0 -29
- package/src/shared/datasources/external/rss/options.ts +0 -11
- package/src/shared/datasources/external/rss/sample.ts +0 -22
- package/src/shared/datasources/external/rss/schema.ts +0 -42
- package/src/shared/datasources/external/threads/media/fetcher.ts +0 -53
- package/src/shared/datasources/external/threads/media/sample.ts +0 -44
- package/src/shared/datasources/external/threads/media/schema.ts +0 -37
- package/src/shared/datasources/external/tiktok/oauth/config.ts +0 -17
- package/src/shared/datasources/external/tiktok/video/fetcher.ts +0 -39
- package/src/shared/datasources/external/tiktok/video/options.ts +0 -12
- package/src/shared/datasources/external/tiktok/video/sample.ts +0 -26
- package/src/shared/datasources/external/tiktok/video/schema.ts +0 -27
- package/src/shared/datasources/external/youtube/list/fetcher.ts +0 -37
- package/src/shared/datasources/external/youtube/list/options.ts +0 -15
- package/src/shared/datasources/external/youtube/list/sample.ts +0 -33
- package/src/shared/datasources/external/youtube/list/schema.ts +0 -38
- package/src/shared/datasources/external/youtube/oauth/config.ts +0 -15
- package/src/shared/datasources/fetcher.ts +0 -17
- package/src/shared/datasources/internal/blog/schema.ts +0 -69
- package/src/shared/datasources/internal/changelog/schema.ts +0 -48
- package/src/shared/datasources/internal/contact-info/schema.ts +0 -20
- package/src/shared/datasources/internal/cv/schema.ts +0 -217
- package/src/shared/datasources/internal/faq/schema.ts +0 -27
- package/src/shared/datasources/internal/job-board/schema.ts +0 -228
- package/src/shared/datasources/internal/links/schema.ts +0 -15
- package/src/shared/datasources/internal/recipes/schema.ts +0 -42
- package/src/shared/datasources/internal/restaurant/schema.ts +0 -225
- package/src/shared/datasources/provider-options.ts +0 -7
- package/src/shared/datasources/samples.ts +0 -26
- package/src/shared/datasources/schemas.ts +0 -45
- package/src/shared/datasources/types.ts +0 -276
- package/src/shared/datasources/utils.ts +0 -16
- package/src/shared/datasources.ts +0 -42
- package/src/shared/env.ts +0 -23
- package/src/shared/errors.ts +0 -1
- package/src/shared/images.ts +0 -44
- package/src/shared/index.ts +0 -3
- package/src/shared/layout-constants.ts +0 -25
- package/src/shared/manifest.ts +0 -50
- package/src/shared/oauth.ts +0 -16
- package/src/shared/page.ts +0 -61
- package/src/shared/prompt.ts +0 -9
- package/src/shared/responsive.ts +0 -5
- package/src/shared/site.ts +0 -97
- package/src/shared/sitemap.ts +0 -66
- package/src/shared/social-icons.ts +0 -307
- package/src/shared/tests/attributes.test.ts +0 -37
- package/src/shared/theme.ts +0 -245
- package/src/shared/themes/README.md +0 -34
- package/src/shared/themes/color-system.ts +0 -127
- package/src/shared/utils/canvas-data-uri.ts +0 -2
- package/src/shared/utils/invariant.ts +0 -25
- package/src/shared/utils/json-date.ts +0 -8
- package/src/shared/utils/merge.ts +0 -12
- package/src/shared/utils/object-hash.ts +0 -7
- package/src/shared/utils/schema.ts +0 -35
- package/src/shared/utils/try-catch.ts +0 -12
- package/src/shared/utils/typed-ref.ts +0 -41
package/src/node/cli/types.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { OptionValues } from "commander";
|
|
2
|
-
import type { Logger } from "../shared/logger";
|
|
3
|
-
|
|
4
|
-
export type CredentialsStore = {
|
|
5
|
-
access_token: string;
|
|
6
|
-
token_type: string;
|
|
7
|
-
expires_in?: number;
|
|
8
|
-
refresh_token?: string;
|
|
9
|
-
refresh_token_expires_in?: number;
|
|
10
|
-
scope?: string;
|
|
11
|
-
expires_at: number;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type CommandArgOpts<Opts extends OptionValues = OptionValues> = {
|
|
15
|
-
args: string[];
|
|
16
|
-
options: CommonOptions & Opts;
|
|
17
|
-
logger: Logger;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export type CommonOptions = {
|
|
21
|
-
logLevel?: "info" | "warn" | "error" | "silent";
|
|
22
|
-
clearScreen?: boolean;
|
|
23
|
-
dryRun?: boolean;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export type BuildOptions = {
|
|
27
|
-
ssr: boolean | "local";
|
|
28
|
-
clean?: boolean;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export type GenericApiError = {
|
|
32
|
-
error: string;
|
|
33
|
-
error_description: string;
|
|
34
|
-
};
|
package/src/node/cli/utils.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export function getPackageManager() {
|
|
2
|
-
// Detect package manager
|
|
3
|
-
let packageManager: string | undefined;
|
|
4
|
-
if (process.env.npm_config_user_agent) {
|
|
5
|
-
const pmPart = process.env.npm_config_user_agent.split(" ")[0];
|
|
6
|
-
packageManager = pmPart.slice(0, pmPart.lastIndexOf("/"));
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// Display message
|
|
10
|
-
if (!packageManager) {
|
|
11
|
-
console.log("Warning: could not detect package manager");
|
|
12
|
-
packageManager = "npm";
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return packageManager;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function formatAPIError(error: { error: string; error_description?: string }) {
|
|
19
|
-
return `[${error.error}]${error.error_description ? `: ${error.error_description}` : ""}`;
|
|
20
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
3
|
-
import fg from "fast-glob";
|
|
4
|
-
import { type Logger, logger as defaultLogger } from "./logger";
|
|
5
|
-
import { basename, dirname, extname } from "node:path";
|
|
6
|
-
import type { SiteAndPagesConfig } from "~/shared/site";
|
|
7
|
-
|
|
8
|
-
export async function loadConfigFromJsFile(
|
|
9
|
-
configPath: string,
|
|
10
|
-
logger = defaultLogger as Logger,
|
|
11
|
-
): Promise<SiteAndPagesConfig> {
|
|
12
|
-
if (!fs.existsSync(configPath)) {
|
|
13
|
-
logger.error(
|
|
14
|
-
"🔴 No enpage.config.js found!\nYour project must have an enpage.config.js file in the root directory.\n\n",
|
|
15
|
-
);
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
const config = (await import(configPath)) as SiteAndPagesConfig;
|
|
19
|
-
|
|
20
|
-
// Parse the readme files fro the same directory as the config file
|
|
21
|
-
const readmePath = dirname(configPath);
|
|
22
|
-
const readme: Record<string, string> = {};
|
|
23
|
-
const readmeFiles = await fg(["README.enpage.md", "README.enpage.*.md"], {
|
|
24
|
-
cwd: readmePath,
|
|
25
|
-
onlyFiles: true,
|
|
26
|
-
absolute: true,
|
|
27
|
-
caseSensitiveMatch: false,
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
for (const file of readmeFiles) {
|
|
31
|
-
const base = basename(file, ".md");
|
|
32
|
-
const ext = extname(base);
|
|
33
|
-
const language = (ext === ".enpage" ? "en" : ext.substring(1)).toLowerCase();
|
|
34
|
-
logger.debug(`Found template readme file (${language}): ${basename(file)}`);
|
|
35
|
-
readme[language] = await readFile(file, "utf-8");
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return config;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function loadConfigFromManifestFile(manifestPath: string, logger: Logger): SiteAndPagesConfig {
|
|
42
|
-
if (!fs.existsSync(manifestPath)) {
|
|
43
|
-
logger.error("🔴 No enpage.manifest.json found!\nYou may want to 'build' your template.\n\n");
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
return JSON.parse(fs.readFileSync(manifestPath, "utf-8"));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function validateTemplateConfig(config: SiteAndPagesConfig, logger: Logger) {
|
|
50
|
-
for (const key in config.site.datasources) {
|
|
51
|
-
if (config.site.datasources[key].provider === "http-json" && !config.site.datasources[key].sampleData) {
|
|
52
|
-
logger.error(
|
|
53
|
-
`🔴 Error: Datasource "${key}" is missing sample data - nothing will be rendered during development! Please check your enpage.config.js file and add a "sampleData" key to your ${key} datasource.`,
|
|
54
|
-
);
|
|
55
|
-
throw new Error(`Missing sample data for datasource "${key}"`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Todo: replace validation from zod to ajv
|
|
60
|
-
// const validated = manifestSchema.safeParse(config.manifest);
|
|
61
|
-
// if (!validated.success) {
|
|
62
|
-
// logger.error(`🔴 Error: template manifest is invalid. Check your call to defineManifest().\n`);
|
|
63
|
-
// const err = fromError(validated.error);
|
|
64
|
-
// logger.error(`Hint: ${err.toString()}\n\n`);
|
|
65
|
-
// process.exit(1);
|
|
66
|
-
// }
|
|
67
|
-
|
|
68
|
-
return config;
|
|
69
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createLogger as createLoggerBase,
|
|
3
|
-
type LogLevel,
|
|
4
|
-
type LogOptions,
|
|
5
|
-
type Logger as BaseLogger,
|
|
6
|
-
} from "vite";
|
|
7
|
-
// import { version } from "../../../package.json";
|
|
8
|
-
import chalk from "chalk";
|
|
9
|
-
|
|
10
|
-
const VERSION = 0.1;
|
|
11
|
-
|
|
12
|
-
type UpstartLoggerLevel = LogLevel | "debug";
|
|
13
|
-
|
|
14
|
-
export function createLogger(level?: UpstartLoggerLevel, allowClearScreen?: boolean, showVersion = false) {
|
|
15
|
-
// vite logger does not support "debug" level
|
|
16
|
-
const logger = createLoggerBase(level === "debug" ? "info" : level, {
|
|
17
|
-
prefix: "[upstart]",
|
|
18
|
-
allowClearScreen,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
if (showVersion) {
|
|
22
|
-
logger.info(chalk.hex("#7270c6").bold(`🚀 Upstart v${VERSION}\n`));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
...logger,
|
|
27
|
-
success: (message: string, options?: LogOptions) => logger.info(chalk.green(message), options),
|
|
28
|
-
error: (message: string, options?: LogOptions) => logger.error(chalk.red(message), options),
|
|
29
|
-
warn: (message: string, options?: LogOptions) => logger.warn(chalk.yellow(message), options),
|
|
30
|
-
warnOnce: (message: string, options?: LogOptions) => logger.warnOnce(chalk.yellow(message), options),
|
|
31
|
-
debug: (message: string, options?: LogOptions) => {
|
|
32
|
-
if (level === "debug") {
|
|
33
|
-
logger.info(chalk.gray(message), options);
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const logger = createLogger();
|
|
40
|
-
|
|
41
|
-
export type Logger = BaseLogger & {
|
|
42
|
-
success: (message: string, options?: LogOptions) => void;
|
|
43
|
-
debug: (message: string, options?: LogOptions) => void;
|
|
44
|
-
};
|
package/src/shared/ajv.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import Ajv, { type ErrorObject } from "ajv";
|
|
2
|
-
import addFormats from "ajv-formats";
|
|
3
|
-
import { preset } from "./bricks/props/preset";
|
|
4
|
-
import { background, backgroundColor } from "./bricks/props/background";
|
|
5
|
-
import { containerLayout } from "./bricks/props/container";
|
|
6
|
-
import { basicAlign } from "./bricks/props/align";
|
|
7
|
-
import { hidden } from "./bricks/props/common";
|
|
8
|
-
import { border } from "./bricks/props/border";
|
|
9
|
-
import { padding } from "./bricks/props/padding";
|
|
10
|
-
import { image } from "./bricks/props/image";
|
|
11
|
-
import { color } from "./bricks/props/color";
|
|
12
|
-
import { shadow } from "./bricks/props/effects";
|
|
13
|
-
import { textContent } from "./bricks/props/text";
|
|
14
|
-
import { cssLength } from "./bricks/props/css-length";
|
|
15
|
-
import { urlOrPageId } from "./bricks/props/string";
|
|
16
|
-
|
|
17
|
-
export type { JSONSchemaType, AnySchemaObject, SchemaObject, JSONType } from "ajv";
|
|
18
|
-
|
|
19
|
-
export const ajv = new Ajv({
|
|
20
|
-
useDefaults: true,
|
|
21
|
-
strictSchema: false,
|
|
22
|
-
validateSchema: false,
|
|
23
|
-
coerceTypes: true,
|
|
24
|
-
allErrors: true,
|
|
25
|
-
inlineRefs: false,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
ajv.addSchema(preset(), "styles:preset");
|
|
29
|
-
ajv.addSchema(background(), "styles:background");
|
|
30
|
-
ajv.addSchema(backgroundColor(), "styles:backgroundColor");
|
|
31
|
-
ajv.addSchema(basicAlign(), "styles:basicAlign");
|
|
32
|
-
ajv.addSchema(containerLayout(), "styles:containerLayout");
|
|
33
|
-
ajv.addSchema(hidden(), "styles:hidden");
|
|
34
|
-
ajv.addSchema(border(), "styles:border");
|
|
35
|
-
ajv.addSchema(padding(), "styles:padding");
|
|
36
|
-
ajv.addSchema(color(), "styles:color");
|
|
37
|
-
ajv.addSchema(shadow(), "styles:shadow");
|
|
38
|
-
ajv.addSchema(cssLength(), "styles:cssLength");
|
|
39
|
-
ajv.addSchema(image(), "assets:image");
|
|
40
|
-
ajv.addSchema(textContent(), "content:textContent");
|
|
41
|
-
ajv.addSchema(urlOrPageId(), "content:urlOrPageId");
|
|
42
|
-
|
|
43
|
-
export const jsonStringsSupportedFormats = [
|
|
44
|
-
"date-time",
|
|
45
|
-
"time",
|
|
46
|
-
"date",
|
|
47
|
-
"email",
|
|
48
|
-
"hostname",
|
|
49
|
-
"ipv4",
|
|
50
|
-
"ipv6",
|
|
51
|
-
"uri",
|
|
52
|
-
"uri-reference",
|
|
53
|
-
"uuid",
|
|
54
|
-
"uri-template",
|
|
55
|
-
"json-pointer",
|
|
56
|
-
"relative-json-pointer",
|
|
57
|
-
"regex",
|
|
58
|
-
] as const;
|
|
59
|
-
|
|
60
|
-
// Add formats to Ajv
|
|
61
|
-
addFormats(ajv, [...jsonStringsSupportedFormats]);
|
|
62
|
-
|
|
63
|
-
ajv.addFormat("date-object", {
|
|
64
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
65
|
-
validate: (data: any) => data instanceof Date && !Number.isNaN(data.getTime()),
|
|
66
|
-
async: false,
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
ajv.addFormat("richtext", {
|
|
70
|
-
validate: (data: string) => typeof data === "string",
|
|
71
|
-
async: false,
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
ajv.addFormat("markdown", {
|
|
75
|
-
validate: (data: string) => typeof data === "string",
|
|
76
|
-
async: false,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
ajv.addFormat("multiline", {
|
|
80
|
-
validate: (data: string) => typeof data === "string",
|
|
81
|
-
async: false,
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
ajv.addFormat("password", {
|
|
85
|
-
validate: (data: string) => typeof data === "string",
|
|
86
|
-
async: false,
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
export function serializeAjvErrors(errors: ErrorObject[] | null | undefined): string {
|
|
90
|
-
if (!errors || errors.length === 0) {
|
|
91
|
-
return "Unknown validation error";
|
|
92
|
-
}
|
|
93
|
-
return errors
|
|
94
|
-
.map((error) => {
|
|
95
|
-
const { instancePath, message, params } = error;
|
|
96
|
-
const path = instancePath || "root";
|
|
97
|
-
const details = Object.entries(params || {})
|
|
98
|
-
.map(([key, value]) => `${key}: ${value}`)
|
|
99
|
-
.join(", ");
|
|
100
|
-
return `${path} ${message} (${details})`;
|
|
101
|
-
})
|
|
102
|
-
.join("; ");
|
|
103
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export function init() {
|
|
2
|
-
window.upstartQueue = window.upstartQueue || [];
|
|
3
|
-
document.addEventListener("visibilitychange", function logData() {
|
|
4
|
-
if (document.visibilityState === "hidden") {
|
|
5
|
-
const payload = JSON.stringify(window.upstartQueue);
|
|
6
|
-
if (navigator.sendBeacon?.(window.location.pathname, payload)) {
|
|
7
|
-
console.debug("beacon sent", payload);
|
|
8
|
-
window.upstartQueue = [];
|
|
9
|
-
} else {
|
|
10
|
-
console.debug("beacon failed", payload);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { BeaconPayload } from "./types";
|
|
2
|
-
|
|
3
|
-
export function track(type: BeaconPayload["e"], data: BeaconPayload["d"] = {}) {
|
|
4
|
-
const payload: BeaconPayload = {
|
|
5
|
-
e: type,
|
|
6
|
-
t: Date.now(),
|
|
7
|
-
d: data,
|
|
8
|
-
};
|
|
9
|
-
window.upstartQueue.push(payload);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
document.addEventListener(
|
|
13
|
-
"click",
|
|
14
|
-
function (e) {
|
|
15
|
-
const target = e.target as HTMLElement;
|
|
16
|
-
track("click", {
|
|
17
|
-
buttonId: target.id,
|
|
18
|
-
});
|
|
19
|
-
},
|
|
20
|
-
true,
|
|
21
|
-
);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
type EventType = "click" | "submit" | "custom";
|
|
2
|
-
|
|
3
|
-
export type BeaconPayload = {
|
|
4
|
-
e: EventType; // event type
|
|
5
|
-
t: number; // timestamp
|
|
6
|
-
d?: Record<string, unknown>; // data
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
declare global {
|
|
10
|
-
interface Window {
|
|
11
|
-
upstartQueue: BeaconPayload[];
|
|
12
|
-
}
|
|
13
|
-
}
|
package/src/shared/attributes.ts
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { Type, type TProperties, type Static, type TObject } from "@sinclair/typebox";
|
|
2
|
-
import type { JSONSchemaType } from "ajv";
|
|
3
|
-
import { backgroundRef } from "./bricks/props/background";
|
|
4
|
-
import { string } from "./bricks/props/string";
|
|
5
|
-
import { optional } from "./bricks/props/helpers";
|
|
6
|
-
import { boolean } from "./bricks/props/boolean";
|
|
7
|
-
import { datetime } from "./bricks/props/date";
|
|
8
|
-
import { enumProp } from "./bricks/props/enum";
|
|
9
|
-
import { jsonDefault } from "json-schema-default";
|
|
10
|
-
|
|
11
|
-
export function defineAttributes(attrs: TProperties) {
|
|
12
|
-
// Attributes starting with "$" are reserved for internal use
|
|
13
|
-
for (const key in attrs) {
|
|
14
|
-
if (key.startsWith("$")) {
|
|
15
|
-
throw new Error(
|
|
16
|
-
`Attribute names starting with '$' (like "${key}") are reserved for internal use. Please rename it.`,
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return Type.Object(attrs);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Retuns the custom attributes schema merged with the default attributes schema
|
|
25
|
-
*/
|
|
26
|
-
export function processAttributesSchema(customAttributes: TObject) {
|
|
27
|
-
return Type.Composite([customAttributes, defaultAttributesSchema]) as AttributesSchema;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type { JSONSchemaType };
|
|
31
|
-
|
|
32
|
-
// Default attributes
|
|
33
|
-
const defaultAttributes = {
|
|
34
|
-
$pageLanguage: enumProp("Language", "en", {
|
|
35
|
-
options: [
|
|
36
|
-
{ value: "ar", title: "Arabic" },
|
|
37
|
-
{ value: "zh", title: "Chinese" },
|
|
38
|
-
{ value: "cs", title: "Czech" },
|
|
39
|
-
{ value: "nl", title: "Dutch" },
|
|
40
|
-
{ value: "en", title: "English" },
|
|
41
|
-
{ value: "fr", title: "French" },
|
|
42
|
-
{ value: "de", title: "German" },
|
|
43
|
-
{ value: "he", title: "Hebrew" },
|
|
44
|
-
{ value: "hi", title: "Hindi" },
|
|
45
|
-
{ value: "it", title: "Italian" },
|
|
46
|
-
{ value: "ja", title: "Japanese" },
|
|
47
|
-
{ value: "ko", title: "Korean" },
|
|
48
|
-
{ value: "fa", title: "Persian" },
|
|
49
|
-
{ value: "pl", title: "Polish" },
|
|
50
|
-
{ value: "pt", title: "Portuguese" },
|
|
51
|
-
{ value: "ru", title: "Russian" },
|
|
52
|
-
{ value: "es", title: "Spanish" },
|
|
53
|
-
{ value: "tr", title: "Turkish" },
|
|
54
|
-
{ value: "vi", title: "Vietnamese" },
|
|
55
|
-
],
|
|
56
|
-
"ai:guidelines":
|
|
57
|
-
"Choose a value based on the site description. If the site is in multiple languages, use 'en'.",
|
|
58
|
-
|
|
59
|
-
"ui:group": "meta",
|
|
60
|
-
"ui:group:title": "Meta tags",
|
|
61
|
-
}),
|
|
62
|
-
|
|
63
|
-
$bodyBackground: optional(
|
|
64
|
-
backgroundRef({
|
|
65
|
-
default: {
|
|
66
|
-
color: "#ffffff",
|
|
67
|
-
},
|
|
68
|
-
title: "Body Background",
|
|
69
|
-
description:
|
|
70
|
-
"Applies to the body element of the page (while $pageBackground applies to the page container)",
|
|
71
|
-
"ui:field": "background",
|
|
72
|
-
// disable for now
|
|
73
|
-
// "ui:show-img-search": true,
|
|
74
|
-
"ui:group": "layout",
|
|
75
|
-
"ui:group:title": "Page Layout",
|
|
76
|
-
"ui:group:order": 3,
|
|
77
|
-
}),
|
|
78
|
-
),
|
|
79
|
-
|
|
80
|
-
$pageBackground: optional(backgroundRef({ title: "Page Background", defaultValue: { color: "base-100" } })),
|
|
81
|
-
|
|
82
|
-
$pageOgImage: optional(
|
|
83
|
-
string("Social share image", "", {
|
|
84
|
-
description: "Image shown when page is shared on social media",
|
|
85
|
-
"ai:guidelines": "Don't generate this property/image, it is automatically generated.",
|
|
86
|
-
"ui:group": "meta",
|
|
87
|
-
"ui:field": "image",
|
|
88
|
-
}),
|
|
89
|
-
),
|
|
90
|
-
|
|
91
|
-
$robotsIndexing: optional(
|
|
92
|
-
boolean("Allow search engines to index this site", true, {
|
|
93
|
-
description: "Disabling this will prevent search engines from indexing this site",
|
|
94
|
-
"ai:guidelines": "Don't generate this property/image, it is automatically generated.",
|
|
95
|
-
"ui:group": "seo",
|
|
96
|
-
"ui:group:title": "SEO",
|
|
97
|
-
"ui:scope": "site",
|
|
98
|
-
}),
|
|
99
|
-
),
|
|
100
|
-
|
|
101
|
-
$siteOgImage: optional(
|
|
102
|
-
string("Social share image", "", {
|
|
103
|
-
description: "Image shown when this site is shared on social media",
|
|
104
|
-
"ai:guidelines": "Don't generate this image, it is automatically generated.",
|
|
105
|
-
"ui:field": "image",
|
|
106
|
-
"ui:group": "meta",
|
|
107
|
-
"ui:group:title": "Meta tags",
|
|
108
|
-
"ui:scope": "site",
|
|
109
|
-
}),
|
|
110
|
-
),
|
|
111
|
-
|
|
112
|
-
$pagePath: string("Page path", "/", {
|
|
113
|
-
description: "The URL path of the page",
|
|
114
|
-
"ui:group": "location",
|
|
115
|
-
"ui:group:title": "Location",
|
|
116
|
-
"ui:field": "path",
|
|
117
|
-
}),
|
|
118
|
-
|
|
119
|
-
$pageTitle: string("Title", "Untitled", {
|
|
120
|
-
"ui:group": "meta",
|
|
121
|
-
"ui:group:title": "Meta tags",
|
|
122
|
-
description: "The title of the page. Appears in the browser tab and search results",
|
|
123
|
-
}),
|
|
124
|
-
|
|
125
|
-
$pageDescription: string("Description", "", {
|
|
126
|
-
"ui:widget": "textarea",
|
|
127
|
-
"ui:group": "meta",
|
|
128
|
-
"ui:group:title": "Meta tags",
|
|
129
|
-
description: "A short description of the page. Used by search engines",
|
|
130
|
-
"ui:multiline": true,
|
|
131
|
-
}),
|
|
132
|
-
|
|
133
|
-
$pageKeywords: string("Keywords", "", {
|
|
134
|
-
"ui:group": "meta",
|
|
135
|
-
"ui:group:title": "Meta tags",
|
|
136
|
-
description: "Keywords related to the page. Used by search engines",
|
|
137
|
-
"ui:multiline": true,
|
|
138
|
-
}),
|
|
139
|
-
|
|
140
|
-
$pageLastUpdated: optional(
|
|
141
|
-
datetime("Last updated", {
|
|
142
|
-
"ui:hidden": true,
|
|
143
|
-
"ai:guidelines": "Don't generate this property.",
|
|
144
|
-
}),
|
|
145
|
-
),
|
|
146
|
-
|
|
147
|
-
// --- layout attributes ---
|
|
148
|
-
|
|
149
|
-
$siteHeadTags: optional(
|
|
150
|
-
Type.String({
|
|
151
|
-
title: "Head tags",
|
|
152
|
-
description:
|
|
153
|
-
"Add custom tags to the <head> of your site. Useful for analytics tags, custom scripts, etc.",
|
|
154
|
-
"ai:guidelines": "Don't include meta tags here, they are automatically generated.",
|
|
155
|
-
"ui:multiline": true,
|
|
156
|
-
"ui:textarea-class": "h-40 !font-mono",
|
|
157
|
-
"ui:placeholder": "<script src='https://example.com/script.js'></script>",
|
|
158
|
-
"ui:premium": true,
|
|
159
|
-
"ui:scope": "site",
|
|
160
|
-
"ui:group": "external-scripts",
|
|
161
|
-
"ui:group:title": "External scripts",
|
|
162
|
-
}),
|
|
163
|
-
),
|
|
164
|
-
$siteBodyTags: optional(
|
|
165
|
-
Type.String({
|
|
166
|
-
title: "Body tags",
|
|
167
|
-
description:
|
|
168
|
-
"Add custom tags to the <body> of your site. Useful for analytics tags, custom scripts, etc.",
|
|
169
|
-
"ui:multiline": true,
|
|
170
|
-
"ui:premium": true,
|
|
171
|
-
"ui:textarea-class": "h-40 !font-mono",
|
|
172
|
-
"ui:placeholder": "<script src='https://example.com/script.js'></script>",
|
|
173
|
-
"ui:scope": "site",
|
|
174
|
-
"ui:group": "external-scripts",
|
|
175
|
-
"ui:group:title": "External scripts",
|
|
176
|
-
}),
|
|
177
|
-
),
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
export const defaultAttributesSchema = Type.Object(defaultAttributes, { additionalProperties: true });
|
|
181
|
-
export const siteAttributesSchemaForLLM = Type.Pick(defaultAttributesSchema, [
|
|
182
|
-
"$bodyBackground",
|
|
183
|
-
"$pageBackground",
|
|
184
|
-
]);
|
|
185
|
-
export const pageAttributesSchemaForLLM = Type.Pick(defaultAttributesSchema, [
|
|
186
|
-
"$pageTitle",
|
|
187
|
-
"$pageDescription",
|
|
188
|
-
"$pageKeywords",
|
|
189
|
-
"$pageLanguage",
|
|
190
|
-
"$pagePath",
|
|
191
|
-
"$bodyBackground",
|
|
192
|
-
"$pageBackground",
|
|
193
|
-
]);
|
|
194
|
-
|
|
195
|
-
export type AttributesSchema = typeof defaultAttributesSchema & Record<string, unknown>;
|
|
196
|
-
|
|
197
|
-
export type Attributes<T extends Record<string, unknown> = Record<string, unknown>> = Static<
|
|
198
|
-
typeof defaultAttributesSchema
|
|
199
|
-
> &
|
|
200
|
-
T;
|
|
201
|
-
|
|
202
|
-
export function resolveAttributes(
|
|
203
|
-
customAttrsSchema: TObject = Type.Object({}),
|
|
204
|
-
data: Record<string, unknown> = {},
|
|
205
|
-
) {
|
|
206
|
-
// To get default values from the custom attributes schema,
|
|
207
|
-
const defaultAttrValues = jsonDefault(defaultAttributesSchema) as Attributes<
|
|
208
|
-
Static<typeof defaultAttributesSchema>
|
|
209
|
-
>;
|
|
210
|
-
return { ...defaultAttrValues, ...data } as Attributes<Static<typeof customAttrsSchema>>;
|
|
211
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import type { TObject, TProperties, TArray } from "@sinclair/typebox";
|
|
2
|
-
import type { IconBase } from "react-icons/lib";
|
|
3
|
-
import { getSchemaDefaults } from "./utils/schema";
|
|
4
|
-
|
|
5
|
-
type BrickKind = "brick" | "widget" | "container";
|
|
6
|
-
|
|
7
|
-
type BrickManifestProps<BProps extends TProperties, DSSchema extends TObject | TArray<TObject>> = {
|
|
8
|
-
type: string;
|
|
9
|
-
kind?: BrickKind;
|
|
10
|
-
name: string;
|
|
11
|
-
icon: typeof IconBase;
|
|
12
|
-
iconClassName?: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
minWidth?: {
|
|
15
|
-
mobile: number;
|
|
16
|
-
desktop: number;
|
|
17
|
-
};
|
|
18
|
-
maxWidth?: {
|
|
19
|
-
mobile: number;
|
|
20
|
-
desktop: number;
|
|
21
|
-
};
|
|
22
|
-
minHeight?: {
|
|
23
|
-
mobile: number;
|
|
24
|
-
desktop: number;
|
|
25
|
-
};
|
|
26
|
-
maxHeight?: {
|
|
27
|
-
mobile: number;
|
|
28
|
-
desktop: number;
|
|
29
|
-
};
|
|
30
|
-
defaultWidth?: {
|
|
31
|
-
mobile: number;
|
|
32
|
-
desktop: number;
|
|
33
|
-
};
|
|
34
|
-
defaultHeight?: {
|
|
35
|
-
mobile: number;
|
|
36
|
-
desktop: number;
|
|
37
|
-
};
|
|
38
|
-
props: TObject<BProps>;
|
|
39
|
-
datasource?: DSSchema;
|
|
40
|
-
hideInLibrary?: boolean;
|
|
41
|
-
defaultInspectorTab?: "preset" | "style" | "content";
|
|
42
|
-
deletable?: boolean;
|
|
43
|
-
movable?: boolean;
|
|
44
|
-
repeatable?: boolean;
|
|
45
|
-
resizable?: boolean;
|
|
46
|
-
duplicatable?: boolean;
|
|
47
|
-
isContainer?: boolean;
|
|
48
|
-
aiInstructions?: string;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export function defineBrickManifest<BProps extends TProperties, DSSchema extends TObject | TArray<TObject>>({
|
|
52
|
-
props,
|
|
53
|
-
defaultWidth,
|
|
54
|
-
defaultHeight,
|
|
55
|
-
minWidth,
|
|
56
|
-
minHeight,
|
|
57
|
-
kind = "brick",
|
|
58
|
-
isContainer = false,
|
|
59
|
-
hideInLibrary = false,
|
|
60
|
-
deletable = true,
|
|
61
|
-
movable = true,
|
|
62
|
-
resizable = true,
|
|
63
|
-
repeatable = false,
|
|
64
|
-
duplicatable = true,
|
|
65
|
-
defaultInspectorTab = "preset",
|
|
66
|
-
icon,
|
|
67
|
-
datasource,
|
|
68
|
-
...rest
|
|
69
|
-
}: BrickManifestProps<BProps, DSSchema>) {
|
|
70
|
-
return {
|
|
71
|
-
...rest,
|
|
72
|
-
datasource: datasource as DSSchema,
|
|
73
|
-
icon,
|
|
74
|
-
props,
|
|
75
|
-
kind,
|
|
76
|
-
defaultInspectorTab,
|
|
77
|
-
hideInLibrary,
|
|
78
|
-
deletable,
|
|
79
|
-
movable,
|
|
80
|
-
resizable,
|
|
81
|
-
repeatable,
|
|
82
|
-
duplicatable,
|
|
83
|
-
isContainer,
|
|
84
|
-
defaultWidth:
|
|
85
|
-
defaultWidth ?? minWidth ?? ({ desktop: 8, mobile: -1 } as { desktop: number; mobile: number }),
|
|
86
|
-
defaultHeight:
|
|
87
|
-
defaultHeight ?? minHeight ?? ({ desktop: 3, mobile: 3 } as { desktop: number; mobile: number }),
|
|
88
|
-
minWidth,
|
|
89
|
-
minHeight,
|
|
90
|
-
} as const;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export type BrickManifest = ReturnType<typeof defineBrickManifest>;
|
|
94
|
-
|
|
95
|
-
export function getBrickManifestDefaults<M extends BrickManifest>(manifest: M) {
|
|
96
|
-
return {
|
|
97
|
-
...manifest,
|
|
98
|
-
props: getSchemaDefaults(manifest.props),
|
|
99
|
-
// mobileProps: {},
|
|
100
|
-
...(manifest.datasource ? { datasource: getSchemaDefaults(manifest.datasource) } : {}),
|
|
101
|
-
// ...(manifest.datarecord ? { datarecord: Value.Create(manifest.datarecord) } : {}),
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export type BrickDefaults = ReturnType<typeof getBrickManifestDefaults>;
|
|
106
|
-
|
|
107
|
-
export type BrickConstraints = Pick<
|
|
108
|
-
BrickManifest,
|
|
109
|
-
"defaultWidth" | "defaultHeight" | "minWidth" | "minHeight" | "maxWidth" | "resizable" | "movable"
|
|
110
|
-
>;
|