@plumix/core 0.1.4 → 0.3.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/dist/admin-bar/collect.d.ts.map +1 -1
- package/dist/admin-bar/collect.js +1 -15
- package/dist/admin-bar/collect.js.map +1 -1
- package/dist/admin-bar/styles.d.ts.map +1 -1
- package/dist/admin-bar/styles.js +1 -11
- package/dist/admin-bar/styles.js.map +1 -1
- package/dist/cli/worker-codegen.d.ts.map +1 -1
- package/dist/cli/worker-codegen.js +3 -5
- package/dist/cli/worker-codegen.js.map +1 -1
- package/dist/context/app.d.ts +8 -0
- package/dist/context/app.d.ts.map +1 -1
- package/dist/context/app.js +7 -0
- package/dist/context/app.js.map +1 -1
- package/dist/context/debug.d.ts +25 -0
- package/dist/context/debug.d.ts.map +1 -0
- package/dist/context/debug.js +13 -0
- package/dist/context/debug.js.map +1 -0
- package/dist/context/stores.d.ts +2 -0
- package/dist/context/stores.d.ts.map +1 -1
- package/dist/context/stores.js.map +1 -1
- package/dist/css-tag.d.ts +2 -0
- package/dist/css-tag.d.ts.map +1 -0
- package/dist/css-tag.js +13 -0
- package/dist/css-tag.js.map +1 -0
- package/dist/db/libsql.d.ts.map +1 -1
- package/dist/db/libsql.js +13 -2
- package/dist/db/libsql.js.map +1 -1
- package/dist/debug-bar/collect.d.ts.map +1 -1
- package/dist/debug-bar/collect.js +1 -15
- package/dist/debug-bar/collect.js.map +1 -1
- package/dist/debug-bar/collector.d.ts +9 -0
- package/dist/debug-bar/collector.d.ts.map +1 -0
- package/dist/debug-bar/collector.js +80 -0
- package/dist/debug-bar/collector.js.map +1 -0
- package/dist/debug-bar/component.d.ts.map +1 -1
- package/dist/debug-bar/component.js +15 -2
- package/dist/debug-bar/component.js.map +1 -1
- package/dist/debug-bar/core-panels.d.ts.map +1 -1
- package/dist/debug-bar/core-panels.js +12 -1
- package/dist/debug-bar/core-panels.js.map +1 -1
- package/dist/debug-bar/db-query.d.ts +21 -0
- package/dist/debug-bar/db-query.d.ts.map +1 -0
- package/dist/debug-bar/db-query.js +23 -0
- package/dist/debug-bar/db-query.js.map +1 -0
- package/dist/debug-bar/format-param.d.ts +14 -0
- package/dist/debug-bar/format-param.d.ts.map +1 -0
- package/dist/debug-bar/format-param.js +27 -0
- package/dist/debug-bar/format-param.js.map +1 -0
- package/dist/debug-bar/highlight-sql.d.ts +11 -0
- package/dist/debug-bar/highlight-sql.d.ts.map +1 -0
- package/dist/debug-bar/highlight-sql.js +82 -0
- package/dist/debug-bar/highlight-sql.js.map +1 -0
- package/dist/debug-bar/panels/app.d.ts +8 -0
- package/dist/debug-bar/panels/app.d.ts.map +1 -0
- package/dist/debug-bar/panels/app.js +32 -0
- package/dist/debug-bar/panels/app.js.map +1 -0
- package/dist/debug-bar/panels/database.d.ts +9 -0
- package/dist/debug-bar/panels/database.d.ts.map +1 -0
- package/dist/debug-bar/panels/database.js +33 -0
- package/dist/debug-bar/panels/database.js.map +1 -0
- package/dist/debug-bar/panels/request.d.ts +2 -2
- package/dist/debug-bar/panels/request.d.ts.map +1 -1
- package/dist/debug-bar/panels/request.js +24 -11
- package/dist/debug-bar/panels/request.js.map +1 -1
- package/dist/debug-bar/panels/template.d.ts +14 -0
- package/dist/debug-bar/panels/template.d.ts.map +1 -0
- package/dist/debug-bar/panels/template.js +40 -0
- package/dist/debug-bar/panels/template.js.map +1 -0
- package/dist/debug-bar/panels/timeline.d.ts +11 -0
- package/dist/debug-bar/panels/timeline.d.ts.map +1 -0
- package/dist/debug-bar/panels/timeline.js +46 -0
- package/dist/debug-bar/panels/timeline.js.map +1 -0
- package/dist/debug-bar/primitives.d.ts +12 -3
- package/dist/debug-bar/primitives.d.ts.map +1 -1
- package/dist/debug-bar/primitives.js +17 -1
- package/dist/debug-bar/primitives.js.map +1 -1
- package/dist/debug-bar/styles.d.ts.map +1 -1
- package/dist/debug-bar/styles.js +229 -17
- package/dist/debug-bar/styles.js.map +1 -1
- package/dist/debug-bar/template-node-label.d.ts +6 -0
- package/dist/debug-bar/template-node-label.d.ts.map +1 -0
- package/dist/debug-bar/template-node-label.js +18 -0
- package/dist/debug-bar/template-node-label.js.map +1 -0
- package/dist/debug-bar/timeline-geometry.d.ts +30 -0
- package/dist/debug-bar/timeline-geometry.d.ts.map +1 -0
- package/dist/debug-bar/timeline-geometry.js +26 -0
- package/dist/debug-bar/timeline-geometry.js.map +1 -0
- package/dist/debug-bar/timeline-model.d.ts +23 -0
- package/dist/debug-bar/timeline-model.d.ts.map +1 -0
- package/dist/debug-bar/timeline-model.js +34 -0
- package/dist/debug-bar/timeline-model.js.map +1 -0
- package/dist/debug-bar/trace-libsql.d.ts +18 -0
- package/dist/debug-bar/trace-libsql.d.ts.map +1 -0
- package/dist/debug-bar/trace-libsql.js +42 -0
- package/dist/debug-bar/trace-libsql.js.map +1 -0
- package/dist/debug-bar/types.d.ts +6 -0
- package/dist/debug-bar/types.d.ts.map +1 -1
- package/dist/hooks/registry.d.ts +14 -3
- package/dist/hooks/registry.d.ts.map +1 -1
- package/dist/hooks/registry.js +22 -0
- package/dist/hooks/registry.js.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/plugin/manifest.d.ts +3 -0
- package/dist/plugin/manifest.d.ts.map +1 -1
- package/dist/plugin/manifest.js +1 -0
- package/dist/plugin/manifest.js.map +1 -1
- package/dist/plugin/register.d.ts.map +1 -1
- package/dist/plugin/register.js +1 -0
- package/dist/plugin/register.js.map +1 -1
- package/dist/route/render/render-template.d.ts +6 -4
- package/dist/route/render/render-template.d.ts.map +1 -1
- package/dist/route/render/render-template.js +48 -44
- package/dist/route/render/render-template.js.map +1 -1
- package/dist/route/render/resolved-entry.d.ts +10 -5
- package/dist/route/render/resolved-entry.d.ts.map +1 -1
- package/dist/route/render/template-builders.d.ts +72 -0
- package/dist/route/render/template-builders.d.ts.map +1 -0
- package/dist/route/render/template-builders.js +113 -0
- package/dist/route/render/template-builders.js.map +1 -0
- package/dist/route/render/template-hierarchy.d.ts +53 -38
- package/dist/route/render/template-hierarchy.d.ts.map +1 -1
- package/dist/route/render/template-hierarchy.js +127 -74
- package/dist/route/render/template-hierarchy.js.map +1 -1
- package/dist/route/resolve.d.ts +3 -3
- package/dist/route/resolve.d.ts.map +1 -1
- package/dist/route/resolve.js +30 -32
- package/dist/route/resolve.js.map +1 -1
- package/dist/runtime/app.d.ts +8 -13
- package/dist/runtime/app.d.ts.map +1 -1
- package/dist/runtime/app.js +1 -39
- package/dist/runtime/app.js.map +1 -1
- package/dist/runtime/dispatcher.d.ts.map +1 -1
- package/dist/runtime/dispatcher.js +8 -9
- package/dist/runtime/dispatcher.js.map +1 -1
- package/dist/template-deps.js +1 -1
- package/dist/template-registry.d.ts +57 -0
- package/dist/template-registry.d.ts.map +1 -0
- package/dist/template-registry.js +1 -0
- package/dist/template-registry.js.map +1 -0
- package/dist/template.d.ts +2 -2
- package/dist/test/default-theme.d.ts.map +1 -1
- package/dist/test/default-theme.js +7 -6
- package/dist/test/default-theme.js.map +1 -1
- package/dist/test/dispatcher.d.ts +3 -0
- package/dist/test/dispatcher.d.ts.map +1 -1
- package/dist/test/dispatcher.js +8 -2
- package/dist/test/dispatcher.js.map +1 -1
- package/dist/test/harness.d.ts.map +1 -1
- package/dist/test/harness.js +12 -2
- package/dist/test/harness.js.map +1 -1
- package/dist/theme-errors.d.ts +0 -3
- package/dist/theme-errors.d.ts.map +1 -1
- package/dist/theme-errors.js +7 -18
- package/dist/theme-errors.js.map +1 -1
- package/dist/theme.d.ts +59 -23
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +21 -10
- package/dist/theme.js.map +1 -1
- package/dist/welcome-theme.d.ts +2 -2
- package/dist/welcome-theme.d.ts.map +1 -1
- package/dist/welcome-theme.js +7 -6
- package/dist/welcome-theme.js.map +1 -1
- package/package.json +7 -7
- package/dist/route/render/archive-props.d.ts +0 -39
- package/dist/route/render/archive-props.d.ts.map +0 -1
- package/dist/route/render/archive-props.js +0 -32
- package/dist/route/render/archive-props.js.map +0 -1
package/dist/theme-errors.js
CHANGED
|
@@ -10,14 +10,9 @@ export class ThemeRegistrationError extends Error {
|
|
|
10
10
|
static missingTheme() {
|
|
11
11
|
return new ThemeRegistrationError("missing_theme", `Plumix config requires a \`theme\`. Every app renders public routes ` +
|
|
12
12
|
`through a theme — there is no inline-HTML fallback. Define one with ` +
|
|
13
|
-
`\`defineTheme({ templates:
|
|
13
|
+
`\`defineTheme({ templates: [fallback(...)] })\` and pass it to ` +
|
|
14
14
|
`\`plumix({ … , theme })\`.`);
|
|
15
15
|
}
|
|
16
|
-
static missingIndexTemplate() {
|
|
17
|
-
return new ThemeRegistrationError("missing_index_template", `Theme registration: \`templates.index\` is required. Every theme ` +
|
|
18
|
-
`must declare an \`index\` template — it is the final fallback the ` +
|
|
19
|
-
`template hierarchy walks to when no more-specific template matches.`);
|
|
20
|
-
}
|
|
21
16
|
static legacyTemplateDepsShape() {
|
|
22
17
|
return new ThemeRegistrationError("legacy_template_deps_shape", `Theme registration: \`templateDeps: { ... }\` is no longer accepted. ` +
|
|
23
18
|
`Lift dep kinds to the flat root of \`defineTheme\` instead — e.g. ` +
|
|
@@ -32,13 +27,10 @@ export class ThemeRegistrationError extends Error {
|
|
|
32
27
|
`function form is for per-template extension (see #614).`);
|
|
33
28
|
}
|
|
34
29
|
static documentInvalidLink(ctx) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
`attribute. Every \`<link>\` in the document manifest must declare ` +
|
|
40
|
-
`a \`rel\` — browsers ignore unkeyed link tags and the renderer ` +
|
|
41
|
-
`would emit invalid HTML.`);
|
|
30
|
+
return new ThemeRegistrationError("document_invalid_link", `The document manifest has a \`link[${ctx.index}]\` entry without a ` +
|
|
31
|
+
`\`rel\` attribute. Every \`<link>\` must declare a \`rel\` — ` +
|
|
32
|
+
`browsers ignore unkeyed link tags and the renderer would emit ` +
|
|
33
|
+
`invalid HTML.`);
|
|
42
34
|
}
|
|
43
35
|
static invalidTemplate(ctx) {
|
|
44
36
|
return new ThemeRegistrationError("invalid_template", `Theme registration: templates.${ctx.slot} must be either a plain ` +
|
|
@@ -48,11 +40,8 @@ export class ThemeRegistrationError extends Error {
|
|
|
48
40
|
`document-fragment fields don't get silently ignored.`);
|
|
49
41
|
}
|
|
50
42
|
static documentInvalidScript(ctx) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
: "`theme:document` filter chain";
|
|
54
|
-
return new ThemeRegistrationError("document_invalid_script", `${source} produced a \`script[${ctx.index}]\` entry with neither ` +
|
|
55
|
-
`\`src\` nor inline content (\`children\` / ` +
|
|
43
|
+
return new ThemeRegistrationError("document_invalid_script", `The document manifest has a \`script[${ctx.index}]\` entry with ` +
|
|
44
|
+
`neither \`src\` nor inline content (\`children\` / ` +
|
|
56
45
|
`\`dangerouslySetInnerHTML\`). Scripts must reference a source URL ` +
|
|
57
46
|
`or carry an inline body — an empty \`<script>\` tag is dead weight.`);
|
|
58
47
|
}
|
package/dist/theme-errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-errors.js","sourceRoot":"","sources":["../src/theme-errors.ts"],"names":[],"mappings":"AASA,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C;QACE,sBAAsB,CAAC,SAAS,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACnE,CAAC;IAEQ,IAAI,CAAwB;IAErC,YAAoB,IAA2B,EAAE,OAAe;QAC9D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,YAAY;QACjB,OAAO,IAAI,sBAAsB,CAC/B,eAAe,EACf,sEAAsE;YACpE,sEAAsE;YACtE,iEAAiE;YACjE,4BAA4B,CAC/B,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,
|
|
1
|
+
{"version":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|
import type { ComponentType, JSX } from "react";
|
|
2
2
|
import type { ShortcodeSpec, ThemeBreakpoints, ThemeTokens } from "@plumix/blocks";
|
|
3
|
-
import type { ArchiveData, ErrorData, FrontPageData, SearchData,
|
|
3
|
+
import type { ArchiveData, EntryData, ErrorData, FrontPageData, SearchData, TaxonomyData } from "./route/render/resolved-entry.js";
|
|
4
4
|
import type { Template, TemplateDepDeclarations } from "./template.js";
|
|
5
5
|
declare module "./hooks/types.js" {
|
|
6
6
|
interface FilterRegistry {
|
|
@@ -9,15 +9,62 @@ declare module "./hooks/types.js" {
|
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Discriminated union of every data shape a template can receive. Per-kind
|
|
12
|
-
* templates (`single`, `archive`, …) narrow via the registry;
|
|
13
|
-
* receives the union
|
|
12
|
+
* templates (`single`, `archive`, …) narrow via the registry; a template that
|
|
13
|
+
* receives the whole union (like `index`) discriminates on the `kind` field —
|
|
14
|
+
* a `switch (data.kind)` gets exhaustiveness, or use the `isEntry`/`isArchive`/…
|
|
15
|
+
* guards below for single-branch checks.
|
|
14
16
|
*/
|
|
15
|
-
export type TemplateData =
|
|
17
|
+
export type TemplateData = EntryData | ArchiveData | TaxonomyData | FrontPageData | SearchData | ErrorData;
|
|
18
|
+
export declare function isEntry(data: TemplateData): data is EntryData;
|
|
19
|
+
export declare function isArchive(data: TemplateData): data is ArchiveData;
|
|
20
|
+
export declare function isTaxonomy(data: TemplateData): data is TaxonomyData;
|
|
21
|
+
export declare function isFrontPage(data: TemplateData): data is FrontPageData;
|
|
22
|
+
export declare function isSearch(data: TemplateData): data is SearchData;
|
|
23
|
+
export declare function isError(data: TemplateData): data is ErrorData;
|
|
16
24
|
export type TemplateComponent<Data> = ComponentType<{
|
|
17
25
|
readonly data: Data;
|
|
18
26
|
}>;
|
|
19
27
|
export type TemplateEntry<Data extends TemplateData> = TemplateComponent<Data> | Template<Data>;
|
|
20
|
-
|
|
28
|
+
/**
|
|
29
|
+
* The fixed set of generic tiers a theme's `templates` array can declare. Each
|
|
30
|
+
* matches one resolved-node kind (`entry`→content, `archive`→content-type
|
|
31
|
+
* archive, `taxonomy`→term, `frontPage`/`search`), plus `fallback`
|
|
32
|
+
* (the universal catch-all) and the `notFound`/`serverError` condition handlers.
|
|
33
|
+
* Type/term-specific matchers arrive in a later slice.
|
|
34
|
+
*/
|
|
35
|
+
export type GenericTier = "fallback" | "entry" | "archive" | "taxonomy" | "frontPage" | "search" | "notFound" | "serverError";
|
|
36
|
+
/**
|
|
37
|
+
* How a targeted rule (from `forEntryType`/`forTermTaxonomy`) matches a resolved
|
|
38
|
+
* node: by node kind + type name, optionally narrowed to one entry/term by
|
|
39
|
+
* `slug` or `id`.
|
|
40
|
+
*/
|
|
41
|
+
export interface TargetMatcher {
|
|
42
|
+
readonly nodeKind: "content" | "content-type-archive" | "term";
|
|
43
|
+
readonly type: string;
|
|
44
|
+
readonly slug?: string;
|
|
45
|
+
readonly id?: number;
|
|
46
|
+
/**
|
|
47
|
+
* A runtime predicate over the resolved data (`whereMeta`/`where`/`named`),
|
|
48
|
+
* evaluated after the identity match. Data-dependent, so the resolver must be
|
|
49
|
+
* given the resolved data to honour it.
|
|
50
|
+
*/
|
|
51
|
+
readonly predicate?: (data: TemplateData) => boolean;
|
|
52
|
+
/** For an author-selectable (`named`) template: its id + editor label. */
|
|
53
|
+
readonly named?: {
|
|
54
|
+
readonly id: string;
|
|
55
|
+
readonly label: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* One entry in a theme's `templates` array: a template bound to either a
|
|
60
|
+
* generic `tier` or a targeted `match`. Exactly one is set — the builders never
|
|
61
|
+
* produce both.
|
|
62
|
+
*/
|
|
63
|
+
export interface TemplateRule {
|
|
64
|
+
readonly template: TemplateEntry<TemplateData>;
|
|
65
|
+
readonly tier?: GenericTier;
|
|
66
|
+
readonly match?: TargetMatcher;
|
|
67
|
+
}
|
|
21
68
|
/**
|
|
22
69
|
* Strip React-isms that don't belong in HTML attribute descriptors:
|
|
23
70
|
* `key`/`ref` are React infrastructure; `on*` handlers don't apply
|
|
@@ -43,24 +90,13 @@ export interface DocumentManifest {
|
|
|
43
90
|
readonly title?: string;
|
|
44
91
|
readonly titleTemplate?: string | ((title: string | undefined) => string);
|
|
45
92
|
}
|
|
46
|
-
export interface TemplateRegistry {
|
|
47
|
-
readonly index: TemplateEntry<TemplateData>;
|
|
48
|
-
readonly single?: TemplateEntry<SingleData>;
|
|
49
|
-
readonly singular?: TemplateEntry<SingleData>;
|
|
50
|
-
readonly page?: TemplateEntry<SingleData>;
|
|
51
|
-
readonly archive?: TemplateEntry<ArchiveData>;
|
|
52
|
-
readonly taxonomy?: TemplateEntry<TaxonomyData>;
|
|
53
|
-
readonly category?: TemplateEntry<TaxonomyData>;
|
|
54
|
-
readonly tag?: TemplateEntry<TaxonomyData>;
|
|
55
|
-
readonly "front-page"?: TemplateEntry<FrontPageData>;
|
|
56
|
-
readonly home?: TemplateEntry<FrontPageData>;
|
|
57
|
-
readonly search?: TemplateEntry<SearchData>;
|
|
58
|
-
readonly "404"?: TemplateEntry<ErrorData>;
|
|
59
|
-
readonly "500"?: TemplateEntry<ErrorData>;
|
|
60
|
-
readonly [key: string]: DynamicTemplateEntry | undefined;
|
|
61
|
-
}
|
|
62
93
|
export interface ThemeDescriptor extends TemplateDepDeclarations {
|
|
63
|
-
|
|
94
|
+
/**
|
|
95
|
+
* The theme's templates: an array of builder rules (`fallback(...)`,
|
|
96
|
+
* `forEntryType(...).template(...)`, …), or a bare component as fallback-only
|
|
97
|
+
* shorthand.
|
|
98
|
+
*/
|
|
99
|
+
readonly templates: readonly TemplateRule[] | TemplateEntry<TemplateData>;
|
|
64
100
|
readonly document?: DocumentManifest;
|
|
65
101
|
readonly tokens?: ThemeTokens;
|
|
66
102
|
/**
|
|
@@ -86,6 +122,6 @@ export interface ThemeDescriptor extends TemplateDepDeclarations {
|
|
|
86
122
|
readonly css?: readonly string[];
|
|
87
123
|
}
|
|
88
124
|
export declare function defineTheme(descriptor: ThemeDescriptor): ThemeDescriptor;
|
|
89
|
-
export declare function validateDocumentManifest(manifest: DocumentManifest
|
|
125
|
+
export declare function validateDocumentManifest(manifest: DocumentManifest): void;
|
|
90
126
|
export {};
|
|
91
127
|
//# sourceMappingURL=theme.d.ts.map
|
package/dist/theme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,aAAa,EACb,UAAU,EACV,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,aAAa,EACb,UAAU,EACV,YAAY,EACb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AASvE,OAAO,QAAQ,kBAAkB,CAAC;IAChC,UAAU,cAAc;QACtB,gBAAgB,EAAE,CAChB,QAAQ,EAAE,gBAAgB,KACvB,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;KACnD;CACF;AAED;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,WAAW,GACX,YAAY,GACZ,aAAa,GACb,UAAU,GACV,SAAS,CAAC;AAEd,wBAAgB,O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B,WAAW,CAAC,MAAM,CAAC,EACnB,UAAU,GAAG,yBAAyB,CACvC,CAAC;IACF,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IAC5C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,MAAM,CAAC,CAAC;CAC3E;AAED,MAAM,WAAW,eAAgB,SAAQ,uBAAuB;IAC9D;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,YAAY,EAAE,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;IAC1E,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,gBAAgB,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IAC/C;;;;;;OAMG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC;AAKD,wBAAgB,WAAW,CAAC,UAAU,EAAE,eAAe,GAAG,eAAe,CAiBxE;AAOD,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAiBzE"}
|
package/dist/theme.js
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import { RESERVED_DEP_KIND_NAMES } from "./template-deps.js";
|
|
2
2
|
import { ThemeError, ThemeRegistrationError } from "./theme-errors.js";
|
|
3
|
+
export function isEntry(data) {
|
|
4
|
+
return data.kind === "entry";
|
|
5
|
+
}
|
|
6
|
+
export function isArchive(data) {
|
|
7
|
+
return data.kind === "archive";
|
|
8
|
+
}
|
|
9
|
+
export function isTaxonomy(data) {
|
|
10
|
+
return data.kind === "taxonomy";
|
|
11
|
+
}
|
|
12
|
+
export function isFrontPage(data) {
|
|
13
|
+
return data.kind === "frontPage";
|
|
14
|
+
}
|
|
15
|
+
export function isSearch(data) {
|
|
16
|
+
return data.kind === "search";
|
|
17
|
+
}
|
|
18
|
+
export function isError(data) {
|
|
19
|
+
return data.kind === "error";
|
|
20
|
+
}
|
|
3
21
|
const TOKEN_SLUG_RE = /^[a-z][a-z0-9-]*$/;
|
|
4
22
|
const TOKEN_VALUE_FORBIDDEN_CHARS = /[;{}\\\n\r]|\/\*|\*\//;
|
|
5
23
|
export function defineTheme(descriptor) {
|
|
6
|
-
// Defense-in-depth: the type system already requires `templates.index`,
|
|
7
|
-
// but JS callers can drop it. The hierarchy walker terminates at
|
|
8
|
-
// `index`, so an absent fallback would render blank pages.
|
|
9
|
-
const templates = descriptor.templates;
|
|
10
|
-
if (!templates.index) {
|
|
11
|
-
throw ThemeRegistrationError.missingIndexTemplate();
|
|
12
|
-
}
|
|
13
24
|
if ("templateDeps" in descriptor) {
|
|
14
25
|
throw ThemeRegistrationError.legacyTemplateDepsShape();
|
|
15
26
|
}
|
|
@@ -33,10 +44,10 @@ export function defineTheme(descriptor) {
|
|
|
33
44
|
// can't recover from gracefully — link entries without `rel` (browsers
|
|
34
45
|
// ignore them, invalid HTML) and scripts with no src + no inline body
|
|
35
46
|
// (dead weight, signals a plugin bug worth surfacing loud).
|
|
36
|
-
export function validateDocumentManifest(manifest
|
|
47
|
+
export function validateDocumentManifest(manifest) {
|
|
37
48
|
manifest.link?.forEach((entry, index) => {
|
|
38
49
|
if (typeof entry.rel !== "string" || entry.rel.length === 0) {
|
|
39
|
-
throw ThemeRegistrationError.documentInvalidLink({ index
|
|
50
|
+
throw ThemeRegistrationError.documentInvalidLink({ index });
|
|
40
51
|
}
|
|
41
52
|
});
|
|
42
53
|
manifest.script?.forEach((entry, index) => {
|
|
@@ -45,7 +56,7 @@ export function validateDocumentManifest(manifest, slot) {
|
|
|
45
56
|
const hasInnerHtml = typeof entry.dangerouslySetInnerHTML?.__html === "string" &&
|
|
46
57
|
entry.dangerouslySetInnerHTML.__html.length > 0;
|
|
47
58
|
if (!hasSrc && !hasChildren && !hasInnerHtml) {
|
|
48
|
-
throw ThemeRegistrationError.documentInvalidScript({ index
|
|
59
|
+
throw ThemeRegistrationError.documentInvalidScript({ index });
|
|
49
60
|
}
|
|
50
61
|
});
|
|
51
62
|
}
|
package/dist/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AA8BvE,MAAM,UAAU,OAAO,CAAC,IAAkB;IACxC,OAAO,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC;AAC/B,CAAC;AACD,MAAM,UAAU,SAAS,CAAC,IAAkB;IAC1C,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;AACjC,CAAC;AACD,MAAM,UAAU,UAAU,CAAC,IAAkB;IAC3C,OAAO,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC;AAClC,CAAC;AACD,MAAM,UAAU,WAAW,CAAC,IAAkB;IAC5C,OAAO,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC;AACnC,CAAC;AACD,MAAM,UAAU,QAAQ,CAAC,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,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBAClD,MAAM,UAAU,CAAC,iBAAiB,CAAC;oBACjC,KAAK;oBACL,IAAI;oBACJ,KAAK,EAAE,KAAK,CAAC,KAAK;iBACnB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/welcome-theme.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* substitutes it at config resolution, so to all downstream code a
|
|
4
4
|
* theme-less site is indistinguishable from one with a user theme.
|
|
5
5
|
*
|
|
6
|
-
* The `
|
|
7
|
-
* render receives `ctx` — needed for the basePath-aware admin link.
|
|
6
|
+
* The sole `fallback` template uses `defineTemplate` (not a plain function) so
|
|
7
|
+
* its render receives `ctx` — needed for the basePath-aware admin link.
|
|
8
8
|
*/
|
|
9
9
|
export declare const welcomeTheme: import("./theme.js").ThemeDescriptor;
|
|
10
10
|
//# sourceMappingURL=welcome-theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"welcome-theme.d.ts","sourceRoot":"","sources":["../src/welcome-theme.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"welcome-theme.d.ts","sourceRoot":"","sources":["../src/welcome-theme.tsx"],"names":[],"mappings":"AAqLA;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,sCAkBvB,CAAC"}
|
package/dist/welcome-theme.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { withBasePath } from "./base-path.js";
|
|
3
|
+
import { fallback } from "./route/render/template-builders.js";
|
|
3
4
|
import { defineTemplate } from "./template.js";
|
|
4
5
|
import { defineTheme } from "./theme.js";
|
|
5
6
|
import { welcomeMessages } from "./welcome/i18n.js";
|
|
@@ -147,15 +148,15 @@ function WelcomeScreen({ basePath, strings, }) {
|
|
|
147
148
|
* substitutes it at config resolution, so to all downstream code a
|
|
148
149
|
* theme-less site is indistinguishable from one with a user theme.
|
|
149
150
|
*
|
|
150
|
-
* The `
|
|
151
|
-
* render receives `ctx` — needed for the basePath-aware admin link.
|
|
151
|
+
* The sole `fallback` template uses `defineTemplate` (not a plain function) so
|
|
152
|
+
* its render receives `ctx` — needed for the basePath-aware admin link.
|
|
152
153
|
*/
|
|
153
154
|
export const welcomeTheme = defineTheme({
|
|
154
|
-
templates:
|
|
155
|
-
|
|
155
|
+
templates: [
|
|
156
|
+
fallback(defineTemplate({
|
|
156
157
|
render: ({ ctx }) => (_jsx(WelcomeScreen, { basePath: ctx.basePath, strings: welcomeMessages(ctx.locale.code) })),
|
|
157
|
-
}),
|
|
158
|
-
|
|
158
|
+
})),
|
|
159
|
+
],
|
|
159
160
|
// Never index a placeholder — it's a misconfiguration if it reaches prod.
|
|
160
161
|
document: {
|
|
161
162
|
title: "plumix",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"welcome-theme.js","sourceRoot":"","sources":["../src/welcome-theme.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,KAAK,GAAG,SAAS,CAAC;AAExB,qEAAqE;AACrE,0EAA0E;AAC1E,sBAAsB;AACtB,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAuGC,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BpB,CAAC;AAEF,SAAS,aAAa,CAAC,EACrB,QAAQ,EACR,OAAO,GAIR;IACC,OAAO,CACL,gBAAM,SAAS,EAAC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M,CAAC,IAAI,CAAC,GACzC,CACH;SACF,CAAC,CACH;KACF;IACD,0EAA0E;IAC1E,QAAQ,EAAE;QACR,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;KAC/C;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumix/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Plumix core: runtime, auth, data model, and plugin system",
|
|
6
6
|
"license": "MIT",
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
"@libsql/client": "^0.17.4",
|
|
85
85
|
"@lingui/core": "^6.4.0",
|
|
86
86
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
87
|
-
"@orpc/openapi": "^1.14.
|
|
88
|
-
"@orpc/server": "^1.14.
|
|
89
|
-
"@orpc/valibot": "^1.14.
|
|
87
|
+
"@orpc/openapi": "^1.14.8",
|
|
88
|
+
"@orpc/server": "^1.14.8",
|
|
89
|
+
"@orpc/valibot": "^1.14.8",
|
|
90
90
|
"@oslojs/crypto": "^1.0.1",
|
|
91
91
|
"@oslojs/encoding": "^1.1.0",
|
|
92
92
|
"@oslojs/webauthn": "^1.0.0",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"drizzle-valibot": "^0.4.2",
|
|
98
98
|
"fishery": "^2.4.0",
|
|
99
99
|
"valibot": "^1.4.2",
|
|
100
|
-
"@plumix/blocks": "0.
|
|
100
|
+
"@plumix/blocks": "0.3.0"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
103
103
|
"@playwright/test": "^1.61.1",
|
|
@@ -112,14 +112,14 @@
|
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
|
-
"@arethetypeswrong/cli": "^0.18.
|
|
115
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
116
116
|
"@playwright/test": "^1.61.1",
|
|
117
117
|
"@types/node": "^24.13.2",
|
|
118
118
|
"@types/react": "^19.2.17",
|
|
119
119
|
"@types/react-dom": "^19.2.3",
|
|
120
120
|
"@vitest/coverage-v8": "^4.1.10",
|
|
121
121
|
"esbuild": "^0.28.1",
|
|
122
|
-
"eslint": "^10.
|
|
122
|
+
"eslint": "^10.7.0",
|
|
123
123
|
"jsdom": "^29.1.1",
|
|
124
124
|
"prettier": "^3.9.5",
|
|
125
125
|
"publint": "^0.3.21",
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `ArchiveProps` is the discriminated union the shared `archive` /
|
|
3
|
-
* `index` fallback templates receive. Specific templates
|
|
4
|
-
* (`taxonomy-category.tsx`, `single-post.tsx`, …) stay strictly typed
|
|
5
|
-
* via `TemplateProps<K>` — themes that fall through to `archive` accept
|
|
6
|
-
* the wider shape and narrow with `isTaxonomy` / `isEntryArchive`.
|
|
7
|
-
*
|
|
8
|
-
* Mirrors WordPress's `is_tax()` / `is_post_type_archive()` conditional
|
|
9
|
-
* tags, but typed: each predicate also acts as a TypeScript type guard
|
|
10
|
-
* so a single `if (isTaxonomy(props))` branch unlocks `props.term` and
|
|
11
|
-
* `props.taxonomy` without casts.
|
|
12
|
-
*
|
|
13
|
-
* The shape is intentionally minimal at this slice — it carries the
|
|
14
|
-
* fields a fallback template needs to discriminate and render. Slices
|
|
15
|
-
* that add pagination, terms-as-children, and meta widen this without
|
|
16
|
-
* breaking the discriminator.
|
|
17
|
-
*/
|
|
18
|
-
export type ArchiveProps = EntryArchiveProps | TaxonomyArchiveProps;
|
|
19
|
-
export interface EntryArchiveProps {
|
|
20
|
-
readonly kind: "entry-archive";
|
|
21
|
-
readonly entryType: string;
|
|
22
|
-
readonly entries: readonly ArchiveEntry[];
|
|
23
|
-
}
|
|
24
|
-
export interface TaxonomyArchiveProps {
|
|
25
|
-
readonly kind: "taxonomy";
|
|
26
|
-
readonly taxonomy: string;
|
|
27
|
-
readonly term: {
|
|
28
|
-
readonly name: string;
|
|
29
|
-
readonly slug: string;
|
|
30
|
-
};
|
|
31
|
-
readonly entries: readonly ArchiveEntry[];
|
|
32
|
-
}
|
|
33
|
-
export interface ArchiveEntry {
|
|
34
|
-
readonly title: string;
|
|
35
|
-
readonly slug: string;
|
|
36
|
-
}
|
|
37
|
-
export declare function isTaxonomy(props: ArchiveProps, taxonomy?: string): props is TaxonomyArchiveProps;
|
|
38
|
-
export declare function isEntryArchive(props: ArchiveProps, entryType?: string): props is EntryArchiveProps;
|
|
39
|
-
//# sourceMappingURL=archive-props.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"archive-props.d.ts","sourceRoot":"","sources":["../../../src/route/render/archive-props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAEpE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAChE,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,YAAY,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB,KAAK,IAAI,oBAAoB,CAI/B;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,YAAY,EACnB,SAAS,CAAC,EAAE,MAAM,GACjB,KAAK,IAAI,iBAAiB,CAI5B"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `ArchiveProps` is the discriminated union the shared `archive` /
|
|
3
|
-
* `index` fallback templates receive. Specific templates
|
|
4
|
-
* (`taxonomy-category.tsx`, `single-post.tsx`, …) stay strictly typed
|
|
5
|
-
* via `TemplateProps<K>` — themes that fall through to `archive` accept
|
|
6
|
-
* the wider shape and narrow with `isTaxonomy` / `isEntryArchive`.
|
|
7
|
-
*
|
|
8
|
-
* Mirrors WordPress's `is_tax()` / `is_post_type_archive()` conditional
|
|
9
|
-
* tags, but typed: each predicate also acts as a TypeScript type guard
|
|
10
|
-
* so a single `if (isTaxonomy(props))` branch unlocks `props.term` and
|
|
11
|
-
* `props.taxonomy` without casts.
|
|
12
|
-
*
|
|
13
|
-
* The shape is intentionally minimal at this slice — it carries the
|
|
14
|
-
* fields a fallback template needs to discriminate and render. Slices
|
|
15
|
-
* that add pagination, terms-as-children, and meta widen this without
|
|
16
|
-
* breaking the discriminator.
|
|
17
|
-
*/
|
|
18
|
-
export function isTaxonomy(props, taxonomy) {
|
|
19
|
-
if (props.kind !== "taxonomy")
|
|
20
|
-
return false;
|
|
21
|
-
if (taxonomy === undefined)
|
|
22
|
-
return true;
|
|
23
|
-
return props.taxonomy === taxonomy;
|
|
24
|
-
}
|
|
25
|
-
export function isEntryArchive(props, entryType) {
|
|
26
|
-
if (props.kind !== "entry-archive")
|
|
27
|
-
return false;
|
|
28
|
-
if (entryType === undefined)
|
|
29
|
-
return true;
|
|
30
|
-
return props.entryType === entryType;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=archive-props.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"archive-props.js","sourceRoot":"","sources":["../../../src/route/render/archive-props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAsBH,MAAM,UAAU,UAAU,CACxB,KAAmB,EACnB,QAAiB;IAEjB,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACxC,OAAO,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,KAAmB,EACnB,SAAkB;IAElB,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe;QAAE,OAAO,KAAK,CAAC;IACjD,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACzC,OAAO,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC;AACvC,CAAC"}
|