@almadar/ui 6.59.0 → 6.62.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/BehaviorValueFrame-3ORZHPWQ.css +1252 -0
- package/dist/BehaviorValueFrame-QYFJEMN5.js +18 -0
- package/dist/TraitValueFrame-2WMYJOA5.css +1252 -0
- package/dist/TraitValueFrame-X6IL3UST.js +17 -0
- package/dist/Typography-KBATMU2V.js +5 -0
- package/dist/{UISlotRenderer-YNY7V2UJ.js → UISlotRenderer-NZBV5BUI.js} +12 -10
- package/dist/avl/index.cjs +32263 -28103
- package/dist/avl/index.d.ts +36 -13
- package/dist/avl/index.js +298 -6130
- package/dist/{avl-3d-context-BpBKZIbc.d.ts → avl-3d-context-Dxun3-ri.d.ts} +2 -0
- package/dist/{chunk-YYYHH5BA.js → chunk-7JRWELUC.js} +4 -6
- package/dist/{chunk-723MJUU3.js → chunk-CXQENFO2.js} +1 -1
- package/dist/chunk-D4NAA2JW.js +49 -0
- package/dist/{chunk-I5QOYW2Z.js → chunk-DXPCAQJU.js} +205 -2
- package/dist/{chunk-J755QADM.js → chunk-EDPUQ2ZJ.js} +327 -18
- package/dist/{chunk-4ZGXIW3B.js → chunk-ERDYADVZ.js} +1 -1
- package/dist/{chunk-7CVXM2KS.js → chunk-EZ5FSNOE.js} +2 -2
- package/dist/{chunk-E6MWYQVZ.js → chunk-G6EFTACU.js} +9713 -786
- package/dist/{chunk-MZIDOJMD.js → chunk-GVQOTA7T.js} +2 -1
- package/dist/{chunk-Q47ZN2DW.js → chunk-N23SVGTH.js} +83 -1
- package/dist/{chunk-KJGVLXEN.js → chunk-N4IJS5DD.js} +50 -116
- package/dist/{chunk-LZRW6GXG.js → chunk-QOV3TUAA.js} +2 -3
- package/dist/chunk-WBWXBA5H.js +434 -0
- package/dist/{chunk-V3FGTQUE.js → chunk-ZR45FGW3.js} +7 -1
- package/dist/{cn-DIql5232.d.ts → cn-CDIhHCUC.d.ts} +40 -16
- package/dist/components/index.cjs +14779 -4354
- package/dist/components/index.d.ts +200 -180
- package/dist/components/index.js +16 -17
- package/dist/context/index.cjs +9 -1
- package/dist/context/index.js +3 -1
- package/dist/hooks/index.cjs +78 -9
- package/dist/hooks/index.d.ts +43 -2
- package/dist/hooks/index.js +6 -7
- package/dist/lib/drawable/three/index.cjs +361 -27
- package/dist/lib/drawable/three/index.d.ts +2 -2
- package/dist/lib/drawable/three/index.js +28 -7
- package/dist/lib/index.cjs +117 -5
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/index.js +99 -6
- package/dist/locales/index.cjs +6 -9
- package/dist/locales/index.js +2 -2
- package/dist/providers/index.cjs +14137 -1311
- package/dist/providers/index.d.ts +36 -4
- package/dist/providers/index.js +37 -17
- package/dist/runtime/index.cjs +28769 -18640
- package/dist/runtime/index.d.ts +70 -3
- package/dist/runtime/index.js +15 -381
- package/dist/ssr/index.cjs +508 -134
- package/dist/ssr/index.d.cts +56 -4
- package/dist/ssr/index.d.ts +56 -4
- package/dist/ssr/index.js +446 -72
- package/dist/{verificationRegistry-B3dj1Zl8.d.ts → verificationRegistry-B5aGl7WF.d.ts} +2 -1
- package/locales/ar.json +2 -3
- package/locales/en.json +2 -3
- package/locales/sl.json +2 -3
- package/package.json +8 -8
- package/tailwind-preset.cjs +78 -8
- package/themes/_base.css +27 -0
- package/themes/_contract.md +6 -0
- package/themes/_fonts.css +4 -4
- package/themes/_foundation.css +11 -0
- package/themes/_presets.css +2 -0
- package/themes/almadar-website.css +10 -0
- package/themes/almadar.css +10 -0
- package/themes/atelier.css +10 -0
- package/themes/bauhaus.css +10 -0
- package/themes/bloomberg-dense.css +10 -0
- package/themes/clay.css +10 -0
- package/themes/corporate.css +10 -0
- package/themes/gazette.css +10 -0
- package/themes/glass.css +10 -0
- package/themes/kflow.css +5 -0
- package/themes/kiosk.css +10 -0
- package/themes/linear-clean.css +10 -0
- package/themes/material.css +10 -0
- package/themes/minimalist.css +10 -0
- package/themes/nata.css +304 -0
- package/themes/neon.css +10 -0
- package/themes/notion-editorial.css +10 -0
- package/themes/orb.css +10 -0
- package/themes/prism.css +10 -0
- package/themes/rawi.css +304 -0
- package/themes/retro.css +10 -0
- package/themes/risograph.css +10 -0
- package/themes/scandi.css +10 -0
- package/themes/solarpunk.css +10 -0
- package/themes/terminal.css +138 -128
- package/dist/Typography-LZTP72Y4.js +0 -5
- package/dist/chunk-D2E44ODB.js +0 -350
- package/dist/chunk-N7JIG57B.js +0 -138
- package/dist/chunk-QJIAJ6EH.js +0 -2256
|
@@ -87,6 +87,8 @@ declare const AVL_3D_COLORS: {
|
|
|
87
87
|
readonly "op:std-memory": string;
|
|
88
88
|
readonly "op:std-trace": string;
|
|
89
89
|
readonly "op:std-behavior": string;
|
|
90
|
+
readonly "op:std-behavior-value": string;
|
|
91
|
+
readonly "op:std-program": string;
|
|
90
92
|
readonly "op:std-integration": string;
|
|
91
93
|
readonly orbitalSphere: "var(--color-card)";
|
|
92
94
|
readonly orbitalRim: "var(--color-info)";
|
|
@@ -130,7 +130,6 @@ var ar_default = {
|
|
|
130
130
|
"aria.upvote": "\u062A\u0635\u0648\u064A\u062A \u0625\u064A\u062C\u0627\u0628\u064A",
|
|
131
131
|
"aria.downvote": "\u062A\u0635\u0648\u064A\u062A \u0633\u0644\u0628\u064A",
|
|
132
132
|
"aria.qrScanner": "\u0645\u0627\u0633\u062D QR",
|
|
133
|
-
"aria.mockScanDev": "\u0645\u0633\u062D \u062A\u062C\u0631\u064A\u0628\u064A (\u062A\u0637\u0648\u064A\u0631)",
|
|
134
133
|
"aria.openMenu": "\u0641\u062A\u062D \u0627\u0644\u0642\u0627\u0626\u0645\u0629",
|
|
135
134
|
"aria.closeMenu": "\u0625\u063A\u0644\u0627\u0642 \u0627\u0644\u0642\u0627\u0626\u0645\u0629",
|
|
136
135
|
"aria.openSidebar": "\u0641\u062A\u062D \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",
|
|
@@ -328,7 +327,6 @@ var ar_default = {
|
|
|
328
327
|
"qrScanner.pauseScanning": "\u0625\u064A\u0642\u0627\u0641 \u0627\u0644\u0645\u0633\u062D \u0645\u0624\u0642\u062A\u064B\u0627",
|
|
329
328
|
"qrScanner.switchToFrontCamera": "\u0627\u0644\u062A\u0628\u062F\u064A\u0644 \u0625\u0644\u0649 \u0627\u0644\u0643\u0627\u0645\u064A\u0631\u0627 \u0627\u0644\u0623\u0645\u0627\u0645\u064A\u0629",
|
|
330
329
|
"qrScanner.switchToRearCamera": "\u0627\u0644\u062A\u0628\u062F\u064A\u0644 \u0625\u0644\u0649 \u0627\u0644\u0643\u0627\u0645\u064A\u0631\u0627 \u0627\u0644\u062E\u0644\u0641\u064A\u0629",
|
|
331
|
-
"qrScanner.mockScan": "\u0645\u0633\u062D \u062A\u062C\u0631\u064A\u0628\u064A",
|
|
332
330
|
"docSearch.placeholder": "\u0627\u0644\u0628\u062D\u062B \u0641\u064A \u0627\u0644\u0648\u062B\u0627\u0626\u0642...",
|
|
333
331
|
"stateMachine.loading": "\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0622\u0644\u0629 \u0627\u0644\u062D\u0627\u0644\u0629\u2026",
|
|
334
332
|
"stateMachine.noStateMachine": "\u0644\u0627 \u062A\u0648\u062C\u062F \u0622\u0644\u0629 \u062D\u0627\u0644\u0629 \u0644\u0639\u0631\u0636\u0647\u0627",
|
|
@@ -1254,7 +1252,8 @@ var ar_default = {
|
|
|
1254
1252
|
"avl.stateInitial": "\u0627\u0644\u0628\u062F\u0627\u064A\u0629",
|
|
1255
1253
|
"avl.stateTerminal": "\u0627\u0644\u0646\u0647\u0627\u064A\u0629",
|
|
1256
1254
|
"avl.guardCaption": "\u0644\u0627 \u064A\u062D\u062F\u062B \u0627\u0644\u0627\u0646\u062A\u0642\u0627\u0644 \u0625\u0644\u0627 \u0639\u0646\u062F\u0645\u0627 \u064A\u0643\u0648\u0646 \u0647\u0630\u0627 \u0627\u0644\u0634\u0631\u0637 \u0635\u062D\u064A\u062D\u064B\u0627.",
|
|
1257
|
-
"avl.effectsCaption": "\u0645\u0627 \u064A\u064F\u0646\u0641\u064E\u0651\u0630\u060C \u0628\u0627\u0644\u062A\u0631\u062A\u064A\u0628\u060C \u0639\u0646\u062F \u062D\u062F\u0648\u062B \u0627\u0644\u0627\u0646\u062A\u0642\u0627\u0644."
|
|
1255
|
+
"avl.effectsCaption": "\u0645\u0627 \u064A\u064F\u0646\u0641\u064E\u0651\u0630\u060C \u0628\u0627\u0644\u062A\u0631\u062A\u064A\u0628\u060C \u0639\u0646\u062F \u062D\u062F\u0648\u062B \u0627\u0644\u0627\u0646\u062A\u0642\u0627\u0644.",
|
|
1256
|
+
"aria.carousel": "\u0639\u0631\u0636 \u0634\u0631\u0627\u0626\u062D"
|
|
1258
1257
|
};
|
|
1259
1258
|
|
|
1260
1259
|
// locales/sl.json
|
|
@@ -1389,7 +1388,6 @@ var sl_default = {
|
|
|
1389
1388
|
"aria.upvote": "Glasuj za",
|
|
1390
1389
|
"aria.downvote": "Glasuj proti",
|
|
1391
1390
|
"aria.qrScanner": "QR skener",
|
|
1392
|
-
"aria.mockScanDev": "Simuliraj skeniranje (dev)",
|
|
1393
1391
|
"aria.openMenu": "Odpri meni",
|
|
1394
1392
|
"aria.closeMenu": "Zapri meni",
|
|
1395
1393
|
"aria.openSidebar": "Odpri stransko vrstico",
|
|
@@ -1587,7 +1585,6 @@ var sl_default = {
|
|
|
1587
1585
|
"qrScanner.pauseScanning": "Za\u010Dasno ustavi skeniranje",
|
|
1588
1586
|
"qrScanner.switchToFrontCamera": "Preklopi na sprednjo kamero",
|
|
1589
1587
|
"qrScanner.switchToRearCamera": "Preklopi na zadnjo kamero",
|
|
1590
|
-
"qrScanner.mockScan": "Preizkusno skeniranje",
|
|
1591
1588
|
"docSearch.placeholder": "Iskanje po dokumentaciji...",
|
|
1592
1589
|
"stateMachine.loading": "Nalaganje stanjskega stroja\u2026",
|
|
1593
1590
|
"stateMachine.noStateMachine": "Ni stanjskega stroja za prikaz",
|
|
@@ -2513,7 +2510,8 @@ var sl_default = {
|
|
|
2513
2510
|
"avl.stateInitial": "za\u010Detek",
|
|
2514
2511
|
"avl.stateTerminal": "konec",
|
|
2515
2512
|
"avl.guardCaption": "Prehod se zgodi le, ko je ta pogoj izpolnjen.",
|
|
2516
|
-
"avl.effectsCaption": "Kaj se izvede, po vrsti, ko se prehod zgodi."
|
|
2513
|
+
"avl.effectsCaption": "Kaj se izvede, po vrsti, ko se prehod zgodi.",
|
|
2514
|
+
"aria.carousel": "vrtiljak"
|
|
2517
2515
|
};
|
|
2518
2516
|
|
|
2519
2517
|
export { ar_default, sl_default };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { TraitValueMountContext } from './chunk-WBWXBA5H.js';
|
|
2
|
+
import { LoadingState, ErrorState, OrbPreview } from './chunk-G6EFTACU.js';
|
|
3
|
+
import { useContext, useMemo, useRef, useState, useEffect } from 'react';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function BehaviorValueFrame({ value }) {
|
|
7
|
+
const host = useContext(TraitValueMountContext);
|
|
8
|
+
const key = useMemo(() => JSON.stringify(value), [value]);
|
|
9
|
+
const latest = useRef(value);
|
|
10
|
+
latest.current = value;
|
|
11
|
+
const [state, setState] = useState({ status: "loading" });
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const current = latest.current;
|
|
14
|
+
const mountBehavior = host?.mountBehavior;
|
|
15
|
+
if (mountBehavior === void 0) {
|
|
16
|
+
setState({ status: "error", message: `This host cannot run behavior ${current.behavior}` });
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let live = true;
|
|
20
|
+
setState({ status: "loading" });
|
|
21
|
+
void mountBehavior(current).then((result) => {
|
|
22
|
+
if (!live) return;
|
|
23
|
+
if (!result.ok) {
|
|
24
|
+
const detail = (result.errors ?? []).map((e) => `${e.code}: ${e.message}`).join("\n");
|
|
25
|
+
setState({ status: "error", message: detail.length > 0 ? `${result.error}
|
|
26
|
+
${detail}` : result.error });
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
setState({ status: "ready", mounted: result.mounted });
|
|
30
|
+
});
|
|
31
|
+
return () => {
|
|
32
|
+
live = false;
|
|
33
|
+
};
|
|
34
|
+
}, [host, key]);
|
|
35
|
+
if (state.status === "loading") return /* @__PURE__ */ jsx(LoadingState, {});
|
|
36
|
+
if (state.status === "error") return /* @__PURE__ */ jsx(ErrorState, { message: state.message });
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
OrbPreview,
|
|
39
|
+
{
|
|
40
|
+
schema: state.mounted.schema,
|
|
41
|
+
initialPagePath: state.mounted.firstPage,
|
|
42
|
+
isolated: true,
|
|
43
|
+
...host?.behaviorTransport !== void 0 ? { transport: host.behaviorTransport } : {}
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
var BehaviorValueFrame_default = BehaviorValueFrame;
|
|
48
|
+
|
|
49
|
+
export { BehaviorValueFrame, BehaviorValueFrame_default };
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { useEventBus } from './chunk-CHNC4UYE.js';
|
|
2
|
-
import {
|
|
2
|
+
import { ar_default, sl_default } from './chunk-7JRWELUC.js';
|
|
3
|
+
import { DEFAULT_CURRENCY } from './chunk-CXQENFO2.js';
|
|
4
|
+
import { en_default } from './chunk-QOV3TUAA.js';
|
|
5
|
+
import React, { createContext, useCallback, useSyncExternalStore, useRef, useState, useContext, useEffect, useMemo } from 'react';
|
|
6
|
+
import { mergeEntityFrame, resolvePageMeta } from '@almadar/core';
|
|
7
|
+
import { createLogger } from '@almadar/logger';
|
|
3
8
|
|
|
4
9
|
function useMediaQuery(query) {
|
|
5
10
|
const subscribe = useCallback(
|
|
@@ -549,6 +554,204 @@ function parseQueryBinding(binding) {
|
|
|
549
554
|
field: parts.length > 1 ? parts.slice(1).join(".") : void 0
|
|
550
555
|
};
|
|
551
556
|
}
|
|
557
|
+
var { $meta: _meta, ...coreMessages } = en_default;
|
|
558
|
+
var coreLocale = coreMessages;
|
|
559
|
+
var { $meta: _arMeta, ...arMessages } = ar_default;
|
|
560
|
+
var { $meta: _slMeta, ...slMessages } = sl_default;
|
|
561
|
+
var uiLocales = { en: coreLocale, ar: arMessages, sl: slMessages };
|
|
562
|
+
var I18nContext = createContext({
|
|
563
|
+
locale: "en",
|
|
564
|
+
direction: "ltr",
|
|
565
|
+
t: (key, params) => {
|
|
566
|
+
let msg = coreLocale[key] ?? key;
|
|
567
|
+
if (params) {
|
|
568
|
+
for (const [k, v] of Object.entries(params)) {
|
|
569
|
+
msg = msg.split(`{{${k}}}`).join(String(v));
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
return msg;
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
I18nContext.displayName = "I18nContext";
|
|
576
|
+
function I18nProvider({ value, children, documentRoot }) {
|
|
577
|
+
useEffect(() => {
|
|
578
|
+
if (!documentRoot) return;
|
|
579
|
+
document.documentElement.lang = value.locale;
|
|
580
|
+
document.documentElement.dir = value.direction;
|
|
581
|
+
}, [documentRoot, value.locale, value.direction]);
|
|
582
|
+
return React.createElement(I18nContext.Provider, { value }, children);
|
|
583
|
+
}
|
|
584
|
+
function useTranslate() {
|
|
585
|
+
return useContext(I18nContext);
|
|
586
|
+
}
|
|
587
|
+
function useRenderI18n() {
|
|
588
|
+
const { locale, messages } = useContext(I18nContext);
|
|
589
|
+
return useMemo(() => messages !== void 0 ? { locale, messages } : void 0, [locale, messages]);
|
|
590
|
+
}
|
|
591
|
+
function useFormatContext() {
|
|
592
|
+
const { t, locale, currency } = useContext(I18nContext);
|
|
593
|
+
return useMemo(
|
|
594
|
+
() => ({ locale, currency: currency ?? DEFAULT_CURRENCY, booleanLabels: { yes: t("common.yes"), no: t("common.no") } }),
|
|
595
|
+
[t, locale, currency]
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
function createTranslate(messages, locale) {
|
|
599
|
+
const uiCatalog = locale !== void 0 ? uiLocales[locale] : void 0;
|
|
600
|
+
return (key, params) => {
|
|
601
|
+
let msg = messages[key] ?? uiCatalog?.[key] ?? coreLocale[key] ?? key;
|
|
602
|
+
if (params) {
|
|
603
|
+
for (const [k, v] of Object.entries(params)) {
|
|
604
|
+
msg = msg.split(`{{${k}}}`).join(String(v));
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
return msg;
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
// lib/bus-claim.ts
|
|
612
|
+
var claims = /* @__PURE__ */ new WeakMap();
|
|
613
|
+
function claimDelivery(source, trait, event) {
|
|
614
|
+
if (source === void 0) return true;
|
|
615
|
+
const key = `${trait}\0${event}`;
|
|
616
|
+
const seen = claims.get(source);
|
|
617
|
+
if (seen === void 0) {
|
|
618
|
+
claims.set(source, /* @__PURE__ */ new Set([key]));
|
|
619
|
+
return true;
|
|
620
|
+
}
|
|
621
|
+
if (seen.has(key)) return false;
|
|
622
|
+
seen.add(key);
|
|
623
|
+
return true;
|
|
624
|
+
}
|
|
625
|
+
var log = createLogger("almadar:ui:shared-entity-store");
|
|
626
|
+
var EMPTY_ENTITY_STATE = {};
|
|
627
|
+
function createSharedEntityStore() {
|
|
628
|
+
const states = /* @__PURE__ */ new Map();
|
|
629
|
+
const subscribers = /* @__PURE__ */ new Map();
|
|
630
|
+
const getSnapshot = (entityId) => states.get(entityId) ?? EMPTY_ENTITY_STATE;
|
|
631
|
+
const subscribe = (entityId, callback) => {
|
|
632
|
+
let set = subscribers.get(entityId);
|
|
633
|
+
if (!set) {
|
|
634
|
+
set = /* @__PURE__ */ new Set();
|
|
635
|
+
subscribers.set(entityId, set);
|
|
636
|
+
}
|
|
637
|
+
set.add(callback);
|
|
638
|
+
return () => {
|
|
639
|
+
const current = subscribers.get(entityId);
|
|
640
|
+
if (!current) return;
|
|
641
|
+
current.delete(callback);
|
|
642
|
+
if (current.size === 0) {
|
|
643
|
+
subscribers.delete(entityId);
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
};
|
|
647
|
+
const commit = (entityId, nextState) => {
|
|
648
|
+
states.set(entityId, nextState);
|
|
649
|
+
const set = subscribers.get(entityId);
|
|
650
|
+
if (!set) return;
|
|
651
|
+
set.forEach((callback) => {
|
|
652
|
+
try {
|
|
653
|
+
callback();
|
|
654
|
+
} catch (error) {
|
|
655
|
+
log.error("Shared entity subscriber error", {
|
|
656
|
+
entityId,
|
|
657
|
+
error: error instanceof Error ? error : String(error)
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
};
|
|
662
|
+
const seed = (entityId, initialState) => {
|
|
663
|
+
if (!states.has(entityId)) {
|
|
664
|
+
states.set(entityId, initialState);
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
return { getSnapshot, subscribe, commit, seed };
|
|
668
|
+
}
|
|
669
|
+
function useSharedEntityStore() {
|
|
670
|
+
const storeRef = useRef(null);
|
|
671
|
+
if (storeRef.current === null) {
|
|
672
|
+
storeRef.current = createSharedEntityStore();
|
|
673
|
+
}
|
|
674
|
+
return storeRef.current;
|
|
675
|
+
}
|
|
676
|
+
var SharedEntityStoreContext = createContext(null);
|
|
677
|
+
function useSharedEntityStoreContext() {
|
|
678
|
+
const store = useContext(SharedEntityStoreContext);
|
|
679
|
+
if (!store) {
|
|
680
|
+
throw new Error(
|
|
681
|
+
"useSharedEntityStoreContext: no SharedEntityStoreContext.Provider found in the component tree"
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
return store;
|
|
685
|
+
}
|
|
686
|
+
function useSharedEntitySnapshot(store, entityId) {
|
|
687
|
+
return useSyncExternalStore(
|
|
688
|
+
(onStoreChange) => store.subscribe(entityId, onStoreChange),
|
|
689
|
+
() => store.getSnapshot(entityId)
|
|
690
|
+
);
|
|
691
|
+
}
|
|
692
|
+
function runTickFrame(entityId, orderedWriters, store) {
|
|
693
|
+
let scratch = store.getSnapshot(entityId);
|
|
694
|
+
for (const writer of orderedWriters) {
|
|
695
|
+
const writes = writer(scratch);
|
|
696
|
+
scratch = mergeEntityFrame(scratch, writes);
|
|
697
|
+
}
|
|
698
|
+
store.commit(entityId, scratch);
|
|
699
|
+
return scratch;
|
|
700
|
+
}
|
|
701
|
+
var OWNED = "data-orb-head";
|
|
702
|
+
var shellTitle;
|
|
703
|
+
function ownedTag(tag, attrs) {
|
|
704
|
+
const el = document.createElement(tag);
|
|
705
|
+
for (const [k, v] of Object.entries(attrs)) el.setAttribute(k, v);
|
|
706
|
+
el.setAttribute(OWNED, "");
|
|
707
|
+
return el;
|
|
708
|
+
}
|
|
709
|
+
function usePageHead(input) {
|
|
710
|
+
const { messages, locale } = useTranslate();
|
|
711
|
+
const title = input ? resolvePageMeta(input.title, (k) => messages?.[k]) : void 0;
|
|
712
|
+
const description = input ? resolvePageMeta(input.description, (k) => messages?.[k]) : void 0;
|
|
713
|
+
const isPublic = input?.access !== "authenticated" && input?.indexing !== "noindex";
|
|
714
|
+
const canonical = input?.origin !== void 0 ? `${input.origin.replace(/\/+$/, "")}${input.path}` : void 0;
|
|
715
|
+
const siteName = input?.siteName;
|
|
716
|
+
const active = input !== null;
|
|
717
|
+
const originBase = input?.origin?.replace(/\/+$/, "");
|
|
718
|
+
const hreflang = [];
|
|
719
|
+
if (originBase !== void 0) {
|
|
720
|
+
for (const alt of input?.alternates ?? []) hreflang.push([alt.locale, `${originBase}${alt.path}`]);
|
|
721
|
+
const fallback = input?.alternates?.find((alt) => alt.locale === input.defaultLocale);
|
|
722
|
+
if (fallback !== void 0) hreflang.push(["x-default", `${originBase}${fallback.path}`]);
|
|
723
|
+
}
|
|
724
|
+
const hreflangKey = hreflang.map(([lang, href]) => `${lang} ${href}`).join("\n");
|
|
725
|
+
useEffect(() => {
|
|
726
|
+
if (!active || typeof document === "undefined") return void 0;
|
|
727
|
+
shellTitle ?? (shellTitle = document.title);
|
|
728
|
+
document.title = title ?? siteName ?? shellTitle;
|
|
729
|
+
const tags = [];
|
|
730
|
+
if (!isPublic) tags.push(ownedTag("meta", { name: "robots", content: "noindex" }));
|
|
731
|
+
if (isPublic && description !== void 0) {
|
|
732
|
+
tags.push(ownedTag("meta", { name: "description", content: description }));
|
|
733
|
+
tags.push(ownedTag("meta", { property: "og:description", content: description }));
|
|
734
|
+
}
|
|
735
|
+
if (isPublic && title !== void 0) tags.push(ownedTag("meta", { property: "og:title", content: title }));
|
|
736
|
+
if (isPublic && canonical !== void 0) {
|
|
737
|
+
tags.push(ownedTag("link", { rel: "canonical", href: canonical }));
|
|
738
|
+
tags.push(ownedTag("meta", { property: "og:url", content: canonical }));
|
|
739
|
+
}
|
|
740
|
+
if (isPublic && siteName !== void 0) tags.push(ownedTag("meta", { property: "og:site_name", content: siteName }));
|
|
741
|
+
if (isPublic) tags.push(ownedTag("meta", { property: "og:locale", content: locale }));
|
|
742
|
+
if (isPublic && hreflangKey !== "") {
|
|
743
|
+
for (const line of hreflangKey.split("\n")) {
|
|
744
|
+
const space = line.indexOf(" ");
|
|
745
|
+
tags.push(ownedTag("link", { rel: "alternate", hreflang: line.slice(0, space), href: line.slice(space + 1) }));
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
for (const stale of Array.from(document.head.querySelectorAll(`[${OWNED}]`))) stale.remove();
|
|
749
|
+
for (const tag of tags) document.head.appendChild(tag);
|
|
750
|
+
return () => {
|
|
751
|
+
for (const tag of tags) tag.remove();
|
|
752
|
+
};
|
|
753
|
+
}, [active, title, description, isPublic, canonical, siteName, locale, hreflangKey]);
|
|
754
|
+
}
|
|
552
755
|
function usePullToRefresh(onRefresh, options = {}) {
|
|
553
756
|
const { threshold = 60, maxPull = 120 } = options;
|
|
554
757
|
const [pullDistance, setPullDistance] = useState(0);
|
|
@@ -678,4 +881,4 @@ function useDragReorder(initialItems, onReorder) {
|
|
|
678
881
|
};
|
|
679
882
|
}
|
|
680
883
|
|
|
681
|
-
export { ALMADAR_DND_MIME, PendingScopeContext, beginPending, endPending, parseQueryBinding, useAuthContext, useCanvasGestures, useDragReorder, useDraggable, useDropZone, useInfiniteScroll, useLongPress, useMediaQuery, usePendingAction, usePendingRows, usePendingScopeValue, usePrefersReducedMotion, usePullToRefresh, useQuerySingleton, useScopeHasPending, useSwipeGesture };
|
|
884
|
+
export { ALMADAR_DND_MIME, I18nProvider, PendingScopeContext, SharedEntityStoreContext, beginPending, claimDelivery, createSharedEntityStore, createTranslate, endPending, parseQueryBinding, runTickFrame, useAuthContext, useCanvasGestures, useDragReorder, useDraggable, useDropZone, useFormatContext, useInfiniteScroll, useLongPress, useMediaQuery, usePageHead, usePendingAction, usePendingRows, usePendingScopeValue, usePrefersReducedMotion, usePullToRefresh, useQuerySingleton, useRenderI18n, useScopeHasPending, useSharedEntitySnapshot, useSharedEntityStore, useSharedEntityStoreContext, useSwipeGesture, useTranslate };
|