@driftime/sanity-plugin-link 0.1.0
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/README.md +593 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1010 -0
- package/dist/index.js.map +1 -0
- package/dist/render.d.ts +164 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +413 -0
- package/dist/render.js.map +1 -0
- package/dist/types-BR08fVY8.js +188 -0
- package/dist/types-BR08fVY8.js.map +1 -0
- package/dist/types-BXseTKgu.d.ts +176 -0
- package/dist/types-BXseTKgu.d.ts.map +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { stegaClean } from "@sanity/client/stega";
|
|
2
|
+
/** Whether the plugin is running in a development build, which decides whether it reports what it recovered from. */
|
|
3
|
+
const isDevelopment = process.env.NODE_ENV === "development", prefixStyle = "color: #2276fc";
|
|
4
|
+
/**
|
|
5
|
+
* Creates the logger a package reports through, so every message names the plugin it came from and
|
|
6
|
+
* only a development build hears it. In a browser console the name is drawn in blue, the way the
|
|
7
|
+
* Studio's own messages are; a terminal ignores the styling and prints it plain.
|
|
8
|
+
*
|
|
9
|
+
* @param name - Name of the package the messages come from.
|
|
10
|
+
* @returns Functions that warn, report an error, or word a message for throwing.
|
|
11
|
+
*/
|
|
12
|
+
function createLogger(name) {
|
|
13
|
+
let prefix = `[${name}]`;
|
|
14
|
+
/**
|
|
15
|
+
* Words a message so it names the package it came from.
|
|
16
|
+
*
|
|
17
|
+
* @param message - The message to word.
|
|
18
|
+
* @returns The message with the package name in front.
|
|
19
|
+
*/
|
|
20
|
+
function format(message) {
|
|
21
|
+
return `${prefix} ${message}`;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
/**
|
|
25
|
+
* Reports something the plugin recovered from, in development only.
|
|
26
|
+
*
|
|
27
|
+
* @param message - What was recovered from and what to do about it.
|
|
28
|
+
*/
|
|
29
|
+
warn(message) {
|
|
30
|
+
isDevelopment && console.warn(`%c${prefix}%c ${message}`, prefixStyle, "");
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Reports something the plugin could not recover from, in development only.
|
|
34
|
+
*
|
|
35
|
+
* @param message - What went wrong and what to do about it.
|
|
36
|
+
*/
|
|
37
|
+
error(message) {
|
|
38
|
+
isDevelopment && console.error(`%c${prefix}%c ${message}`, prefixStyle, "");
|
|
39
|
+
},
|
|
40
|
+
format
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** Name the package is published under, which every message it reports carries. */
|
|
44
|
+
const pluginName = "@driftime/sanity-plugin-link", logger = createLogger(pluginName), defaultTitleField = "title";
|
|
45
|
+
/**
|
|
46
|
+
* Checks whether a value is defined and non-empty, treating `false`, empty strings, and objects with
|
|
47
|
+
* no keys as absent. An array is absent unless one of its elements is itself present, while anything
|
|
48
|
+
* built from a class counts as present on existence alone. Not intended for boolean flags.
|
|
49
|
+
*
|
|
50
|
+
* @param value - The value to check.
|
|
51
|
+
* @returns True if the value is defined and not empty.
|
|
52
|
+
*/
|
|
53
|
+
function isDefined(value) {
|
|
54
|
+
if (value == null || value === !1) return !1;
|
|
55
|
+
if (typeof value == "string") return value.trim() !== "";
|
|
56
|
+
if (Array.isArray(value)) return value.some((element) => isDefined(element));
|
|
57
|
+
if (typeof value == "object") {
|
|
58
|
+
let prototype = Reflect.getPrototypeOf(value);
|
|
59
|
+
return prototype !== Object.prototype && prototype !== null || Object.keys(value).length > 0;
|
|
60
|
+
}
|
|
61
|
+
return !0;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Converts a string between different casing formats.
|
|
65
|
+
*
|
|
66
|
+
* @param value - The string to convert.
|
|
67
|
+
* @param format - The target casing format.
|
|
68
|
+
* @returns The converted string.
|
|
69
|
+
*/
|
|
70
|
+
function convertCase(value, format) {
|
|
71
|
+
let words = value.replaceAll(/(?<lower>[a-z0-9])(?<upper>[A-Z])/gu, "$<lower> $<upper>").replaceAll(/[-_\s]+/gu, " ").trim().toLowerCase();
|
|
72
|
+
switch (format) {
|
|
73
|
+
case "kebab": return words.replaceAll(/\s+/gu, "-");
|
|
74
|
+
case "snake": return words.replaceAll(/\s+/gu, "_");
|
|
75
|
+
case "camel": return words.replaceAll(/\s+(?<character>.)/gu, (_match, character) => character.toUpperCase());
|
|
76
|
+
case "pascal": return words.replaceAll(/(?:^|\s+)(?<character>.)/gu, (_match, character) => character.toUpperCase());
|
|
77
|
+
case "title": return words.replaceAll(/\b\w/gu, (character) => character.toUpperCase());
|
|
78
|
+
case "sentence": return words.replaceAll(/^(?<character>.)/gu, (character) => character.toUpperCase());
|
|
79
|
+
default: return value;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Checks whether a value can be read by key, narrowing what arrives untyped from outside the plugin.
|
|
84
|
+
*
|
|
85
|
+
* @param value - The value to check.
|
|
86
|
+
* @returns True if the value has keys to read.
|
|
87
|
+
*/
|
|
88
|
+
function isRecord(value) {
|
|
89
|
+
return typeof value == "object" && !!value;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Reads a value out of nested records by following a path of keys, so a caller can name something
|
|
93
|
+
* inside a shape it does not otherwise know.
|
|
94
|
+
*
|
|
95
|
+
* @param value - The object to read from.
|
|
96
|
+
* @param path - Keys leading to the value.
|
|
97
|
+
* @returns The value at the path, or undefined when a key is missing or a step holds no keys to read.
|
|
98
|
+
*/
|
|
99
|
+
function readPath(value, path) {
|
|
100
|
+
let current = value;
|
|
101
|
+
for (let segment of path) {
|
|
102
|
+
if (!isRecord(current)) return;
|
|
103
|
+
current = current[segment];
|
|
104
|
+
}
|
|
105
|
+
return current;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Reads an internal link's parameters as the pairs a query string is built from, dropping any row
|
|
109
|
+
* that names no key so a half-written parameter never reaches an address.
|
|
110
|
+
*
|
|
111
|
+
* @param searchParams - The stored parameters.
|
|
112
|
+
* @returns The parameters that name a key, or undefined when none do.
|
|
113
|
+
*/
|
|
114
|
+
function readSearchParams(searchParams) {
|
|
115
|
+
if (!isDefined(searchParams)) return;
|
|
116
|
+
let entries = searchParams.flatMap(({ key, value }) => {
|
|
117
|
+
let name = stegaClean(key);
|
|
118
|
+
return isDefined(name) ? [[name, stegaClean(value) ?? ""]] : [];
|
|
119
|
+
});
|
|
120
|
+
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Builds the address that opens a message to a chosen inbox.
|
|
124
|
+
*
|
|
125
|
+
* @param email - The address the message is sent to.
|
|
126
|
+
* @param subject - The subject the message opens with.
|
|
127
|
+
* @returns The address, or undefined when no inbox was named.
|
|
128
|
+
*/
|
|
129
|
+
function composeEmailHref(email, subject) {
|
|
130
|
+
let address = stegaClean(email);
|
|
131
|
+
if (!isDefined(address)) return;
|
|
132
|
+
let line = stegaClean(subject);
|
|
133
|
+
return isDefined(line) ? `mailto:${address}?subject=${encodeURIComponent(line)}` : `mailto:${address}`;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Builds the address that starts a call to a chosen number. Spacing an author wrote for legibility is
|
|
137
|
+
* dropped, since a dialler reads none of it.
|
|
138
|
+
*
|
|
139
|
+
* @param phone - The number the call is placed to.
|
|
140
|
+
* @returns The address, or undefined when no number was named.
|
|
141
|
+
*/
|
|
142
|
+
function composePhoneHref(phone) {
|
|
143
|
+
let number = stegaClean(phone);
|
|
144
|
+
if (isDefined(number)) return `tel:${number.replaceAll(/\s+/gu, "")}`;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Appends the anchor and query string an author added onto the address a route resolved to, merging
|
|
148
|
+
* with any parameters the route already carried.
|
|
149
|
+
*
|
|
150
|
+
* @param href - The address the route resolved to.
|
|
151
|
+
* @param anchor - Section of the destination page to arrive at.
|
|
152
|
+
* @param searchParams - Query string parameters to append.
|
|
153
|
+
* @returns The address carrying the anchor and parameters, in the same absolute or relative form it arrived in.
|
|
154
|
+
*/
|
|
155
|
+
function appendDestination(href, anchor, searchParams) {
|
|
156
|
+
let params = readSearchParams(searchParams), hash = stegaClean(anchor);
|
|
157
|
+
if (!isDefined(params) && !isDefined(hash)) return href;
|
|
158
|
+
let placeholder = "http://append.invalid";
|
|
159
|
+
try {
|
|
160
|
+
let url = new URL(href, placeholder);
|
|
161
|
+
for (let [key, value] of Object.entries(params ?? {})) url.searchParams.set(key, value);
|
|
162
|
+
return isDefined(hash) && (url.hash = convertCase(hash, "kebab")), url.origin === placeholder ? url.pathname + url.search + url.hash : url.href;
|
|
163
|
+
} catch {
|
|
164
|
+
return href;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Builds the address that moves a visitor within the page they are already reading.
|
|
169
|
+
*
|
|
170
|
+
* @param anchor - Section of the page to arrive at.
|
|
171
|
+
* @returns The address, or undefined when no section was named.
|
|
172
|
+
*/
|
|
173
|
+
function composeAnchorHref(anchor) {
|
|
174
|
+
let hash = stegaClean(anchor);
|
|
175
|
+
if (isDefined(hash)) return `#${convertCase(hash, "kebab")}`;
|
|
176
|
+
}
|
|
177
|
+
/** Type name of the link object. */
|
|
178
|
+
const linkTypeName = "link", linkMarkTypeName = "linkMark", searchParamTypeName = "linkSearchParam", linkDestinations = [
|
|
179
|
+
"page",
|
|
180
|
+
"anchor",
|
|
181
|
+
"url",
|
|
182
|
+
"email",
|
|
183
|
+
"phone",
|
|
184
|
+
"file"
|
|
185
|
+
];
|
|
186
|
+
export { appendDestination as a, composePhoneHref as c, readPath as d, defaultTitleField as f, isDevelopment as h, searchParamTypeName as i, convertCase as l, pluginName as m, linkMarkTypeName as n, composeAnchorHref as o, logger as p, linkTypeName as r, composeEmailHref as s, linkDestinations as t, isDefined as u };
|
|
187
|
+
|
|
188
|
+
//# sourceMappingURL=types-BR08fVY8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-BR08fVY8.js","names":["isDevelopment","process","env","isDevelopment","prefixStyle","createLogger","name","prefix","format","message","warn","console","error","createLogger","pluginName","logger","defaultTitleField","Nullable","T","isDefined","value","undefined","trim","Array","isArray","some","element","prototype","Reflect","getPrototypeOf","Object","keys","length","convertCase","format","words","replaceAll","toLowerCase","_match","character","toUpperCase","isRecord","Record","readPath","path","current","segment","convertCase","isDefined","stegaClean","SanityLinkSearchParam","readSearchParams","searchParams","undefined","entries","flatMap","key","value","name","const","length","Object","fromEntries","composeEmailHref","email","subject","address","line","encodeURIComponent","composePhoneHref","phone","number","replaceAll","appendDestination","href","anchor","params","hash","placeholder","url","URL","set","origin","pathname","search","composeAnchorHref","linkTypeName","linkMarkTypeName","searchParamTypeName","linkDestinations","const","SanityLinkDestination","SanityLinkRouteParams","Record","SanityLinkReference","_ref","T","SanityLinkDocument","_id","_type","_routeParams","title","SanityLinkFileAsset","url","originalFilename","SanityLinkFile","asset","SanityLinkSearchParam","_key","key","value","SanityPageLink","type","reference","TDocument","anchor","searchParams","label","SanityAnchorLink","SanityUrlLink","SanityEmailLink","email","subject","SanityPhoneLink","phone","SanityFileLink","file","SanityLink"],"sources":["../../@repo/lib/environment.ts","../../@repo/lib/logger.ts","../src/config/defaults.ts","../../@repo/lib/utils.ts","../src/lib/destinations.ts","../src/types.ts"],"sourcesContent":["/** Whether the plugin is running in a development build, which decides whether it reports what it recovered from. */\nexport const isDevelopment = process.env[\"NODE_ENV\"] === \"development\";\n","import { isDevelopment } from \"./environment\";\n\n/** Style the prefix is drawn with in a browser console, matching the blue the Studio uses for its own. */\nconst prefixStyle = \"color: #2276fc\";\n\n/**\n * Creates the logger a package reports through, so every message names the plugin it came from and\n * only a development build hears it. In a browser console the name is drawn in blue, the way the\n * Studio's own messages are; a terminal ignores the styling and prints it plain.\n *\n * @param name - Name of the package the messages come from.\n * @returns Functions that warn, report an error, or word a message for throwing.\n */\nexport function createLogger(name: string) {\n const prefix = `[${name}]`;\n\n /**\n * Words a message so it names the package it came from.\n *\n * @param message - The message to word.\n * @returns The message with the package name in front.\n */\n function format(message: string) {\n return `${prefix} ${message}`;\n }\n\n return {\n /**\n * Reports something the plugin recovered from, in development only.\n *\n * @param message - What was recovered from and what to do about it.\n */\n warn(message: string) {\n if (isDevelopment) console.warn(`%c${prefix}%c ${message}`, prefixStyle, \"\");\n },\n /**\n * Reports something the plugin could not recover from, in development only.\n *\n * @param message - What went wrong and what to do about it.\n */\n error(message: string) {\n if (isDevelopment) console.error(`%c${prefix}%c ${message}`, prefixStyle, \"\");\n },\n format,\n };\n}\n","import { createLogger } from \"@repo/lib/logger\";\n\n/** Name the package is published under, which every message it reports carries. */\nexport const pluginName = \"@driftime/sanity-plugin-link\";\n\n/** Logger every message the package reports goes through. */\nexport const logger = createLogger(pluginName);\n\n/** Field an internal link borrows its label from, and a preview its title from, when none is configured. */\nexport const defaultTitleField = \"title\";\n","/** A value that may be absent, covering both null and undefined. */\ntype Nullable<T> = T | null | undefined;\n\n/**\n * Checks whether a value is defined and non-empty, treating `false`, empty strings, and objects with\n * no keys as absent. An array is absent unless one of its elements is itself present, while anything\n * built from a class counts as present on existence alone. Not intended for boolean flags.\n *\n * @param value - The value to check.\n * @returns True if the value is defined and not empty.\n */\nexport function isDefined<T>(value: Nullable<T> | false): value is T {\n if (value === undefined || value === null || value === false) return false;\n if (typeof value === \"string\") return value.trim() !== \"\";\n if (Array.isArray(value)) return value.some((element) => isDefined(element));\n\n if (typeof value === \"object\") {\n const prototype = Reflect.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) return true;\n\n return Object.keys(value).length > 0;\n }\n\n return true;\n}\n\n/**\n * Converts a string between different casing formats.\n *\n * @param value - The string to convert.\n * @param format - The target casing format.\n * @returns The converted string.\n */\nexport function convertCase(value: string, format: \"kebab\" | \"snake\" | \"camel\" | \"pascal\" | \"title\" | \"sentence\") {\n const words = value\n .replaceAll(/(?<lower>[a-z0-9])(?<upper>[A-Z])/gu, \"$<lower> $<upper>\")\n .replaceAll(/[-_\\s]+/gu, \" \")\n .trim()\n .toLowerCase();\n\n switch (format) {\n case \"kebab\": {\n return words.replaceAll(/\\s+/gu, \"-\");\n }\n case \"snake\": {\n return words.replaceAll(/\\s+/gu, \"_\");\n }\n case \"camel\": {\n return words.replaceAll(/\\s+(?<character>.)/gu, (_match, character: string) => character.toUpperCase());\n }\n case \"pascal\": {\n return words.replaceAll(/(?:^|\\s+)(?<character>.)/gu, (_match, character: string) => character.toUpperCase());\n }\n case \"title\": {\n return words.replaceAll(/\\b\\w/gu, (character) => character.toUpperCase());\n }\n case \"sentence\": {\n return words.replaceAll(/^(?<character>.)/gu, (character) => character.toUpperCase());\n }\n default: {\n return value;\n }\n }\n}\n\n/**\n * Checks whether a value can be read by key, narrowing what arrives untyped from outside the plugin.\n *\n * @param value - The value to check.\n * @returns True if the value has keys to read.\n */\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null;\n}\n\n/**\n * Reads a value out of nested records by following a path of keys, so a caller can name something\n * inside a shape it does not otherwise know.\n *\n * @param value - The object to read from.\n * @param path - Keys leading to the value.\n * @returns The value at the path, or undefined when a key is missing or a step holds no keys to read.\n */\nexport function readPath(value: unknown, path: string[]) {\n let current: unknown = value;\n\n for (const segment of path) {\n if (!isRecord(current)) return undefined;\n\n current = current[segment];\n }\n\n return current;\n}\n","import { convertCase, isDefined } from \"@repo/lib/utils\";\nimport { stegaClean } from \"@sanity/client/stega\";\n\nimport type { SanityLinkSearchParam } from \"@/types\";\n\n/**\n * Reads an internal link's parameters as the pairs a query string is built from, dropping any row\n * that names no key so a half-written parameter never reaches an address.\n *\n * @param searchParams - The stored parameters.\n * @returns The parameters that name a key, or undefined when none do.\n */\nfunction readSearchParams(searchParams: SanityLinkSearchParam[] | undefined) {\n if (!isDefined(searchParams)) return undefined;\n\n const entries = searchParams.flatMap(({ key, value }) => {\n const name = stegaClean(key);\n\n return isDefined(name) ? [[name, stegaClean(value) ?? \"\"] as const] : [];\n });\n\n return entries.length > 0 ? Object.fromEntries(entries) : undefined;\n}\n\n/**\n * Builds the address that opens a message to a chosen inbox.\n *\n * @param email - The address the message is sent to.\n * @param subject - The subject the message opens with.\n * @returns The address, or undefined when no inbox was named.\n */\nexport function composeEmailHref(email: string | undefined, subject: string | undefined) {\n const address = stegaClean(email);\n if (!isDefined(address)) return undefined;\n\n const line = stegaClean(subject);\n\n return isDefined(line) ? `mailto:${address}?subject=${encodeURIComponent(line)}` : `mailto:${address}`;\n}\n\n/**\n * Builds the address that starts a call to a chosen number. Spacing an author wrote for legibility is\n * dropped, since a dialler reads none of it.\n *\n * @param phone - The number the call is placed to.\n * @returns The address, or undefined when no number was named.\n */\nexport function composePhoneHref(phone: string | undefined) {\n const number = stegaClean(phone);\n if (!isDefined(number)) return undefined;\n\n return `tel:${number.replaceAll(/\\s+/gu, \"\")}`;\n}\n\n/**\n * Appends the anchor and query string an author added onto the address a route resolved to, merging\n * with any parameters the route already carried.\n *\n * @param href - The address the route resolved to.\n * @param anchor - Section of the destination page to arrive at.\n * @param searchParams - Query string parameters to append.\n * @returns The address carrying the anchor and parameters, in the same absolute or relative form it arrived in.\n */\nexport function appendDestination(\n href: string,\n anchor: string | undefined,\n searchParams: SanityLinkSearchParam[] | undefined,\n) {\n const params = readSearchParams(searchParams);\n const hash = stegaClean(anchor);\n if (!isDefined(params) && !isDefined(hash)) return href;\n\n // Stands in for the site's own origin, so a relative address can be parsed and rebuilt as one.\n const placeholder = \"http://append.invalid\";\n\n try {\n const url = new URL(href, placeholder);\n\n // An author's own parameter wins over one the route already carried, having been written later.\n for (const [key, value] of Object.entries(params ?? {})) url.searchParams.set(key, value);\n if (isDefined(hash)) url.hash = convertCase(hash, \"kebab\");\n\n return url.origin === placeholder ? url.pathname + url.search + url.hash : url.href;\n } catch {\n return href;\n }\n}\n\n/**\n * Builds the address that moves a visitor within the page they are already reading.\n *\n * @param anchor - Section of the page to arrive at.\n * @returns The address, or undefined when no section was named.\n */\nexport function composeAnchorHref(anchor: string | undefined) {\n const hash = stegaClean(anchor);\n if (!isDefined(hash)) return undefined;\n\n return `#${convertCase(hash, \"kebab\")}`;\n}\n","/** Type name of the link object. */\nexport const linkTypeName = \"link\";\n\n/**\n * Type name a link takes as a Portable Text annotation. It is stored as `_type`, which is how the\n * label field and the resolver tell an annotated span from a link field.\n */\nexport const linkMarkTypeName = \"linkMark\";\n\n/** Type name of one search parameter on an internal link. */\nexport const searchParamTypeName = \"linkSearchParam\";\n\n/** Kinds of destination a link may point at, in the order the Studio offers them. */\nexport const linkDestinations = [\"page\", \"anchor\", \"url\", \"email\", \"phone\", \"file\"] as const;\n\n/**\n * Which kind of destination a link points at, discriminating the stored union.\n *\n * @public\n */\nexport type SanityLinkDestination = (typeof linkDestinations)[number];\n\n/**\n * Values filling a document's route parameters, present once a query spreads the route params fragment.\n *\n * @public\n */\nexport type SanityLinkRouteParams = Record<string, string | null | undefined>;\n\n/**\n * A pointer to another document, holding the raw reference until a query expands it into the document\n * itself.\n *\n * @public\n */\nexport type SanityLinkReference<T> = { _ref: string } | T;\n\n/**\n * The document an internal link points at, holding as much of it as resolution reads. Narrow this to\n * a consumer's own routed document type wherever a stored link is typed.\n *\n * @public\n */\nexport interface SanityLinkDocument {\n _id: string;\n _type: string;\n /** Values filling this document's route parameters, absent when its query left them unfetched. */\n _routeParams?: SanityLinkRouteParams;\n /** Title the link borrows when no label was written. */\n title?: string;\n}\n\n/**\n * The file a download link serves, holding as much of it as resolution reads.\n *\n * @public\n */\nexport interface SanityLinkFileAsset {\n _id: string;\n _type: string;\n /** Address the file is served from. */\n url?: string;\n /** Name the file was uploaded under, offered to the browser as the name to save it by. */\n originalFilename?: string;\n}\n\n/**\n * A file field, whose asset stays a raw reference until a query expands it.\n *\n * @public\n */\nexport interface SanityLinkFile {\n _type: \"file\";\n /** The uploaded file itself. */\n asset?: SanityLinkReference<SanityLinkFileAsset>;\n}\n\n/**\n * One query string parameter appended to an internal link's address.\n *\n * @public\n */\nexport interface SanityLinkSearchParam {\n _type: typeof searchParamTypeName;\n _key: string;\n /** Name the parameter is read under. */\n key?: string;\n /** Value the parameter carries. */\n value?: string;\n}\n\n/**\n * A link to a page on the site itself, pointing at the document rather than its address so the link\n * survives that document's slug changing.\n *\n * @public\n */\nexport interface SanityPageLink<TDocument = SanityLinkDocument> {\n _type: typeof linkTypeName | typeof linkMarkTypeName;\n type: \"page\";\n /** Document the link points at. */\n reference?: SanityLinkReference<TDocument>;\n /** Section of the destination page to arrive at, stored without its leading hash. */\n anchor?: string;\n /** Query string parameters appended to the destination's address. */\n searchParams?: SanityLinkSearchParam[];\n /** Text a visitor reads, standing in front of the destination document's own title. */\n label?: string;\n}\n\n/**\n * A link to a section of the page it is drawn on, for moving a visitor within a page rather than\n * between them.\n *\n * @public\n */\nexport interface SanityAnchorLink {\n _type: typeof linkTypeName | typeof linkMarkTypeName;\n type: \"anchor\";\n /** Section of this page to arrive at, stored without its leading hash. */\n anchor?: string;\n /** Text a visitor reads. */\n label?: string;\n}\n\n/**\n * A link to an address elsewhere, covering any web page the site does not serve itself.\n *\n * @public\n */\nexport interface SanityUrlLink {\n _type: typeof linkTypeName | typeof linkMarkTypeName;\n type: \"url\";\n /** Address the link points at, including the scheme in front of it. */\n url?: string;\n /** Text a visitor reads. */\n label?: string;\n}\n\n/**\n * A link that opens a message to an address, rather than asking an author to know a URI scheme.\n *\n * @public\n */\nexport interface SanityEmailLink {\n _type: typeof linkTypeName | typeof linkMarkTypeName;\n type: \"email\";\n /** Address the message is sent to. */\n email?: string;\n /** Subject the message opens with. */\n subject?: string;\n /** Text a visitor reads. */\n label?: string;\n}\n\n/**\n * A link that starts a call to a number, rather than asking an author to know a URI scheme.\n *\n * @public\n */\nexport interface SanityPhoneLink {\n _type: typeof linkTypeName | typeof linkMarkTypeName;\n type: \"phone\";\n /** Number the call is placed to. */\n phone?: string;\n /** Text a visitor reads. */\n label?: string;\n}\n\n/**\n * A link to a file a visitor downloads, held with the link rather than addressed elsewhere.\n *\n * @public\n */\nexport interface SanityFileLink {\n _type: typeof linkTypeName | typeof linkMarkTypeName;\n type: \"file\";\n /** File the link serves. */\n file?: SanityLinkFile;\n /** Text a visitor reads. */\n label?: string;\n}\n\n/**\n * A link an author authored, discriminated by the kind of destination it points at.\n *\n * @public\n */\nexport type SanityLink<TDocument = SanityLinkDocument> =\n | SanityPageLink<TDocument>\n | SanityAnchorLink\n | SanityUrlLink\n | SanityEmailLink\n | SanityPhoneLink\n | SanityFileLink;\n"],"mappings":"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"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/** Type name of the link object. */
|
|
2
|
+
declare const linkTypeName = "link";
|
|
3
|
+
/**
|
|
4
|
+
* Type name a link takes as a Portable Text annotation. It is stored as `_type`, which is how the
|
|
5
|
+
* label field and the resolver tell an annotated span from a link field.
|
|
6
|
+
*/
|
|
7
|
+
declare const linkMarkTypeName = "linkMark";
|
|
8
|
+
/** Type name of one search parameter on an internal link. */
|
|
9
|
+
declare const searchParamTypeName = "linkSearchParam";
|
|
10
|
+
/** Kinds of destination a link may point at, in the order the Studio offers them. */
|
|
11
|
+
declare const linkDestinations: readonly ["page", "anchor", "url", "email", "phone", "file"];
|
|
12
|
+
/**
|
|
13
|
+
* Which kind of destination a link points at, discriminating the stored union.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
type SanityLinkDestination = (typeof linkDestinations)[number];
|
|
18
|
+
/**
|
|
19
|
+
* Values filling a document's route parameters, present once a query spreads the route params fragment.
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
type SanityLinkRouteParams = Record<string, string | null | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* A pointer to another document, holding the raw reference until a query expands it into the document
|
|
26
|
+
* itself.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
type SanityLinkReference<T> = {
|
|
31
|
+
_ref: string;
|
|
32
|
+
} | T;
|
|
33
|
+
/**
|
|
34
|
+
* The document an internal link points at, holding as much of it as resolution reads. Narrow this to
|
|
35
|
+
* a consumer's own routed document type wherever a stored link is typed.
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
interface SanityLinkDocument {
|
|
40
|
+
_id: string;
|
|
41
|
+
_type: string;
|
|
42
|
+
/** Values filling this document's route parameters, absent when its query left them unfetched. */
|
|
43
|
+
_routeParams?: SanityLinkRouteParams;
|
|
44
|
+
/** Title the link borrows when no label was written. */
|
|
45
|
+
title?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The file a download link serves, holding as much of it as resolution reads.
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
interface SanityLinkFileAsset {
|
|
53
|
+
_id: string;
|
|
54
|
+
_type: string;
|
|
55
|
+
/** Address the file is served from. */
|
|
56
|
+
url?: string;
|
|
57
|
+
/** Name the file was uploaded under, offered to the browser as the name to save it by. */
|
|
58
|
+
originalFilename?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A file field, whose asset stays a raw reference until a query expands it.
|
|
62
|
+
*
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
interface SanityLinkFile {
|
|
66
|
+
_type: "file";
|
|
67
|
+
/** The uploaded file itself. */
|
|
68
|
+
asset?: SanityLinkReference<SanityLinkFileAsset>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* One query string parameter appended to an internal link's address.
|
|
72
|
+
*
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
interface SanityLinkSearchParam {
|
|
76
|
+
_type: typeof searchParamTypeName;
|
|
77
|
+
_key: string;
|
|
78
|
+
/** Name the parameter is read under. */
|
|
79
|
+
key?: string;
|
|
80
|
+
/** Value the parameter carries. */
|
|
81
|
+
value?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A link to a page on the site itself, pointing at the document rather than its address so the link
|
|
85
|
+
* survives that document's slug changing.
|
|
86
|
+
*
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
89
|
+
interface SanityPageLink<TDocument = SanityLinkDocument> {
|
|
90
|
+
_type: typeof linkTypeName | typeof linkMarkTypeName;
|
|
91
|
+
type: "page";
|
|
92
|
+
/** Document the link points at. */
|
|
93
|
+
reference?: SanityLinkReference<TDocument>;
|
|
94
|
+
/** Section of the destination page to arrive at, stored without its leading hash. */
|
|
95
|
+
anchor?: string;
|
|
96
|
+
/** Query string parameters appended to the destination's address. */
|
|
97
|
+
searchParams?: SanityLinkSearchParam[];
|
|
98
|
+
/** Text a visitor reads, standing in front of the destination document's own title. */
|
|
99
|
+
label?: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A link to a section of the page it is drawn on, for moving a visitor within a page rather than
|
|
103
|
+
* between them.
|
|
104
|
+
*
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
interface SanityAnchorLink {
|
|
108
|
+
_type: typeof linkTypeName | typeof linkMarkTypeName;
|
|
109
|
+
type: "anchor";
|
|
110
|
+
/** Section of this page to arrive at, stored without its leading hash. */
|
|
111
|
+
anchor?: string;
|
|
112
|
+
/** Text a visitor reads. */
|
|
113
|
+
label?: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A link to an address elsewhere, covering any web page the site does not serve itself.
|
|
117
|
+
*
|
|
118
|
+
* @public
|
|
119
|
+
*/
|
|
120
|
+
interface SanityUrlLink {
|
|
121
|
+
_type: typeof linkTypeName | typeof linkMarkTypeName;
|
|
122
|
+
type: "url";
|
|
123
|
+
/** Address the link points at, including the scheme in front of it. */
|
|
124
|
+
url?: string;
|
|
125
|
+
/** Text a visitor reads. */
|
|
126
|
+
label?: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* A link that opens a message to an address, rather than asking an author to know a URI scheme.
|
|
130
|
+
*
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
133
|
+
interface SanityEmailLink {
|
|
134
|
+
_type: typeof linkTypeName | typeof linkMarkTypeName;
|
|
135
|
+
type: "email";
|
|
136
|
+
/** Address the message is sent to. */
|
|
137
|
+
email?: string;
|
|
138
|
+
/** Subject the message opens with. */
|
|
139
|
+
subject?: string;
|
|
140
|
+
/** Text a visitor reads. */
|
|
141
|
+
label?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A link that starts a call to a number, rather than asking an author to know a URI scheme.
|
|
145
|
+
*
|
|
146
|
+
* @public
|
|
147
|
+
*/
|
|
148
|
+
interface SanityPhoneLink {
|
|
149
|
+
_type: typeof linkTypeName | typeof linkMarkTypeName;
|
|
150
|
+
type: "phone";
|
|
151
|
+
/** Number the call is placed to. */
|
|
152
|
+
phone?: string;
|
|
153
|
+
/** Text a visitor reads. */
|
|
154
|
+
label?: string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* A link to a file a visitor downloads, held with the link rather than addressed elsewhere.
|
|
158
|
+
*
|
|
159
|
+
* @public
|
|
160
|
+
*/
|
|
161
|
+
interface SanityFileLink {
|
|
162
|
+
_type: typeof linkTypeName | typeof linkMarkTypeName;
|
|
163
|
+
type: "file";
|
|
164
|
+
/** File the link serves. */
|
|
165
|
+
file?: SanityLinkFile;
|
|
166
|
+
/** Text a visitor reads. */
|
|
167
|
+
label?: string;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* A link an author authored, discriminated by the kind of destination it points at.
|
|
171
|
+
*
|
|
172
|
+
* @public
|
|
173
|
+
*/
|
|
174
|
+
type SanityLink<TDocument = SanityLinkDocument> = SanityPageLink<TDocument> | SanityAnchorLink | SanityUrlLink | SanityEmailLink | SanityPhoneLink | SanityFileLink;
|
|
175
|
+
export { SanityLinkDestination as a, SanityLinkFileAsset as c, SanityLinkSearchParam as d, SanityPageLink as f, linkTypeName as h, SanityLink as i, SanityLinkReference as l, SanityUrlLink as m, SanityEmailLink as n, SanityLinkDocument as o, SanityPhoneLink as p, SanityFileLink as r, SanityLinkFile as s, SanityAnchorLink as t, SanityLinkRouteParams as u };
|
|
176
|
+
//# sourceMappingURL=types-BXseTKgu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-BXseTKgu.d.ts","names":[],"sources":["../src/types.ts"],"mappings":"AACA;cAAa;;;;;cAMA;;cAGA;;cAGA;;;;;;KAOD,gCAAgC;;;;;;KAOhC,wBAAwB;;;;;;;KAQxB,oBAAoB;EAAO;IAAiB;;;;;;;UAQvC;EACf;EACA;;EAEA,eAAe;;EAEf;;;;;;;UAQe;EACf;EACA;;EAEA;;EAEA;;;;;;;UAQe;EACf;;EAEA,QAAQ,oBAAoB;;;;;;;UAQb;EACf,cAAc;EACd;;EAEA;;EAEA;;;;;;;;UASe,eAAe,YAAY;EAC1C,cAAc,sBAAsB;EACpC;;EAEA,YAAY,oBAAoB;;EAEhC;;EAEA,eAAe;;EAEf;;;;;;;;UASe;EACf,cAAc,sBAAsB;EACpC;;EAEA;;EAEA;;;;;;;UAQe;EACf,cAAc,sBAAsB;EACpC;;EAEA;;EAEA;;;;;;;UAQe;EACf,cAAc,sBAAsB;EACpC;;EAEA;;EAEA;;EAEA;;;;;;;UAQe;EACf,cAAc,sBAAsB;EACpC;;EAEA;;EAEA;;;;;;;UAQe;EACf,cAAc,sBAAsB;EACpC;;EAEA,OAAO;;EAEP;;;;;;;KAQU,WAAW,YAAY,sBAC/B,eAAe,aACf,mBACA,gBACA,kBACA,kBACA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@driftime/sanity-plugin-link",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Links for Sanity Studio, covering every destination and resolved from routes declared once.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"link",
|
|
7
|
+
"portable-text",
|
|
8
|
+
"reference",
|
|
9
|
+
"sanity",
|
|
10
|
+
"sanity-plugin",
|
|
11
|
+
"url"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/driftime/sanity-plugins/tree/main/packages/link#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/driftime/sanity-plugins/issues"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "Kenny Heard",
|
|
20
|
+
"email": "kenny@driftime.com",
|
|
21
|
+
"url": "https://driftime.com"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/driftime/sanity-plugins.git",
|
|
26
|
+
"directory": "packages/link"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"type": "module",
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"source": "./src/index.ts",
|
|
37
|
+
"default": "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./render": {
|
|
40
|
+
"source": "./src/render.ts",
|
|
41
|
+
"default": "./dist/render.js"
|
|
42
|
+
},
|
|
43
|
+
"./package.json": "./package.json"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"exports": {
|
|
47
|
+
".": "./dist/index.js",
|
|
48
|
+
"./render": "./dist/render.js",
|
|
49
|
+
"./package.json": "./package.json"
|
|
50
|
+
},
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"typecheck": "tsc",
|
|
55
|
+
"dev": "plugin-kit link-watch",
|
|
56
|
+
"build": "bun run typecheck && plugin-kit verify-package --silent && pkg-utils build --strict --check --clean && node --check dist/index.js && node --check dist/render.js",
|
|
57
|
+
"prepublishOnly": "bun run build",
|
|
58
|
+
"push": "yalc push"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@portabletext/editor": "^8.1.3",
|
|
62
|
+
"@portabletext/html": "^2.0.0",
|
|
63
|
+
"@sanity/client": "^7.26.2 || ^8.0.0",
|
|
64
|
+
"@sanity/icons": "^5.2.1",
|
|
65
|
+
"@sanity/ui": "^4.0.3",
|
|
66
|
+
"@sanity/util": "^6.13.2"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@repo/components": "workspace:*",
|
|
70
|
+
"@repo/lib": "workspace:*",
|
|
71
|
+
"@sanity/pkg-utils": "catalog:"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"react": "19",
|
|
75
|
+
"sanity": "^6.10.0"
|
|
76
|
+
},
|
|
77
|
+
"browserslist": "extends @sanity/browserslist-config",
|
|
78
|
+
"engines": {
|
|
79
|
+
"node": ">=20.19 <22 || >=22.12"
|
|
80
|
+
},
|
|
81
|
+
"sanityPlugin": {
|
|
82
|
+
"verifyPackage": {
|
|
83
|
+
"tsconfig": false,
|
|
84
|
+
"scripts": false,
|
|
85
|
+
"oxlint": false,
|
|
86
|
+
"oxfmt": false
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|