@perkyzz/emvb 1.1.0 → 1.2.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/THIRD_PARTY_NOTICES.md +1 -0
- package/package.json +10 -9
- package/src/admin/agents-api.ts +5 -1
- package/src/admin/content-api.ts +29 -0
- package/src/admin/editor/Editor.tsx +6 -1
- package/src/admin/editor/ScheduleDialog.tsx +167 -0
- package/src/admin/editor/TopBar.tsx +33 -1
- package/src/admin/editor/dnd/new-element.ts +46 -0
- package/src/admin/editor/editor-chrome.tsx +9 -0
- package/src/admin/editor/element-chrome.ts +22 -0
- package/src/admin/editor/panels/ElementPanel.tsx +5 -1
- package/src/admin/editor/panels/settings/DraftTextField.tsx +33 -1
- package/src/admin/editor/panels/settings/FieldBindControl.tsx +6 -1
- package/src/admin/editor/panels/settings/FieldControl.tsx +10 -1
- package/src/admin/editor/panels/settings/IconPicker.tsx +4 -1
- package/src/admin/editor/panels/settings/ItemList.tsx +36 -2
- package/src/admin/editor/panels/settings/advanced-rules.ts +3 -0
- package/src/admin/editor/store.ts +7 -1
- package/src/admin/editor/useEditorData.ts +4 -0
- package/src/admin/editor/useSave.ts +47 -3
- package/src/admin/export-api.ts +20 -3
- package/src/admin/menus-api.ts +113 -0
- package/src/admin/pages/ImportElementorDialog.tsx +25 -1
- package/src/astro/EmVBPage.astro +3 -0
- package/src/astro/render.ts +43 -18
- package/src/astro/request-data.ts +3 -0
- package/src/astro/resolve-theme.ts +77 -44
- package/src/astro/visitor.ts +23 -4
- package/src/astro/widgets/EmVBAlertsRuntime.astro +8 -0
- package/src/astro/widgets/EmVBCarouselRuntime.astro +8 -0
- package/src/astro/widgets/EmVBLightboxRuntime.astro +8 -0
- package/src/astro/widgets/EmVBWidgetRuntimes.astro +19 -0
- package/src/astro/widgets/alerts.ts +37 -0
- package/src/astro/widgets/carousel.ts +167 -0
- package/src/astro/widgets/index.ts +1 -0
- package/src/astro/widgets/lightbox.ts +123 -0
- package/src/constants.ts +1 -1
- package/src/core/a11y/audit.ts +101 -2
- package/src/core/arrange.ts +57 -1
- package/src/core/bounded-array.ts +16 -13
- package/src/core/contract.ts +4 -1
- package/src/core/elements/icon-svg.ts +135 -0
- package/src/core/elements/index.ts +33 -127
- package/src/core/elements/widgets.ts +907 -0
- package/src/core/export/runtimes.generated.ts +3 -0
- package/src/core/export/site.ts +20 -3
- package/src/core/extensions/schema.ts +2 -1
- package/src/core/geo-trust.ts +18 -0
- package/src/core/icons/social.generated.ts +29 -0
- package/src/core/image-edit/schema.ts +2 -1
- package/src/core/import/elementor/context.ts +18 -0
- package/src/core/import/elementor/index.ts +50 -7
- package/src/core/import/elementor/widgets.ts +394 -133
- package/src/core/issue-cap.ts +19 -0
- package/src/core/limits.ts +6 -0
- package/src/core/loop-collections.ts +33 -0
- package/src/core/proposals.ts +8 -2
- package/src/core/render/index.ts +27 -4
- package/src/core/render/vnode.ts +44 -6
- package/src/core/sanitize/svg-upload.ts +276 -23
- package/src/core/sanitize/svg.ts +3 -3
- package/src/core/schema/descriptors.ts +4 -0
- package/src/core/schema/design.ts +6 -5
- package/src/core/schema/layout.ts +395 -15
- package/src/core/schema/style.ts +2 -1
- package/src/core/shadowing-ids.ts +41 -0
- package/src/core/theme/conditions.ts +2 -1
- package/src/core/theme/parse-doc.ts +10 -5
- package/src/core/theme/triggers.ts +3 -2
- package/src/core/validate.ts +3 -2
- package/src/index.ts +23 -2
- package/src/mcp/ports.ts +18 -7
- package/src/mcp/proposals.ts +36 -11
- package/src/mcp/tools.ts +1 -1
- package/src/server/agent-settings.ts +12 -1
- package/src/server/hooks.ts +41 -6
- package/src/server/mcp-routes.ts +11 -5
- package/src/server/plugin.ts +27 -2
- package/src/server/presence.ts +5 -1
- package/src/server/proposals.ts +16 -4
- package/src/server/requests.ts +60 -11
- package/src/server/site-origin.ts +13 -0
- package/src/server/targets.ts +26 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S-05 (W-995): the site's own origin from its configuration (EmDash's site URL setting), never
|
|
3
|
+
* from the request: the Host header is the caller's to choose. Undefined when none is set.
|
|
4
|
+
*/
|
|
5
|
+
export function trustedOrigin(siteUrl: unknown): string | undefined {
|
|
6
|
+
if (typeof siteUrl !== "string" || !siteUrl) return undefined;
|
|
7
|
+
try {
|
|
8
|
+
const url = new URL(siteUrl);
|
|
9
|
+
return url.protocol === "https:" || url.protocol === "http:" ? url.origin : undefined;
|
|
10
|
+
} catch {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PluginContext, RouteContext } from "emdash";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
import { PAGES_COLLECTION, THEME_PARTS_COLLECTION } from "../constants.ts";
|
|
4
|
+
import type { ProposalTarget } from "../core/proposals.ts";
|
|
5
|
+
import { canvasFieldSlugs } from "./hooks.ts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* S-09 (W-998): a request or an editor presence may name only an entry that exists in an EmVB
|
|
9
|
+
* collection or in a collection with an emvb:canvas field. Routes took any slug and id, so junk
|
|
10
|
+
* targets filled storage and hid real requests.
|
|
11
|
+
*/
|
|
12
|
+
export async function isEmvbTarget(
|
|
13
|
+
ctx: RouteContext<unknown>,
|
|
14
|
+
target: z.infer<typeof ProposalTarget>,
|
|
15
|
+
): Promise<boolean> {
|
|
16
|
+
const owned =
|
|
17
|
+
target.collection === PAGES_COLLECTION || target.collection === THEME_PARTS_COLLECTION;
|
|
18
|
+
if (!owned) {
|
|
19
|
+
const slugs = await canvasFieldSlugs(ctx as unknown as PluginContext, target.collection).catch(
|
|
20
|
+
() => [],
|
|
21
|
+
);
|
|
22
|
+
if (slugs.length === 0) return false;
|
|
23
|
+
}
|
|
24
|
+
const found = await ctx.content?.get(target.collection, target.id).catch(() => null);
|
|
25
|
+
return Boolean(found);
|
|
26
|
+
}
|