@acmekit/admin-sdk 2.13.1

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 ADDED
@@ -0,0 +1 @@
1
+ # @acmekit/admin-sdk
@@ -0,0 +1,55 @@
1
+ import { NestedRoutePosition, InjectionZone } from '@acmekit/admin-shared';
2
+ import { ComponentType } from 'react';
3
+
4
+ interface WidgetConfig {
5
+ /**
6
+ * The injection zone or zones that the widget should be injected into.
7
+ */
8
+ zone: InjectionZone | InjectionZone[];
9
+ }
10
+ interface RouteConfig {
11
+ /**
12
+ * An optional label to display in the sidebar. If not provided, the route will not be displayed in the sidebar.
13
+ */
14
+ label?: string;
15
+ /**
16
+ * An optional icon to display in the sidebar together with the label. If no label is provided, the icon will be ignored.
17
+ */
18
+ icon?: ComponentType;
19
+ /**
20
+ * The nested route to display under existing route in the sidebar.
21
+ */
22
+ nested?: NestedRoutePosition;
23
+ /**
24
+ * The ranking of the route among sibling routes. Routes are sorted in ascending order (lower rank appears first).
25
+ * If not provided, the route will be ranked after all routes with explicit ranks.
26
+ */
27
+ rank?: number;
28
+ /**
29
+ * An optional i18n namespace for translating the label. When provided, the label will be treated as a translation key.
30
+ * @example
31
+ * ```ts
32
+ * label: "menuItems.customFeature"
33
+ * translationNs: "my-plugin"
34
+ * // Will translate using: t("menuItems.customFeature", { ns: "my-plugin" })
35
+ * ```
36
+ */
37
+ translationNs?: string;
38
+ }
39
+
40
+ /**
41
+ * Define a widget configuration.
42
+ *
43
+ * @param config The widget configuration.
44
+ * @returns The widget configuration.
45
+ */
46
+ declare function defineWidgetConfig(config: WidgetConfig): WidgetConfig;
47
+ /**
48
+ * Define a route configuration.
49
+ *
50
+ * @param config The route configuration.
51
+ * @returns The route configuration.
52
+ */
53
+ declare function defineRouteConfig(config: RouteConfig): RouteConfig;
54
+
55
+ export { type RouteConfig, type WidgetConfig, defineRouteConfig, defineWidgetConfig };
@@ -0,0 +1,55 @@
1
+ import { NestedRoutePosition, InjectionZone } from '@acmekit/admin-shared';
2
+ import { ComponentType } from 'react';
3
+
4
+ interface WidgetConfig {
5
+ /**
6
+ * The injection zone or zones that the widget should be injected into.
7
+ */
8
+ zone: InjectionZone | InjectionZone[];
9
+ }
10
+ interface RouteConfig {
11
+ /**
12
+ * An optional label to display in the sidebar. If not provided, the route will not be displayed in the sidebar.
13
+ */
14
+ label?: string;
15
+ /**
16
+ * An optional icon to display in the sidebar together with the label. If no label is provided, the icon will be ignored.
17
+ */
18
+ icon?: ComponentType;
19
+ /**
20
+ * The nested route to display under existing route in the sidebar.
21
+ */
22
+ nested?: NestedRoutePosition;
23
+ /**
24
+ * The ranking of the route among sibling routes. Routes are sorted in ascending order (lower rank appears first).
25
+ * If not provided, the route will be ranked after all routes with explicit ranks.
26
+ */
27
+ rank?: number;
28
+ /**
29
+ * An optional i18n namespace for translating the label. When provided, the label will be treated as a translation key.
30
+ * @example
31
+ * ```ts
32
+ * label: "menuItems.customFeature"
33
+ * translationNs: "my-plugin"
34
+ * // Will translate using: t("menuItems.customFeature", { ns: "my-plugin" })
35
+ * ```
36
+ */
37
+ translationNs?: string;
38
+ }
39
+
40
+ /**
41
+ * Define a widget configuration.
42
+ *
43
+ * @param config The widget configuration.
44
+ * @returns The widget configuration.
45
+ */
46
+ declare function defineWidgetConfig(config: WidgetConfig): WidgetConfig;
47
+ /**
48
+ * Define a route configuration.
49
+ *
50
+ * @param config The route configuration.
51
+ * @returns The route configuration.
52
+ */
53
+ declare function defineRouteConfig(config: RouteConfig): RouteConfig;
54
+
55
+ export { type RouteConfig, type WidgetConfig, defineRouteConfig, defineWidgetConfig };
package/dist/index.js ADDED
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ defineRouteConfig: () => defineRouteConfig,
24
+ defineWidgetConfig: () => defineWidgetConfig
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+
28
+ // src/config/utils.ts
29
+ var import_zod = require("zod");
30
+ function createConfigHelper(config) {
31
+ return {
32
+ ...config,
33
+ /**
34
+ * This property is required to allow the config to be exported,
35
+ * while still allowing HMR to work correctly.
36
+ *
37
+ * It tricks Fast Refresh into thinking that the config is a React component,
38
+ * which allows it to be updated without a full page reload.
39
+ */
40
+ $$typeof: Symbol.for("react.memo")
41
+ };
42
+ }
43
+ function defineWidgetConfig(config) {
44
+ return createConfigHelper(config);
45
+ }
46
+ function defineRouteConfig(config) {
47
+ return createConfigHelper(config);
48
+ }
49
+ // Annotate the CommonJS export names for ESM import in node:
50
+ 0 && (module.exports = {
51
+ defineRouteConfig,
52
+ defineWidgetConfig
53
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,25 @@
1
+ // src/config/utils.ts
2
+ import { z } from "zod";
3
+ function createConfigHelper(config) {
4
+ return {
5
+ ...config,
6
+ /**
7
+ * This property is required to allow the config to be exported,
8
+ * while still allowing HMR to work correctly.
9
+ *
10
+ * It tricks Fast Refresh into thinking that the config is a React component,
11
+ * which allows it to be updated without a full page reload.
12
+ */
13
+ $$typeof: Symbol.for("react.memo")
14
+ };
15
+ }
16
+ function defineWidgetConfig(config) {
17
+ return createConfigHelper(config);
18
+ }
19
+ function defineRouteConfig(config) {
20
+ return createConfigHelper(config);
21
+ }
22
+ export {
23
+ defineRouteConfig,
24
+ defineWidgetConfig
25
+ };
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@acmekit/admin-sdk",
3
+ "description": "SDK for building extension for the AcmeKit admin dashboard.",
4
+ "version": "2.13.1",
5
+ "author": "Kasper Kristensen <kasper@acmekit.com>",
6
+ "types": "dist/index.d.ts",
7
+ "main": "dist/index.js",
8
+ "module": "dist/index.mjs",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/acmekit/acmekit",
12
+ "directory": "packages/admin/admin-sdk"
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "package.json"
17
+ ],
18
+ "scripts": {
19
+ "build": "yarn run -T tsup"
20
+ },
21
+ "dependencies": {
22
+ "@acmekit/admin-shared": "2.13.1",
23
+ "zod": "3.25.76"
24
+ },
25
+ "packageManager": "yarn@3.2.1"
26
+ }