straplight 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +83 -0
  3. package/assets/icon.png +0 -0
  4. package/assets/screenshot.png +0 -0
  5. package/dist/_chunks/Settings-BLDXIWWB.js +166 -0
  6. package/dist/_chunks/Settings-CncfOILf.mjs +166 -0
  7. package/dist/_chunks/StraplightOverlay-DLEpUqQM.mjs +506 -0
  8. package/dist/_chunks/StraplightOverlay-dGd1yRZj.js +506 -0
  9. package/dist/_chunks/en-B4KWt_jN.js +4 -0
  10. package/dist/_chunks/en-Byx4XI2L.mjs +4 -0
  11. package/dist/_chunks/index-B2B6CFFk.mjs +82 -0
  12. package/dist/_chunks/index-CuzgWWKQ.js +103 -0
  13. package/dist/admin/index.js +3 -0
  14. package/dist/admin/index.mjs +4 -0
  15. package/dist/admin/src/components/StraplightOverlay.d.ts +1 -0
  16. package/dist/admin/src/components/StraplightPortal.d.ts +6 -0
  17. package/dist/admin/src/hooks/useStraplight.d.ts +23 -0
  18. package/dist/admin/src/hooks/useStraplightSettings.d.ts +6 -0
  19. package/dist/admin/src/index.d.ts +11 -0
  20. package/dist/admin/src/pages/Settings.d.ts +2 -0
  21. package/dist/admin/src/pluginId.d.ts +1 -0
  22. package/dist/admin/src/utils/getTranslation.d.ts +2 -0
  23. package/dist/server/index.js +263 -0
  24. package/dist/server/index.mjs +264 -0
  25. package/dist/server/src/bootstrap.d.ts +5 -0
  26. package/dist/server/src/config/index.d.ts +5 -0
  27. package/dist/server/src/content-types/index.d.ts +2 -0
  28. package/dist/server/src/controllers/controller.d.ts +7 -0
  29. package/dist/server/src/controllers/index.d.ts +14 -0
  30. package/dist/server/src/controllers/settings.d.ts +8 -0
  31. package/dist/server/src/destroy.d.ts +5 -0
  32. package/dist/server/src/index.d.ts +68 -0
  33. package/dist/server/src/middlewares/index.d.ts +2 -0
  34. package/dist/server/src/policies/index.d.ts +2 -0
  35. package/dist/server/src/register.d.ts +5 -0
  36. package/dist/server/src/routes/admin/index.d.ts +12 -0
  37. package/dist/server/src/routes/content-api/index.d.ts +5 -0
  38. package/dist/server/src/routes/index.d.ts +18 -0
  39. package/dist/server/src/services/index.d.ts +15 -0
  40. package/dist/server/src/services/service.d.ts +7 -0
  41. package/dist/server/src/services/settings.d.ts +28 -0
  42. package/dist/server/src/utils/content-type-helpers.d.ts +4 -0
  43. package/package.json +85 -0
@@ -0,0 +1,68 @@
1
+ declare const _default: {
2
+ register: ({ strapi }: {
3
+ strapi: import("@strapi/types/dist/core").Strapi;
4
+ }) => void;
5
+ bootstrap: ({ strapi }: {
6
+ strapi: import("@strapi/types/dist/core").Strapi;
7
+ }) => void;
8
+ destroy: ({ strapi }: {
9
+ strapi: import("@strapi/types/dist/core").Strapi;
10
+ }) => void;
11
+ config: {
12
+ default: {};
13
+ validator(): void;
14
+ };
15
+ controllers: {
16
+ controller: ({ strapi }: {
17
+ strapi: import("@strapi/types/dist/core").Strapi;
18
+ }) => {
19
+ search(ctx: any): Promise<void>;
20
+ };
21
+ settings: ({ strapi }: {
22
+ strapi: import("@strapi/types/dist/core").Strapi;
23
+ }) => {
24
+ getSettings(ctx: any): Promise<void>;
25
+ updateSettings(ctx: any): Promise<void>;
26
+ };
27
+ };
28
+ routes: {
29
+ 'content-api': () => {
30
+ type: string;
31
+ routes: any[];
32
+ };
33
+ /**
34
+ * Plugin server methods
35
+ */
36
+ admin: () => {
37
+ type: string;
38
+ routes: {
39
+ method: string;
40
+ path: string;
41
+ handler: string; /**
42
+ * Plugin server methods
43
+ */
44
+ config: {
45
+ policies: any[];
46
+ };
47
+ }[];
48
+ };
49
+ };
50
+ services: {
51
+ service: ({ strapi }: {
52
+ strapi: import("@strapi/types/dist/core").Strapi;
53
+ }) => {
54
+ search(query: string): Promise<any[]>;
55
+ };
56
+ settings: ({ strapi }: {
57
+ strapi: import("@strapi/types/dist/core").Strapi;
58
+ }) => {
59
+ getSettings(): Promise<import("./services/settings").StraplightSettings>;
60
+ setSettings(newSettings: import("./services/settings").StraplightSettings): Promise<import("./services/settings").StraplightSettings>;
61
+ getContentTypes(): import("./services/settings").ContentTypeInfo[];
62
+ };
63
+ };
64
+ contentTypes: {};
65
+ policies: {};
66
+ middlewares: {};
67
+ };
68
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ declare const register: ({ strapi }: {
3
+ strapi: Core.Strapi;
4
+ }) => void;
5
+ export default register;
@@ -0,0 +1,12 @@
1
+ declare const _default: () => {
2
+ type: string;
3
+ routes: {
4
+ method: string;
5
+ path: string;
6
+ handler: string;
7
+ config: {
8
+ policies: any[];
9
+ };
10
+ }[];
11
+ };
12
+ export default _default;
@@ -0,0 +1,5 @@
1
+ declare const _default: () => {
2
+ type: string;
3
+ routes: any[];
4
+ };
5
+ export default _default;
@@ -0,0 +1,18 @@
1
+ declare const routes: {
2
+ 'content-api': () => {
3
+ type: string;
4
+ routes: any[];
5
+ };
6
+ admin: () => {
7
+ type: string;
8
+ routes: {
9
+ method: string;
10
+ path: string;
11
+ handler: string;
12
+ config: {
13
+ policies: any[];
14
+ };
15
+ }[];
16
+ };
17
+ };
18
+ export default routes;
@@ -0,0 +1,15 @@
1
+ declare const _default: {
2
+ service: ({ strapi }: {
3
+ strapi: import("@strapi/types/dist/core").Strapi;
4
+ }) => {
5
+ search(query: string): Promise<any[]>;
6
+ };
7
+ settings: ({ strapi }: {
8
+ strapi: import("@strapi/types/dist/core").Strapi;
9
+ }) => {
10
+ getSettings(): Promise<import("./settings").StraplightSettings>;
11
+ setSettings(newSettings: import("./settings").StraplightSettings): Promise<import("./settings").StraplightSettings>;
12
+ getContentTypes(): import("./settings").ContentTypeInfo[];
13
+ };
14
+ };
15
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ declare const service: ({ strapi }: {
3
+ strapi: Core.Strapi;
4
+ }) => {
5
+ search(query: string): Promise<any[]>;
6
+ };
7
+ export default service;
@@ -0,0 +1,28 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ interface ContentTypeSettings {
3
+ enabled: boolean;
4
+ displayFields: string[];
5
+ }
6
+ export interface StraplightSettings {
7
+ debounceMs: number;
8
+ minQueryLength: number;
9
+ contentTypes: Record<string, ContentTypeSettings>;
10
+ }
11
+ export interface ContentTypeInfo {
12
+ uid: string;
13
+ displayName: string;
14
+ fields: {
15
+ name: string;
16
+ type: string;
17
+ target?: string;
18
+ }[];
19
+ mainField: string;
20
+ }
21
+ declare const settings: ({ strapi }: {
22
+ strapi: Core.Strapi;
23
+ }) => {
24
+ getSettings(): Promise<StraplightSettings>;
25
+ setSettings(newSettings: StraplightSettings): Promise<StraplightSettings>;
26
+ getContentTypes(): ContentTypeInfo[];
27
+ };
28
+ export default settings;
@@ -0,0 +1,4 @@
1
+ export declare const STRING_FIELD_TYPES: Set<string>;
2
+ export declare const MAIN_FIELD_CANDIDATES: string[];
3
+ export declare function getMainField(schema: any): string | null;
4
+ export declare function getSearchableFields(schema: any): string[];
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "straplight",
3
+ "version": "1.1.0",
4
+ "description": "Spotlight-like search for Strapi admin",
5
+ "license": "MIT",
6
+ "author": "Bartosz Gamza",
7
+ "keywords": [
8
+ "strapi",
9
+ "strapi-plugin",
10
+ "search",
11
+ "spotlight",
12
+ "cmd-k",
13
+ "command-palette"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/bartoszgamza/straplight.git"
18
+ },
19
+ "homepage": "https://github.com/bartoszgamza/straplight#readme",
20
+ "bugs": {
21
+ "url": "https://github.com/bartoszgamza/straplight/issues"
22
+ },
23
+ "type": "commonjs",
24
+ "exports": {
25
+ "./package.json": "./package.json",
26
+ "./strapi-admin": {
27
+ "types": "./dist/admin/src/index.d.ts",
28
+ "source": "./admin/src/index.ts",
29
+ "import": "./dist/admin/index.mjs",
30
+ "require": "./dist/admin/index.js",
31
+ "default": "./dist/admin/index.js"
32
+ },
33
+ "./strapi-server": {
34
+ "types": "./dist/server/src/index.d.ts",
35
+ "source": "./server/src/index.ts",
36
+ "import": "./dist/server/index.mjs",
37
+ "require": "./dist/server/index.js",
38
+ "default": "./dist/server/index.js"
39
+ }
40
+ },
41
+ "files": [
42
+ "dist",
43
+ "assets"
44
+ ],
45
+ "scripts": {
46
+ "build": "strapi-plugin build",
47
+ "watch": "strapi-plugin watch",
48
+ "watch:link": "strapi-plugin watch:link",
49
+ "verify": "strapi-plugin verify",
50
+ "test:ts:front": "run -T tsc -p admin/tsconfig.json",
51
+ "test:ts:back": "run -T tsc -p server/tsconfig.json"
52
+ },
53
+ "dependencies": {
54
+ "@strapi/design-system": "^2.0.0-rc.30",
55
+ "@strapi/icons": "^2.0.0-rc.30",
56
+ "react-intl": "^8.1.3"
57
+ },
58
+ "devDependencies": {
59
+ "@strapi/sdk-plugin": "^5.4.0",
60
+ "@strapi/strapi": "^5.35.0",
61
+ "@strapi/typescript-utils": "^5.35.0",
62
+ "@types/react": "^19.2.13",
63
+ "@types/react-dom": "^19.2.3",
64
+ "prettier": "^3.8.1",
65
+ "react": "^18.3.1",
66
+ "react-dom": "^18.3.1",
67
+ "react-router-dom": "^6.30.3",
68
+ "styled-components": "^6.3.8",
69
+ "typescript": "^5.9.3"
70
+ },
71
+ "peerDependencies": {
72
+ "@strapi/strapi": "^5.35.0",
73
+ "@strapi/sdk-plugin": "^5.4.0",
74
+ "react": "^18.3.1",
75
+ "react-dom": "^18.3.1",
76
+ "react-router-dom": "^6.30.3",
77
+ "styled-components": "^6.3.8"
78
+ },
79
+ "strapi": {
80
+ "kind": "plugin",
81
+ "name": "straplight",
82
+ "displayName": "Straplight",
83
+ "description": "Spotlight-like search for Strapi admin"
84
+ }
85
+ }