@webround/editor 0.0.0-stage → 0.3.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/dist/blocks.d.ts +90 -0
- package/dist/blocks.js +119 -0
- package/dist/bridge.d.ts +96 -0
- package/dist/bridge.js +970 -0
- package/dist/check/aria.d.ts +19 -0
- package/dist/check/aria.js +106 -0
- package/dist/check/cli.d.ts +3 -0
- package/dist/check/cli.js +30 -0
- package/dist/check/css.d.ts +13 -0
- package/dist/check/css.js +63 -0
- package/dist/check/html.d.ts +8 -0
- package/dist/check/html.js +29 -0
- package/dist/check/index.d.ts +4 -0
- package/dist/check/index.js +5 -0
- package/dist/check/links.d.ts +7 -0
- package/dist/check/links.js +23 -0
- package/dist/check/orphans.d.ts +20 -0
- package/dist/check/orphans.js +57 -0
- package/dist/check/producer-code.d.ts +53 -0
- package/dist/check/producer-code.js +379 -0
- package/dist/check/producer-dom.d.ts +21 -0
- package/dist/check/producer-dom.js +52 -0
- package/dist/check/project.d.ts +20 -0
- package/dist/check/project.js +51 -0
- package/dist/check/rules.d.ts +7 -0
- package/dist/check/rules.js +517 -0
- package/dist/check/types.d.ts +160 -0
- package/dist/check/types.js +22 -0
- package/dist/components/WrAltcha.d.ts +5 -0
- package/dist/components/WrAltcha.js +8 -0
- package/dist/components/WrButton.d.ts +8 -0
- package/dist/components/WrButton.js +34 -0
- package/dist/components/WrForm.d.ts +6 -0
- package/dist/components/WrForm.js +29 -0
- package/dist/components/WrFormPrivacy.d.ts +4 -0
- package/dist/components/WrFormPrivacy.js +7 -0
- package/dist/components/WrFormSuccess.d.ts +4 -0
- package/dist/components/WrFormSuccess.js +12 -0
- package/dist/components/WrIframe.d.ts +12 -0
- package/dist/components/WrIframe.js +30 -0
- package/dist/components/WrImage.d.ts +9 -0
- package/dist/components/WrImage.js +28 -0
- package/dist/components/WrInput.d.ts +8 -0
- package/dist/components/WrInput.js +29 -0
- package/dist/components/WrLink.d.ts +10 -0
- package/dist/components/WrLink.js +38 -0
- package/dist/components/WrNav.d.ts +26 -0
- package/dist/components/WrNav.js +30 -0
- package/dist/components/WrSection.d.ts +11 -0
- package/dist/components/WrSection.js +5 -0
- package/dist/components/WrShared.d.ts +12 -0
- package/dist/components/WrShared.js +20 -0
- package/dist/components/WrText.d.ts +11 -0
- package/dist/components/WrText.js +41 -0
- package/dist/components/WrVideo.d.ts +9 -0
- package/dist/components/WrVideo.js +73 -0
- package/dist/components/text-editor/CodeThemeContext.d.ts +8 -0
- package/dist/components/text-editor/CodeThemeContext.js +10 -0
- package/dist/components/text-editor/ExampleTheme.d.ts +77 -0
- package/dist/components/text-editor/ExampleTheme.js +76 -0
- package/dist/components/text-editor/ToolbarContext.d.ts +17 -0
- package/dist/components/text-editor/ToolbarContext.js +32 -0
- package/dist/components/text-editor/WrTextEditor.d.ts +13 -0
- package/dist/components/text-editor/WrTextEditor.js +48 -0
- package/dist/components/text-editor/common/constants.d.ts +109 -0
- package/dist/components/text-editor/common/constants.js +58 -0
- package/dist/components/text-editor/common/surface.d.ts +3 -0
- package/dist/components/text-editor/common/surface.js +8 -0
- package/dist/components/text-editor/common/utils.d.ts +7 -0
- package/dist/components/text-editor/common/utils.js +78 -0
- package/dist/components/text-editor/hooks/useLexicalCommitOnBlur.d.ts +5 -0
- package/dist/components/text-editor/hooks/useLexicalCommitOnBlur.js +41 -0
- package/dist/components/text-editor/hooks/useLexicalMarkdown.d.ts +33 -0
- package/dist/components/text-editor/hooks/useLexicalMarkdown.js +284 -0
- package/dist/components/text-editor/nodes/CodeBlockNode.d.ts +23 -0
- package/dist/components/text-editor/nodes/CodeBlockNode.js +138 -0
- package/dist/components/text-editor/nodes/HorizontalRuleNode.d.ts +13 -0
- package/dist/components/text-editor/nodes/HorizontalRuleNode.js +22 -0
- package/dist/components/text-editor/plugins/CodeBlockPlugin.d.ts +2 -0
- package/dist/components/text-editor/plugins/CodeBlockPlugin.js +38 -0
- package/dist/components/text-editor/plugins/FontPlugin.d.ts +12 -0
- package/dist/components/text-editor/plugins/FontPlugin.js +114 -0
- package/dist/components/text-editor/plugins/FontSizePlugin.d.ts +7 -0
- package/dist/components/text-editor/plugins/FontSizePlugin.js +105 -0
- package/dist/components/text-editor/plugins/FontWeightPlugin.d.ts +6 -0
- package/dist/components/text-editor/plugins/FontWeightPlugin.js +103 -0
- package/dist/components/text-editor/plugins/HTMLTagPlugin.d.ts +7 -0
- package/dist/components/text-editor/plugins/HTMLTagPlugin.js +82 -0
- package/dist/components/text-editor/plugins/HorizontalRulePlugin.d.ts +2 -0
- package/dist/components/text-editor/plugins/HorizontalRulePlugin.js +35 -0
- package/dist/components/text-editor/plugins/LineSpacingPlugin.d.ts +7 -0
- package/dist/components/text-editor/plugins/LineSpacingPlugin.js +83 -0
- package/dist/components/text-editor/plugins/LinkPlugin.d.ts +8 -0
- package/dist/components/text-editor/plugins/LinkPlugin.js +183 -0
- package/dist/components/text-editor/plugins/ListToolbarPlugin.d.ts +7 -0
- package/dist/components/text-editor/plugins/ListToolbarPlugin.js +40 -0
- package/dist/components/text-editor/plugins/LoadContentPlugin.d.ts +4 -0
- package/dist/components/text-editor/plugins/LoadContentPlugin.js +63 -0
- package/dist/components/text-editor/plugins/MarkdownExportPlugin.d.ts +4 -0
- package/dist/components/text-editor/plugins/MarkdownExportPlugin.js +17 -0
- package/dist/components/text-editor/plugins/MarkdownPastePlugin.d.ts +2 -0
- package/dist/components/text-editor/plugins/MarkdownPastePlugin.js +45 -0
- package/dist/components/text-editor/plugins/SanitizePastePlugin.d.ts +3 -0
- package/dist/components/text-editor/plugins/SanitizePastePlugin.js +40 -0
- package/dist/components/text-editor/plugins/TextAlignPlugin.d.ts +7 -0
- package/dist/components/text-editor/plugins/TextAlignPlugin.js +65 -0
- package/dist/components/text-editor/plugins/TextColorPlugin.d.ts +7 -0
- package/dist/components/text-editor/plugins/TextColorPlugin.js +117 -0
- package/dist/components/text-editor/plugins/ToolbarPlugin.d.ts +10 -0
- package/dist/components/text-editor/plugins/ToolbarPlugin.js +73 -0
- package/dist/components/text-editor/theme-colors.d.ts +11 -0
- package/dist/components/text-editor/theme-colors.js +28 -0
- package/dist/context/WrAppContext.d.ts +35 -0
- package/dist/context/WrAppContext.js +113 -0
- package/dist/context/WrLayout.d.ts +15 -0
- package/dist/context/WrLayout.js +22 -0
- package/dist/context/WrPageContext.d.ts +28 -0
- package/dist/context/WrPageContext.js +282 -0
- package/dist/context/restoreValues.d.ts +2 -0
- package/dist/context/restoreValues.js +6 -0
- package/dist/contrast.d.ts +45 -0
- package/dist/contrast.js +122 -0
- package/dist/drop.d.ts +7 -0
- package/dist/drop.js +51 -0
- package/dist/gaps.d.ts +14 -0
- package/dist/gaps.js +50 -0
- package/dist/hooks/useWrMessage.d.ts +5 -0
- package/dist/hooks/useWrMessage.js +24 -0
- package/dist/hooks/useWrSave.d.ts +2 -0
- package/dist/hooks/useWrSave.js +11 -0
- package/dist/index.css +467 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +20 -0
- package/dist/interactive.d.ts +8 -0
- package/dist/interactive.js +13 -0
- package/dist/measure-rules.d.ts +34 -0
- package/dist/measure-rules.js +54 -0
- package/dist/measure.d.ts +11 -0
- package/dist/measure.js +139 -0
- package/dist/messages.d.ts +860 -0
- package/dist/messages.js +2 -0
- package/dist/nav.d.ts +5 -0
- package/dist/nav.js +10 -0
- package/dist/operations/animations-store.d.ts +6 -0
- package/dist/operations/animations-store.js +63 -0
- package/dist/operations/cli.d.ts +3 -0
- package/dist/operations/cli.js +52 -0
- package/dist/operations/comments-store.d.ts +17 -0
- package/dist/operations/comments-store.js +62 -0
- package/dist/operations/context.d.ts +12 -0
- package/dist/operations/context.js +35 -0
- package/dist/operations/define.d.ts +81 -0
- package/dist/operations/define.js +86 -0
- package/dist/operations/index.d.ts +6 -0
- package/dist/operations/index.js +6 -0
- package/dist/operations/ops/check.d.ts +5 -0
- package/dist/operations/ops/check.js +53 -0
- package/dist/operations/ops/comments.d.ts +6 -0
- package/dist/operations/ops/comments.js +133 -0
- package/dist/operations/ops/content.d.ts +16 -0
- package/dist/operations/ops/content.js +73 -0
- package/dist/operations/ops/json.d.ts +4 -0
- package/dist/operations/ops/json.js +27 -0
- package/dist/operations/ops/langs.d.ts +4 -0
- package/dist/operations/ops/langs.js +32 -0
- package/dist/operations/ops/nodes.d.ts +8 -0
- package/dist/operations/ops/nodes.js +270 -0
- package/dist/operations/ops/pages.d.ts +8 -0
- package/dist/operations/ops/pages.js +154 -0
- package/dist/operations/ops/project.d.ts +36 -0
- package/dist/operations/ops/project.js +97 -0
- package/dist/operations/ops/seo.d.ts +17 -0
- package/dist/operations/ops/seo.js +358 -0
- package/dist/operations/ops/style.d.ts +76 -0
- package/dist/operations/ops/style.js +268 -0
- package/dist/operations/ops/stylesets.d.ts +9 -0
- package/dist/operations/ops/stylesets.js +145 -0
- package/dist/operations/ops/theme.d.ts +6 -0
- package/dist/operations/ops/theme.js +304 -0
- package/dist/operations/registry.d.ts +8 -0
- package/dist/operations/registry.js +19 -0
- package/dist/operations/stylesets-store.d.ts +50 -0
- package/dist/operations/stylesets-store.js +216 -0
- package/dist/registry.d.ts +5 -0
- package/dist/registry.js +24 -0
- package/dist/save.d.ts +65 -0
- package/dist/save.js +86 -0
- package/dist/schema.d.ts +69 -0
- package/dist/schema.js +110 -0
- package/dist/scope.d.ts +41 -0
- package/dist/scope.js +44 -0
- package/dist/vite-plugins/ast.d.ts +3 -0
- package/dist/vite-plugins/ast.js +238 -0
- package/dist/vite-plugins/core-swap.d.ts +3 -0
- package/dist/vite-plugins/core-swap.js +57 -0
- package/dist/vite-plugins/create-page.d.ts +4 -0
- package/dist/vite-plugins/create-page.js +59 -0
- package/dist/vite-plugins/guard.d.ts +15 -0
- package/dist/vite-plugins/guard.js +35 -0
- package/dist/vite-plugins/head.d.ts +13 -0
- package/dist/vite-plugins/head.js +53 -0
- package/dist/vite-plugins/index.d.ts +7 -0
- package/dist/vite-plugins/index.js +7 -0
- package/dist/vite-plugins/jsx-tree.d.ts +118 -0
- package/dist/vite-plugins/jsx-tree.js +686 -0
- package/dist/vite-plugins/langs.d.ts +3 -0
- package/dist/vite-plugins/langs.js +44 -0
- package/dist/vite-plugins/operations.d.ts +10 -0
- package/dist/vite-plugins/operations.js +66 -0
- package/dist/vite-plugins/pages-api.d.ts +3 -0
- package/dist/vite-plugins/pages-api.js +112 -0
- package/dist/vite-plugins/pages.d.ts +3 -0
- package/dist/vite-plugins/pages.js +64 -0
- package/dist/vite-plugins/read.d.ts +3 -0
- package/dist/vite-plugins/read.js +45 -0
- package/dist/vite-plugins/seo-files.d.ts +8 -0
- package/dist/vite-plugins/seo-files.js +42 -0
- package/dist/vite-plugins/theme.d.ts +3 -0
- package/dist/vite-plugins/theme.js +207 -0
- package/dist/vite-plugins/update.d.ts +3 -0
- package/dist/vite-plugins/update.js +46 -0
- package/dist/vite-plugins/wr-plugins.d.ts +15 -0
- package/dist/vite-plugins/wr-plugins.js +34 -0
- package/dist/vite-plugins.d.ts +11 -0
- package/dist/vite-plugins.js +518 -0
- package/package.json +96 -5
- package/README.md +0 -3
package/dist/drop.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { wrHoldsElements } from '@webround/core/kinds';
|
|
2
|
+
// Where an element dragged over the page would land, said in the page's own layout: next to the element under the pointer, before or after it along the way the layout flows (down a
|
|
3
|
+
// column, across a row), or inside a section that has nothing in it yet. The editor decides whether that place is allowed (it knows the tree); this only looks at the page.
|
|
4
|
+
const idOf = (el) => el?.getAttribute('data-wr-id') ?? null;
|
|
5
|
+
const inside = (outer, el) => outer !== null && (outer === el || outer.contains(el));
|
|
6
|
+
const rectOf = (el) => { const r = el.getBoundingClientRect(); return { top: r.top, left: r.left, width: r.width, height: r.height }; };
|
|
7
|
+
/** The way the children of a box flow: across (a row, a grid) or down (everything else). */
|
|
8
|
+
function flowOf(box) {
|
|
9
|
+
if (!box)
|
|
10
|
+
return 'y';
|
|
11
|
+
const style = getComputedStyle(box);
|
|
12
|
+
if (style.display === 'grid' || style.display === 'inline-grid')
|
|
13
|
+
return 'x';
|
|
14
|
+
if (style.display === 'flex' || style.display === 'inline-flex')
|
|
15
|
+
return style.flexDirection.startsWith('row') ? 'x' : 'y';
|
|
16
|
+
return 'y';
|
|
17
|
+
}
|
|
18
|
+
const distance = (r, x, y) => Math.hypot(Math.max(r.left - x, 0, x - r.right), Math.max(r.top - y, 0, y - r.bottom));
|
|
19
|
+
/** The line that shows a place next to `ref`: along its edge, across the way the layout flows. */
|
|
20
|
+
function lineAt(ref, zone, flow) {
|
|
21
|
+
const r = ref.getBoundingClientRect();
|
|
22
|
+
return flow === 'x'
|
|
23
|
+
? { top: r.top, left: zone === 'before' ? r.left : r.right, width: 0, height: r.height }
|
|
24
|
+
: { top: zone === 'before' ? r.top : r.bottom, left: r.left, width: r.width, height: 0 };
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Where `dragged` (an element of the page, or null for a new block that is not there yet) would land if it were let go at (x, y) of the page; null if the pointer is over nothing the editor
|
|
28
|
+
* knows, or is over the element itself (or something inside it).
|
|
29
|
+
*/
|
|
30
|
+
export function wrDropTargetAt(dragged, x, y, doc = document) {
|
|
31
|
+
const over = doc.elementFromPoint(x, y)?.closest('[data-wr-id]') ?? null;
|
|
32
|
+
// Over the thing being moved (or what is in it) there is nowhere to go: it is where it is. Neither the element nor anything inside it is a place for itself.
|
|
33
|
+
if (!over || !idOf(over) || inside(dragged, over))
|
|
34
|
+
return null;
|
|
35
|
+
const kind = over.getAttribute('data-wr-type') ?? '';
|
|
36
|
+
if (wrHoldsElements(kind)) {
|
|
37
|
+
const kids = Array.from(over.children).filter(k => idOf(k) && !inside(dragged, k));
|
|
38
|
+
if (kids.length === 0)
|
|
39
|
+
return { overId: idOf(over), zone: 'inside', line: rectOf(over) };
|
|
40
|
+
const flow = flowOf(over);
|
|
41
|
+
const ref = kids.map(k => ({ k, d: distance(k.getBoundingClientRect(), x, y) })).sort((a, b) => a.d - b.d)[0].k;
|
|
42
|
+
const r = ref.getBoundingClientRect();
|
|
43
|
+
const zone = (flow === 'x' ? x < r.left + r.width / 2 : y < r.top + r.height / 2) ? 'before' : 'after';
|
|
44
|
+
return { overId: idOf(ref), zone, line: lineAt(ref, zone, flow) };
|
|
45
|
+
}
|
|
46
|
+
const flow = flowOf(over.parentElement);
|
|
47
|
+
const r = over.getBoundingClientRect();
|
|
48
|
+
const zone = (flow === 'x' ? x < r.left + r.width / 2 : y < r.top + r.height / 2) ? 'before' : 'after';
|
|
49
|
+
return { overId: idOf(over), zone, line: lineAt(over, zone, flow) };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=drop.js.map
|
package/dist/gaps.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { WrBoxGaps, WrRect } from './messages';
|
|
2
|
+
export interface WrGapInput {
|
|
3
|
+
/** The computed `display` of the box. */
|
|
4
|
+
display: string;
|
|
5
|
+
/** The computed `column-gap` and `row-gap`, in px (0 for `normal`). */
|
|
6
|
+
columnGap: number;
|
|
7
|
+
rowGap: number;
|
|
8
|
+
/** The box the children are laid out in: inside its border and padding. */
|
|
9
|
+
content: WrRect;
|
|
10
|
+
/** The children that take part in the layout (not `display: none`, not positioned out of it). */
|
|
11
|
+
kids: readonly WrRect[];
|
|
12
|
+
}
|
|
13
|
+
export declare function wrBoxGaps({ display, columnGap, rowGap, content, kids }: WrGapInput): WrBoxGaps | null;
|
|
14
|
+
//# sourceMappingURL=gaps.d.ts.map
|
package/dist/gaps.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** Less than this is not a gap anyone can see (and a layout that rounds would make bands out of nothing). */
|
|
2
|
+
const MIN_BAND = 1;
|
|
3
|
+
const isBox = (display) => /(^|-)(flex|grid)$/.test(display);
|
|
4
|
+
const isGrid = (display) => /grid$/.test(display);
|
|
5
|
+
export function wrBoxGaps({ display, columnGap, rowGap, content, kids }) {
|
|
6
|
+
if (!isBox(display) || kids.length < 2)
|
|
7
|
+
return null;
|
|
8
|
+
// Rows: children that overlap in height are on one line (a flex row, a wrapped line, a grid row); one that starts below the others starts the next line
|
|
9
|
+
const sorted = [...kids].sort((a, b) => a.top - b.top || a.left - b.left);
|
|
10
|
+
const rows = [];
|
|
11
|
+
let bottom = -Infinity;
|
|
12
|
+
for (const kid of sorted) {
|
|
13
|
+
if (rows.length === 0 || kid.top >= bottom - 0.5) {
|
|
14
|
+
rows.push([kid]);
|
|
15
|
+
bottom = kid.top + kid.height;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
rows[rows.length - 1].push(kid);
|
|
19
|
+
bottom = Math.max(bottom, kid.top + kid.height);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// What the gap is, not the free space around it: in a flex box the space a `justify-content` adds between the children is not the gap (the band is only as big as the gap, next to the
|
|
23
|
+
// child before it); in a grid the children fill their tracks, so what is measured between them is the gap
|
|
24
|
+
const size = (measured, gap) => (gap >= MIN_BAND && measured >= MIN_BAND ? (isGrid(display) ? measured : Math.min(measured, gap)) : 0);
|
|
25
|
+
const bands = [];
|
|
26
|
+
const extent = (row) => {
|
|
27
|
+
const top = Math.min(...row.map(k => k.top));
|
|
28
|
+
return { top, height: Math.max(...row.map(k => k.top + k.height)) - top };
|
|
29
|
+
};
|
|
30
|
+
for (const row of rows) {
|
|
31
|
+
const line = extent(row);
|
|
32
|
+
const byLeft = [...row].sort((a, b) => a.left - b.left);
|
|
33
|
+
for (let i = 1; i < byLeft.length; i++) {
|
|
34
|
+
const left = byLeft[i - 1].left + byLeft[i - 1].width;
|
|
35
|
+
const width = size(byLeft[i].left - left, columnGap);
|
|
36
|
+
if (width > 0)
|
|
37
|
+
bands.push({ axis: 'column', top: line.top, left, width, height: line.height });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
for (let i = 1; i < rows.length; i++) {
|
|
41
|
+
const above = extent(rows[i - 1]);
|
|
42
|
+
const below = extent(rows[i]);
|
|
43
|
+
const top = above.top + above.height;
|
|
44
|
+
const height = size(below.top - top, rowGap);
|
|
45
|
+
if (height > 0)
|
|
46
|
+
bands.push({ axis: 'row', top, left: content.left, width: content.width, height });
|
|
47
|
+
}
|
|
48
|
+
return bands.length === 0 ? null : { column: columnGap, row: rowGap, bands };
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=gaps.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { WrEditorInbound } from '../messages';
|
|
2
|
+
export declare function useWrMessage<T extends WrEditorInbound['type']>(type: T, elementId: string, handler: (msg: Extract<WrEditorInbound, {
|
|
3
|
+
type: T;
|
|
4
|
+
}>) => void): void;
|
|
5
|
+
//# sourceMappingURL=useWrMessage.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { registerWrSchema } from '../registry';
|
|
3
|
+
import { kindOfUpdateMessage, multilangFieldsOf } from '../schema';
|
|
4
|
+
export function useWrMessage(type, elementId, handler) {
|
|
5
|
+
const handlerRef = useRef(handler);
|
|
6
|
+
useEffect(() => { handlerRef.current = handler; });
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const kind = kindOfUpdateMessage(type);
|
|
9
|
+
registerWrSchema(elementId, kind ? multilangFieldsOf(kind) : []);
|
|
10
|
+
}, [type, elementId]);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const onMessage = (e) => {
|
|
13
|
+
const data = e.data;
|
|
14
|
+
if (data?.type !== type)
|
|
15
|
+
return;
|
|
16
|
+
if (data.elementId !== elementId)
|
|
17
|
+
return;
|
|
18
|
+
handlerRef.current(data);
|
|
19
|
+
};
|
|
20
|
+
window.addEventListener('message', onMessage);
|
|
21
|
+
return () => window.removeEventListener('message', onMessage);
|
|
22
|
+
}, [type, elementId]);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=useWrMessage.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export async function wrSave(pageName, id, value) {
|
|
2
|
+
await fetch('/wr/update', {
|
|
3
|
+
method: 'PUT',
|
|
4
|
+
headers: { 'Content-Type': 'application/json' },
|
|
5
|
+
body: JSON.stringify({
|
|
6
|
+
file: `config/${pageName}.json`,
|
|
7
|
+
patch: { [id]: value },
|
|
8
|
+
}),
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=useWrSave.js.map
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
/* ── LIGHT THEME ── */
|
|
2
|
+
:root,
|
|
3
|
+
[data-theme="light"] {
|
|
4
|
+
|
|
5
|
+
--wr-bg: #ffffff;
|
|
6
|
+
|
|
7
|
+
/* SFONDI — 1 = più chiaro, 5 = più scuro */
|
|
8
|
+
--wr-bg-1: #ffffff;
|
|
9
|
+
--wr-bg-2: #f8fafc;
|
|
10
|
+
--wr-bg-3: #edf2f7;
|
|
11
|
+
--wr-bg-4: #e2e8f0;
|
|
12
|
+
--wr-bg-5: #cbd5e1;
|
|
13
|
+
|
|
14
|
+
/* SFONDI INVERSI */
|
|
15
|
+
--wr-bg-1-inv: #020617;
|
|
16
|
+
--wr-bg-2-inv: #0f172a;
|
|
17
|
+
--wr-bg-3-inv: #1e293b;
|
|
18
|
+
--wr-bg-4-inv: #f1f5f9;
|
|
19
|
+
--wr-bg-5-inv: #ffffff;
|
|
20
|
+
|
|
21
|
+
/* TESTO — 1 = più visibile, 4 = meno visibile */
|
|
22
|
+
--wr-text-1: #0f172a;
|
|
23
|
+
--wr-text-2: #1e293b;
|
|
24
|
+
--wr-text-3: #475569;
|
|
25
|
+
--wr-text-4: #94a3b8;
|
|
26
|
+
|
|
27
|
+
/* TESTO INVERSI */
|
|
28
|
+
--wr-text-1-inv: #ffffff;
|
|
29
|
+
--wr-text-2-inv: #f1f5f9;
|
|
30
|
+
--wr-text-3-inv: #94a3b8;
|
|
31
|
+
--wr-text-4-inv: #334155;
|
|
32
|
+
|
|
33
|
+
/* SEZIONI ALWAYS-DARK */
|
|
34
|
+
--wr-bg-dark-1: #0f172a;
|
|
35
|
+
--wr-bg-dark-2: #1e293b;
|
|
36
|
+
--wr-bg-dark-3: #334155;
|
|
37
|
+
|
|
38
|
+
/* BORDI */
|
|
39
|
+
--wr-border: rgba(15, 23, 42, 0.10);
|
|
40
|
+
--wr-border-strong: rgba(15, 23, 42, 0.18);
|
|
41
|
+
|
|
42
|
+
/* OMBRE */
|
|
43
|
+
--wr-shadow-1: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);
|
|
44
|
+
--wr-shadow-2: 0 4px 12px rgba(15, 23, 42, 0.10), 0 2px 4px rgba(15, 23, 42, 0.06);
|
|
45
|
+
--wr-shadow-3: 0 12px 32px rgba(15, 23, 42, 0.14), 0 4px 8px rgba(15, 23, 42, 0.08);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* ── DARK THEME ── */
|
|
49
|
+
[data-theme="dark"] {
|
|
50
|
+
|
|
51
|
+
--wr-bg: #334155;
|
|
52
|
+
|
|
53
|
+
/* SFONDI — 1 = più chiaro, 5 = più scuro */
|
|
54
|
+
--wr-bg-1: #334155;
|
|
55
|
+
--wr-bg-2: #232d3f;
|
|
56
|
+
--wr-bg-3: #162030;
|
|
57
|
+
--wr-bg-4: #0f172a;
|
|
58
|
+
--wr-bg-5: #020617;
|
|
59
|
+
|
|
60
|
+
/* SFONDI INVERSI */
|
|
61
|
+
--wr-bg-1-inv: #ffffff;
|
|
62
|
+
--wr-bg-2-inv: #f8fafc;
|
|
63
|
+
--wr-bg-3-inv: #edf2f7;
|
|
64
|
+
--wr-bg-4-inv: #1e293b;
|
|
65
|
+
--wr-bg-5-inv: #0f172a;
|
|
66
|
+
|
|
67
|
+
/* TESTO — 1 = più visibile, 4 = meno visibile */
|
|
68
|
+
--wr-text-1: #ffffff;
|
|
69
|
+
--wr-text-2: #e2e8f0;
|
|
70
|
+
--wr-text-3: #94a3b8;
|
|
71
|
+
--wr-text-4: #475569;
|
|
72
|
+
|
|
73
|
+
/* TESTO INVERSI */
|
|
74
|
+
--wr-text-1-inv: #0f172a;
|
|
75
|
+
--wr-text-2-inv: #1e293b;
|
|
76
|
+
--wr-text-3-inv: #475569;
|
|
77
|
+
--wr-text-4-inv: #cbd5e1;
|
|
78
|
+
|
|
79
|
+
/* SEZIONI ALWAYS-DARK */
|
|
80
|
+
--wr-bg-dark-1: #000000;
|
|
81
|
+
--wr-bg-dark-2: #0f172a;
|
|
82
|
+
--wr-bg-dark-3: #1e293b;
|
|
83
|
+
|
|
84
|
+
/* BORDI */
|
|
85
|
+
--wr-border: rgba(255, 255, 255, 0.10);
|
|
86
|
+
--wr-border-strong: rgba(255, 255, 255, 0.16);
|
|
87
|
+
|
|
88
|
+
/* OMBRE */
|
|
89
|
+
--wr-shadow-1: 0 1px 3px rgba(0, 0, 0, 0.30), 0 1px 2px rgba(0, 0, 0, 0.20);
|
|
90
|
+
--wr-shadow-2: 0 4px 12px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
91
|
+
--wr-shadow-3: 0 12px 32px rgba(0, 0, 0, 0.60), 0 4px 8px rgba(0, 0, 0, 0.35);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* ── UTILITY CLASSES ── */
|
|
95
|
+
|
|
96
|
+
/* SFONDI */
|
|
97
|
+
.wr-bg {
|
|
98
|
+
background-color: var(--wr-bg);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.wr-bg-1 {
|
|
102
|
+
background-color: var(--wr-bg-1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.wr-bg-2 {
|
|
106
|
+
background-color: var(--wr-bg-2);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.wr-bg-3 {
|
|
110
|
+
background-color: var(--wr-bg-3);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.wr-bg-4 {
|
|
114
|
+
background-color: var(--wr-bg-4);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.wr-bg-5 {
|
|
118
|
+
background-color: var(--wr-bg-5);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.wr-bg-1-inv {
|
|
122
|
+
background-color: var(--wr-bg-1-inv);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.wr-bg-2-inv {
|
|
126
|
+
background-color: var(--wr-bg-2-inv);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.wr-bg-3-inv {
|
|
130
|
+
background-color: var(--wr-bg-3-inv);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.wr-bg-4-inv {
|
|
134
|
+
background-color: var(--wr-bg-4-inv);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.wr-bg-5-inv {
|
|
138
|
+
background-color: var(--wr-bg-5-inv);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* TESTO */
|
|
142
|
+
.wr-text {
|
|
143
|
+
color: var(--wr-text);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.wr-text-1 {
|
|
147
|
+
color: var(--wr-text-1);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.wr-text-2 {
|
|
151
|
+
color: var(--wr-text-2);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.wr-text-3 {
|
|
155
|
+
color: var(--wr-text-3);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.wr-text-4 {
|
|
159
|
+
color: var(--wr-text-4);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.wr-text-1-inv {
|
|
163
|
+
color: var(--wr-text-1-inv);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.wr-text-2-inv {
|
|
167
|
+
color: var(--wr-text-2-inv);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.wr-text-3-inv {
|
|
171
|
+
color: var(--wr-text-3-inv);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.wr-text-4-inv {
|
|
175
|
+
color: var(--wr-text-4-inv);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* ALWAYS-DARK */
|
|
179
|
+
.wr-bg-dark-1 {
|
|
180
|
+
background-color: var(--wr-bg-dark-1);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.wr-bg-dark-2 {
|
|
184
|
+
background-color: var(--wr-bg-dark-2);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.wr-bg-dark-3 {
|
|
188
|
+
background-color: var(--wr-bg-dark-3);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/* testo su always-dark — hardcoded, non dipende dal tema */
|
|
192
|
+
.wr-dark-text-1 {
|
|
193
|
+
color: #ffffff;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.wr-dark-text-2 {
|
|
197
|
+
color: #e2e8f0;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.wr-dark-text-3 {
|
|
201
|
+
color: #94a3b8;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.wr-dark-text-4 {
|
|
205
|
+
color: #475569;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.wr-elevated-border {
|
|
209
|
+
border-color: rgba(255, 255, 255, 0.08);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.wr-elevated-border-strong {
|
|
213
|
+
border-color: rgba(255, 255, 255, 0.16);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* BORDI */
|
|
217
|
+
.wr-border {
|
|
218
|
+
border-color: var(--wr-border);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.wr-border-strong {
|
|
222
|
+
border-color: var(--wr-border-strong);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/* OMBRE */
|
|
226
|
+
.wr-shadow-1 {
|
|
227
|
+
box-shadow: var(--wr-shadow-1);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.wr-shadow-2 {
|
|
231
|
+
box-shadow: var(--wr-shadow-2);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.wr-shadow-3 {
|
|
235
|
+
box-shadow: var(--wr-shadow-3);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/* ── SUPERFICI DEI PLUGIN (toolbar e menu) ──
|
|
239
|
+
Vivono dentro la pagina del sito, quindi i loro colori sono FISSI e non dipendono da niente di esterno
|
|
240
|
+
(tema del sito, data-theme, :root, colore del body, regole globali tipo `* { color }`).
|
|
241
|
+
1) Si ridefiniscono i token con valori chiari scritti nel codice: tutto ciò che sta dentro le due
|
|
242
|
+
superfici li usa tramite var(--wr-*) e riceve sempre questi, anche se il sito ne definisce altri.
|
|
243
|
+
2) Dentro le superfici il colore si eredita SEMPRE dalla radice: un `* { color }` del sito colpisce
|
|
244
|
+
ogni elemento direttamente e senza questo reset renderebbe bianche icone e testi senza colore proprio.
|
|
245
|
+
Questo blocco va PRIMA delle regole dei singoli elementi: quelle, a parità di specificità, vincono. */
|
|
246
|
+
.wr-toolbar-menu,
|
|
247
|
+
.wr-floating-bar {
|
|
248
|
+
--wr-bg-1: #ffffff;
|
|
249
|
+
--wr-bg-3: #edf2f7;
|
|
250
|
+
--wr-text-2: #000000;
|
|
251
|
+
--wr-text-3: #475569;
|
|
252
|
+
--wr-border: rgba(15, 23, 42, 0.10);
|
|
253
|
+
--wr-border-strong: rgba(15, 23, 42, 0.18);
|
|
254
|
+
--wr-shadow-2: 0 4px 12px rgba(15, 23, 42, 0.10), 0 2px 4px rgba(15, 23, 42, 0.06);
|
|
255
|
+
color: #000000;
|
|
256
|
+
color-scheme: light;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.wr-toolbar-menu *,
|
|
260
|
+
.wr-floating-bar * {
|
|
261
|
+
color: inherit;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.wr-toolbar-trigger {
|
|
265
|
+
display: inline-flex;
|
|
266
|
+
justify-content: space-between;
|
|
267
|
+
align-items: center;
|
|
268
|
+
width: 100%;
|
|
269
|
+
border-radius: 12px;
|
|
270
|
+
border: 1px solid var(--wr-border-strong);
|
|
271
|
+
padding: 8px 16px;
|
|
272
|
+
background: var(--wr-bg-1);
|
|
273
|
+
font-size: 14px;
|
|
274
|
+
font-weight: 500;
|
|
275
|
+
color: var(--wr-text-2);
|
|
276
|
+
cursor: pointer;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.wr-toolbar-trigger:hover {
|
|
280
|
+
background: var(--wr-bg-3);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.wr-toolbar-chevron {
|
|
284
|
+
margin-left: 8px;
|
|
285
|
+
height: 20px;
|
|
286
|
+
width: 20px;
|
|
287
|
+
transition: transform 200ms;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.wr-toolbar-chevron--open {
|
|
291
|
+
transform: rotate(180deg);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.wr-toolbar-menu {
|
|
295
|
+
position: fixed;
|
|
296
|
+
z-index: 10001;
|
|
297
|
+
background: var(--wr-bg-1);
|
|
298
|
+
border: 1px solid var(--wr-border);
|
|
299
|
+
border-radius: 12px;
|
|
300
|
+
box-shadow: var(--wr-shadow-2);
|
|
301
|
+
max-height: 240px;
|
|
302
|
+
overflow-y: auto;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.wr-toolbar-item {
|
|
306
|
+
display: block;
|
|
307
|
+
width: 100%;
|
|
308
|
+
padding: 8px 16px;
|
|
309
|
+
font-size: 14px;
|
|
310
|
+
text-align: left;
|
|
311
|
+
background: transparent;
|
|
312
|
+
border: none;
|
|
313
|
+
cursor: pointer;
|
|
314
|
+
color: var(--wr-text-2);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.wr-toolbar-item:hover {
|
|
318
|
+
background: var(--wr-bg-3);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.wr-toolbar-item--active {
|
|
322
|
+
font-weight: 700;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.wr-divider {
|
|
326
|
+
width: 1px;
|
|
327
|
+
height: 24px;
|
|
328
|
+
background: #e5e7eb;
|
|
329
|
+
margin: 0 2px;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.wr-floating-bar-wrap {
|
|
333
|
+
position: fixed;
|
|
334
|
+
top: 20px;
|
|
335
|
+
left: 50%;
|
|
336
|
+
transform: translateX(-50%);
|
|
337
|
+
width: auto;
|
|
338
|
+
max-width: 100%;
|
|
339
|
+
padding: 4px 16px;
|
|
340
|
+
z-index: 10001;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.wr-floating-bar {
|
|
344
|
+
border-radius: 8px;
|
|
345
|
+
overflow-x: auto;
|
|
346
|
+
white-space: nowrap;
|
|
347
|
+
display: flex;
|
|
348
|
+
align-items: center;
|
|
349
|
+
gap: 8px;
|
|
350
|
+
background: var(--wr-bg-1);
|
|
351
|
+
border: 1px solid var(--wr-border-strong);
|
|
352
|
+
box-shadow: var(--wr-shadow-2);
|
|
353
|
+
padding: 4px 8px;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.wr-toolbar-icon-btn {
|
|
357
|
+
display: inline-flex;
|
|
358
|
+
align-items: center;
|
|
359
|
+
justify-content: center;
|
|
360
|
+
background: transparent;
|
|
361
|
+
border: none;
|
|
362
|
+
padding: 6px;
|
|
363
|
+
border-radius: 6px;
|
|
364
|
+
cursor: pointer;
|
|
365
|
+
color: var(--wr-text-2);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.wr-toolbar-icon-btn:hover {
|
|
369
|
+
background: var(--wr-bg-3);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.wr-toolbar-icon-btn--active {
|
|
373
|
+
background: var(--wr-bg-3);
|
|
374
|
+
color: #3b82f6;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.wr-toolbar-icon-btn:disabled,
|
|
378
|
+
.wr-toolbar-icon-btn--disabled {
|
|
379
|
+
cursor: not-allowed;
|
|
380
|
+
opacity: 0.5;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.wr-core-input {
|
|
384
|
+
width: 100%;
|
|
385
|
+
border: 1px solid var(--wr-border);
|
|
386
|
+
padding: 8px;
|
|
387
|
+
border-radius: 6px;
|
|
388
|
+
background: var(--wr-bg-1);
|
|
389
|
+
color: var(--wr-text-2);
|
|
390
|
+
font-size: 14px;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.wr-color-dot {
|
|
394
|
+
width: 14px;
|
|
395
|
+
height: 14px;
|
|
396
|
+
border-radius: 50%;
|
|
397
|
+
border: 1px solid var(--wr-border);
|
|
398
|
+
display: inline-block;
|
|
399
|
+
flex-shrink: 0;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.wr-menu-row {
|
|
403
|
+
display: flex;
|
|
404
|
+
align-items: center;
|
|
405
|
+
gap: 8px;
|
|
406
|
+
padding: 8px 16px;
|
|
407
|
+
font-size: 12px;
|
|
408
|
+
text-transform: uppercase;
|
|
409
|
+
font-weight: 500;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.wr-label {
|
|
413
|
+
display: block;
|
|
414
|
+
font-size: 14px;
|
|
415
|
+
color: var(--wr-text-2);
|
|
416
|
+
margin-bottom: 4px;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.wr-help-text {
|
|
420
|
+
font-size: 12px;
|
|
421
|
+
color: var(--wr-text-3);
|
|
422
|
+
margin-top: 4px;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.wr-error-text {
|
|
426
|
+
font-size: 12px;
|
|
427
|
+
color: #ef4444;
|
|
428
|
+
margin-top: 4px;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.wr-primary-btn {
|
|
432
|
+
width: 100%;
|
|
433
|
+
background: #3b82f6;
|
|
434
|
+
color: #fff;
|
|
435
|
+
padding: 8px 12px;
|
|
436
|
+
border-radius: 12px;
|
|
437
|
+
box-shadow: var(--wr-shadow-1);
|
|
438
|
+
border: none;
|
|
439
|
+
cursor: pointer;
|
|
440
|
+
margin-top: 12px;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.wr-primary-btn:hover {
|
|
444
|
+
background: #2563eb;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.wr-primary-btn:disabled {
|
|
448
|
+
opacity: 0.5;
|
|
449
|
+
cursor: not-allowed;
|
|
450
|
+
}
|
|
451
|
+
/* Un contenitore vuoto (appena inserito) non ha altezza: senza un riquadro non c'è niente da cliccare, e da lì non si può
|
|
452
|
+
aggiungere altro dentro. Solo in modifica: questo CSS arriva con il package editor, mai con il core. */
|
|
453
|
+
[data-wr-type="section"]:empty {
|
|
454
|
+
min-height: 3rem;
|
|
455
|
+
outline: 1px dashed rgba(100, 116, 139, 0.55);
|
|
456
|
+
outline-offset: -1px;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/* A line that names the colors under it (the theme's, the others) in a menu of colors */
|
|
460
|
+
.wr-menu-heading {
|
|
461
|
+
padding: 6px 16px 2px;
|
|
462
|
+
font-size: 10px;
|
|
463
|
+
letter-spacing: 0.06em;
|
|
464
|
+
text-transform: uppercase;
|
|
465
|
+
font-weight: 600;
|
|
466
|
+
opacity: 0.6;
|
|
467
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
export { WrAppProvider, useWrApp } from './context/WrAppContext';
|
|
3
|
+
export { WrPageProvider, useWrPage, useWrPageUpdate, useWrPageMeta, useWrHistory } from './context/WrPageContext';
|
|
4
|
+
export { getFields, getFieldBackend, type FieldDef, type FieldBackend, type FieldLabelKey } from './schema';
|
|
5
|
+
export { WrButton } from './components/WrButton';
|
|
6
|
+
export { WrIframe } from './components/WrIframe';
|
|
7
|
+
export { WrImage } from './components/WrImage';
|
|
8
|
+
export { WrLink } from './components/WrLink';
|
|
9
|
+
export { WrAltcha } from './components/WrAltcha';
|
|
10
|
+
export { WrForm } from './components/WrForm';
|
|
11
|
+
export { WrFormPrivacy } from './components/WrFormPrivacy';
|
|
12
|
+
export { WrFormSuccess } from './components/WrFormSuccess';
|
|
13
|
+
export { WrInput } from './components/WrInput';
|
|
14
|
+
export { WrNav } from './components/WrNav';
|
|
15
|
+
export type { WrNavOptions } from './components/WrNav';
|
|
16
|
+
export { WrSection } from './components/WrSection';
|
|
17
|
+
export { WrShared } from './components/WrShared';
|
|
18
|
+
export { WrText } from './components/WrText';
|
|
19
|
+
export { WrVideo } from './components/WrVideo';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// packages/editor/src/index.ts
|
|
2
|
+
import './index.css';
|
|
3
|
+
export { WrAppProvider, useWrApp } from './context/WrAppContext';
|
|
4
|
+
export { WrPageProvider, useWrPage, useWrPageUpdate, useWrPageMeta, useWrHistory } from './context/WrPageContext';
|
|
5
|
+
export { getFields, getFieldBackend } from './schema';
|
|
6
|
+
export { WrButton } from './components/WrButton';
|
|
7
|
+
export { WrIframe } from './components/WrIframe';
|
|
8
|
+
export { WrImage } from './components/WrImage';
|
|
9
|
+
export { WrLink } from './components/WrLink';
|
|
10
|
+
export { WrAltcha } from './components/WrAltcha';
|
|
11
|
+
export { WrForm } from './components/WrForm';
|
|
12
|
+
export { WrFormPrivacy } from './components/WrFormPrivacy';
|
|
13
|
+
export { WrFormSuccess } from './components/WrFormSuccess';
|
|
14
|
+
export { WrInput } from './components/WrInput';
|
|
15
|
+
export { WrNav } from './components/WrNav';
|
|
16
|
+
export { WrSection } from './components/WrSection';
|
|
17
|
+
export { WrShared } from './components/WrShared';
|
|
18
|
+
export { WrText } from './components/WrText';
|
|
19
|
+
export { WrVideo } from './components/WrVideo';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const WR_INTERACTIVE_ATTR = "data-wr-interactive";
|
|
2
|
+
/** Da spargere sull'elemento radice di un componente interattivo. */
|
|
3
|
+
export declare const wrInteractive: {
|
|
4
|
+
readonly "data-wr-interactive": "true";
|
|
5
|
+
};
|
|
6
|
+
/** Vero se l'elemento è un componente che si accende come interattivo. */
|
|
7
|
+
export declare const isWrInteractive: (el: Pick<Element, "hasAttribute"> | null | undefined) => boolean;
|
|
8
|
+
//# sourceMappingURL=interactive.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Un elemento "interattivo" è uno su cui un click FA qualcosa nella pagina (un link naviga, un bottone agisce, un iframe è una pagina
|
|
2
|
+
// viva): in anteprima deve continuare a farlo. Quindi non si seleziona cliccandolo: lo si seleziona dalla maniglia che compare quando
|
|
3
|
+
// ci si passa sopra (stessa cosa dei link e dei bottoni).
|
|
4
|
+
//
|
|
5
|
+
// Un solo meccanismo, dichiarativo: un componente "si accende" mettendo `{...wrInteractive}` sul suo elemento. Il bridge non conosce
|
|
6
|
+
// nessun componente per nome, legge solo questo marcatore: un componente nuovo che deve comportarsi così ha una riga, e il bridge
|
|
7
|
+
// non cambia. (Solo nel package editor: il core è puro rendering e non sa nulla dell'editor.)
|
|
8
|
+
export const WR_INTERACTIVE_ATTR = 'data-wr-interactive';
|
|
9
|
+
/** Da spargere sull'elemento radice di un componente interattivo. */
|
|
10
|
+
export const wrInteractive = { [WR_INTERACTIVE_ATTR]: 'true' };
|
|
11
|
+
/** Vero se l'elemento è un componente che si accende come interattivo. */
|
|
12
|
+
export const isWrInteractive = (el) => !!el && el.hasAttribute(WR_INTERACTIVE_ATTR);
|
|
13
|
+
//# sourceMappingURL=interactive.js.map
|