@almadar/ui 4.40.0 → 4.41.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/avl/index.cjs
CHANGED
|
@@ -52828,8 +52828,24 @@ var AvlOrbitalsCosmicZoom = ({
|
|
|
52828
52828
|
() => parseApplicationLevel(parsedSchema),
|
|
52829
52829
|
[parsedSchema]
|
|
52830
52830
|
);
|
|
52831
|
-
const
|
|
52832
|
-
const
|
|
52831
|
+
const outerRef = React119.useRef(null);
|
|
52832
|
+
const [measured, setMeasured] = React119.useState(null);
|
|
52833
|
+
React119.useLayoutEffect(() => {
|
|
52834
|
+
const el = outerRef.current;
|
|
52835
|
+
if (!el) return;
|
|
52836
|
+
const update = () => {
|
|
52837
|
+
const r2 = el.getBoundingClientRect();
|
|
52838
|
+
if (r2.width > 0 && r2.height > 0) setMeasured({ w: r2.width, h: r2.height });
|
|
52839
|
+
};
|
|
52840
|
+
update();
|
|
52841
|
+
const ro = new ResizeObserver(update);
|
|
52842
|
+
ro.observe(el);
|
|
52843
|
+
return () => ro.disconnect();
|
|
52844
|
+
}, []);
|
|
52845
|
+
const fallbackW = typeof width === "number" ? width : 800;
|
|
52846
|
+
const fallbackH = typeof height === "number" ? height : 450;
|
|
52847
|
+
const containerW = measured?.w ?? fallbackW;
|
|
52848
|
+
const containerH = measured?.h ?? fallbackH;
|
|
52833
52849
|
const positions = React119.useMemo(
|
|
52834
52850
|
() => layoutOrbitals(orbitals.length, containerW, containerH),
|
|
52835
52851
|
[orbitals.length, containerW, containerH]
|
|
@@ -52985,10 +53001,11 @@ var AvlOrbitalsCosmicZoom = ({
|
|
|
52985
53001
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
52986
53002
|
Box,
|
|
52987
53003
|
{
|
|
53004
|
+
ref: outerRef,
|
|
52988
53005
|
className,
|
|
52989
53006
|
position: "relative",
|
|
52990
53007
|
overflow: "visible",
|
|
52991
|
-
style: { width, height
|
|
53008
|
+
style: { width, height },
|
|
52992
53009
|
children: [
|
|
52993
53010
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
52994
53011
|
Box,
|
package/dist/avl/index.js
CHANGED
|
@@ -52782,8 +52782,24 @@ var AvlOrbitalsCosmicZoom = ({
|
|
|
52782
52782
|
() => parseApplicationLevel(parsedSchema),
|
|
52783
52783
|
[parsedSchema]
|
|
52784
52784
|
);
|
|
52785
|
-
const
|
|
52786
|
-
const
|
|
52785
|
+
const outerRef = useRef(null);
|
|
52786
|
+
const [measured, setMeasured] = useState(null);
|
|
52787
|
+
useLayoutEffect(() => {
|
|
52788
|
+
const el = outerRef.current;
|
|
52789
|
+
if (!el) return;
|
|
52790
|
+
const update = () => {
|
|
52791
|
+
const r2 = el.getBoundingClientRect();
|
|
52792
|
+
if (r2.width > 0 && r2.height > 0) setMeasured({ w: r2.width, h: r2.height });
|
|
52793
|
+
};
|
|
52794
|
+
update();
|
|
52795
|
+
const ro = new ResizeObserver(update);
|
|
52796
|
+
ro.observe(el);
|
|
52797
|
+
return () => ro.disconnect();
|
|
52798
|
+
}, []);
|
|
52799
|
+
const fallbackW = typeof width === "number" ? width : 800;
|
|
52800
|
+
const fallbackH = typeof height === "number" ? height : 450;
|
|
52801
|
+
const containerW = measured?.w ?? fallbackW;
|
|
52802
|
+
const containerH = measured?.h ?? fallbackH;
|
|
52787
52803
|
const positions = useMemo(
|
|
52788
52804
|
() => layoutOrbitals(orbitals.length, containerW, containerH),
|
|
52789
52805
|
[orbitals.length, containerW, containerH]
|
|
@@ -52939,10 +52955,11 @@ var AvlOrbitalsCosmicZoom = ({
|
|
|
52939
52955
|
return /* @__PURE__ */ jsxs(
|
|
52940
52956
|
Box,
|
|
52941
52957
|
{
|
|
52958
|
+
ref: outerRef,
|
|
52942
52959
|
className,
|
|
52943
52960
|
position: "relative",
|
|
52944
52961
|
overflow: "visible",
|
|
52945
|
-
style: { width, height
|
|
52962
|
+
style: { width, height },
|
|
52946
52963
|
children: [
|
|
52947
52964
|
/* @__PURE__ */ jsx(
|
|
52948
52965
|
Box,
|
|
@@ -26895,6 +26895,16 @@ function nextBlockId(prefix = "blk") {
|
|
|
26895
26895
|
const random = Math.random().toString(36).slice(2, 8);
|
|
26896
26896
|
return `${prefix}-${Date.now().toString(36)}-${_idSeq}-${random}`;
|
|
26897
26897
|
}
|
|
26898
|
+
function normalizeBlocks(raw) {
|
|
26899
|
+
if (!raw || raw.length === 0) return [createBlock("paragraph")];
|
|
26900
|
+
return raw.map((row) => {
|
|
26901
|
+
const r = row;
|
|
26902
|
+
const rawType = r.type;
|
|
26903
|
+
const type = typeof rawType === "string" && BLOCK_TYPES.has(rawType) ? rawType : "paragraph";
|
|
26904
|
+
const id = typeof r.id === "string" && r.id ? r.id : nextBlockId(type);
|
|
26905
|
+
return { ...r, id, type };
|
|
26906
|
+
});
|
|
26907
|
+
}
|
|
26898
26908
|
function createBlock(type) {
|
|
26899
26909
|
switch (type) {
|
|
26900
26910
|
case "bullet-list":
|
|
@@ -27445,7 +27455,7 @@ function BlockRow({
|
|
|
27445
27455
|
}
|
|
27446
27456
|
);
|
|
27447
27457
|
}
|
|
27448
|
-
var TOOLBAR_ENTRIES, BLOCK_TYPE_LABEL, CHANGEABLE_TYPES, _idSeq; exports.RichBlockEditor = void 0;
|
|
27458
|
+
var TOOLBAR_ENTRIES, BLOCK_TYPE_LABEL, CHANGEABLE_TYPES, _idSeq, BLOCK_TYPES; exports.RichBlockEditor = void 0;
|
|
27449
27459
|
var init_RichBlockEditor = __esm({
|
|
27450
27460
|
"components/molecules/RichBlockEditor.tsx"() {
|
|
27451
27461
|
"use client";
|
|
@@ -27492,6 +27502,18 @@ var init_RichBlockEditor = __esm({
|
|
|
27492
27502
|
"code"
|
|
27493
27503
|
];
|
|
27494
27504
|
_idSeq = 0;
|
|
27505
|
+
BLOCK_TYPES = /* @__PURE__ */ new Set([
|
|
27506
|
+
"paragraph",
|
|
27507
|
+
"heading-1",
|
|
27508
|
+
"heading-2",
|
|
27509
|
+
"heading-3",
|
|
27510
|
+
"bullet-list",
|
|
27511
|
+
"numbered-list",
|
|
27512
|
+
"quote",
|
|
27513
|
+
"code",
|
|
27514
|
+
"divider",
|
|
27515
|
+
"image"
|
|
27516
|
+
]);
|
|
27495
27517
|
exports.RichBlockEditor = ({
|
|
27496
27518
|
initialBlocks,
|
|
27497
27519
|
onChange,
|
|
@@ -27502,7 +27524,7 @@ var init_RichBlockEditor = __esm({
|
|
|
27502
27524
|
className
|
|
27503
27525
|
}) => {
|
|
27504
27526
|
const [blocks, setBlocks] = React121.useState(
|
|
27505
|
-
() => initialBlocks
|
|
27527
|
+
() => normalizeBlocks(initialBlocks)
|
|
27506
27528
|
);
|
|
27507
27529
|
const onChangeRef = React121.useRef(onChange);
|
|
27508
27530
|
React121.useEffect(() => {
|
package/dist/components/index.js
CHANGED
|
@@ -26850,6 +26850,16 @@ function nextBlockId(prefix = "blk") {
|
|
|
26850
26850
|
const random = Math.random().toString(36).slice(2, 8);
|
|
26851
26851
|
return `${prefix}-${Date.now().toString(36)}-${_idSeq}-${random}`;
|
|
26852
26852
|
}
|
|
26853
|
+
function normalizeBlocks(raw) {
|
|
26854
|
+
if (!raw || raw.length === 0) return [createBlock("paragraph")];
|
|
26855
|
+
return raw.map((row) => {
|
|
26856
|
+
const r = row;
|
|
26857
|
+
const rawType = r.type;
|
|
26858
|
+
const type = typeof rawType === "string" && BLOCK_TYPES.has(rawType) ? rawType : "paragraph";
|
|
26859
|
+
const id = typeof r.id === "string" && r.id ? r.id : nextBlockId(type);
|
|
26860
|
+
return { ...r, id, type };
|
|
26861
|
+
});
|
|
26862
|
+
}
|
|
26853
26863
|
function createBlock(type) {
|
|
26854
26864
|
switch (type) {
|
|
26855
26865
|
case "bullet-list":
|
|
@@ -27400,7 +27410,7 @@ function BlockRow({
|
|
|
27400
27410
|
}
|
|
27401
27411
|
);
|
|
27402
27412
|
}
|
|
27403
|
-
var TOOLBAR_ENTRIES, BLOCK_TYPE_LABEL, CHANGEABLE_TYPES, _idSeq, RichBlockEditor;
|
|
27413
|
+
var TOOLBAR_ENTRIES, BLOCK_TYPE_LABEL, CHANGEABLE_TYPES, _idSeq, BLOCK_TYPES, RichBlockEditor;
|
|
27404
27414
|
var init_RichBlockEditor = __esm({
|
|
27405
27415
|
"components/molecules/RichBlockEditor.tsx"() {
|
|
27406
27416
|
"use client";
|
|
@@ -27447,6 +27457,18 @@ var init_RichBlockEditor = __esm({
|
|
|
27447
27457
|
"code"
|
|
27448
27458
|
];
|
|
27449
27459
|
_idSeq = 0;
|
|
27460
|
+
BLOCK_TYPES = /* @__PURE__ */ new Set([
|
|
27461
|
+
"paragraph",
|
|
27462
|
+
"heading-1",
|
|
27463
|
+
"heading-2",
|
|
27464
|
+
"heading-3",
|
|
27465
|
+
"bullet-list",
|
|
27466
|
+
"numbered-list",
|
|
27467
|
+
"quote",
|
|
27468
|
+
"code",
|
|
27469
|
+
"divider",
|
|
27470
|
+
"image"
|
|
27471
|
+
]);
|
|
27450
27472
|
RichBlockEditor = ({
|
|
27451
27473
|
initialBlocks,
|
|
27452
27474
|
onChange,
|
|
@@ -27457,7 +27479,7 @@ var init_RichBlockEditor = __esm({
|
|
|
27457
27479
|
className
|
|
27458
27480
|
}) => {
|
|
27459
27481
|
const [blocks, setBlocks] = useState(
|
|
27460
|
-
() => initialBlocks
|
|
27482
|
+
() => normalizeBlocks(initialBlocks)
|
|
27461
27483
|
);
|
|
27462
27484
|
const onChangeRef = useRef(onChange);
|
|
27463
27485
|
useEffect(() => {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* scope for the Phase 10 scaffold.
|
|
9
9
|
*/
|
|
10
10
|
import React from "react";
|
|
11
|
-
import type { EventEmit, EventPayloadValue } from '@almadar/core';
|
|
11
|
+
import type { EntityRow, EventEmit, EventPayloadValue } from '@almadar/core';
|
|
12
12
|
export type BlockType = "paragraph" | "heading-1" | "heading-2" | "heading-3" | "bullet-list" | "numbered-list" | "quote" | "code" | "divider" | "image";
|
|
13
13
|
export interface RichBlock {
|
|
14
14
|
id: string;
|
|
@@ -19,7 +19,14 @@ export interface RichBlock {
|
|
|
19
19
|
[key: string]: EventPayloadValue;
|
|
20
20
|
}
|
|
21
21
|
export interface RichBlockEditorProps {
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Initial block payload. Accepts strongly-typed RichBlock[] from native
|
|
24
|
+
* callers and the wider EntityRow[] shape that orb-bound traits emit
|
|
25
|
+
* (orb `[object]` lowers to `Record<string, FieldValue | undefined>[]`,
|
|
26
|
+
* which is structurally EntityRow[]). Items missing id/type are normalized
|
|
27
|
+
* into paragraph blocks at mount.
|
|
28
|
+
*/
|
|
29
|
+
initialBlocks?: readonly RichBlock[] | readonly EntityRow[];
|
|
23
30
|
onChange?: (blocks: RichBlock[]) => void;
|
|
24
31
|
changeEvent?: EventEmit<{
|
|
25
32
|
blocks: RichBlock[];
|