@kardalum/plugin-sdk 0.17.0 → 0.19.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 +109 -0
- package/README.md +4 -3
- package/dist/assets/asset-picker.d.ts +11 -0
- package/dist/assets/asset-picker.js +109 -0
- package/dist/assets/asset-tree.d.ts +30 -0
- package/dist/assets/asset-tree.js +150 -0
- package/dist/built-in-editor-ids.d.ts +1 -0
- package/dist/built-in-editor-ids.js +20 -0
- package/dist/built-in-serializers.js +1 -1
- package/dist/built-in-settings-schemas.d.ts +2 -0
- package/dist/built-in-settings-schemas.js +31 -4
- package/dist/built-in-value-schemas.js +3 -0
- package/dist/built-ins.js +20 -11
- package/dist/capabilities.js +5 -0
- package/dist/data-type-plugin.d.ts +2 -2
- package/dist/datatype-validation.d.ts +2 -2
- package/dist/datatype-validation.js +20 -6
- package/dist/datatypes-entry.d.ts +1 -0
- package/dist/datatypes-entry.js +1 -0
- package/dist/define-plugin.d.ts +4 -4
- package/dist/define-plugin.js +5 -5
- package/dist/entitlement-entry.d.ts +3 -2
- package/dist/entitlement-entry.js +13 -1
- package/dist/entitlement-gate.d.ts +18 -0
- package/dist/entitlement-gate.js +95 -21
- package/dist/entitlement-plan.d.ts +21 -0
- package/dist/entitlement-plan.js +26 -0
- package/dist/entitlement-types.d.ts +21 -4
- package/dist/entitlement.d.ts +29 -1
- package/dist/entitlement.js +39 -0
- package/dist/grid-arrow-step.d.ts +7 -0
- package/dist/grid-arrow-step.js +20 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +11 -12
- package/dist/manifest-entry.d.ts +4 -0
- package/dist/manifest-entry.js +4 -0
- package/dist/manifest-schema.d.ts +5 -1
- package/dist/manifest-schema.js +14 -2
- package/dist/manifest.d.ts +21 -1
- package/dist/media/media-picker.js +34 -34
- package/dist/notify.d.ts +17 -0
- package/dist/notify.js +17 -0
- package/dist/plugin-context.js +3 -3
- package/dist/register-built-ins.js +6 -6
- package/dist/registry.js +1 -1
- package/dist/richtext/block-panel.js +19 -20
- package/dist/richtext/extensions.js +17 -8
- package/dist/richtext/insert-menu.js +4 -4
- package/dist/richtext/kardalum-block.js +17 -17
- package/dist/richtext/style-listbox.js +2 -2
- package/dist/richtext/text-style-class.js +1 -1
- package/dist/richtext-html-entry.d.ts +35 -0
- package/dist/richtext-html-entry.js +73 -0
- package/dist/simple-storage-value-provider.js +3 -3
- package/dist/structured-storage-types.d.ts +12 -1
- package/dist/structured-storage-types.js +2 -2
- package/dist/tailwind.js +10 -3
- package/dist/tokens/tailwind-theme.css +176 -0
- package/dist/tokens/tokens.css +1 -0
- package/dist/tokens/tokens.json +2 -1
- package/dist/ui-entry.js +3 -3
- package/dist/vendor-check.d.ts +39 -0
- package/dist/vendor-check.js +79 -0
- package/dist/vendor-entry.d.ts +3 -0
- package/dist/vendor-entry.js +9 -0
- package/dist/vendor-service.d.ts +20 -0
- package/dist/vendor-service.js +20 -0
- package/dist/views/asset-view.d.ts +6 -0
- package/dist/views/asset-view.js +55 -0
- package/dist/views/content-list-settings-view.js +1 -1
- package/dist/views/content-list-view.js +1 -1
- package/dist/views/date-range-view.js +5 -5
- package/dist/views/html-code-editor.js +2 -3
- package/dist/views/html-view.js +7 -7
- package/dist/views/image-view.js +5 -5
- package/dist/views/rich-text-view.js +33 -32
- package/node_modules/@kardalum/api-schemas/README.md +1 -1
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +17 -15
- package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.d.ts +21 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.js +42 -0
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +10 -3
- package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.d.ts +36 -0
- package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.js +46 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +30 -9
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -3
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +12 -6
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +11 -6
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +50 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +26 -6
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +6 -3
- package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.js +28 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +56 -6
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +8 -8
- package/node_modules/@kardalum/api-schemas/dist/home.schema.d.ts +130 -0
- package/node_modules/@kardalum/api-schemas/dist/home.schema.js +87 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +48 -19
- package/node_modules/@kardalum/api-schemas/dist/index.js +34 -12
- package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.d.ts +46 -0
- package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.js +52 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +162 -1
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +144 -9
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +17 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +15 -9
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +4 -4
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +5 -5
- package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +93 -0
- package/node_modules/@kardalum/api-schemas/dist/news.schema.js +86 -0
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +410 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +193 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +86 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +92 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +7 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.js +1 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +251 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +196 -31
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +19 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +33 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +3 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +10 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +24 -4
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +23 -20
- package/node_modules/@kardalum/api-schemas/dist/render-editing.js +4 -4
- package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.d.ts +83 -0
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +73 -0
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +207 -0
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +147 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +17 -8
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +14 -0
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +3 -3
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +27 -12
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +22 -10
- package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +6 -1
- package/node_modules/@kardalum/api-schemas/dist/uuid.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/uuid.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +88 -0
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +100 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +5 -0
- package/node_modules/@kardalum/design-tokens/README.md +1 -1
- package/node_modules/@kardalum/design-tokens/dist/build-css.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +2 -2
- package/node_modules/@kardalum/design-tokens/dist/build-theme-css.d.ts +16 -0
- package/node_modules/@kardalum/design-tokens/dist/build-theme-css.js +76 -0
- package/node_modules/@kardalum/design-tokens/dist/generate.js +4 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +176 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +3 -3
- package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +2 -2
- package/node_modules/@kardalum/design-tokens/dist/theme-css.js +2 -2
- package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +2 -2
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +3 -3
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +3 -3
- package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/themes/light.js +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +3 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +6 -5
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +2 -1
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +2 -1
- package/node_modules/@kardalum/design-tokens/dist/types.js +1 -1
- package/node_modules/@kardalum/design-tokens/package.json +6 -3
- package/node_modules/@kardalum/plugin-package/README.md +1 -1
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +4 -4
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +54 -6
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +18 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +9 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +58 -1
- package/node_modules/@kardalum/plugin-package/dist/envelope.d.ts +2 -2
- package/node_modules/@kardalum/plugin-package/dist/envelope.js +2 -2
- package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +3 -3
- package/node_modules/@kardalum/plugin-package/dist/extract.js +10 -10
- package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/hash.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +4 -2
- package/node_modules/@kardalum/plugin-package/dist/index.js +3 -1
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +56 -19
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +119 -25
- package/node_modules/@kardalum/plugin-package/dist/package-contract.d.ts +2 -2
- package/node_modules/@kardalum/plugin-package/dist/package-contract.js +5 -5
- package/node_modules/@kardalum/plugin-package/dist/types.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/vendor-token.d.ts +24 -0
- package/node_modules/@kardalum/plugin-package/dist/vendor-token.js +118 -0
- package/node_modules/@kardalum/ui/README.md +1 -1
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +8 -3
- package/node_modules/@kardalum/ui/dist/components/badge.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/button.js +2 -2
- package/node_modules/@kardalum/ui/dist/components/checkbox.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.js +52 -4
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +5 -1
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +20 -7
- package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +4 -4
- package/node_modules/@kardalum/ui/dist/components/input.js +6 -1
- package/node_modules/@kardalum/ui/dist/components/popover-panel.d.ts +4 -0
- package/node_modules/@kardalum/ui/dist/components/popover-panel.js +13 -0
- package/node_modules/@kardalum/ui/dist/components/property-field.js +3 -3
- package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/sheet.js +15 -9
- package/node_modules/@kardalum/ui/dist/components/skeleton.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +3 -3
- package/node_modules/@kardalum/ui/dist/components/tab-strip.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/toast.js +4 -3
- package/node_modules/@kardalum/ui/dist/components/tooltip.d.ts +27 -0
- package/node_modules/@kardalum/ui/dist/components/tooltip.js +82 -0
- package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +11 -0
- package/node_modules/@kardalum/ui/dist/components/truncated-text.js +94 -0
- package/node_modules/@kardalum/ui/dist/components/use-toast.js +2 -2
- package/node_modules/@kardalum/ui/dist/index.d.ts +4 -1
- package/node_modules/@kardalum/ui/dist/index.js +4 -1
- package/node_modules/@kardalum/ui/dist/lib/menu-host.d.ts +5 -0
- package/node_modules/@kardalum/ui/dist/lib/menu-host.js +17 -0
- package/node_modules/@kardalum/ui/package.json +8 -6
- package/package.json +21 -7
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
import type { LicenseVerdictEnvelope } from "@kardalum/plugin-package";
|
|
1
|
+
import type { LicenseVerdictEnvelope, LicenseVerdictTerm } from "@kardalum/plugin-package";
|
|
2
2
|
import type { ScopedStructuredStorage } from "./structured-storage-types.js";
|
|
3
|
-
|
|
3
|
+
import type { PluginVendorService } from "./vendor-service.js";
|
|
4
|
+
export type { LicenseVerdictEnvelope, LicenseVerdictTerm };
|
|
5
|
+
/** A live plan of the plugin's marketplace listing, as the listing API
|
|
6
|
+
* names it (S316). `shape` is "free", "one_time", "monthly" or "yearly". */
|
|
7
|
+
export interface ListingPlanSummary {
|
|
8
|
+
key: string;
|
|
9
|
+
shape: string;
|
|
10
|
+
priceCents: number;
|
|
11
|
+
position: number;
|
|
12
|
+
}
|
|
4
13
|
/** The host's latest authentic licence verdict for a plugin, exactly as the
|
|
5
14
|
* marketplace signed it, whatever its status: a revoked or invalid one makes
|
|
6
|
-
* `requireEntitlement` answer `not-valid`.
|
|
15
|
+
* `requireEntitlement` answer `not-valid`. `termSignature` (S317) covers the
|
|
16
|
+
* envelope's `planId` and `term`; a host built before S317 hands none, and
|
|
17
|
+
* the plan then reads as unknown. */
|
|
7
18
|
export type EntitlementVerdict = {
|
|
8
19
|
kind: "verdict";
|
|
9
20
|
envelope: LicenseVerdictEnvelope;
|
|
10
21
|
signature: string;
|
|
22
|
+
termSignature?: string;
|
|
11
23
|
};
|
|
12
24
|
/** What the host hands a plugin (S284b fix wave: a tagged value, so "no
|
|
13
25
|
* check needed here" and "no verdict" can never be read as each other).
|
|
@@ -20,10 +32,14 @@ export type EntitlementVerdict = {
|
|
|
20
32
|
* - `none`: the host holds no verdict for this plugin (a free plugin, or a
|
|
21
33
|
* paid one whose verdict was never stored). `requireEntitlement` refuses
|
|
22
34
|
* with `missing`. A free plugin never calls it.
|
|
23
|
-
* - `verdict`: check it with `requireEntitlement`.
|
|
35
|
+
* - `verdict`: check it with `requireEntitlement`.
|
|
36
|
+
*
|
|
37
|
+
* `listingPlans` (S317) are the listing's live plans when the host knows
|
|
38
|
+
* them, so `entitlementPlan` can give a local evaluation the highest plan. */
|
|
24
39
|
export type Entitlement = {
|
|
25
40
|
kind: "exempt";
|
|
26
41
|
reason: "non-production";
|
|
42
|
+
listingPlans?: ListingPlanSummary[];
|
|
27
43
|
} | EntitlementVerdict | {
|
|
28
44
|
kind: "none";
|
|
29
45
|
};
|
|
@@ -36,4 +52,5 @@ export type EntitlementErrorCode = "missing" | "invalid-signature" | "wrong-plug
|
|
|
36
52
|
export type PluginTaskContext = {
|
|
37
53
|
entitlement: Entitlement;
|
|
38
54
|
structuredStorage?: ScopedStructuredStorage;
|
|
55
|
+
vendorService?: PluginVendorService;
|
|
39
56
|
};
|
package/dist/entitlement.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type LicenseVerdictEnvelope, type TrustedKey } from "@kardalum/plugin-package";
|
|
2
|
-
import type {
|
|
2
|
+
import type { EntitlementPlan } from "./entitlement-plan.js";
|
|
3
|
+
import type { Entitlement, EntitlementErrorCode, ListingPlanSummary } from "./entitlement-types.js";
|
|
3
4
|
import type { ScopedStructuredStorage } from "./structured-storage-types.js";
|
|
4
5
|
export declare class EntitlementError extends Error {
|
|
5
6
|
readonly code: EntitlementErrorCode;
|
|
@@ -55,3 +56,30 @@ export interface RequireEntitlementOptions {
|
|
|
55
56
|
* a future-dated verdict.
|
|
56
57
|
*/
|
|
57
58
|
export declare function requireEntitlement(entitlement: Entitlement | null | undefined, opts: RequireEntitlementOptions): Promise<LicenseVerdictEnvelope | null>;
|
|
59
|
+
/** S318: what `entitlementPlan` needs beside the entitlement. */
|
|
60
|
+
export interface EntitlementPlanOptions {
|
|
61
|
+
/** The plugin's own id: a verdict issued for another plugin reads as null. */
|
|
62
|
+
pluginId: string;
|
|
63
|
+
listingPlans?: readonly ListingPlanSummary[];
|
|
64
|
+
trustedKeys?: TrustedKey[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* S317 (spec 3d): the plan and the term beside `requireEntitlement`, never
|
|
68
|
+
* instead of it. It does not decide entitlement: call it after
|
|
69
|
+
* `requireEntitlement` resolved, to choose what the plan unlocks.
|
|
70
|
+
*
|
|
71
|
+
* - `verdict`: the signed `planId` and `term` when the verdict's signature
|
|
72
|
+
* and its `termSignature` verify; a verdict without them (one from before
|
|
73
|
+
* S317, or a host that hands no term signature) reads as plan unknown,
|
|
74
|
+
* term active. A verdict that does not verify is null.
|
|
75
|
+
* - `exempt` (a non-production install): the highest plan of
|
|
76
|
+
* `listingPlans`, or of the plans the host handed, term active; plan
|
|
77
|
+
* unknown when neither is known.
|
|
78
|
+
* - `none`, null or undefined: null.
|
|
79
|
+
* - A verdict of another plugin id, or whose status is not `valid`: null,
|
|
80
|
+
* as `requireEntitlement` would refuse it.
|
|
81
|
+
*
|
|
82
|
+
* A lapsed or past-due term still comes with a `valid` verdict (S317 D4):
|
|
83
|
+
* reads go on working, and the term is the signal for what to refuse.
|
|
84
|
+
*/
|
|
85
|
+
export declare function entitlementPlan(entitlement: Entitlement | null | undefined, opts: EntitlementPlanOptions): EntitlementPlan | null;
|
package/dist/entitlement.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
// value, so an operator who flips the host's database still has to patch
|
|
13
13
|
// signed, watermarked plugin code to get that work for free.
|
|
14
14
|
import { ENTITLEMENT_MAX_AGE_MS, MAX_VERDICT_AGE_MS, verifyLicenseVerdictSignature, } from "@kardalum/plugin-package";
|
|
15
|
+
import { highestListingPlan, planFromEnvelope, UNKNOWN_TERM } from "./entitlement-plan.js";
|
|
15
16
|
import { LICENSE_VERDICT_PUBLIC_KEYS } from "./license-verdict-keys.js";
|
|
16
17
|
import { isLocalHost } from "./local-host.js";
|
|
17
18
|
const ERROR_CODES = ["missing", "invalid-signature", "wrong-plugin", "not-valid", "expired"];
|
|
@@ -168,3 +169,41 @@ export async function requireEntitlement(entitlement, opts) {
|
|
|
168
169
|
}
|
|
169
170
|
return envelope;
|
|
170
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* S317 (spec 3d): the plan and the term beside `requireEntitlement`, never
|
|
174
|
+
* instead of it. It does not decide entitlement: call it after
|
|
175
|
+
* `requireEntitlement` resolved, to choose what the plan unlocks.
|
|
176
|
+
*
|
|
177
|
+
* - `verdict`: the signed `planId` and `term` when the verdict's signature
|
|
178
|
+
* and its `termSignature` verify; a verdict without them (one from before
|
|
179
|
+
* S317, or a host that hands no term signature) reads as plan unknown,
|
|
180
|
+
* term active. A verdict that does not verify is null.
|
|
181
|
+
* - `exempt` (a non-production install): the highest plan of
|
|
182
|
+
* `listingPlans`, or of the plans the host handed, term active; plan
|
|
183
|
+
* unknown when neither is known.
|
|
184
|
+
* - `none`, null or undefined: null.
|
|
185
|
+
* - A verdict of another plugin id, or whose status is not `valid`: null,
|
|
186
|
+
* as `requireEntitlement` would refuse it.
|
|
187
|
+
*
|
|
188
|
+
* A lapsed or past-due term still comes with a `valid` verdict (S317 D4):
|
|
189
|
+
* reads go on working, and the term is the signal for what to refuse.
|
|
190
|
+
*/
|
|
191
|
+
export function entitlementPlan(entitlement, opts) {
|
|
192
|
+
if (entitlement === null || entitlement === undefined || typeof entitlement !== "object")
|
|
193
|
+
return null;
|
|
194
|
+
if (entitlement.kind === "exempt") {
|
|
195
|
+
return { planId: highestListingPlan(opts.listingPlans ?? entitlement.listingPlans), term: { ...UNKNOWN_TERM } };
|
|
196
|
+
}
|
|
197
|
+
if (entitlement.kind !== "verdict")
|
|
198
|
+
return null;
|
|
199
|
+
const checked = verifyLicenseVerdictSignature(entitlement, opts.trustedKeys ?? LICENSE_VERDICT_PUBLIC_KEYS, { now: END_OF_TIME, maxAgeMs: Number.POSITIVE_INFINITY });
|
|
200
|
+
if (!checked.ok)
|
|
201
|
+
return null;
|
|
202
|
+
// verifyLicenseVerdictSignature keeps planId and term only under a
|
|
203
|
+
// verified termSignature, so their presence is the verification.
|
|
204
|
+
const envelope = checked.envelope;
|
|
205
|
+
// S318 (S317 rider): the same plugin id and status checks requireEntitlement makes.
|
|
206
|
+
if (envelope.pluginId !== opts.pluginId || envelope.status !== "valid")
|
|
207
|
+
return null;
|
|
208
|
+
return planFromEnvelope(envelope, envelope.planId !== undefined || envelope.term !== undefined);
|
|
209
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S314c4 (D4): how far an arrow key moves focus in a picker's option grid,
|
|
3
|
+
* read in the page's direction. Right goes forward in a left-to-right page and
|
|
4
|
+
* back in a right-to-left one, as the row reads; Down and Up keep moving one
|
|
5
|
+
* option forward and back in both.
|
|
6
|
+
*/
|
|
7
|
+
export declare function gridArrowStep(key: string, rtl: boolean): -1 | 0 | 1;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S314c4 (D4): how far an arrow key moves focus in a picker's option grid,
|
|
3
|
+
* read in the page's direction. Right goes forward in a left-to-right page and
|
|
4
|
+
* back in a right-to-left one, as the row reads; Down and Up keep moving one
|
|
5
|
+
* option forward and back in both.
|
|
6
|
+
*/
|
|
7
|
+
export function gridArrowStep(key, rtl) {
|
|
8
|
+
switch (key) {
|
|
9
|
+
case "ArrowDown":
|
|
10
|
+
return 1;
|
|
11
|
+
case "ArrowUp":
|
|
12
|
+
return -1;
|
|
13
|
+
case "ArrowRight":
|
|
14
|
+
return rtl ? -1 : 1;
|
|
15
|
+
case "ArrowLeft":
|
|
16
|
+
return rtl ? 1 : -1;
|
|
17
|
+
default:
|
|
18
|
+
return 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,9 +11,11 @@ export { PluginValueProvider, PluginSettingsProvider, PluginApiProvider, Content
|
|
|
11
11
|
export { PluginScreenProvider, PluginTranslateProvider, usePluginScreen, usePluginTranslate, type PluginScreenContext, type PluginTranslate, } from "./plugin-screen-context.js";
|
|
12
12
|
export { SimpleStorageValueProvider } from "./simple-storage-value-provider.js";
|
|
13
13
|
export { EntitlementGate, useEntitlement, type EntitlementStatus, type UseEntitlementResult, } from "./entitlement-gate.js";
|
|
14
|
-
export type { Entitlement, EntitlementErrorCode, EntitlementVerdict, PluginTaskContext } from "./entitlement-types.js";
|
|
14
|
+
export type { Entitlement, EntitlementErrorCode, EntitlementVerdict, PluginTaskContext, ListingPlanSummary, LicenseVerdictTerm } from "./entitlement-types.js";
|
|
15
|
+
export { highestListingPlan, planFromEnvelope, UNKNOWN_TERM, type EntitlementPlan } from "./entitlement-plan.js";
|
|
15
16
|
export { buildRichtextExtensions, TextStyleClass, KardalumBlock, KardalumBlockOnPage, selectedKardalumBlock, findKardalumBlocks, setBlockHtml, unavailableBlockHtml, moveSelectionPastBlock, type BuildRichtextExtensionsOptions, type RichtextTextStyle, type TextStyleClassAttributes, type KardalumBlockAttributes, type KardalumBlockLocation, type SelectedKardalumBlock, } from "./richtext/extensions.js";
|
|
16
17
|
export { MediaPicker, type MediaPickerItem, type MediaPickerProps } from "./media/media-picker.js";
|
|
18
|
+
export { gridArrowStep } from "./grid-arrow-step.js";
|
|
17
19
|
export { MediaFileProvider, useMediaFile, useMediaFileReplace, type CurrentMediaFile, type MediaFileProviderProps, type MediaFileReplace, } from "./views/file-upload-view.js";
|
|
18
20
|
export { MediaRenditionProvider, useMediaRendition, isRenditionIneligible, RENDITION_INELIGIBLE_TYPES, type MediaRenditionCut, type MediaRenditionHost, type MediaRenditionProviderProps, } from "./views/crop-view.js";
|
|
19
21
|
export { StyleListbox, type StyleListboxProps } from "./richtext/style-listbox.js";
|
|
@@ -25,4 +27,9 @@ export { Input, type InputProps } from "@kardalum/ui";
|
|
|
25
27
|
export { Button, type ButtonProps } from "@kardalum/ui";
|
|
26
28
|
export { Switch, type SwitchProps } from "@kardalum/ui";
|
|
27
29
|
export { Badge, type BadgeProps } from "@kardalum/ui";
|
|
30
|
+
export { IconTooltip, type IconTooltipProps } from "@kardalum/ui";
|
|
31
|
+
export { TruncatedText, type TruncatedTextProps } from "@kardalum/ui";
|
|
28
32
|
export { cn } from "@kardalum/ui";
|
|
33
|
+
export type { NotificationRefusalReason, PluginNotify, PluginNotifyInput, PluginNotifyResult } from "./notify.js";
|
|
34
|
+
export { VENDOR_SERVICE_ERROR_CODES, VendorServiceError, isVendorServiceError } from "./vendor-service.js";
|
|
35
|
+
export type { PluginVendorService, VendorServiceErrorCode, VendorServiceRequestInit } from "./vendor-service.js";
|
package/dist/index.js
CHANGED
|
@@ -24,10 +24,15 @@ export { SimpleStorageValueProvider } from "./simple-storage-value-provider.js";
|
|
|
24
24
|
// the separate `@kardalum/plugin-sdk/entitlement` subpath (it needs
|
|
25
25
|
// node:crypto); these two verify in the browser and import nothing Node.
|
|
26
26
|
export { EntitlementGate, useEntitlement, } from "./entitlement-gate.js";
|
|
27
|
+
export { highestListingPlan, planFromEnvelope, UNKNOWN_TERM } from "./entitlement-plan.js";
|
|
27
28
|
export { buildRichtextExtensions, TextStyleClass, KardalumBlock, KardalumBlockOnPage, selectedKardalumBlock, findKardalumBlocks, setBlockHtml, unavailableBlockHtml, moveSelectionPastBlock, } from "./richtext/extensions.js";
|
|
28
29
|
// Exported so a later on-page task can reuse the same modal from admin-ui
|
|
29
30
|
// (S197 Task 2) rather than forking it.
|
|
30
31
|
export { MediaPicker } from "./media/media-picker.js";
|
|
32
|
+
// S314c7 (D2): the arrow rule the pickers use (Left and Right follow the page
|
|
33
|
+
// direction, Up and Down keep theirs), for any grid or strip a host or plugin
|
|
34
|
+
// draws.
|
|
35
|
+
export { gridArrowStep } from "./grid-arrow-step.js";
|
|
31
36
|
// S234a: the file upload editor's field stores no value of its own (see
|
|
32
37
|
// file-upload-view.tsx's doc comment), so the host has no `data` key to
|
|
33
38
|
// hand it a current file through. Exported here so the media item screen
|
|
@@ -79,16 +84,10 @@ export { Input } from "@kardalum/ui";
|
|
|
79
84
|
export { Button } from "@kardalum/ui";
|
|
80
85
|
export { Switch } from "@kardalum/ui";
|
|
81
86
|
export { Badge } from "@kardalum/ui";
|
|
87
|
+
// S357b: a plugin's icon buttons and long names need the same two the admin
|
|
88
|
+
// uses; the admin's TooltipProvider is above every mounted plugin view.
|
|
89
|
+
export { IconTooltip } from "@kardalum/ui";
|
|
90
|
+
export { TruncatedText } from "@kardalum/ui";
|
|
82
91
|
export { cn } from "@kardalum/ui";
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
// package incidentally registered the six built-in datatypes, whether the
|
|
86
|
-
// consumer wanted that or not. That made this entry point permanently
|
|
87
|
-
// heavy (TipTap always, CodeMirror/lezer since S197 Task 8's HTML
|
|
88
|
-
// datatype), which every first-party plugin's Module Federation `shared`
|
|
89
|
-
// config (pointing at this exact bare specifier) then packaged a dead-
|
|
90
|
-
// weight fallback copy of into its own artifact, see
|
|
91
|
-
// `register-built-ins.ts`'s own doc comment for the full story. Built-in
|
|
92
|
-
// registration is now that separate, explicitly-imported subpath
|
|
93
|
-
// (`@kardalum/plugin-sdk/register-built-ins`): apps/admin-ui's
|
|
94
|
-
// bootstrap (main.tsx) and vitest setup are its only two real consumers.
|
|
92
|
+
// S320: context.vendorService and its typed error.
|
|
93
|
+
export { VENDOR_SERVICE_ERROR_CODES, VendorServiceError, isVendorServiceError } from "./vendor-service.js";
|
package/dist/manifest-entry.d.ts
CHANGED
|
@@ -6,3 +6,7 @@ export { ASSERTION_KINDS, AssertionsSchema, BUILT_IN_RAIL_SECTIONS, CMSPluginSch
|
|
|
6
6
|
export type { PluginColumnType, PluginColumnSchema, PluginIndexSchema, PluginTableSchema, StructuredQueryBuilder, StructuredStorageTransaction, ScopedStructuredStorage, PublishedContent, PluginApiRouteContext, } from "./structured-storage-types.js";
|
|
7
7
|
export type { Entitlement, EntitlementErrorCode, EntitlementVerdict, PluginTaskContext } from "./entitlement-types.js";
|
|
8
8
|
export { definePlugin, PluginDefinitionError } from "./define-plugin.js";
|
|
9
|
+
export { NOTIFICATION_REFUSAL_REASONS, NotificationRefusedError, isNotificationRefusedError } from "./notify.js";
|
|
10
|
+
export type { NotificationRefusalReason, PluginNotify, PluginNotifyInput, PluginNotifyResult } from "./notify.js";
|
|
11
|
+
export { VENDOR_SERVICE_ERROR_CODES, VendorServiceError, isVendorServiceError } from "./vendor-service.js";
|
|
12
|
+
export type { PluginVendorService, VendorServiceErrorCode, VendorServiceRequestInit } from "./vendor-service.js";
|
package/dist/manifest-entry.js
CHANGED
|
@@ -11,3 +11,7 @@ export { VIEW_BEARING_CONTRIBUTIONS, declaresClientBundle, slotLabel } from "./m
|
|
|
11
11
|
export { CAPABILITY_IDS, CAPABILITY_LABELS, capabilityLabel, PROMISED_CAPABILITY_SENTENCE, deriveCapabilities, isActionGated, } from "./capabilities.js";
|
|
12
12
|
export { ASSERTION_KINDS, AssertionsSchema, BUILT_IN_RAIL_SECTIONS, CMSPluginSchema, CONTRIBUTION_KEYS, DATABASE_DIALECTS, DataTypePluginSchema, PLUGIN_TYPES, TIER1_DIALECTS, formatIssues, validatePluginManifest, } from "./manifest-schema.js";
|
|
13
13
|
export { definePlugin, PluginDefinitionError } from "./define-plugin.js";
|
|
14
|
+
// S314n3: context.notify and its typed refusal.
|
|
15
|
+
export { NOTIFICATION_REFUSAL_REASONS, NotificationRefusedError, isNotificationRefusedError } from "./notify.js";
|
|
16
|
+
// S320: context.vendorService and its typed error.
|
|
17
|
+
export { VENDOR_SERVICE_ERROR_CODES, VendorServiceError, isVendorServiceError } from "./vendor-service.js";
|
|
@@ -119,9 +119,9 @@ export declare const CMSPluginSchema: z.ZodObject<{
|
|
|
119
119
|
railEntries: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
120
120
|
id: z.ZodString;
|
|
121
121
|
section: z.ZodEnum<{
|
|
122
|
+
settings: "settings";
|
|
122
123
|
media: "media";
|
|
123
124
|
content: "content";
|
|
124
|
-
settings: "settings";
|
|
125
125
|
users: "users";
|
|
126
126
|
}>;
|
|
127
127
|
label: z.ZodPreprocess<z.ZodObject<{
|
|
@@ -304,6 +304,7 @@ export declare const CMSPluginSchema: z.ZodObject<{
|
|
|
304
304
|
description: z.ZodOptional<z.ZodString>;
|
|
305
305
|
repository: z.ZodOptional<z.ZodString>;
|
|
306
306
|
}, z.core.$strict>>;
|
|
307
|
+
notifications: z.ZodOptional<z.ZodLiteral<true>>;
|
|
307
308
|
}, z.core.$strict>;
|
|
308
309
|
price: z.ZodOptional<z.ZodNumber>;
|
|
309
310
|
signature: z.ZodOptional<z.ZodString>;
|
|
@@ -439,6 +440,9 @@ export declare const CMSPluginSchema: z.ZodObject<{
|
|
|
439
440
|
}, z.core.$strict>], "kind">>;
|
|
440
441
|
}, z.core.$strict>>;
|
|
441
442
|
}, z.core.$strict>>;
|
|
443
|
+
vendorService: z.ZodOptional<z.ZodObject<{
|
|
444
|
+
origin: z.ZodString;
|
|
445
|
+
}, z.core.$strict>>;
|
|
442
446
|
id: z.ZodString;
|
|
443
447
|
version: z.ZodString;
|
|
444
448
|
name: z.ZodString;
|
package/dist/manifest-schema.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { API_ROUTE_ACCESS_TIERS, API_ROUTE_METHODS, DATABASE_DIALECTS, PLUGIN_TYPES, STORAGE_TYPES, TEMPLATE_KINDS, TIER1_DIALECTS, API_ROUTE_RESPONSE_STATUSES_MAX, isApiRouteResponseStatus, ActionStringSchema, DocsLanguageSchema, PLUGIN_ID_MESSAGE, PLUGIN_ID_REGEX, PluginManifestIdSchema, SLOT_ID_MAX, pluginManifestFields, SLOT_ID_REGEX, PluginDocsPageSchema, PluginInstallDeclarationSchema, apiRoutePathParams, checkApiRouteActions, checkApiRouteDeclarations, checkTemplateAndAssetDeclarations, PluginAssetPathSchema, PluginTemplateEntrySchema, checkDocsDeclaration, checkInstallDeclaration, CreateDocumentTypeRequestSchema, PluginActionDeclarationSchema, PluginRoleOfferSchema, PluginLabelSchema, SlotLabelSchema, checkActionDeclarations as checkActionDeclarationsRule, isPluginActionFor } from "@kardalum/api-schemas";
|
|
2
|
+
import { API_ROUTE_ACCESS_TIERS, API_ROUTE_METHODS, DATABASE_DIALECTS, PLUGIN_TYPES, STORAGE_TYPES, TEMPLATE_KINDS, TIER1_DIALECTS, API_ROUTE_RESPONSE_STATUSES_MAX, isApiRouteResponseStatus, ActionStringSchema, DocsLanguageSchema, PLUGIN_ID_MESSAGE, PLUGIN_ID_REGEX, PluginManifestIdSchema, SLOT_ID_MAX, pluginManifestFields, SLOT_ID_REGEX, PluginDocsPageSchema, PluginInstallDeclarationSchema, PluginVendorServiceSchema, apiRoutePathParams, checkApiRouteActions, checkApiRouteDeclarations, checkTemplateAndAssetDeclarations, PluginAssetPathSchema, PluginTemplateEntrySchema, checkDocsDeclaration, checkInstallDeclaration, CreateDocumentTypeRequestSchema, PluginActionDeclarationSchema, PluginRoleOfferSchema, PluginLabelSchema, SlotLabelSchema, checkActionDeclarations as checkActionDeclarationsRule, isPluginActionFor } from "@kardalum/api-schemas";
|
|
3
3
|
import { isActionGated } from "./capabilities.js";
|
|
4
4
|
// Runtime mirror of manifest.ts: the same contract, enforced for
|
|
5
5
|
// manifests that arrive as VALUES (Module Federation remotes, sideloaded
|
|
@@ -513,8 +513,16 @@ const contributionsShape = {
|
|
|
513
513
|
// PLUGINS, each of which has a manifest and so is itself capped. A
|
|
514
514
|
// four-segment entry here could never resolve to an installable plugin,
|
|
515
515
|
// so catching it at publish beats discovering it at install.
|
|
516
|
-
|
|
516
|
+
// S349 (D2): at least one. Declaring members is what makes a plugin a
|
|
517
|
+
// bundle, whatever its label (D1), so an empty list would declare a
|
|
518
|
+
// bundle of nothing; a plugin that bundles none leaves the key out.
|
|
519
|
+
bundledPlugins: z
|
|
520
|
+
.array(manifestIdSchema)
|
|
521
|
+
.min(1, { error: "must name at least one member plugin id (leave bundledPlugins out when the plugin bundles none)" })
|
|
522
|
+
.optional(),
|
|
517
523
|
bundledTemplate: bundledTemplateSchema.optional(),
|
|
524
|
+
// S314n3 (D1): `true` or absent; the capability is derived from it.
|
|
525
|
+
notifications: z.literal(true).optional(),
|
|
518
526
|
};
|
|
519
527
|
const contributionsSchema = z
|
|
520
528
|
.object(contributionsShape)
|
|
@@ -573,6 +581,10 @@ const baseFields = {
|
|
|
573
581
|
// defaults among the choices) runs below through checkInstallDeclaration,
|
|
574
582
|
// the function `kardalum plugin validate` and the marketplace door run.
|
|
575
583
|
install: PluginInstallDeclarationSchema.optional(),
|
|
584
|
+
// S320 (D6): the author's server, an origin and nothing else (strict). An
|
|
585
|
+
// http://localhost origin parses (a plugin in development); both publish
|
|
586
|
+
// gates refuse it (vendorServiceCheck in @kardalum/plugin-package).
|
|
587
|
+
vendorService: PluginVendorServiceSchema.optional(),
|
|
576
588
|
};
|
|
577
589
|
const pluginTypeSchema = z.enum(PLUGIN_TYPES);
|
|
578
590
|
// One manifest, no union (S268). `type` is a marketplace listing label
|
package/dist/manifest.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentType } from "react";
|
|
2
|
-
import type { CreateDocumentTypeRequest, PluginDocsPage, PluginInstallDeclaration, PluginLabel, ResolvedInstallAnswers } from "@kardalum/api-schemas";
|
|
2
|
+
import type { CreateDocumentTypeRequest, PluginDocsPage, PluginInstallDeclaration, PluginLabel, PluginVendorServiceDeclaration, ResolvedInstallAnswers } from "@kardalum/api-schemas";
|
|
3
3
|
export type { InstallChoice, InstallOption, InstallStep, PluginInstallDeclaration, ResolvedInstallAnswers } from "@kardalum/api-schemas";
|
|
4
4
|
import type { ThemeTokenOverrides } from "@kardalum/design-tokens";
|
|
5
5
|
import { VIEW_BEARING_CONTRIBUTIONS, declaresClientBundle } from "@kardalum/plugin-package/reference";
|
|
@@ -8,6 +8,8 @@ import type { DataTypePlugin } from "./data-type-plugin.js";
|
|
|
8
8
|
import type { BUILT_IN_RAIL_SECTIONS } from "./manifest-schema.js";
|
|
9
9
|
import type { PluginApiRouteContext, PublishedContent, ScopedStructuredStorage } from "./structured-storage-types.js";
|
|
10
10
|
import type { Entitlement, PluginTaskContext } from "./entitlement-types.js";
|
|
11
|
+
import type { PluginNotify } from "./notify.js";
|
|
12
|
+
import type { PluginVendorService } from "./vendor-service.js";
|
|
11
13
|
/**
|
|
12
14
|
* The seven plugin types. Since S268 this is a marketplace listing and
|
|
13
15
|
* filter label only: it does not decide which contributions a plugin may
|
|
@@ -140,6 +142,15 @@ export interface PluginHookContext {
|
|
|
140
142
|
* `requireEntitlement` from `@kardalum/plugin-sdk/entitlement`; a hook
|
|
141
143
|
* that throws its EntitlementError is skipped with one log line. */
|
|
142
144
|
entitlement: Entitlement;
|
|
145
|
+
/** S318: true while the plugin's licence term is lapsed: the host refuses its writes (403 plugin_read_only), so a route or hook can skip them. Set by the host; absent reads as false. */
|
|
146
|
+
readOnly?: boolean;
|
|
147
|
+
/** S314n3: sends a notification to people in the admin. Present only for a plugin that
|
|
148
|
+
* declares `contributions.notifications: true` and is active; a refusal throws
|
|
149
|
+
* NotificationRefusedError (check it with `isNotificationRefusedError`). */
|
|
150
|
+
notify?: PluginNotify;
|
|
151
|
+
/** S320: calls the plugin's declared vendor service with a 5-minute licence
|
|
152
|
+
* token. Present only when the manifest declares `vendorService`. */
|
|
153
|
+
vendorService?: PluginVendorService;
|
|
143
154
|
}
|
|
144
155
|
export type HookHandler = (payload: unknown, context?: PluginHookContext) => void | Promise<void>;
|
|
145
156
|
export type PluginHooks = Partial<Record<HookEvent, HookHandler>>;
|
|
@@ -401,6 +412,11 @@ export interface PluginContributions {
|
|
|
401
412
|
/** Plugin ids installed together, resolved by the marketplace. */
|
|
402
413
|
bundledPlugins?: string[];
|
|
403
414
|
bundledTemplate?: BundledTemplateContribution;
|
|
415
|
+
/** S314n3 (D1): the plugin sends notifications to people in the admin through
|
|
416
|
+
* `context.notify` in its hooks and API routes; a plugin that does not declare it
|
|
417
|
+
* gets no `notify`. It derives the `admin.notifications` capability, which
|
|
418
|
+
* is a promised capability, so a reviewer reads it against your code. */
|
|
419
|
+
notifications?: true;
|
|
404
420
|
}
|
|
405
421
|
/**
|
|
406
422
|
* The contributions that put code in the browser, and so the ones that
|
|
@@ -565,6 +581,10 @@ export interface PluginManifestBase {
|
|
|
565
581
|
* The built-in questions (the sample content, the offered roles) are never
|
|
566
582
|
* declared here: they follow from what the package ships. */
|
|
567
583
|
install?: PluginInstallDeclaration;
|
|
584
|
+
/** S320 (D6): the author's server a paid plugin's server code calls through
|
|
585
|
+
* `context.vendorService.fetch`. The CMS sends it a 5-minute licence token,
|
|
586
|
+
* never the key. Declaring it is declaring outbound network use. */
|
|
587
|
+
vendorService?: PluginVendorServiceDeclaration;
|
|
568
588
|
}
|
|
569
589
|
/**
|
|
570
590
|
* The full plugin manifest. One shape for every plugin: `type` is a
|
|
@@ -2,8 +2,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { ChevronRight, Folder as FolderIcon } from "lucide-react";
|
|
4
4
|
import { renditionShape, } from "@kardalum/api-schemas";
|
|
5
|
-
import { Button, cn, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, } from "@kardalum/ui";
|
|
5
|
+
import { Button, cn, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, TruncatedText, } from "@kardalum/ui";
|
|
6
6
|
import { MANAGE_API, usePluginApi } from "../plugin-context.js";
|
|
7
|
+
import { gridArrowStep } from "../grid-arrow-step.js";
|
|
7
8
|
import { readAllPages } from "../read-all-pages.js";
|
|
8
9
|
import { isRenditionIneligible } from "../rendition-eligibility.js";
|
|
9
10
|
import { uploadFailureMessage } from "./upload-error.js";
|
|
@@ -372,35 +373,34 @@ export function MediaPicker({ onPick, onClose, collectAlt, acceptedTypes, rendit
|
|
|
372
373
|
function handleGridKeyDown(event) {
|
|
373
374
|
if (items.length === 0)
|
|
374
375
|
return;
|
|
376
|
+
// The grid reads in the page's direction (the compose sheet reads it the same way).
|
|
377
|
+
const step = gridArrowStep(event.key, event.currentTarget.closest('[dir="rtl"]') !== null);
|
|
375
378
|
let next = activeIndex;
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
return;
|
|
379
|
+
if (step !== 0) {
|
|
380
|
+
next = Math.min(Math.max(activeIndex + step, 0), items.length - 1);
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
switch (event.key) {
|
|
384
|
+
case "Home":
|
|
385
|
+
next = 0;
|
|
386
|
+
break;
|
|
387
|
+
case "End":
|
|
388
|
+
next = items.length - 1;
|
|
389
|
+
break;
|
|
390
|
+
case "Enter":
|
|
391
|
+
case " ": {
|
|
392
|
+
event.preventDefault();
|
|
393
|
+
// Read rather than asserted: `items` is filtered by what the
|
|
394
|
+
// field accepts, so it can be shorter than the index a previous
|
|
395
|
+
// listing left behind.
|
|
396
|
+
const focused = items[activeIndex];
|
|
397
|
+
if (focused)
|
|
398
|
+
selectItem(focused);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
default:
|
|
402
|
+
return;
|
|
401
403
|
}
|
|
402
|
-
default:
|
|
403
|
-
return;
|
|
404
404
|
}
|
|
405
405
|
event.preventDefault();
|
|
406
406
|
focusIndex(next);
|
|
@@ -424,10 +424,10 @@ export function MediaPicker({ onPick, onClose, collectAlt, acceptedTypes, rendit
|
|
|
424
424
|
event.preventDefault();
|
|
425
425
|
opener.focus();
|
|
426
426
|
}
|
|
427
|
-
}, children: [_jsxs(SheetHeader, { className: "flex-col items-start gap-1", children: [_jsx(SheetTitle, { children: "Choose an image" }), _jsxs(SheetDescription, { children: ["Showing images from your library.", rendition ? (_jsxs(_Fragment, { children: [" ", "This field asks for a ", _jsx("strong", { className: "font-medium text-text-primary", children: requestedShape }), " crop."] })) : null] })] }), _jsx("nav", { "aria-label": "Folder location", className: "shrink-0 border-b border-border-default px-4 py-2", children: _jsxs("ol", { className: "flex flex-wrap items-center gap-1 text-sm text-text-tertiary", children: [_jsx("li", { children: currentFolderId === null ? (_jsx("span", { "aria-current": "page", className: "font-medium text-text-primary", children: ROOT_LABEL })) : (_jsx("button", { type: "button", onClick: () => openFolder(null), className: "rounded-md px-1 hover:text-primary-600 hover:underline focus-visible:outline-
|
|
427
|
+
}, children: [_jsxs(SheetHeader, { className: "flex-col items-start gap-1", children: [_jsx(SheetTitle, { children: "Choose an image" }), _jsxs(SheetDescription, { children: ["Showing images from your library.", rendition ? (_jsxs(_Fragment, { children: [" ", "This field asks for a ", _jsx("strong", { className: "font-medium text-text-primary", children: requestedShape }), " crop."] })) : null] })] }), _jsx("nav", { "aria-label": "Folder location", className: "shrink-0 border-b border-border-default px-4 py-2", children: _jsxs("ol", { className: "flex flex-wrap items-center gap-1 text-sm text-text-tertiary", children: [_jsx("li", { children: currentFolderId === null ? (_jsx("span", { "aria-current": "page", className: "font-medium text-text-primary", children: ROOT_LABEL })) : (_jsx("button", { type: "button", onClick: () => openFolder(null), className: "rounded-md px-1 hover:text-primary-600 hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600", children: ROOT_LABEL })) }), breadcrumbPath.map((folder, index) => {
|
|
428
428
|
const isCurrent = index === breadcrumbPath.length - 1;
|
|
429
|
-
return (_jsxs("li", { className: "flex min-w-0 items-center gap-1", children: [_jsx(ChevronRight, { "aria-hidden": "true", className: "size-3 shrink-0 rtl:rotate-180" }), isCurrent ? (_jsx(
|
|
430
|
-
})] }) }), _jsxs("div", { className: "flex flex-1 flex-col gap-4 overflow-y-auto p-4", children: [error && _jsx("p", { className: "text-sm text-danger-600", children: error }), visibleFolders.length > 0 && (_jsx("ul", { "aria-label": "Folders", className: "flex flex-wrap gap-2", children: visibleFolders.map((folder) => (_jsx("li", { className: "min-w-0", children: _jsxs("button", { type: "button", onClick: () => openFolder(folder.id), className: "flex max-w-full items-center gap-2 rounded-full border border-border-default bg-background-elevated px-3 py-1 text-xs text-text-secondary hover:bg-background-hover focus-visible:outline-
|
|
429
|
+
return (_jsxs("li", { className: "flex min-w-0 items-center gap-1", children: [_jsx(ChevronRight, { "aria-hidden": "true", className: "size-3 shrink-0 rtl:rotate-180" }), isCurrent ? (_jsx(TruncatedText, { "aria-current": "page", className: "truncate font-medium text-text-primary", children: folder.name })) : (_jsx("button", { type: "button", onClick: () => openFolder(folder.id), className: "min-w-0 rounded-md px-1 hover:text-primary-600 hover:underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600", children: _jsx(TruncatedText, { className: "block truncate", children: folder.name }) }))] }, folder.id));
|
|
430
|
+
})] }) }), _jsxs("div", { className: "flex flex-1 flex-col gap-4 overflow-y-auto p-4", children: [error && _jsx("p", { className: "text-sm text-danger-600", children: error }), visibleFolders.length > 0 && (_jsx("ul", { "aria-label": "Folders", className: "flex flex-wrap gap-2", children: visibleFolders.map((folder) => (_jsx("li", { className: "min-w-0", children: _jsxs("button", { type: "button", onClick: () => openFolder(folder.id), className: "flex max-w-full items-center gap-2 rounded-full border border-border-default bg-background-elevated px-3 py-1 text-xs text-text-secondary hover:bg-background-hover focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600", children: [_jsx(FolderIcon, { "aria-hidden": "true", className: "size-4 shrink-0 text-text-tertiary" }), _jsx(TruncatedText, { className: "truncate", children: folder.name })] }) }, folder.id))) })), loading && _jsx("p", { className: "text-sm text-text-secondary", children: "Loading\u2026" }), emptyBecauseFiltered && (_jsx("p", { className: "text-sm text-text-secondary", children: "Nothing here is a kind this field accepts." })), !loading && rawItems.length === 0 && visibleFolders.length === 0 && (_jsx("p", { className: "text-sm text-text-secondary", children: currentFolderId === null ? "No images in the media library yet." : "No images in this folder yet." })), !loading && items.length > 0 && (_jsx("div", { role: "listbox", "aria-label": "Media library", onKeyDown: handleGridKeyDown, className: "grid grid-cols-3 gap-3", children: items.map((item, index) => {
|
|
431
431
|
const selected = pending?.id === item.id;
|
|
432
432
|
// `hasRendition` is only set when the listing was asked
|
|
433
433
|
// about a crop, so absent means nothing was asked and
|
|
@@ -440,8 +440,8 @@ export function MediaPicker({ onPick, onClose, collectAlt, acceptedTypes, rendit
|
|
|
440
440
|
: `${item.filename}: no ${requestedShape} crop yet, so this field shows the full image.`;
|
|
441
441
|
return (_jsxs("button", { type: "button", ref: (el) => {
|
|
442
442
|
optionRefs.current[index] = el;
|
|
443
|
-
}, role: "option", "aria-selected": selected, title: title, tabIndex: index === activeIndex ? 0 : -1, onFocus: () => setActiveIndex(index), onClick: () => selectItem(item), className: cn("flex flex-col overflow-hidden rounded-md border text-start focus-visible:outline-
|
|
443
|
+
}, role: "option", "aria-selected": selected, title: title, tabIndex: index === activeIndex ? 0 : -1, onFocus: () => setActiveIndex(index), onClick: () => selectItem(item), className: cn("flex flex-col overflow-hidden rounded-md border text-start focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600", selected
|
|
444
444
|
? "border-primary-600 bg-primary-100"
|
|
445
|
-
: "border-border-subtle hover:bg-background-elevated"), children: [_jsx("span", { className: "block aspect-square overflow-hidden bg-background-subtle", children: _jsx("img", { src: item.downloadUrl, alt: "", className: "h-full w-full object-cover" }) }), _jsxs("span", { className: "block min-w-0 px-2 py-1", children: [_jsx(
|
|
446
|
-
}) })), !loading && nextCursor && (_jsx("div", { className: "flex justify-center", children: _jsx(Button, { type: "button", variant: "outline", size: "sm", disabled: loadingMore, onClick: () => void loadMore(), children: loadingMore ? "Loading…" : "Load more" }) }))] }), pending && (_jsxs("div", { className: "flex shrink-0 items-center gap-3 border-t border-border-default px-4 py-3", children: [_jsx("img", { src: pending.downloadUrl, alt: "", className: "h-12 w-12 shrink-0 rounded-md border border-border-subtle object-cover" }), _jsxs("div", { className: "flex-1", children: [_jsx("label", { htmlFor: "media-picker-alt", className: "mb-1 block text-xs font-medium text-text-secondary", children: "Alt text" }), _jsx("input", { id: "media-picker-alt", ref: altInputRef, type: "text", value: altText, onChange: (event) => setAltText(event.target.value), placeholder: "Describe this image for screen readers (optional)", className: "w-full rounded-md border border-border-default bg-background-elevated px-2 py-1 text-sm text-text-primary focus-visible:outline-
|
|
445
|
+
: "border-border-subtle hover:bg-background-elevated"), children: [_jsx("span", { className: "block aspect-square overflow-hidden bg-background-subtle", children: _jsx("img", { src: item.downloadUrl, alt: "", className: "h-full w-full object-cover" }) }), _jsxs("span", { className: "block min-w-0 px-2 py-1", children: [_jsx(TruncatedText, { className: "block truncate font-mono text-xs text-text-tertiary", children: item.filename }), fallsBack && (_jsx("span", { className: "mt-1 inline-block rounded-sm bg-warning-100 px-1 text-xs text-warning-800", children: "full image" }))] })] }, item.id));
|
|
446
|
+
}) })), !loading && nextCursor && (_jsx("div", { className: "flex justify-center", children: _jsx(Button, { type: "button", variant: "outline", size: "sm", disabled: loadingMore, onClick: () => void loadMore(), children: loadingMore ? "Loading…" : "Load more" }) }))] }), pending && (_jsxs("div", { className: "flex shrink-0 items-center gap-3 border-t border-border-default px-4 py-3", children: [_jsx("img", { src: pending.downloadUrl, alt: "", className: "h-12 w-12 shrink-0 rounded-md border border-border-subtle object-cover" }), _jsxs("div", { className: "flex-1", children: [_jsx("label", { htmlFor: "media-picker-alt", className: "mb-1 block text-xs font-medium text-text-secondary", children: "Alt text" }), _jsx("input", { id: "media-picker-alt", ref: altInputRef, type: "text", value: altText, onChange: (event) => setAltText(event.target.value), placeholder: "Describe this image for screen readers (optional)", className: "w-full rounded-md border border-border-default bg-background-elevated px-2 py-1 text-sm text-text-primary focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600" })] })] })), _jsxs(SheetFooter, { className: "items-center justify-start", children: [_jsxs("p", { className: "text-sm text-text-tertiary", children: ["Or", " ", _jsx("button", { type: "button", disabled: uploading, onClick: () => uploadInputRef.current?.click(), className: "rounded-md text-primary-600 underline focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary-600", children: uploading ? `uploading into ${currentFolderName}…` : `upload into ${currentFolderName}` })] }), _jsx("input", { id: "media-picker-upload", ref: uploadInputRef, type: "file", className: "hidden", accept: acceptAttribute(acceptedTypes), "aria-label": `Upload into ${currentFolderName}`, disabled: uploading, onChange: (event) => void handleUpload(event) }), _jsx("span", { className: "ms-auto flex gap-2", children: pending ? (_jsxs(_Fragment, { children: [_jsx(Button, { type: "button", variant: "outline", onClick: onClose, children: "Cancel" }), _jsx(Button, { type: "button", onClick: () => onPick({ id: pending.id, downloadUrl: pending.downloadUrl, alt: altText }), children: "Insert" })] })) : (_jsx(Button, { type: "button", variant: "outline", onClick: onClose, children: "Close" })) })] })] }) }));
|
|
447
447
|
}
|
package/dist/notify.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SendNotificationRequestInput } from "@kardalum/api-schemas";
|
|
2
|
+
/** What `context.notify` takes: `to` (actions, roles, people), a title, an optional text and link. */
|
|
3
|
+
export type PluginNotifyInput = SendNotificationRequestInput;
|
|
4
|
+
export interface PluginNotifyResult {
|
|
5
|
+
/** How many people it reached. */
|
|
6
|
+
recipients: number;
|
|
7
|
+
}
|
|
8
|
+
export type PluginNotify = (input: PluginNotifyInput) => Promise<PluginNotifyResult>;
|
|
9
|
+
/** Why a send was refused. */
|
|
10
|
+
export declare const NOTIFICATION_REFUSAL_REASONS: readonly ["invalid", "unknownTarget", "nobody", "overLimit", "rateLimited", "inactive"];
|
|
11
|
+
export type NotificationRefusalReason = (typeof NOTIFICATION_REFUSAL_REASONS)[number];
|
|
12
|
+
export declare class NotificationRefusedError extends Error {
|
|
13
|
+
readonly reason: NotificationRefusalReason;
|
|
14
|
+
constructor(reason: NotificationRefusalReason, message: string);
|
|
15
|
+
}
|
|
16
|
+
/** True for a NotificationRefusedError from ANY copy of this SDK: a plugin bundles its own copy, so `instanceof` would miss the host's class. */
|
|
17
|
+
export declare function isNotificationRefusedError(value: unknown): value is NotificationRefusedError;
|
package/dist/notify.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Why a send was refused. */
|
|
2
|
+
export const NOTIFICATION_REFUSAL_REASONS = ["invalid", "unknownTarget", "nobody", "overLimit", "rateLimited", "inactive"];
|
|
3
|
+
export class NotificationRefusedError extends Error {
|
|
4
|
+
reason;
|
|
5
|
+
constructor(reason, message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "NotificationRefusedError";
|
|
8
|
+
this.reason = reason;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/** True for a NotificationRefusedError from ANY copy of this SDK: a plugin bundles its own copy, so `instanceof` would miss the host's class. */
|
|
12
|
+
export function isNotificationRefusedError(value) {
|
|
13
|
+
if (!(value instanceof Error) || value.name !== "NotificationRefusedError")
|
|
14
|
+
return false;
|
|
15
|
+
const reason = value.reason;
|
|
16
|
+
return typeof reason === "string" && NOTIFICATION_REFUSAL_REASONS.includes(reason);
|
|
17
|
+
}
|
package/dist/plugin-context.js
CHANGED
|
@@ -5,7 +5,7 @@ export function PluginValueProvider({ value, onChange, children }) {
|
|
|
5
5
|
return _jsx(PluginValueContext.Provider, { value: { value, onChange }, children: children });
|
|
6
6
|
}
|
|
7
7
|
// A view calling this outside a host-rendered PluginValueProvider is a
|
|
8
|
-
// real bug (the host forgot to wrap it)
|
|
8
|
+
// real bug (the host forgot to wrap it), so throw loudly, don't hand back
|
|
9
9
|
// a silently-undefined value/no-op onChange.
|
|
10
10
|
export function usePluginValue() {
|
|
11
11
|
const ctx = useContext(PluginValueContext);
|
|
@@ -18,7 +18,7 @@ const PluginSettingsContext = createContext(null);
|
|
|
18
18
|
export function PluginSettingsProvider({ settings, onSettingsChange, children }) {
|
|
19
19
|
return (_jsx(PluginSettingsContext.Provider, { value: { settings, onSettingsChange }, children: children }));
|
|
20
20
|
}
|
|
21
|
-
// Returns settings directly (not {settings, onChange})
|
|
21
|
+
// Returns settings directly (not {settings, onChange}): this is the
|
|
22
22
|
// READ-ONLY path used by input/readOnly/preview views (Session 69). For a
|
|
23
23
|
// settings-EDITING view (the "settings" DataTypePluginViews slot), use
|
|
24
24
|
// usePluginSettingsValue() below instead.
|
|
@@ -30,7 +30,7 @@ export function usePluginSettings() {
|
|
|
30
30
|
return ctx.settings;
|
|
31
31
|
}
|
|
32
32
|
// Mirrors usePluginValue()'s {value, onChange} shape, for settings-EDITING
|
|
33
|
-
// views only (Session 69)
|
|
33
|
+
// views only (Session 69): the host (e.g. the Data Types editor) must
|
|
34
34
|
// supply onSettingsChange via PluginSettingsProvider, or this throws:
|
|
35
35
|
// a settings view rendered in a read-only context is a host bug, same
|
|
36
36
|
// "throw loudly" philosophy as usePluginValue().
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// The `@kardalum/plugin-sdk/register-built-ins` subpath: runs the
|
|
2
2
|
// package's built-in datatype registration side effect (the six
|
|
3
|
-
// `registerDataType()` calls in `built-ins.tsx
|
|
3
|
+
// `registerDataType()` calls in `built-ins.tsx`: text/number/boolean/
|
|
4
4
|
// date/image/richtext/html) and nothing else.
|
|
5
5
|
//
|
|
6
6
|
// S197 final-review fix F5: this used to be the package INDEX's own
|
|
7
7
|
// trailing side effect (`import "./built-ins.js"`), which meant importing
|
|
8
|
-
// ANYTHING from the bare `@kardalum/plugin-sdk` specifier
|
|
9
|
-
// primitive, a provider, a type
|
|
8
|
+
// ANYTHING from the bare `@kardalum/plugin-sdk` specifier (a UI
|
|
9
|
+
// primitive, a provider, a type) incidentally triggered it too. That was
|
|
10
10
|
// harmless on its own, but it meant the package's main entry could never
|
|
11
11
|
// be lightweight: `built-ins.tsx` statically imports both
|
|
12
12
|
// rich-text-view.tsx (TipTap) and, since S197 Task 8's HTML datatype,
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
//
|
|
17
17
|
// Every first-party plugin's Module Federation config shares
|
|
18
18
|
// `@kardalum/plugin-sdk` as a runtime singleton (see any
|
|
19
|
-
// `plugins/*/vite.config.ts`)
|
|
19
|
+
// `plugins/*/vite.config.ts`): that `shared` entry resolves to the bare
|
|
20
20
|
// package specifier, i.e. the MAIN entry, regardless of which subpath a
|
|
21
21
|
// plugin's own view code actually imports from. Module Federation still
|
|
22
22
|
// bundles a fallback copy of that shared module into every remote's own
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
// compatible version), so as long as the main entry pulled in TipTap +
|
|
25
25
|
// CodeMirror, EVERY plugin's packaged artifact carried a multi-hundred-KB
|
|
26
26
|
// dead-weight fallback chunk that never actually loads at runtime (the
|
|
27
|
-
// admin host's own copy always satisfies the singleton first)
|
|
27
|
+
// admin host's own copy always satisfies the singleton first), and this is
|
|
28
28
|
// what pushed google-maps' packaged bundle size over the marketplace's
|
|
29
29
|
// 250KB budget the moment CodeMirror/lezer landed in plugin-sdk's
|
|
30
30
|
// dependency tree, not anything google-maps' own view code did.
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
// that at the root for every plugin at once, not just the one that
|
|
34
34
|
// happened to trip a test. Exactly ONE real consumer needs this:
|
|
35
35
|
// apps/admin-ui's own bootstrap (main.tsx) and its vitest setup
|
|
36
|
-
// (vitest.setup.ts)
|
|
36
|
+
// (vitest.setup.ts): both import this once, for its side effect, the
|
|
37
37
|
// same "run once at startup" pattern initTheme()/the i18n import already
|
|
38
38
|
// use in main.tsx. A REMOTE plugin never needs this: its own views read
|
|
39
39
|
// datatypes through its OWN manifest object, never through this
|
package/dist/registry.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Static registry: built-ins register into this exact same map at module
|
|
2
|
-
// load (Core vs Plugin
|
|
2
|
+
// load (Core vs Plugin: built-ins are statically registered, dynamically
|
|
3
3
|
// loaded marketplace plugins are a second registration path into this same
|
|
4
4
|
// registry, not a different kind of plugin).
|
|
5
5
|
const dataTypes = new Map();
|