@verbb/plugin-kit-core 2.0.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/CHANGELOG.md +48 -0
- package/LICENSE.md +21 -0
- package/README.md +46 -0
- package/dist/eslint/config.base.js +222 -0
- package/dist/eslint/config.react-hooks.js +45 -0
- package/dist/eslint/config.react-typescript.js +9 -0
- package/dist/eslint/config.react.js +10 -0
- package/dist/eslint/config.typescript-only.js +30 -0
- package/dist/eslint/config.typescript.js +7 -0
- package/dist/eslint/config.vite-react.js +5 -0
- package/dist/host/hostBridge.d.ts +40 -0
- package/dist/host/hostBridge.d.ts.map +1 -0
- package/dist/host/index.d.ts +3 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/portal.d.ts +18 -0
- package/dist/host/portal.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/plugin-kit-core.es.js +464 -0
- package/dist/plugin-kit-core.es.js.map +1 -0
- package/dist/plugin-kit-core.umd.js +528 -0
- package/dist/plugin-kit-core.umd.js.map +1 -0
- package/dist/prettier/config.mjs +10 -0
- package/dist/utils/collections.d.ts +79 -0
- package/dist/utils/collections.d.ts.map +1 -0
- package/dist/utils/forms.d.ts +27 -0
- package/dist/utils/forms.d.ts.map +1 -0
- package/dist/utils/handle.d.ts +17 -0
- package/dist/utils/handle.d.ts.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/markdown.d.ts +30 -0
- package/dist/utils/markdown.d.ts.map +1 -0
- package/dist/utils/promises.d.ts +13 -0
- package/dist/utils/promises.d.ts.map +1 -0
- package/dist/utils/query.d.ts +3 -0
- package/dist/utils/query.d.ts.map +1 -0
- package/dist/utils/string.d.ts +16 -0
- package/dist/utils/string.d.ts.map +1 -0
- package/package.json +57 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 2.0.0 - 2026-07-19
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Aligned package version with the Plugin Kit v2 lockstep release (`@verbb/plugin-kit-web`, React/Vue adapters, forms, and related packages).
|
|
9
|
+
- Continues to ship Craft host bridge helpers, shared utils, and ESLint presets for CP frontends.
|
|
10
|
+
|
|
11
|
+
## 1.0.9 - 2026-07-02
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- Released alongside `@verbb/plugin-kit-react` to keep package versions aligned.
|
|
15
|
+
|
|
16
|
+
## 1.0.8 - 2026-06-23
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Released alongside `@verbb/plugin-kit-react` to keep package versions aligned.
|
|
20
|
+
|
|
21
|
+
## 1.0.7 - 2026-06-18
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- Released alongside `@verbb/plugin-kit-react` to keep package versions aligned.
|
|
25
|
+
|
|
26
|
+
## 1.0.6 - 2026-06-14
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
- Released alongside `@verbb/plugin-kit-react` to keep package versions aligned.
|
|
30
|
+
|
|
31
|
+
## 1.0.5 - 2026-06-12
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
- Released alongside `@verbb/plugin-kit-react` to keep package versions aligned.
|
|
35
|
+
|
|
36
|
+
## 1.0.4 - 2026-06-10
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
- Released alongside `@verbb/plugin-kit-react` to keep package versions aligned.
|
|
40
|
+
|
|
41
|
+
## 1.0.1 - 2026-06-07
|
|
42
|
+
|
|
43
|
+
### Changed
|
|
44
|
+
- Released alongside `@verbb/plugin-kit-react` to keep package versions aligned.
|
|
45
|
+
|
|
46
|
+
## 1.0.0
|
|
47
|
+
|
|
48
|
+
- Initial public release.
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Verbb
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# `@verbb/plugin-kit-core`
|
|
2
|
+
|
|
3
|
+
Shared utilities and Craft CP host integration for Plugin Kit. Framework adapters and `@verbb/plugin-kit-web` depend on this package; most apps get it transitively.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @verbb/plugin-kit-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What you get
|
|
12
|
+
|
|
13
|
+
| Area | Examples |
|
|
14
|
+
|------|----------|
|
|
15
|
+
| Host bridge | `setHostBridge`, `getHostBridge`, Craft request / selector helpers |
|
|
16
|
+
| Portal helpers | `setPortalContainer`, `getPortalMountNode`, … |
|
|
17
|
+
| Utils | string/handle helpers, markdown, query, collections, promises |
|
|
18
|
+
| Tooling | `@verbb/plugin-kit-core/eslint/*`, `@verbb/plugin-kit-core/prettier/*` |
|
|
19
|
+
|
|
20
|
+
## Host bridge
|
|
21
|
+
|
|
22
|
+
Prefer the adapter helpers when you use React/Vue:
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { createCraftHostBridge, PluginKitProvider } from '@verbb/plugin-kit-react/utils';
|
|
26
|
+
// or from '@verbb/plugin-kit-vue/utils' / '/app'
|
|
27
|
+
|
|
28
|
+
<PluginKitProvider hostBridge={createCraftHostBridge()} … />
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Low-level (vanilla / custom bootstrap):
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { setHostBridge } from '@verbb/plugin-kit-core';
|
|
35
|
+
|
|
36
|
+
setHostBridge({
|
|
37
|
+
request: (method, action, config) => Craft.sendActionRequest(method, action, config),
|
|
38
|
+
// …
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Skip the bridge when the screen only uses UI primitives.
|
|
43
|
+
|
|
44
|
+
## Docs
|
|
45
|
+
|
|
46
|
+
Shared concepts live under the Web / React / Vue guides on [docs.verbb.io/plugin-kit](https://docs.verbb.io/plugin-kit/).
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
// Global ignores
|
|
6
|
+
{
|
|
7
|
+
ignores: [
|
|
8
|
+
'**/dist/**',
|
|
9
|
+
'**/node_modules/**',
|
|
10
|
+
'**/*.min.js',
|
|
11
|
+
'**/*.bundle.js',
|
|
12
|
+
'**/*.config.js',
|
|
13
|
+
'**/*.config.ts',
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
// Base JavaScript configuration
|
|
18
|
+
{
|
|
19
|
+
files: ['**/*.{js,jsx,mjs,cjs}'],
|
|
20
|
+
languageOptions: {
|
|
21
|
+
ecmaVersion: 2022,
|
|
22
|
+
sourceType: 'module',
|
|
23
|
+
globals: {
|
|
24
|
+
...globals.browser,
|
|
25
|
+
...globals.es2021,
|
|
26
|
+
...globals.node,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
// Global rules used by every config, not specific to any language
|
|
32
|
+
{
|
|
33
|
+
rules: {
|
|
34
|
+
// Inherit recommended rules
|
|
35
|
+
...js.configs.recommended.rules,
|
|
36
|
+
|
|
37
|
+
//
|
|
38
|
+
// Best Practices
|
|
39
|
+
//
|
|
40
|
+
|
|
41
|
+
// enforces return statements in callbacks of array's methods
|
|
42
|
+
'array-callback-return': ['warn', { allowImplicit: true }],
|
|
43
|
+
|
|
44
|
+
// specify curly brace conventions for all control statements
|
|
45
|
+
curly: ['warn', 'all'],
|
|
46
|
+
|
|
47
|
+
// encourages use of dot notation whenever possible
|
|
48
|
+
'dot-notation': ['warn', { allowKeywords: true }],
|
|
49
|
+
|
|
50
|
+
// enforces consistent newlines before or after dots
|
|
51
|
+
'dot-location': ['warn', 'property'],
|
|
52
|
+
|
|
53
|
+
// disallow the use of alert, confirm, and prompt
|
|
54
|
+
'no-alert': 'off',
|
|
55
|
+
|
|
56
|
+
// disallow else after a return in an if
|
|
57
|
+
'no-else-return': ['warn', { allowElseIf: false }],
|
|
58
|
+
|
|
59
|
+
// disallow empty functions, except for standalone funcs/arrows
|
|
60
|
+
'no-empty-function': ['warn', {
|
|
61
|
+
allow: [
|
|
62
|
+
'arrowFunctions',
|
|
63
|
+
'functions',
|
|
64
|
+
'methods',
|
|
65
|
+
],
|
|
66
|
+
}],
|
|
67
|
+
|
|
68
|
+
// disallow use of eval()
|
|
69
|
+
'no-eval': 'warn',
|
|
70
|
+
|
|
71
|
+
// disallow the use of leading or trailing decimal points in numeric literals
|
|
72
|
+
'no-floating-decimal': 'warn',
|
|
73
|
+
|
|
74
|
+
// disallow use of multiple spaces
|
|
75
|
+
'no-multi-spaces': ['warn', {
|
|
76
|
+
ignoreEOLComments: false,
|
|
77
|
+
}],
|
|
78
|
+
|
|
79
|
+
// disallow use of multiline strings
|
|
80
|
+
'no-multi-str': 'warn',
|
|
81
|
+
|
|
82
|
+
// disallow useless string concatenation
|
|
83
|
+
'no-useless-concat': 'warn',
|
|
84
|
+
|
|
85
|
+
// disallow redundant return; keywords
|
|
86
|
+
'no-useless-return': 'warn',
|
|
87
|
+
|
|
88
|
+
// disallow unnecessary escape characters
|
|
89
|
+
'no-useless-escape': 'off',
|
|
90
|
+
|
|
91
|
+
// require or disallow Yoda conditions
|
|
92
|
+
yoda: 'warn',
|
|
93
|
+
|
|
94
|
+
//
|
|
95
|
+
// ES6
|
|
96
|
+
//
|
|
97
|
+
|
|
98
|
+
// require braces in arrow function body
|
|
99
|
+
'arrow-body-style': ['warn', 'always'],
|
|
100
|
+
|
|
101
|
+
// disallow arrow functions where they could be confused with comparisons
|
|
102
|
+
'no-confusing-arrow': ['warn', {
|
|
103
|
+
allowParens: true,
|
|
104
|
+
}],
|
|
105
|
+
|
|
106
|
+
// require let or const instead of var
|
|
107
|
+
'no-var': 'warn',
|
|
108
|
+
|
|
109
|
+
// require method and property shorthand syntax for object literals
|
|
110
|
+
'object-shorthand': ['warn', 'always', {
|
|
111
|
+
ignoreConstructors: false,
|
|
112
|
+
avoidQuotes: true,
|
|
113
|
+
}],
|
|
114
|
+
|
|
115
|
+
// suggest using arrow functions as callbacks
|
|
116
|
+
'prefer-arrow-callback': ['warn', {
|
|
117
|
+
allowNamedFunctions: false,
|
|
118
|
+
allowUnboundThis: true,
|
|
119
|
+
}],
|
|
120
|
+
|
|
121
|
+
// suggest using of const declaration for variables that are never modified after declared
|
|
122
|
+
'prefer-const': ['warn', {
|
|
123
|
+
destructuring: 'any',
|
|
124
|
+
ignoreReadBeforeAssign: true,
|
|
125
|
+
}],
|
|
126
|
+
|
|
127
|
+
// Prefer destructuring from arrays and objects
|
|
128
|
+
'prefer-destructuring': ['warn', {
|
|
129
|
+
VariableDeclarator: {
|
|
130
|
+
array: false,
|
|
131
|
+
object: true,
|
|
132
|
+
},
|
|
133
|
+
AssignmentExpression: {
|
|
134
|
+
array: true,
|
|
135
|
+
object: false,
|
|
136
|
+
},
|
|
137
|
+
}, {
|
|
138
|
+
enforceForRenamedProperties: false,
|
|
139
|
+
}],
|
|
140
|
+
|
|
141
|
+
// suggest using template literals instead of string concatenation
|
|
142
|
+
'prefer-template': 'warn',
|
|
143
|
+
|
|
144
|
+
// import sorting
|
|
145
|
+
'sort-imports': ['off', {
|
|
146
|
+
ignoreCase: false,
|
|
147
|
+
ignoreDeclarationSort: false,
|
|
148
|
+
ignoreMemberSort: false,
|
|
149
|
+
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
|
|
150
|
+
allowSeparatedGroups: true,
|
|
151
|
+
}],
|
|
152
|
+
|
|
153
|
+
//
|
|
154
|
+
// Style
|
|
155
|
+
//
|
|
156
|
+
|
|
157
|
+
// require camel case names
|
|
158
|
+
camelcase: ['warn', { properties: 'always', ignoreDestructuring: true }],
|
|
159
|
+
|
|
160
|
+
// enforce or disallow capitalization of the first letter of a comment
|
|
161
|
+
'capitalized-comments': ['warn', 'always', {
|
|
162
|
+
line: {
|
|
163
|
+
ignorePattern: '.*',
|
|
164
|
+
ignoreInlineComments: true,
|
|
165
|
+
ignoreConsecutiveComments: true,
|
|
166
|
+
},
|
|
167
|
+
block: {
|
|
168
|
+
ignorePattern: '.*',
|
|
169
|
+
ignoreInlineComments: true,
|
|
170
|
+
ignoreConsecutiveComments: true,
|
|
171
|
+
},
|
|
172
|
+
}],
|
|
173
|
+
|
|
174
|
+
// require or disallow an empty line between class members
|
|
175
|
+
'lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: false }],
|
|
176
|
+
|
|
177
|
+
// require or disallow newlines around directives
|
|
178
|
+
'lines-around-directive': ['warn', {
|
|
179
|
+
before: 'always',
|
|
180
|
+
after: 'always',
|
|
181
|
+
}],
|
|
182
|
+
|
|
183
|
+
// disallow if as the only statement in an else block
|
|
184
|
+
'no-lonely-if': 'warn',
|
|
185
|
+
|
|
186
|
+
// disallow multiple empty lines, only one newline at the end, and no new lines at the beginning
|
|
187
|
+
'no-multiple-empty-lines': ['warn', { max: 2, maxBOF: 0, maxEOF: 0 }],
|
|
188
|
+
|
|
189
|
+
// disallow nested ternary expressions
|
|
190
|
+
'no-nested-ternary': 'warn',
|
|
191
|
+
|
|
192
|
+
// Prefer use of an object spread over Object.assign
|
|
193
|
+
'prefer-object-spread': 'warn',
|
|
194
|
+
|
|
195
|
+
// require or disallow a space immediately following the // or /* in a comment
|
|
196
|
+
'spaced-comment': ['warn', 'always', {
|
|
197
|
+
line: {
|
|
198
|
+
exceptions: ['-', '+'],
|
|
199
|
+
markers: ['=', '!', '/'], // space here to support sprockets directives, slash for TS /// comments
|
|
200
|
+
},
|
|
201
|
+
block: {
|
|
202
|
+
exceptions: ['-', '+'],
|
|
203
|
+
markers: ['=', '!', ':', '::'], // space here to support sprockets directives and flow comment types
|
|
204
|
+
balanced: true,
|
|
205
|
+
}
|
|
206
|
+
}],
|
|
207
|
+
|
|
208
|
+
//
|
|
209
|
+
// Variables
|
|
210
|
+
//
|
|
211
|
+
|
|
212
|
+
// disallow use of undeclared variables unless mentioned in a /*global */ block
|
|
213
|
+
'no-undef': 'off',
|
|
214
|
+
|
|
215
|
+
// disallow declaration of variables that are not used in the code
|
|
216
|
+
'no-unused-vars': 'off',
|
|
217
|
+
|
|
218
|
+
// disallow use of variables before they are defined
|
|
219
|
+
'no-use-before-define': ['warn', { functions: true, classes: true, variables: true }],
|
|
220
|
+
},
|
|
221
|
+
}
|
|
222
|
+
]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
2
|
+
|
|
3
|
+
export function createReactHooksConfig({
|
|
4
|
+
jsxFiles = ['**/*.{jsx,tsx}'],
|
|
5
|
+
hookFiles = ['**/use*.{js,ts}', '**/*Hook*.{js,ts}'],
|
|
6
|
+
} = {}) {
|
|
7
|
+
const configs = [];
|
|
8
|
+
|
|
9
|
+
if (jsxFiles.length > 0) {
|
|
10
|
+
configs.push({
|
|
11
|
+
files: jsxFiles,
|
|
12
|
+
languageOptions: {
|
|
13
|
+
parserOptions: {
|
|
14
|
+
ecmaFeatures: {
|
|
15
|
+
jsx: true,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
plugins: {
|
|
20
|
+
'react-hooks': reactHooks,
|
|
21
|
+
},
|
|
22
|
+
rules: {
|
|
23
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
24
|
+
'react-hooks/exhaustive-deps': 'warn',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (hookFiles.length > 0) {
|
|
30
|
+
configs.push({
|
|
31
|
+
files: hookFiles,
|
|
32
|
+
plugins: {
|
|
33
|
+
'react-hooks': reactHooks,
|
|
34
|
+
},
|
|
35
|
+
rules: {
|
|
36
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
37
|
+
'react-hooks/exhaustive-deps': 'warn',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return configs;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default createReactHooksConfig();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import baseConfig from '@verbb/plugin-kit/eslint/config.base.js';
|
|
2
|
+
import reactHooksConfig from '@verbb/plugin-kit/eslint/config.react-hooks.js';
|
|
3
|
+
import typescriptConfig from '@verbb/plugin-kit/eslint/config.typescript-only.js';
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
...baseConfig,
|
|
7
|
+
...typescriptConfig,
|
|
8
|
+
...reactHooksConfig,
|
|
9
|
+
];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import baseConfig from '@verbb/plugin-kit/eslint/config.base.js';
|
|
2
|
+
import { createReactHooksConfig } from '@verbb/plugin-kit/eslint/config.react-hooks.js';
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
...baseConfig,
|
|
6
|
+
...createReactHooksConfig({
|
|
7
|
+
jsxFiles: ['**/*.{js,jsx}'],
|
|
8
|
+
hookFiles: ['**/use*.js', '**/*Hook*.js'],
|
|
9
|
+
}),
|
|
10
|
+
];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import tsParser from '@typescript-eslint/parser';
|
|
2
|
+
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
|
3
|
+
|
|
4
|
+
export function createTypeScriptConfig({ files = ['**/*.{ts,tsx}'] } = {}) {
|
|
5
|
+
return [
|
|
6
|
+
{
|
|
7
|
+
files,
|
|
8
|
+
languageOptions: {
|
|
9
|
+
parser: tsParser,
|
|
10
|
+
parserOptions: {
|
|
11
|
+
ecmaVersion: 'latest',
|
|
12
|
+
sourceType: 'module',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
plugins: {
|
|
16
|
+
'@typescript-eslint': tsPlugin,
|
|
17
|
+
},
|
|
18
|
+
rules: {
|
|
19
|
+
...tsPlugin.configs.recommended.rules,
|
|
20
|
+
|
|
21
|
+
'@typescript-eslint/no-unused-vars': 'warn',
|
|
22
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
23
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
24
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default createTypeScriptConfig();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type HostRequestMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
2
|
+
export type HostRequestConfig = {
|
|
3
|
+
data?: Record<string, unknown>;
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
};
|
|
6
|
+
export type HostSelectedElement = {
|
|
7
|
+
id?: number;
|
|
8
|
+
siteId?: number;
|
|
9
|
+
label?: string;
|
|
10
|
+
url?: string;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
};
|
|
13
|
+
export type HostElementSelectorOptions = {
|
|
14
|
+
storageKey: string;
|
|
15
|
+
sources?: string[];
|
|
16
|
+
criteria?: Record<string, unknown>;
|
|
17
|
+
multiSelect?: boolean;
|
|
18
|
+
limit?: number | null;
|
|
19
|
+
defaultSiteId?: number;
|
|
20
|
+
autoFocusSearchBox?: boolean;
|
|
21
|
+
showSiteMenu?: boolean;
|
|
22
|
+
onShow?: () => void;
|
|
23
|
+
onSelect: (elements: HostSelectedElement[]) => void;
|
|
24
|
+
closeOtherModals?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export type PluginKitHostBridge = {
|
|
27
|
+
request: <T = unknown>(method: HostRequestMethod, action: string, config?: HostRequestConfig) => Promise<T>;
|
|
28
|
+
openElementSelector: (elementType: string, options: HostElementSelectorOptions) => void;
|
|
29
|
+
formatDate: (date: Date) => string;
|
|
30
|
+
getTimepickerOptions: () => Record<string, unknown>;
|
|
31
|
+
getLocale: () => string;
|
|
32
|
+
};
|
|
33
|
+
export declare const setHostBridge: (bridge?: Partial<PluginKitHostBridge>) => void;
|
|
34
|
+
export declare const getHostBridge: () => Partial<PluginKitHostBridge>;
|
|
35
|
+
export declare const hostRequest: <T = unknown>(method: HostRequestMethod, action: string, config?: HostRequestConfig) => Promise<T>;
|
|
36
|
+
export declare const hostOpenElementSelector: (elementType: string, options: HostElementSelectorOptions) => void;
|
|
37
|
+
export declare const hostFormatDate: (date: Date) => string;
|
|
38
|
+
export declare const hostGetTimepickerOptions: () => Record<string, unknown>;
|
|
39
|
+
export declare const hostGetLocale: () => string;
|
|
40
|
+
//# sourceMappingURL=hostBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostBridge.d.ts","sourceRoot":"","sources":["../../src/host/hostBridge.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE5E,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,QAAQ,EAAE,mBAAmB,EAAE,KAAK,IAAI,CAAC;IACpD,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAC9B,OAAO,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5G,mBAAmB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,0BAA0B,KAAK,IAAI,CAAC;IACxF,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;IACnC,oBAAoB,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpD,SAAS,EAAE,MAAM,MAAM,CAAC;CAC3B,CAAC;AAIF,eAAO,MAAM,aAAa,GAAI,SAAQ,OAAO,CAAC,mBAAmB,CAAM,KAAG,IAKzE,CAAC;AAEF,eAAO,MAAM,aAAa,QAAO,OAAO,CAAC,mBAAmB,CAE3D,CAAC;AAcF,eAAO,MAAM,WAAW,GAAU,CAAC,GAAG,OAAO,EACzC,QAAQ,iBAAiB,EACzB,QAAQ,MAAM,EACd,SAAS,iBAAiB,KAC3B,OAAO,CAAC,CAAC,CAGX,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,aAAa,MAAM,EAAE,SAAS,0BAA0B,KAAG,IAGlG,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,IAAI,KAAG,MAG3C,CAAC;AAEF,eAAO,MAAM,wBAAwB,QAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAGjE,CAAC;AAEF,eAAO,MAAM,aAAa,QAAO,MAGhC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type PortalContainer = HTMLElement | ShadowRoot | null;
|
|
2
|
+
export type PortalContainerRef = {
|
|
3
|
+
current: PortalContainer;
|
|
4
|
+
};
|
|
5
|
+
export type PortalContainerInput = PortalContainer | PortalContainerRef;
|
|
6
|
+
export declare const setPortalClassName: (className: string) => void;
|
|
7
|
+
export declare const getPortalClassName: (className?: string) => string | undefined;
|
|
8
|
+
export declare const setPortalContainer: (container: PortalContainerInput) => void;
|
|
9
|
+
export declare const getPortalContainer: (container?: PortalContainerInput) => PortalContainer | undefined;
|
|
10
|
+
export declare const setShadowRootSelectors: (selectors: string[]) => void;
|
|
11
|
+
export declare const getShadowRootSelectors: () => string[];
|
|
12
|
+
/**
|
|
13
|
+
* Resolve where floating content should be portaled.
|
|
14
|
+
* Falls back to document.body when no container is configured.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getPortalMountNode: (container?: PortalContainerInput) => HTMLElement;
|
|
17
|
+
export declare const getPortalTargetForAppend: () => HTMLElement | undefined;
|
|
18
|
+
//# sourceMappingURL=portal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../src/host/portal.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC;AAE9D,MAAM,MAAM,kBAAkB,GAAG;IAC7B,OAAO,EAAE,eAAe,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG,kBAAkB,CAAC;AAMxE,eAAO,MAAM,kBAAkB,GAAI,WAAW,MAAM,KAAG,IAEtD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,YAAY,MAAM,KAAG,MAAM,GAAG,SAEhE,CAAC;AAcF,eAAO,MAAM,kBAAkB,GAAI,WAAW,oBAAoB,KAAG,IAEpE,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,YAAY,oBAAoB,KAAG,eAAe,GAAG,SAEvF,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,WAAW,MAAM,EAAE,KAAG,IAQ5D,CAAC;AAEF,eAAO,MAAM,sBAAsB,QAAO,MAAM,EAE/C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,YAAY,oBAAoB,KAAG,WAmBrE,CAAC;AAEF,eAAO,MAAM,wBAAwB,QAAO,WAAW,GAAG,SAezD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|