@wikex/admin-kit 0.2.1 → 0.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/admin/before-login.js +2 -1
- package/dist/admin/brand.js +3 -2
- package/dist/admin/header.js +30 -21
- package/dist/admin/logout-button.js +2 -1
- package/dist/admin/nav-client.d.ts +16 -0
- package/dist/admin/nav-client.js +258 -0
- package/dist/admin/nav.d.ts +2 -5
- package/dist/admin/nav.js +5 -259
- package/dist/admin/theme-toggle.js +2 -1
- package/dist/admin/view-site.js +8 -3
- package/dist/{chunk-IL2CUCDG.js → chunk-GMPR6LHH.js} +2 -1
- package/dist/{chunk-W4ZKDOWJ.js → chunk-GZ2B5BTH.js} +2 -0
- package/dist/{chunk-GGSOO4FQ.js → chunk-SAI5SWZA.js} +2 -0
- package/dist/{chunk-LP22Y3NO.js → chunk-SM6CCKQQ.js} +2 -1
- package/dist/chunk-VK4EFLWH.js +119 -0
- package/dist/{chunk-XGKGKCQ6.js → chunk-X7VETFVD.js} +2 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.js +66 -6
- package/dist/live-preview.d.ts +69 -1
- package/dist/live-preview.js +3 -2
- package/dist/project-ClCmpyeX.d.ts +54 -0
- package/dist/project.d.ts +1 -34
- package/dist/rich-text-client.js +2 -1
- package/dist/starter-client.d.ts +45 -4
- package/dist/starter-client.js +7 -6
- package/dist/starter.d.ts +1 -2
- package/dist/text-style-runtime.js +69 -3
- package/package.json +2 -1
- package/dist/chunk-MDMKKWPU.js +0 -12
- package/dist/chunk-YMBJCWN3.js +0 -73
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
type BlockPickerOption = {
|
|
2
|
+
description: string;
|
|
3
|
+
image?: string;
|
|
4
|
+
label: string;
|
|
5
|
+
payloadLabel?: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
};
|
|
8
|
+
type VisualEditorDocumentTarget = {
|
|
9
|
+
collection: string;
|
|
10
|
+
documentID: string;
|
|
11
|
+
kind: 'collection';
|
|
12
|
+
} | {
|
|
13
|
+
global: string;
|
|
14
|
+
kind: 'global';
|
|
15
|
+
};
|
|
16
|
+
type VisualEditorScope = 'content' | 'footer' | 'header';
|
|
17
|
+
type VisualEditorRoute = {
|
|
18
|
+
documentTarget: VisualEditorDocumentTarget | null;
|
|
19
|
+
scope: VisualEditorScope;
|
|
20
|
+
type: 'collection' | 'global';
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type WikexProjectDefinition<TModuleID extends string = string> = {
|
|
24
|
+
admin?: {
|
|
25
|
+
collectionOrder?: readonly string[];
|
|
26
|
+
globalOrder?: readonly string[];
|
|
27
|
+
};
|
|
28
|
+
brand: {
|
|
29
|
+
description: string;
|
|
30
|
+
logo: {
|
|
31
|
+
height: number;
|
|
32
|
+
url: string;
|
|
33
|
+
width: number;
|
|
34
|
+
};
|
|
35
|
+
name: string;
|
|
36
|
+
};
|
|
37
|
+
homepage?: {
|
|
38
|
+
defaultMode: 'builder' | 'preset';
|
|
39
|
+
};
|
|
40
|
+
id: string;
|
|
41
|
+
modules: readonly TModuleID[];
|
|
42
|
+
};
|
|
43
|
+
declare const defineWikexProject: <const TModuleID extends string, const TProject extends WikexProjectDefinition<TModuleID>>(project: TProject) => TProject;
|
|
44
|
+
type VisualEditorRouteRegistry = {
|
|
45
|
+
collections?: readonly string[];
|
|
46
|
+
globals?: Readonly<Record<string, VisualEditorScope>> | readonly string[];
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Creates the route adapter consumed by Live Preview without coupling the admin
|
|
50
|
+
* kit to collection names from a specific website.
|
|
51
|
+
*/
|
|
52
|
+
declare const createVisualEditorRouteResolver: (registry: VisualEditorRouteRegistry) => (pathname: string) => VisualEditorRoute | null;
|
|
53
|
+
|
|
54
|
+
export { type BlockPickerOption as B, type VisualEditorRouteRegistry as V, type WikexProjectDefinition as W, type VisualEditorRoute as a, createVisualEditorRouteResolver as c, defineWikexProject as d };
|
package/dist/project.d.ts
CHANGED
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
type WikexProjectDefinition<TModuleID extends string = string> = {
|
|
4
|
-
admin?: {
|
|
5
|
-
collectionOrder?: readonly string[];
|
|
6
|
-
globalOrder?: readonly string[];
|
|
7
|
-
};
|
|
8
|
-
brand: {
|
|
9
|
-
description: string;
|
|
10
|
-
logo: {
|
|
11
|
-
height: number;
|
|
12
|
-
url: string;
|
|
13
|
-
width: number;
|
|
14
|
-
};
|
|
15
|
-
name: string;
|
|
16
|
-
};
|
|
17
|
-
homepage?: {
|
|
18
|
-
defaultMode: 'builder' | 'preset';
|
|
19
|
-
};
|
|
20
|
-
id: string;
|
|
21
|
-
modules: readonly TModuleID[];
|
|
22
|
-
};
|
|
23
|
-
declare const defineWikexProject: <const TModuleID extends string, const TProject extends WikexProjectDefinition<TModuleID>>(project: TProject) => TProject;
|
|
24
|
-
type VisualEditorRouteRegistry = {
|
|
25
|
-
collections?: readonly string[];
|
|
26
|
-
globals?: Readonly<Record<string, VisualEditorScope>> | readonly string[];
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Creates the route adapter consumed by Live Preview without coupling the admin
|
|
30
|
-
* kit to collection names from a specific website.
|
|
31
|
-
*/
|
|
32
|
-
declare const createVisualEditorRouteResolver: (registry: VisualEditorRouteRegistry) => (pathname: string) => VisualEditorRoute | null;
|
|
33
|
-
|
|
34
|
-
export { type VisualEditorRouteRegistry, type WikexProjectDefinition, createVisualEditorRouteResolver, defineWikexProject };
|
|
1
|
+
export { V as VisualEditorRouteRegistry, W as WikexProjectDefinition, c as createVisualEditorRouteResolver, d as defineWikexProject } from './project-ClCmpyeX.js';
|
package/dist/rich-text-client.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use client";
|
|
2
3
|
import {
|
|
3
4
|
TEXT_FONT_OPTIONS,
|
|
4
5
|
TEXT_LINE_HEIGHT_OPTIONS,
|
|
5
6
|
getTextStyleCSS,
|
|
6
7
|
normalizeTextStyleValue
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-VK4EFLWH.js";
|
|
8
9
|
|
|
9
10
|
// src/rich-text/client.tsx
|
|
10
11
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
package/dist/starter-client.d.ts
CHANGED
|
@@ -1,8 +1,49 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { createContentModule } from '@wikex/content-kit';
|
|
3
|
+
import { b as VisualEditorRoute, B as BlockPickerOption } from './runtimeConfig-BwjQepcW.js';
|
|
4
|
+
|
|
5
|
+
type WikexProjectDefinition<TModuleID extends string = string> = {
|
|
6
|
+
admin?: {
|
|
7
|
+
collectionOrder?: readonly string[];
|
|
8
|
+
globalOrder?: readonly string[];
|
|
9
|
+
};
|
|
10
|
+
brand: {
|
|
11
|
+
description: string;
|
|
12
|
+
logo: {
|
|
13
|
+
height: number;
|
|
14
|
+
url: string;
|
|
15
|
+
width: number;
|
|
16
|
+
};
|
|
17
|
+
name: string;
|
|
18
|
+
};
|
|
19
|
+
homepage?: {
|
|
20
|
+
defaultMode: 'builder' | 'preset';
|
|
21
|
+
};
|
|
22
|
+
id: string;
|
|
23
|
+
modules: readonly TModuleID[];
|
|
24
|
+
};
|
|
25
|
+
declare const defineWikexProject: <const TModuleID extends string, const TProject extends WikexProjectDefinition<TModuleID>>(project: TProject) => TProject;
|
|
26
|
+
|
|
27
|
+
type WikexStarterBrand = {
|
|
28
|
+
description: string;
|
|
29
|
+
logo: {
|
|
30
|
+
height: number;
|
|
31
|
+
url: string;
|
|
32
|
+
width: number;
|
|
33
|
+
};
|
|
34
|
+
name: string;
|
|
35
|
+
};
|
|
36
|
+
type WikexStarter = {
|
|
37
|
+
collections: ReturnType<typeof createContentModule>['collections'];
|
|
38
|
+
getVisualEditorRoute: (pathname: string) => VisualEditorRoute | null;
|
|
39
|
+
livePreview: {
|
|
40
|
+
brand: WikexStarterBrand;
|
|
41
|
+
pageBlocks: readonly BlockPickerOption[];
|
|
42
|
+
postBlocks: readonly BlockPickerOption[];
|
|
43
|
+
};
|
|
44
|
+
plugins: ReturnType<typeof createContentModule>['plugins'];
|
|
45
|
+
project: ReturnType<typeof defineWikexProject>;
|
|
46
|
+
};
|
|
6
47
|
|
|
7
48
|
type LivePreviewConfig = WikexStarter['livePreview'] & {
|
|
8
49
|
getVisualEditorRoute: WikexStarter['getVisualEditorRoute'];
|
package/dist/starter-client.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use client";
|
|
3
|
+
import "./chunk-SM6CCKQQ.js";
|
|
4
|
+
import {
|
|
5
|
+
configureAdminBrand
|
|
6
|
+
} from "./chunk-X7VETFVD.js";
|
|
2
7
|
import {
|
|
3
8
|
LivePreviewEditor_default,
|
|
4
9
|
configureLivePreview
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-LP22Y3NO.js";
|
|
8
|
-
import {
|
|
9
|
-
configureAdminBrand
|
|
10
|
-
} from "./chunk-XGKGKCQ6.js";
|
|
10
|
+
} from "./chunk-GMPR6LHH.js";
|
|
11
|
+
import "./chunk-VK4EFLWH.js";
|
|
11
12
|
|
|
12
13
|
// src/starter/client.tsx
|
|
13
14
|
var createWikexLivePreviewAdapter = ({
|
package/dist/starter.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createContentModule, ContentModuleOptions } from '@wikex/content-kit';
|
|
2
|
-
import {
|
|
3
|
-
import { defineWikexProject } from './project.js';
|
|
2
|
+
import { a as VisualEditorRoute, B as BlockPickerOption, d as defineWikexProject } from './project-ClCmpyeX.js';
|
|
4
3
|
|
|
5
4
|
type WikexStarterBrand = {
|
|
6
5
|
description: string;
|
|
@@ -1,8 +1,74 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use client";
|
|
2
3
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
EDITABLE_PREVIEW_SELECTOR,
|
|
5
|
+
getEditableElementStyleKey,
|
|
6
|
+
getTextStyleCSS,
|
|
7
|
+
normalizeTextStyleMap
|
|
8
|
+
} from "./chunk-VK4EFLWH.js";
|
|
9
|
+
|
|
10
|
+
// src/TextStyleRuntime.tsx
|
|
11
|
+
import { useEffect } from "react";
|
|
12
|
+
var TextStyleRuntime = ({ styles }) => {
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const normalizedStyles = normalizeTextStyleMap(styles);
|
|
15
|
+
const originals = /* @__PURE__ */ new Map();
|
|
16
|
+
let applyFrame = 0;
|
|
17
|
+
const applyStyles = () => {
|
|
18
|
+
const fields = new Set(
|
|
19
|
+
document.querySelectorAll(`[data-wikex-field],${EDITABLE_PREVIEW_SELECTOR}`)
|
|
20
|
+
);
|
|
21
|
+
for (const element of fields) {
|
|
22
|
+
const fieldPath = element.dataset.wikexField || getEditableElementStyleKey(element);
|
|
23
|
+
if (!fieldPath || !normalizedStyles[fieldPath]) continue;
|
|
24
|
+
if (!originals.has(element)) {
|
|
25
|
+
originals.set(element, {
|
|
26
|
+
boxSizing: element.style.boxSizing,
|
|
27
|
+
fontFamily: element.style.fontFamily,
|
|
28
|
+
lineHeight: element.style.lineHeight,
|
|
29
|
+
marginLeft: element.style.marginLeft,
|
|
30
|
+
marginRight: element.style.marginRight,
|
|
31
|
+
maxWidth: element.style.maxWidth,
|
|
32
|
+
width: element.style.width
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const style = getTextStyleCSS(normalizedStyles[fieldPath]);
|
|
36
|
+
element.style.boxSizing = style.boxSizing || "";
|
|
37
|
+
element.style.fontFamily = style.fontFamily || "";
|
|
38
|
+
element.style.lineHeight = style.lineHeight || "";
|
|
39
|
+
element.style.marginLeft = style.marginLeft || "";
|
|
40
|
+
element.style.marginRight = style.marginRight || "";
|
|
41
|
+
element.style.maxWidth = style.maxWidth || "";
|
|
42
|
+
element.style.width = style.width || "";
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const scheduleApplyStyles = () => {
|
|
46
|
+
if (applyFrame) return;
|
|
47
|
+
applyFrame = window.requestAnimationFrame(() => {
|
|
48
|
+
applyFrame = 0;
|
|
49
|
+
applyStyles();
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
applyStyles();
|
|
53
|
+
const observer = new MutationObserver(scheduleApplyStyles);
|
|
54
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
55
|
+
return () => {
|
|
56
|
+
observer.disconnect();
|
|
57
|
+
window.cancelAnimationFrame(applyFrame);
|
|
58
|
+
for (const [element, original] of originals) {
|
|
59
|
+
if (!element.isConnected) continue;
|
|
60
|
+
element.style.boxSizing = original.boxSizing;
|
|
61
|
+
element.style.fontFamily = original.fontFamily;
|
|
62
|
+
element.style.lineHeight = original.lineHeight;
|
|
63
|
+
element.style.marginLeft = original.marginLeft;
|
|
64
|
+
element.style.marginRight = original.marginRight;
|
|
65
|
+
element.style.maxWidth = original.maxWidth;
|
|
66
|
+
element.style.width = original.width;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}, [styles]);
|
|
70
|
+
return null;
|
|
71
|
+
};
|
|
6
72
|
export {
|
|
7
73
|
TextStyleRuntime
|
|
8
74
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wikex/admin-kit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Reusable Payload CMS admin shell, visual editor and typography tools for Wikex projects",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"./admin/header": "./dist/admin/header.js",
|
|
30
30
|
"./admin/logout-button": "./dist/admin/logout-button.js",
|
|
31
31
|
"./admin/nav": "./dist/admin/nav.js",
|
|
32
|
+
"./admin/nav-client": "./dist/admin/nav-client.js",
|
|
32
33
|
"./admin/theme-toggle": "./dist/admin/theme-toggle.js",
|
|
33
34
|
"./admin/view-site": "./dist/admin/view-site.js",
|
|
34
35
|
"./live-preview": "./dist/live-preview.js",
|
package/dist/chunk-MDMKKWPU.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// src/admin/ViewSite.tsx
|
|
2
|
-
import { ArrowUpRight } from "lucide-react";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
var AdminViewSite = () => /* @__PURE__ */ jsxs("a", { className: "admin-view-site", "data-slot": "button", href: "/", rel: "noreferrer", target: "_blank", children: [
|
|
5
|
-
"Xem website",
|
|
6
|
-
/* @__PURE__ */ jsx(ArrowUpRight, { "aria-hidden": "true" })
|
|
7
|
-
] });
|
|
8
|
-
var ViewSite_default = AdminViewSite;
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
ViewSite_default
|
|
12
|
-
};
|
package/dist/chunk-YMBJCWN3.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EDITABLE_PREVIEW_SELECTOR,
|
|
3
|
-
getEditableElementStyleKey,
|
|
4
|
-
getTextStyleCSS,
|
|
5
|
-
normalizeTextStyleMap
|
|
6
|
-
} from "./chunk-BUD6BMFV.js";
|
|
7
|
-
|
|
8
|
-
// src/TextStyleRuntime.tsx
|
|
9
|
-
import { useEffect } from "react";
|
|
10
|
-
var TextStyleRuntime = ({ styles }) => {
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
const normalizedStyles = normalizeTextStyleMap(styles);
|
|
13
|
-
const originals = /* @__PURE__ */ new Map();
|
|
14
|
-
let applyFrame = 0;
|
|
15
|
-
const applyStyles = () => {
|
|
16
|
-
const fields = new Set(
|
|
17
|
-
document.querySelectorAll(`[data-wikex-field],${EDITABLE_PREVIEW_SELECTOR}`)
|
|
18
|
-
);
|
|
19
|
-
for (const element of fields) {
|
|
20
|
-
const fieldPath = element.dataset.wikexField || getEditableElementStyleKey(element);
|
|
21
|
-
if (!fieldPath || !normalizedStyles[fieldPath]) continue;
|
|
22
|
-
if (!originals.has(element)) {
|
|
23
|
-
originals.set(element, {
|
|
24
|
-
boxSizing: element.style.boxSizing,
|
|
25
|
-
fontFamily: element.style.fontFamily,
|
|
26
|
-
lineHeight: element.style.lineHeight,
|
|
27
|
-
marginLeft: element.style.marginLeft,
|
|
28
|
-
marginRight: element.style.marginRight,
|
|
29
|
-
maxWidth: element.style.maxWidth,
|
|
30
|
-
width: element.style.width
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
const style = getTextStyleCSS(normalizedStyles[fieldPath]);
|
|
34
|
-
element.style.boxSizing = style.boxSizing || "";
|
|
35
|
-
element.style.fontFamily = style.fontFamily || "";
|
|
36
|
-
element.style.lineHeight = style.lineHeight || "";
|
|
37
|
-
element.style.marginLeft = style.marginLeft || "";
|
|
38
|
-
element.style.marginRight = style.marginRight || "";
|
|
39
|
-
element.style.maxWidth = style.maxWidth || "";
|
|
40
|
-
element.style.width = style.width || "";
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const scheduleApplyStyles = () => {
|
|
44
|
-
if (applyFrame) return;
|
|
45
|
-
applyFrame = window.requestAnimationFrame(() => {
|
|
46
|
-
applyFrame = 0;
|
|
47
|
-
applyStyles();
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
applyStyles();
|
|
51
|
-
const observer = new MutationObserver(scheduleApplyStyles);
|
|
52
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
53
|
-
return () => {
|
|
54
|
-
observer.disconnect();
|
|
55
|
-
window.cancelAnimationFrame(applyFrame);
|
|
56
|
-
for (const [element, original] of originals) {
|
|
57
|
-
if (!element.isConnected) continue;
|
|
58
|
-
element.style.boxSizing = original.boxSizing;
|
|
59
|
-
element.style.fontFamily = original.fontFamily;
|
|
60
|
-
element.style.lineHeight = original.lineHeight;
|
|
61
|
-
element.style.marginLeft = original.marginLeft;
|
|
62
|
-
element.style.marginRight = original.marginRight;
|
|
63
|
-
element.style.maxWidth = original.maxWidth;
|
|
64
|
-
element.style.width = original.width;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}, [styles]);
|
|
68
|
-
return null;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export {
|
|
72
|
-
TextStyleRuntime
|
|
73
|
-
};
|