@levo-so/site-runtime 0.1.113 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CollectionInput-5QMoXahu.js +147 -0
  2. package/DateTimeWidget-CARoq7bQ.js +254 -0
  3. package/PhoneWidget-vtDO9CFq.js +99 -0
  4. package/Popover-B76-bN-a.js +57 -0
  5. package/RichTextWidget-CafZBEKI.js +912 -0
  6. package/ThemeProvider-Cm2jJC7a.js +381 -0
  7. package/Tooltip-Bx-BfR7T.js +78 -0
  8. package/VerifyButton-D1Mwk04d.js +299 -0
  9. package/index.d.ts +674 -0
  10. package/index.js +5752 -0
  11. package/package.json +63 -31
  12. package/styles.css +2 -0
  13. package/README.md +0 -93
  14. package/dist/LevoSiteProvider.d.ts +0 -25
  15. package/dist/LevoSiteProvider.js +0 -23
  16. package/dist/client.d.ts +0 -26
  17. package/dist/client.js +0 -14
  18. package/dist/data/index.d.ts +0 -101
  19. package/dist/data/index.js +0 -79
  20. package/dist/index.d.ts +0 -26
  21. package/dist/index.js +0 -6
  22. package/dist/inspector/dom.d.ts +0 -56
  23. package/dist/inspector/dom.js +0 -224
  24. package/dist/inspector/editorChannel.d.ts +0 -7
  25. package/dist/inspector/editorChannel.js +0 -19
  26. package/dist/inspector/historyWatcher.d.ts +0 -8
  27. package/dist/inspector/historyWatcher.js +0 -24
  28. package/dist/inspector/index.d.ts +0 -2
  29. package/dist/inspector/index.js +0 -191
  30. package/dist/inspector/messageRouter.d.ts +0 -38
  31. package/dist/inspector/messageRouter.js +0 -134
  32. package/dist/inspector/originalsStash.d.ts +0 -12
  33. package/dist/inspector/originalsStash.js +0 -24
  34. package/dist/inspector/protocol.d.ts +0 -180
  35. package/dist/inspector/stagedOverrides.d.ts +0 -28
  36. package/dist/inspector/stagedOverrides.js +0 -60
  37. package/dist/inspector/textEditController.d.ts +0 -24
  38. package/dist/inspector/textEditController.js +0 -62
  39. package/dist/pageHead.d.ts +0 -75
  40. package/dist/pageHead.js +0 -102
@@ -1,24 +0,0 @@
1
- import { IEditorChannel } from './editorChannel';
2
- import { IOriginalsStash } from './originalsStash';
3
- export type ITextEditController = ReturnType<typeof createTextEditController>;
4
- export declare const createTextEditController: (deps: {
5
- channel: IEditorChannel;
6
- originals: IOriginalsStash;
7
- /**
8
- * Drop the text-mode hover affordance (outline + tracked hover target). Cursor is NOT
9
- * reset here — the pointer tracker owns it (hovering the edited node clears it there).
10
- */
11
- clearTextHover: () => void;
12
- }) => {
13
- startEdit: (el: Element, caretAtEnd?: boolean) => void;
14
- /** The node currently in contenteditable, or null — read by hover/click/staged logic. */
15
- editingNode: () => Element | null;
16
- /** Commit any in-flight edit (mode exit, defensive re-entry). No-op when idle. */
17
- commitIfEditing: () => void;
18
- /**
19
- * Teardown for unmount: end any in-flight edit WITHOUT committing (no report on
20
- * teardown — matches the original closure's cleanup, which called endEdit directly).
21
- */
22
- teardown: () => void;
23
- };
24
- //# sourceMappingURL=textEditController.d.ts.map
@@ -1,62 +0,0 @@
1
- import { COLOR as e, nodesForSource as t, sourceIndex as n, sourceOf as r } from "./dom.js";
2
- //#region src/inspector/textEditController.ts
3
- var i = (i) => {
4
- let { channel: a, originals: o, clearTextHover: s } = i, c = null, l = "", u = 0, d = (() => {
5
- try {
6
- let e = document.createElement("div");
7
- return e.setAttribute("contenteditable", "plaintext-only"), e.contentEditable === "plaintext-only";
8
- } catch {
9
- return !1;
10
- }
11
- })(), f = () => {
12
- c && _(c);
13
- }, p = (e) => {
14
- e.key === "Enter" ? (e.preventDefault(), c && _(c)) : e.key === "Escape" && (e.preventDefault(), c && v(c));
15
- }, m = (e) => {
16
- let t = window.getSelection();
17
- if (!t) return;
18
- let n = document.createRange();
19
- n.selectNodeContents(e), n.collapse(!1), t.removeAllRanges(), t.addRange(n);
20
- }, h = (t, i = !1) => {
21
- if (c === t) return;
22
- c && _(c), c = t, l = r(t) || "", u = n(t, l), s(), o.capture(`${l}#${u}`, t.textContent ?? ""), t.setAttribute("contenteditable", d ? "plaintext-only" : "true");
23
- let a = t;
24
- a.style.outline = `2px solid ${e.hover}`, a.style.outlineOffset = "3px", a.style.borderRadius = "3px", a.focus(), i && m(t), a.addEventListener("blur", f, !0), a.addEventListener("keydown", p, !0);
25
- }, g = (e) => {
26
- e.removeAttribute("contenteditable");
27
- let t = e;
28
- t.style.outline = "", t.style.outlineOffset = "", t.style.borderRadius = "", t.removeEventListener("blur", f, !0), t.removeEventListener("keydown", p, !0), c = null;
29
- }, _ = (e) => {
30
- let n = r(e), i = u, s = o.get(`${l}#${u}`);
31
- g(e);
32
- let c = (e.textContent ?? "").replace(/\s+/g, " ").trim();
33
- a.send({
34
- type: "element-text-changed",
35
- element: {
36
- source: n,
37
- index: i,
38
- tag: e.tagName.toLowerCase(),
39
- value: c,
40
- previous: s,
41
- occurrences: n ? t(n).length : 1
42
- }
43
- });
44
- }, v = (e) => {
45
- let t = `${l}#${u}`;
46
- g(e);
47
- let n = o.restore(t);
48
- n != null && (e.textContent = n);
49
- };
50
- return {
51
- startEdit: h,
52
- editingNode: () => c,
53
- commitIfEditing: () => {
54
- c && _(c);
55
- },
56
- teardown: () => {
57
- c && g(c);
58
- }
59
- };
60
- };
61
- //#endregion
62
- export { i as createTextEditController };
@@ -1,75 +0,0 @@
1
- /** One page's head metadata. Every field optional — site defaults fill gaps per-field. */
2
- export interface IPageMeta {
3
- title?: string;
4
- description?: string;
5
- /** Absolute URL. Rendered as `<link rel="canonical">`. */
6
- canonical?: string;
7
- /** e.g. "index,follow" / "noindex,nofollow". */
8
- robots?: string;
9
- og?: {
10
- title?: string;
11
- description?: string;
12
- image?: string;
13
- /** Defaults to "website" when any og field is present. */
14
- type?: string;
15
- };
16
- twitter?: {
17
- /** Defaults to "summary_large_image" when any twitter field is present. */
18
- card?: string;
19
- title?: string;
20
- description?: string;
21
- image?: string;
22
- };
23
- /** JSON-LD object(s) — each becomes a `<script type="application/ld+json">`. */
24
- ldJson?: Record<string, unknown> | Array<Record<string, unknown>>;
25
- /**
26
- * Raw head snippet for THIS page. v1 supports `<script>`, `<meta>` and `<link>` tags
27
- * only (the analytics / verification / preload cases) — anything else is dropped by
28
- * `parseRawHead`, since arbitrary markup can't be expressed as document metadata.
29
- */
30
- customHead?: string;
31
- }
32
- /** Site-wide defaults + site-wide raw head, from `src/pages/_site.meta.ts`. */
33
- export interface ISiteMeta extends IPageMeta {
34
- /** "%s · Acme" — %s is the page title. Applied only when the page provides a title. */
35
- titleTemplate?: string;
36
- }
37
- interface IHeadEntry {
38
- [attr: string]: string | undefined;
39
- }
40
- export interface IComposedHead {
41
- meta: IHeadEntry[];
42
- links: IHeadEntry[];
43
- scripts: IHeadEntry[];
44
- }
45
- /**
46
- * Tolerant extraction of `<script>` / `<meta>` / `<link>` tags from a raw head snippet.
47
- * Unsupported tags are DROPPED (documented v1 limitation) — silently at runtime; the
48
- * editor warns at save time.
49
- */
50
- export declare const parseRawHead: (raw: string) => IComposedHead;
51
- /**
52
- * Compose one page's document metadata from its sidecar + the site defaults. Page
53
- * values win per-FIELD (an empty page og.title still inherits the site og.title).
54
- * The object shape doubles as a TanStack Start route `head()` result for when the
55
- * scaffold wires routes directly.
56
- */
57
- export declare const pageHead: (meta?: IPageMeta, site?: ISiteMeta) => IComposedHead;
58
- /**
59
- * Renders a page's metadata as document tags. Pages include it anywhere in their JSX —
60
- * React 19 hoists <title>/<meta>/<link> into <head> (SSR too); scripts render in place
61
- * (see the file header caveat). The studio wires this automatically on a page's first
62
- * meta save:
63
- *
64
- * import meta from "./about.meta";
65
- * import siteMeta from "./_site.meta";
66
- * import { PageHead } from "../lib/pageHead";
67
- * …
68
- * <PageHead meta={meta} site={siteMeta} />
69
- */
70
- export declare function PageHead({ meta, site }: {
71
- meta?: IPageMeta;
72
- site?: ISiteMeta;
73
- }): import("react/jsx-runtime").JSX.Element;
74
- export {};
75
- //# sourceMappingURL=pageHead.d.ts.map
package/dist/pageHead.js DELETED
@@ -1,102 +0,0 @@
1
- import { Fragment as e, jsx as t, jsxs as n } from "react/jsx-runtime";
2
- //#region src/pageHead.tsx
3
- var r = (e) => JSON.stringify(e).replace(/<\//g, "<\\/"), i = (e) => {
4
- let t = {}, n = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*("([^"]*)"|'([^']*)'|[^\s"'>]+))?/g;
5
- for (let r = n.exec(e); r; r = n.exec(e)) {
6
- let e = r[1];
7
- !e || /^on/i.test(e) || (t[e] = r[3] ?? r[4] ?? (r[2] ? r[2] : ""));
8
- }
9
- return t;
10
- }, a = (e) => {
11
- let t = {
12
- meta: [],
13
- links: [],
14
- scripts: []
15
- };
16
- if (!e?.trim()) return t;
17
- let n = e.replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi, (e, n, r) => {
18
- let a = i(n), o = r.trim();
19
- return o && (a.children = o), t.scripts.push(a), "";
20
- });
21
- return n = n.replace(/<(meta|link)\b([^>]*?)\/?>/gi, (e, n, r) => ((n.toLowerCase() === "meta" ? t.meta : t.links).push(i(r)), "")), t;
22
- }, o = (e = {}, t = {}) => {
23
- let n = {
24
- meta: [],
25
- links: [],
26
- scripts: []
27
- }, i = e.title?.trim(), o = t.title?.trim(), s = t.titleTemplate?.includes("%s") ? t.titleTemplate : void 0, c = i ? s ? s.replace("%s", i) : i : o;
28
- c && n.meta.push({ title: c });
29
- let l = e.description ?? t.description;
30
- l && n.meta.push({
31
- name: "description",
32
- content: l
33
- });
34
- let u = e.robots ?? t.robots;
35
- u && n.meta.push({
36
- name: "robots",
37
- content: u
38
- });
39
- let d = e.canonical ?? t.canonical;
40
- d && n.links.push({
41
- rel: "canonical",
42
- href: d
43
- });
44
- let f = {
45
- ...t.og,
46
- ...e.og
47
- }, p = f.title ?? i ?? o, m = f.description ?? l;
48
- (p || m || f.image) && (n.meta.push({
49
- property: "og:type",
50
- content: f.type ?? "website"
51
- }), p && n.meta.push({
52
- property: "og:title",
53
- content: p
54
- }), m && n.meta.push({
55
- property: "og:description",
56
- content: m
57
- }), f.image && n.meta.push({
58
- property: "og:image",
59
- content: f.image
60
- }));
61
- let h = {
62
- ...t.twitter,
63
- ...e.twitter
64
- }, g = h.title ?? p, _ = h.description ?? m, v = h.image ?? f.image;
65
- (g || _ || v) && (n.meta.push({
66
- name: "twitter:card",
67
- content: h.card ?? "summary_large_image"
68
- }), g && n.meta.push({
69
- name: "twitter:title",
70
- content: g
71
- }), _ && n.meta.push({
72
- name: "twitter:description",
73
- content: _
74
- }), v && n.meta.push({
75
- name: "twitter:image",
76
- content: v
77
- }));
78
- let y = e.ldJson ? Array.isArray(e.ldJson) ? e.ldJson : [e.ldJson] : [];
79
- for (let e of y) n.scripts.push({
80
- type: "application/ld+json",
81
- children: r(e)
82
- });
83
- for (let r of [t.customHead, e.customHead]) {
84
- if (!r) continue;
85
- let e = a(r);
86
- n.meta.push(...e.meta), n.links.push(...e.links), n.scripts.push(...e.scripts);
87
- }
88
- return n;
89
- };
90
- function s({ meta: r, site: i }) {
91
- let a = o(r, i);
92
- return /* @__PURE__ */ n(e, { children: [
93
- a.meta.map((e, n) => e.title === void 0 ? /* @__PURE__ */ t("meta", { ...e }, `m${n}`) : /* @__PURE__ */ t("title", { children: e.title }, `t${n}`)),
94
- a.links.map((e, n) => /* @__PURE__ */ t("link", { ...e }, `l${n}`)),
95
- a.scripts.map(({ children: e, ...n }, r) => e === void 0 ? /* @__PURE__ */ t("script", { ...n }, `s${r}`) : /* @__PURE__ */ t("script", {
96
- ...n,
97
- dangerouslySetInnerHTML: { __html: e }
98
- }, `s${r}`))
99
- ] });
100
- }
101
- //#endregion
102
- export { s as PageHead, o as pageHead, a as parseRawHead };