@aphexcms/cms-core 9.2.0 → 9.2.2
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/cli/generate-types.d.ts.map +1 -1
- package/dist/cli/generate-types.js +21 -3
- package/dist/cli/generate-types.js.map +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +4 -0
- package/dist/components/AdminApp.svelte +27 -11
- package/dist/components/AdminApp.svelte.d.ts.map +1 -1
- package/dist/components/admin/AdminLayout.svelte.d.ts +3 -3
- package/dist/components/admin/DocumentEditor.svelte +548 -21
- package/dist/components/admin/DocumentEditor.svelte.d.ts +6 -0
- package/dist/components/admin/DocumentEditor.svelte.d.ts.map +1 -1
- package/dist/components/admin/SchemaField.svelte +1 -1
- package/dist/components/admin/fields/ArrayField.svelte +2 -2
- package/dist/components/admin/fields/ImageField.svelte +85 -27
- package/dist/components/admin/fields/ImageField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/NumberField.svelte +61 -16
- package/dist/components/admin/fields/NumberField.svelte.d.ts +2 -2
- package/dist/components/admin/fields/NumberField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/StringField.svelte +26 -2
- package/dist/components/admin/fields/StringField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/richtext/ImageBlockModal.svelte +133 -0
- package/dist/components/admin/fields/richtext/ImageBlockModal.svelte.d.ts +14 -0
- package/dist/components/admin/fields/richtext/ImageBlockModal.svelte.d.ts.map +1 -0
- package/dist/components/admin/fields/richtext/PortableTextImageView.svelte +2 -2
- package/dist/components/admin/fields/richtext/RichtextField.svelte +164 -13
- package/dist/components/admin/fields/richtext/RichtextField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/richtext/portable-text-serializer.d.ts.map +1 -1
- package/dist/components/admin/fields/richtext/portable-text-serializer.js +6 -4
- package/dist/components/admin/fields/richtext/svelte-node-view.d.ts.map +1 -1
- package/dist/components/admin/fields/richtext/svelte-node-view.js +11 -0
- package/dist/lib/client/index.d.ts +1 -0
- package/dist/lib/client/index.d.ts.map +1 -1
- package/dist/lib/client/index.js +4 -0
- package/dist/lib/client/index.js.map +1 -1
- package/dist/lib/components/admin/fields/richtext/portable-text-serializer.d.ts.map +1 -1
- package/dist/lib/components/admin/fields/richtext/portable-text-serializer.js +6 -4
- package/dist/lib/components/admin/fields/richtext/portable-text-serializer.js.map +1 -1
- package/dist/lib/components/admin/fields/richtext/svelte-node-view.d.ts.map +1 -1
- package/dist/lib/components/admin/fields/richtext/svelte-node-view.js +11 -0
- package/dist/lib/components/admin/fields/richtext/svelte-node-view.js.map +1 -1
- package/dist/lib/preview/assets.d.ts +19 -0
- package/dist/lib/preview/assets.d.ts.map +1 -0
- package/dist/lib/preview/assets.js +60 -0
- package/dist/lib/preview/assets.js.map +1 -0
- package/dist/lib/preview/perspective.d.ts +20 -0
- package/dist/lib/preview/perspective.d.ts.map +1 -0
- package/dist/lib/preview/perspective.js +21 -0
- package/dist/lib/preview/perspective.js.map +1 -0
- package/dist/lib/preview/stega.d.ts +25 -0
- package/dist/lib/preview/stega.d.ts.map +1 -0
- package/dist/lib/preview/stega.js +168 -0
- package/dist/lib/preview/stega.js.map +1 -0
- package/dist/lib/richtext-context.svelte.d.ts +18 -0
- package/dist/lib/richtext-context.svelte.d.ts.map +1 -0
- package/dist/lib/richtext-context.svelte.js +13 -0
- package/dist/lib/richtext-context.svelte.js.map +1 -0
- package/dist/lib/server/index.d.ts +1 -0
- package/dist/lib/server/index.d.ts.map +1 -1
- package/dist/lib/server/index.js +2 -0
- package/dist/lib/server/index.js.map +1 -1
- package/dist/lib/services/asset-service.d.ts +12 -0
- package/dist/lib/services/asset-service.d.ts.map +1 -1
- package/dist/lib/services/asset-service.js +32 -0
- package/dist/lib/services/asset-service.js.map +1 -1
- package/dist/lib/types/asset.d.ts +15 -0
- package/dist/lib/types/asset.d.ts.map +1 -1
- package/dist/lib/types/config.d.ts +7 -0
- package/dist/lib/types/config.d.ts.map +1 -1
- package/dist/lib/types/schemas.d.ts +30 -1
- package/dist/lib/types/schemas.d.ts.map +1 -1
- package/dist/lib/types/schemas.js.map +1 -1
- package/dist/lib/utils/preview.d.ts +4 -0
- package/dist/lib/utils/preview.d.ts.map +1 -1
- package/dist/lib/utils/preview.js +7 -0
- package/dist/lib/utils/preview.js.map +1 -1
- package/dist/lib/vite/index.d.ts +12 -1
- package/dist/lib/vite/index.d.ts.map +1 -1
- package/dist/lib/vite/index.js +89 -1
- package/dist/lib/vite/index.js.map +1 -1
- package/dist/preview/assets.d.ts +19 -0
- package/dist/preview/assets.d.ts.map +1 -0
- package/dist/preview/assets.js +59 -0
- package/dist/preview/perspective.d.ts +20 -0
- package/dist/preview/perspective.d.ts.map +1 -0
- package/dist/preview/perspective.js +20 -0
- package/dist/preview/stega.d.ts +25 -0
- package/dist/preview/stega.d.ts.map +1 -0
- package/dist/preview/stega.js +167 -0
- package/dist/richtext-context.svelte.d.ts +18 -0
- package/dist/richtext-context.svelte.d.ts.map +1 -0
- package/dist/richtext-context.svelte.js +12 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -0
- package/dist/services/asset-service.d.ts +12 -0
- package/dist/services/asset-service.d.ts.map +1 -1
- package/dist/services/asset-service.js +32 -0
- package/dist/types/asset.d.ts +15 -0
- package/dist/types/asset.d.ts.map +1 -1
- package/dist/types/config.d.ts +7 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/schemas.d.ts +30 -1
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/utils/preview.d.ts +4 -0
- package/dist/utils/preview.d.ts.map +1 -1
- package/dist/utils/preview.js +7 -0
- package/dist/vite/index.d.ts +12 -1
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +89 -1
- package/package.json +3 -2
|
@@ -2,6 +2,10 @@ import type { SchemaType } from '../types/schemas.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Walk a dot-path (e.g. `seo.title`) through an object. Returns the
|
|
4
4
|
* terminal value, or `undefined` if any segment along the way is missing.
|
|
5
|
+
*
|
|
6
|
+
* Quoted strings (single or double) are treated as literals and returned
|
|
7
|
+
* as-is, e.g. `'"My Title"'` → `'My Title'`. Useful for singletons or
|
|
8
|
+
* any schema that needs a static preview title.
|
|
5
9
|
*/
|
|
6
10
|
export declare function readPath(item: any, path: string): unknown;
|
|
7
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/preview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/preview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAUzD;AA2CD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,EACrC,gBAAgB,CAAC,EAAE,MAAM,GACvB,MAAM,CAkBR;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,GACnC,MAAM,GAAG,IAAI,CAMf"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Walk a dot-path (e.g. `seo.title`) through an object. Returns the
|
|
3
3
|
* terminal value, or `undefined` if any segment along the way is missing.
|
|
4
|
+
*
|
|
5
|
+
* Quoted strings (single or double) are treated as literals and returned
|
|
6
|
+
* as-is, e.g. `'"My Title"'` → `'My Title'`. Useful for singletons or
|
|
7
|
+
* any schema that needs a static preview title.
|
|
4
8
|
*/
|
|
5
9
|
export function readPath(item, path) {
|
|
10
|
+
const match = path.match(/^(['"])(.+)\1$/);
|
|
11
|
+
if (match)
|
|
12
|
+
return match[2];
|
|
6
13
|
let current = item;
|
|
7
14
|
for (const segment of path.split('.')) {
|
|
8
15
|
if (current == null)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../../src/lib/utils/preview.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../../src/lib/utils/preview.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAS,EAAE,IAAY;IAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC3C,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IAE3B,IAAI,OAAO,GAAQ,IAAI,CAAC;IACxB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,IAAI,OAAO,IAAI,IAAI;YAAE,OAAO,SAAS,CAAC;QACtC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,KAAc;IACtC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IACjC,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,K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eAAe,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;YAC7D,IAAI,QAAQ;gBAAE,OAAO,QAAQ,CAAC;QAC/B,CAAC;aAAM,CAAC;YACP,KAAK,MAAM,IAAI,IAAI,oBAAoB,EAAE,CAAC;gBACzC,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC/C,IAAI,QAAQ;oBAAE,OAAO,QAAQ,CAAC;YAC/B,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,MAAM,EAAE,KAAK,IAAI,gBAAgB,IAAI,UAAU,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACrC,IAAS,EACT,MAAqC;IAErC,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC1C,IAAI,QAAQ;QAAE,OAAO,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACxD,MAAM,UAAU,GAAG,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC;IACrD,IAAI,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC;IAC7B,OAAO,eAAe,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;AACpD,CAAC"}
|
package/dist/lib/vite/index.d.ts
CHANGED
|
@@ -27,9 +27,19 @@ export interface AphexHMROptions {
|
|
|
27
27
|
*/
|
|
28
28
|
mode?: 'swap' | 'restart';
|
|
29
29
|
}
|
|
30
|
+
export interface AphexTypegenOptions {
|
|
31
|
+
/** Schema entry passed to `aphex generate:types`. Default `src/lib/schemaTypes/index.ts`. */
|
|
32
|
+
schema?: string;
|
|
33
|
+
/** Output file for the generated types. Default `src/lib/generated-types.ts`. */
|
|
34
|
+
output?: string;
|
|
35
|
+
/** Regenerate once when the dev server starts (catches edits made while it was down). Default `true`. */
|
|
36
|
+
runOnStart?: boolean;
|
|
37
|
+
}
|
|
30
38
|
export interface AphexOptions {
|
|
31
39
|
/** HMR plugin options. Pass `false` to disable schema HMR. */
|
|
32
40
|
hmr?: AphexHMROptions | false;
|
|
41
|
+
/** Auto type-generation options. Pass `false` to disable regenerating types on schema change. */
|
|
42
|
+
typegen?: AphexTypegenOptions | false;
|
|
33
43
|
/** Disable the dayjs ESM alias redirect. */
|
|
34
44
|
dayjs?: boolean;
|
|
35
45
|
/** Disable the SSR noExternal/external defaults for cms-core/ui packages. */
|
|
@@ -62,7 +72,8 @@ export declare function aphexHMR(options?: AphexHMROptions): Plugin;
|
|
|
62
72
|
/**
|
|
63
73
|
* One-stop Vite plugin for AphexCMS apps. Bundles:
|
|
64
74
|
*
|
|
65
|
-
* - schema HMR (
|
|
75
|
+
* - schema HMR (hot-swap the engine config on change)
|
|
76
|
+
* - auto type-generation (regenerate generated-types.ts when a schema file changes)
|
|
66
77
|
* - dayjs ESM alias redirect
|
|
67
78
|
* - SSR noExternal/external defaults for cms-core/ui packages
|
|
68
79
|
* - optimizeDeps tuning so first-render isn't slowed by lazy dep discovery
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/vite/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/vite/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAElD,MAAM,WAAW,eAAe;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IACnC,6FAA6F;IAC7F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yGAAyG;IACzG,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC5B,8DAA8D;IAC9D,GAAG,CAAC,EAAE,eAAe,GAAG,KAAK,CAAC;IAC9B,iGAAiG;IACjG,OAAO,CAAC,EAAE,mBAAmB,GAAG,KAAK,CAAC;IACtC,4CAA4C;IAC5C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6EAA6E;IAC7E,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,yDAAyD;IACzD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,sEAAsE;IACtE,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAID;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CAAC,OAAO,GAAE,eAAoB,GAAG,MAAM,CAiF9D;AAuOD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,KAAK,CAAC,OAAO,GAAE,YAAiB,GAAG,MAAM,EAAE,CAuB1D"}
|
package/dist/lib/vite/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
import { join } from 'node:path';
|
|
2
5
|
const require = createRequire(import.meta.url);
|
|
3
6
|
/**
|
|
4
7
|
* Watches the CMS config and schema files in dev. When any of them change,
|
|
@@ -228,10 +231,92 @@ function aphexWatchUnfilter() {
|
|
|
228
231
|
}
|
|
229
232
|
};
|
|
230
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Regenerates `generated-types.ts` whenever a schema file changes in dev — so the typed
|
|
236
|
+
* `localAPI.collections.*`, generated document interfaces, etc. stay in sync without a manual
|
|
237
|
+
* `aphex generate:types`. Dev-only (`apply: 'serve'`); production builds expect types to already
|
|
238
|
+
* be committed.
|
|
239
|
+
*
|
|
240
|
+
* Runs the project's local `aphex generate:types` bin in a child process (the same command the
|
|
241
|
+
* `generate:types` package script runs), debounced and coalesced so rapid saves collapse into one
|
|
242
|
+
* run and overlapping runs don't pile up.
|
|
243
|
+
*/
|
|
244
|
+
function aphexTypegen(options = {}) {
|
|
245
|
+
const schema = options.schema ?? 'src/lib/schemaTypes/index.ts';
|
|
246
|
+
const output = options.output ?? 'src/lib/generated-types.ts';
|
|
247
|
+
const runOnStart = options.runOnStart ?? true;
|
|
248
|
+
const schemaDir = '/schemaTypes/';
|
|
249
|
+
return {
|
|
250
|
+
name: 'aphex:typegen',
|
|
251
|
+
apply: 'serve',
|
|
252
|
+
configureServer(server) {
|
|
253
|
+
const root = server.config.root;
|
|
254
|
+
let pending = null;
|
|
255
|
+
let running = false;
|
|
256
|
+
let rerun = false;
|
|
257
|
+
function regenerate(reason) {
|
|
258
|
+
if (running) {
|
|
259
|
+
rerun = true; // a change landed mid-run — schedule one more pass after it finishes
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
running = true;
|
|
263
|
+
const binName = process.platform === 'win32' ? 'aphex.cmd' : 'aphex';
|
|
264
|
+
const localBin = join(root, 'node_modules', '.bin', binName);
|
|
265
|
+
const useLocal = existsSync(localBin);
|
|
266
|
+
const cmd = useLocal ? localBin : process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
267
|
+
const args = useLocal
|
|
268
|
+
? ['generate:types', schema, output]
|
|
269
|
+
: ['--no-install', 'aphex', 'generate:types', schema, output];
|
|
270
|
+
const child = spawn(cmd, args, { cwd: root, stdio: 'pipe' });
|
|
271
|
+
let stderr = '';
|
|
272
|
+
child.stderr?.on('data', (d) => (stderr += d));
|
|
273
|
+
child.on('error', (err) => {
|
|
274
|
+
running = false;
|
|
275
|
+
console.error('[aphex:typegen] failed to run generate:types:', err.message);
|
|
276
|
+
});
|
|
277
|
+
child.on('close', (code) => {
|
|
278
|
+
running = false;
|
|
279
|
+
if (code === 0) {
|
|
280
|
+
console.log(`🧬 [aphex] regenerated ${output} (${reason})`);
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
console.error(`[aphex:typegen] generate:types exited with code ${code}\n${stderr}`);
|
|
284
|
+
}
|
|
285
|
+
if (rerun) {
|
|
286
|
+
rerun = false;
|
|
287
|
+
regenerate('coalesced change');
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function schedule(reason) {
|
|
292
|
+
if (pending)
|
|
293
|
+
clearTimeout(pending);
|
|
294
|
+
pending = setTimeout(() => {
|
|
295
|
+
pending = null;
|
|
296
|
+
regenerate(reason);
|
|
297
|
+
}, 250);
|
|
298
|
+
}
|
|
299
|
+
if (runOnStart)
|
|
300
|
+
schedule('startup');
|
|
301
|
+
for (const event of ['change', 'add', 'unlink']) {
|
|
302
|
+
server.watcher.on(event, (file) => {
|
|
303
|
+
const normalized = file.replace(/\\/g, '/');
|
|
304
|
+
// Only react to schema files — never to the generated output (which would loop).
|
|
305
|
+
if (normalized.includes(schemaDir) &&
|
|
306
|
+
normalized.endsWith('.ts') &&
|
|
307
|
+
!normalized.endsWith('generated-types.ts')) {
|
|
308
|
+
schedule(`schema change: ${normalized.split('/').pop()}`);
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
}
|
|
231
315
|
/**
|
|
232
316
|
* One-stop Vite plugin for AphexCMS apps. Bundles:
|
|
233
317
|
*
|
|
234
|
-
* - schema HMR (
|
|
318
|
+
* - schema HMR (hot-swap the engine config on change)
|
|
319
|
+
* - auto type-generation (regenerate generated-types.ts when a schema file changes)
|
|
235
320
|
* - dayjs ESM alias redirect
|
|
236
321
|
* - SSR noExternal/external defaults for cms-core/ui packages
|
|
237
322
|
* - optimizeDeps tuning so first-render isn't slowed by lazy dep discovery
|
|
@@ -256,6 +341,9 @@ export function aphex(options = {}) {
|
|
|
256
341
|
if (options.hmr !== false) {
|
|
257
342
|
plugins.push(aphexHMR(options.hmr ?? {}));
|
|
258
343
|
}
|
|
344
|
+
if (options.typegen !== false) {
|
|
345
|
+
plugins.push(aphexTypegen(options.typegen ?? {}));
|
|
346
|
+
}
|
|
259
347
|
if (options.dayjs !== false) {
|
|
260
348
|
plugins.push(aphexDayjsAlias());
|
|
261
349
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/vite/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/vite/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAwDjC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,QAAQ,CAAC,UAA2B,EAAE;IACrD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,eAAe,CAAC;IACvD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,iBAAiB,CAAC;IAC3D,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,GAAG,CAAC;IAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC;IAEpC,OAAO;QACN,IAAI,EAAE,WAAW;QACjB,eAAe,CAAC,MAAqB;YACpC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;YAE/B,SAAS,cAAc,CAAC,IAAY;gBACnC,MAAM,UAAU,GAAG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,CAAC;IACnC,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;QAC7B,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** A resolved asset's renderable data. */
|
|
2
|
+
export interface ResolvedAsset {
|
|
3
|
+
url: string;
|
|
4
|
+
alt?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Collect every asset `_ref` reachable in a value. Image and file fields, and
|
|
8
|
+
* portable-text image blocks, all carry `{ asset: { _ref } }`, so one generic walk
|
|
9
|
+
* covers them — callers never enumerate field paths by hand.
|
|
10
|
+
*/
|
|
11
|
+
export declare function collectAssetRefs(value: unknown, acc?: Set<string>): Set<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Inject resolved `{ url, alt }` onto every `{ asset: { _ref } }` in a value, in place.
|
|
14
|
+
* After this, `image.asset.url` / `image.asset.alt` are populated so the frontend reads
|
|
15
|
+
* them directly. Mutates the value — pass a clone (e.g. `$state.snapshot`) if the input
|
|
16
|
+
* must be preserved. Refs absent from `resolved` are left untouched.
|
|
17
|
+
*/
|
|
18
|
+
export declare function injectAssetData(value: unknown, resolved: ReadonlyMap<string, ResolvedAsset>): void;
|
|
19
|
+
//# sourceMappingURL=assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/lib/preview/assets.ts"],"names":[],"mappings":"AAYA,0CAA0C;AAC1C,MAAM,WAAW,aAAa;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,GAAE,GAAG,CAAC,MAAM,CAAa,GAAG,GAAG,CAAC,MAAM,CAAC,CAW1F;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC9B,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,GAC1C,IAAI,CAgBN"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Asset URL injection — the single source of truth for "make a document's images
|
|
2
|
+
// renderable". Aphex asset URLs aren't derivable from the `_ref` alone, so before a
|
|
3
|
+
// document can be rendered (server-side on a public route, or client-side in the live
|
|
4
|
+
// preview) each `{ asset: { _ref } }` has to be resolved to its URL/alt and have those
|
|
5
|
+
// woven back into the document.
|
|
6
|
+
//
|
|
7
|
+
// This module owns the *walk* (collect refs / inject results). The *resolution* of a
|
|
8
|
+
// ref → { url, alt } differs by environment — the server uses `AssetService`, the editor
|
|
9
|
+
// uses the assets API client — so it's supplied by the caller. Keeping the walk in one
|
|
10
|
+
// place means SSR and live preview produce documents of the exact same shape:
|
|
11
|
+
// `image.asset.url` is always populated, and the frontend never needs a side-channel map.
|
|
12
|
+
/**
|
|
13
|
+
* Collect every asset `_ref` reachable in a value. Image and file fields, and
|
|
14
|
+
* portable-text image blocks, all carry `{ asset: { _ref } }`, so one generic walk
|
|
15
|
+
* covers them — callers never enumerate field paths by hand.
|
|
16
|
+
*/
|
|
17
|
+
export function collectAssetRefs(value, acc = new Set()) {
|
|
18
|
+
if (!value || typeof value !== 'object')
|
|
19
|
+
return acc;
|
|
20
|
+
if (Array.isArray(value)) {
|
|
21
|
+
for (const v of value)
|
|
22
|
+
collectAssetRefs(v, acc);
|
|
23
|
+
return acc;
|
|
24
|
+
}
|
|
25
|
+
const obj = value;
|
|
26
|
+
const ref = obj.asset?._ref;
|
|
27
|
+
if (typeof ref === 'string')
|
|
28
|
+
acc.add(ref);
|
|
29
|
+
for (const key in obj)
|
|
30
|
+
collectAssetRefs(obj[key], acc);
|
|
31
|
+
return acc;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Inject resolved `{ url, alt }` onto every `{ asset: { _ref } }` in a value, in place.
|
|
35
|
+
* After this, `image.asset.url` / `image.asset.alt` are populated so the frontend reads
|
|
36
|
+
* them directly. Mutates the value — pass a clone (e.g. `$state.snapshot`) if the input
|
|
37
|
+
* must be preserved. Refs absent from `resolved` are left untouched.
|
|
38
|
+
*/
|
|
39
|
+
export function injectAssetData(value, resolved) {
|
|
40
|
+
if (!value || typeof value !== 'object')
|
|
41
|
+
return;
|
|
42
|
+
if (Array.isArray(value)) {
|
|
43
|
+
for (const v of value)
|
|
44
|
+
injectAssetData(v, resolved);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const obj = value;
|
|
48
|
+
const asset = obj.asset;
|
|
49
|
+
if (asset && typeof asset === 'object' && typeof asset._ref === 'string') {
|
|
50
|
+
const hit = resolved.get(asset._ref);
|
|
51
|
+
if (hit) {
|
|
52
|
+
asset.url = hit.url;
|
|
53
|
+
if (hit.alt != null)
|
|
54
|
+
asset.alt = hit.alt;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
for (const key in obj)
|
|
58
|
+
injectAssetData(obj[key], resolved);
|
|
59
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Auth } from '../types/auth.js';
|
|
2
|
+
export type PreviewPerspective = 'draft' | 'published';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the content perspective for a SvelteKit load function.
|
|
5
|
+
*
|
|
6
|
+
* Returns `'draft'` only when the `?aphex-preview` query param is present
|
|
7
|
+
* AND the request carries a valid authenticated session — so unauthenticated
|
|
8
|
+
* visitors who manually append the param always get published content.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // +page.server.ts
|
|
12
|
+
* import { getPreviewPerspective } from '@aphexcms/cms-core/server';
|
|
13
|
+
*
|
|
14
|
+
* export const load = async ({ locals, url }) => {
|
|
15
|
+
* const perspective = getPreviewPerspective(locals.auth, url);
|
|
16
|
+
* const post = await api.findOne({ perspective });
|
|
17
|
+
* };
|
|
18
|
+
*/
|
|
19
|
+
export declare function getPreviewPerspective(auth: Auth | undefined, url: URL): PreviewPerspective;
|
|
20
|
+
//# sourceMappingURL=perspective.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perspective.d.ts","sourceRoot":"","sources":["../../src/lib/preview/perspective.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,WAAW,CAAC;AAEvD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,EAAE,GAAG,EAAE,GAAG,GAAG,kBAAkB,CAG1F"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the content perspective for a SvelteKit load function.
|
|
3
|
+
*
|
|
4
|
+
* Returns `'draft'` only when the `?aphex-preview` query param is present
|
|
5
|
+
* AND the request carries a valid authenticated session — so unauthenticated
|
|
6
|
+
* visitors who manually append the param always get published content.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // +page.server.ts
|
|
10
|
+
* import { getPreviewPerspective } from '@aphexcms/cms-core/server';
|
|
11
|
+
*
|
|
12
|
+
* export const load = async ({ locals, url }) => {
|
|
13
|
+
* const perspective = getPreviewPerspective(locals.auth, url);
|
|
14
|
+
* const post = await api.findOne({ perspective });
|
|
15
|
+
* };
|
|
16
|
+
*/
|
|
17
|
+
export function getPreviewPerspective(auth, url) {
|
|
18
|
+
const isAuthenticated = auth?.type === 'session';
|
|
19
|
+
return url.searchParams.has('aphex-preview') && isAuthenticated ? 'draft' : 'published';
|
|
20
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Field } from '../types/schemas.js';
|
|
2
|
+
/**
|
|
3
|
+
* Remove all stega-encoded data from a string or deep JSON structure.
|
|
4
|
+
* Use in <svelte:head> (title, meta), alt text, aria-labels — anywhere the raw
|
|
5
|
+
* string is needed without invisible characters.
|
|
6
|
+
*/
|
|
7
|
+
export declare function stegaClean<T>(value: T): T;
|
|
8
|
+
/** Decode the stega payload from a string. Returns null if not encoded. */
|
|
9
|
+
export declare function stegaDecode(value: string): {
|
|
10
|
+
field: string;
|
|
11
|
+
blockIndex?: number;
|
|
12
|
+
blockKey?: string;
|
|
13
|
+
arrayIndex?: number;
|
|
14
|
+
objectPath?: string;
|
|
15
|
+
} | null;
|
|
16
|
+
/**
|
|
17
|
+
* Recursively encode all string-bearing fields in a document with their top-level
|
|
18
|
+
* field name. Handles: string/text/url, string arrays, object subfields, and
|
|
19
|
+
* portable text blocks (including custom block types like callout, codeBlock).
|
|
20
|
+
*
|
|
21
|
+
* Every nested string always encodes the *top-level* field name so that clicking
|
|
22
|
+
* in the preview navigates to the correct editor field.
|
|
23
|
+
*/
|
|
24
|
+
export declare function stegaEncodeDocument(data: Record<string, unknown>, fields: Field[]): Record<string, unknown>;
|
|
25
|
+
//# sourceMappingURL=stega.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stega.d.ts","sourceRoot":"","sources":["../../src/lib/preview/stega.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,qBAAqB,CAAC;AAEhE;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAEzC;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAUP;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,EAAE,KAAK,EAAE,GACb,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzB"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { vercelStegaCombine, vercelStegaClean, vercelStegaDecode } from '@vercel/stega';
|
|
2
|
+
/**
|
|
3
|
+
* Remove all stega-encoded data from a string or deep JSON structure.
|
|
4
|
+
* Use in <svelte:head> (title, meta), alt text, aria-labels — anywhere the raw
|
|
5
|
+
* string is needed without invisible characters.
|
|
6
|
+
*/
|
|
7
|
+
export function stegaClean(value) {
|
|
8
|
+
return vercelStegaClean(value);
|
|
9
|
+
}
|
|
10
|
+
/** Decode the stega payload from a string. Returns null if not encoded. */
|
|
11
|
+
export function stegaDecode(value) {
|
|
12
|
+
return (vercelStegaDecode(value) ?? null);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Recursively encode all string-bearing fields in a document with their top-level
|
|
16
|
+
* field name. Handles: string/text/url, string arrays, object subfields, and
|
|
17
|
+
* portable text blocks (including custom block types like callout, codeBlock).
|
|
18
|
+
*
|
|
19
|
+
* Every nested string always encodes the *top-level* field name so that clicking
|
|
20
|
+
* in the preview navigates to the correct editor field.
|
|
21
|
+
*/
|
|
22
|
+
export function stegaEncodeDocument(data, fields) {
|
|
23
|
+
const result = { ...data };
|
|
24
|
+
for (const field of fields) {
|
|
25
|
+
const val = result[field.name];
|
|
26
|
+
if (val == null)
|
|
27
|
+
continue;
|
|
28
|
+
// objectPath is undefined at root — each field IS the top-level, no sub-path needed
|
|
29
|
+
result[field.name] = encodeFieldValue(val, field, field.name, undefined);
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Internal helpers — topLevel is always the document root field name so the
|
|
35
|
+
// editor knows which field to scroll to; objectPath carries the dotted sub-path
|
|
36
|
+
// so the editor can drill into nested inputs.
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
function encodeFieldValue(val, field, topLevel, objectPath) {
|
|
39
|
+
if (val == null)
|
|
40
|
+
return val;
|
|
41
|
+
const path = objectPath ? `${objectPath}.${field.name}` : field.name;
|
|
42
|
+
switch (field.type) {
|
|
43
|
+
case 'string':
|
|
44
|
+
case 'text':
|
|
45
|
+
case 'url':
|
|
46
|
+
if (typeof val === 'string' && val) {
|
|
47
|
+
const payload = { field: topLevel };
|
|
48
|
+
// Only include objectPath for nested fields (not the top-level field itself)
|
|
49
|
+
if (objectPath)
|
|
50
|
+
payload.objectPath = path;
|
|
51
|
+
return vercelStegaCombine(val, payload);
|
|
52
|
+
}
|
|
53
|
+
return val;
|
|
54
|
+
case 'array':
|
|
55
|
+
if (!Array.isArray(val))
|
|
56
|
+
return val;
|
|
57
|
+
// Only forward objectPath when truly nested (inside an object); top-level
|
|
58
|
+
// arrays must NOT get an objectPath or the arrayIndex navigation branch is skipped.
|
|
59
|
+
return encodeArray(val, field.of, topLevel, objectPath ? path : undefined);
|
|
60
|
+
case 'object':
|
|
61
|
+
if (typeof val !== 'object' || !field.fields)
|
|
62
|
+
return val;
|
|
63
|
+
return encodeObject(val, field.fields, topLevel, path);
|
|
64
|
+
// image, file, reference, slug, number, boolean, date, datetime — not text, skip.
|
|
65
|
+
// Image click-to-edit is handled at render time (the frontend stega-encodes the
|
|
66
|
+
// *effective* alt — override or asset default — so every image is clickable, not
|
|
67
|
+
// just ones with a per-placement override).
|
|
68
|
+
default:
|
|
69
|
+
return val;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function encodeArray(items, of, topLevel, objectPath) {
|
|
73
|
+
const hasBlock = of.some((t) => t.type === 'block');
|
|
74
|
+
const firstType = of[0]?.type;
|
|
75
|
+
if (hasBlock) {
|
|
76
|
+
// Portable text — encode spans within blocks and string fields in custom block types
|
|
77
|
+
return encodePortableText(items, of, topLevel);
|
|
78
|
+
}
|
|
79
|
+
if (firstType === 'string' || firstType === 'text') {
|
|
80
|
+
// Primitive string array (e.g. tags) — include the item's array index
|
|
81
|
+
return items.map((item, arrayIndex) => {
|
|
82
|
+
if (typeof item !== 'string' || !item)
|
|
83
|
+
return item;
|
|
84
|
+
const payload = { field: topLevel, arrayIndex };
|
|
85
|
+
if (objectPath)
|
|
86
|
+
payload.objectPath = objectPath;
|
|
87
|
+
return vercelStegaCombine(item, payload);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
// Array of inline objects — encode each item's string fields
|
|
91
|
+
if (of[0]?.fields) {
|
|
92
|
+
return items.map((item, arrayIndex) => {
|
|
93
|
+
if (!item || typeof item !== 'object')
|
|
94
|
+
return item;
|
|
95
|
+
const obj = item;
|
|
96
|
+
const typeRef = of.find((t) => t.name === obj._type || t.type === obj._type) ?? of[0];
|
|
97
|
+
if (!typeRef?.fields)
|
|
98
|
+
return item;
|
|
99
|
+
const itemPath = objectPath ? `${objectPath}[${arrayIndex}]` : `[${arrayIndex}]`;
|
|
100
|
+
return encodeObject(obj, typeRef.fields, topLevel, itemPath);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return items;
|
|
104
|
+
}
|
|
105
|
+
function encodeObject(obj, fields, topLevel, objectPath) {
|
|
106
|
+
const result = { ...obj };
|
|
107
|
+
for (const field of fields) {
|
|
108
|
+
const val = result[field.name];
|
|
109
|
+
if (val == null)
|
|
110
|
+
continue;
|
|
111
|
+
result[field.name] = encodeFieldValue(val, field, topLevel, objectPath);
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
/** Encode portable text: spans in standard blocks + string fields in custom block types. */
|
|
116
|
+
function encodePortableText(blocks, of, topLevel) {
|
|
117
|
+
return blocks.map((block, blockIndex) => {
|
|
118
|
+
if (!block || typeof block !== 'object')
|
|
119
|
+
return block;
|
|
120
|
+
const b = block;
|
|
121
|
+
if (b._type === 'block' && Array.isArray(b.children)) {
|
|
122
|
+
// Standard text block — encode each span's text with its block index so the
|
|
123
|
+
// editor can position the cursor at the exact block when clicked.
|
|
124
|
+
return {
|
|
125
|
+
...b,
|
|
126
|
+
children: b.children.map((child) => {
|
|
127
|
+
if (!child || typeof child !== 'object')
|
|
128
|
+
return child;
|
|
129
|
+
const span = child;
|
|
130
|
+
if (span._type === 'span' && typeof span.text === 'string' && span.text) {
|
|
131
|
+
return {
|
|
132
|
+
...span,
|
|
133
|
+
text: vercelStegaCombine(span.text, { field: topLevel, blockIndex })
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
return child;
|
|
137
|
+
})
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
// Built-in image block — click-to-edit is stamped at render time (the frontend
|
|
141
|
+
// stega-encodes the effective alt with this block's _key), so no encoding here.
|
|
142
|
+
if (b._type === 'image')
|
|
143
|
+
return block;
|
|
144
|
+
// Custom block type (callout, codeBlock, etc.) — encode string fields, carrying
|
|
145
|
+
// blockIndex so clicking them opens the block's edit modal in the editor.
|
|
146
|
+
const typeRef = of.find((t) => t.name === b._type || t.type === b._type);
|
|
147
|
+
if (typeRef?.fields) {
|
|
148
|
+
return encodeCustomBlock(b, typeRef.fields, topLevel, blockIndex);
|
|
149
|
+
}
|
|
150
|
+
return block;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/** Encode string fields of a custom block with { field, blockIndex, blockKey } so the editor can open the modal. */
|
|
154
|
+
function encodeCustomBlock(obj, fields, topLevel, blockIndex) {
|
|
155
|
+
const result = { ...obj };
|
|
156
|
+
const blockKey = typeof obj._key === 'string' ? obj._key : undefined;
|
|
157
|
+
for (const field of fields) {
|
|
158
|
+
const val = result[field.name];
|
|
159
|
+
if (!val)
|
|
160
|
+
continue;
|
|
161
|
+
if ((field.type === 'string' || field.type === 'text' || field.type === 'url') &&
|
|
162
|
+
typeof val === 'string') {
|
|
163
|
+
result[field.name] = vercelStegaCombine(val, { field: topLevel, blockIndex, blockKey });
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/core';
|
|
2
|
+
/**
|
|
3
|
+
* A registered richtext editor plus the imperative hooks DocumentEditor needs for
|
|
4
|
+
* click-to-edit — e.g. opening the link popover after dropping the caret in a link,
|
|
5
|
+
* rather than relying on the editor's transaction heuristic to notice the selection move.
|
|
6
|
+
*/
|
|
7
|
+
export interface RichtextEditorHandle {
|
|
8
|
+
editor: Editor;
|
|
9
|
+
/** Open the link action popover for the link at the current selection. */
|
|
10
|
+
openLinkPopover: () => void;
|
|
11
|
+
}
|
|
12
|
+
type EditorRegistry = Map<string, RichtextEditorHandle>;
|
|
13
|
+
/** Call once in DocumentEditor to create the registry. */
|
|
14
|
+
export declare function setRichtextEditorRegistry(): EditorRegistry;
|
|
15
|
+
/** Call in RichtextField to register/unregister the editor handle. */
|
|
16
|
+
export declare function getRichtextEditorRegistry(): EditorRegistry | null;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=richtext-context.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"richtext-context.svelte.d.ts","sourceRoot":"","sources":["../src/lib/richtext-context.svelte.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,eAAe,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,KAAK,cAAc,GAAG,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAExD,0DAA0D;AAC1D,wBAAgB,yBAAyB,IAAI,cAAc,CAI1D;AAED,sEAAsE;AACtE,wBAAgB,yBAAyB,IAAI,cAAc,GAAG,IAAI,CAEjE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getContext, setContext } from 'svelte';
|
|
2
|
+
const KEY = Symbol('aphex:richtext-editors');
|
|
3
|
+
/** Call once in DocumentEditor to create the registry. */
|
|
4
|
+
export function setRichtextEditorRegistry() {
|
|
5
|
+
const registry = new Map();
|
|
6
|
+
setContext(KEY, registry);
|
|
7
|
+
return registry;
|
|
8
|
+
}
|
|
9
|
+
/** Call in RichtextField to register/unregister the editor handle. */
|
|
10
|
+
export function getRichtextEditorRegistry() {
|
|
11
|
+
return getContext(KEY) ?? null;
|
|
12
|
+
}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { GET as serveAssetCDN } from '../routes/assets-cdn.js';
|
|
|
18
18
|
export { createAphexApi, mountAphexBuiltins, toHonoHandler, type AphexEnv } from './api/index.js';
|
|
19
19
|
export * from '../schema-utils/index.js';
|
|
20
20
|
export { createHashForPublishing } from '../utils/content-hash.js';
|
|
21
|
+
export { getPreviewPerspective, type PreviewPerspective } from '../preview/perspective.js';
|
|
21
22
|
export { createGraphQLHandler, type GraphQLConfig, type GraphQLSettings, type GraphQLHandlerResult } from '../graphql/index.js';
|
|
22
23
|
export { LocalAPI, createLocalAPI, getLocalAPI, CollectionAPI, SingletonOperationError, PermissionChecker, PermissionError, type Collections, type SingletonCollection, type LocalAPIContext, type CreateOptions, type UpdateOptions } from '../local-api/index.js';
|
|
23
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/server/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAE/B,cAAc,kBAAkB,CAAC;AAEjC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG5C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,MAAM,EAAE,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from '../schema-utils/index.js';
|
|
37
37
|
// Content hash utilities (server-side)
|
|
38
38
|
export { createHashForPublishing } from '../utils/content-hash.js';
|
|
39
|
+
// Preview utilities
|
|
40
|
+
export { getPreviewPerspective } from '../preview/perspective.js';
|
|
39
41
|
// GraphQL (built-in, enabled by default)
|
|
40
42
|
export { createGraphQLHandler } from '../graphql/index.js';
|
|
41
43
|
// Local API (unified operations layer)
|