@plitzi/sdk-elements 0.39.10 → 0.39.12
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/CHANGELOG.md +28 -0
- package/dist/Element/hooks/useElementState.d.ts +1 -1
- package/dist/builder/index.d.ts +2 -0
- package/dist/builder/index.mjs +4 -1
- package/dist/builder/ruleFields.d.ts +16 -0
- package/dist/builder/ruleFields.mjs +86 -0
- package/dist/builder/ruleSummary.d.ts +6 -0
- package/dist/builder/ruleSummary.mjs +33 -0
- package/dist/dataSource/GlobalSources.mjs +120 -99
- package/dist/dataSource/index.d.ts +1 -0
- package/dist/dataSource/index.mjs +6 -5
- package/dist/dataSource/useAudienceScope.d.ts +8 -0
- package/dist/dataSource/useAudienceScope.mjs +40 -0
- package/dist/dataSource/useExperiments.d.ts +12 -0
- package/dist/dataSource/useExperiments.mjs +58 -0
- package/dist/elements/basic/Link/declaration.mjs +1 -1
- package/dist/elements/declarations/index.d.ts +112 -2
- package/dist/elements/declarations/index.mjs +55 -49
- package/dist/elements/index.d.ts +5 -1
- package/dist/elements/index.mjs +6 -2
- package/dist/elements/media/Embed/declaration.d.ts +1 -1
- package/dist/elements/media/Embed/index.d.ts +1 -1
- package/dist/elements/provider/Channel/declaration.mjs +1 -1
- package/dist/elements/settings.mjs +8 -2
- package/dist/elements/structure/TimeWindow/Settings.d.ts +8 -0
- package/dist/elements/structure/TimeWindow/Settings.mjs +40 -0
- package/dist/elements/structure/TimeWindow/TimeWindow.d.ts +14 -0
- package/dist/elements/structure/TimeWindow/TimeWindow.mjs +32 -0
- package/dist/elements/structure/TimeWindow/declaration.d.ts +34 -0
- package/dist/elements/structure/TimeWindow/declaration.mjs +26 -0
- package/dist/elements/structure/TimeWindow/index.d.ts +32 -0
- package/dist/elements/structure/TimeWindow/index.mjs +5 -0
- package/dist/elements/testing/Variants/Settings.d.ts +14 -0
- package/dist/elements/testing/Variants/Settings.mjs +280 -0
- package/dist/elements/testing/Variants/VariantItem/Settings.d.ts +13 -0
- package/dist/elements/testing/Variants/VariantItem/Settings.mjs +140 -0
- package/dist/elements/testing/Variants/VariantItem/VariantItem.d.ts +18 -0
- package/dist/elements/testing/Variants/VariantItem/VariantItem.mjs +11 -0
- package/dist/elements/testing/Variants/VariantItem/declaration.d.ts +38 -0
- package/dist/elements/testing/Variants/VariantItem/declaration.mjs +29 -0
- package/dist/elements/testing/Variants/VariantItem/index.d.ts +36 -0
- package/dist/elements/testing/Variants/VariantItem/index.mjs +5 -0
- package/dist/elements/testing/Variants/Variants.d.ts +28 -0
- package/dist/elements/testing/Variants/Variants.mjs +31 -0
- package/dist/elements/testing/Variants/declaration.d.ts +44 -0
- package/dist/elements/testing/Variants/declaration.mjs +30 -0
- package/dist/elements/testing/Variants/index.d.ts +77 -0
- package/dist/elements/testing/Variants/index.mjs +9 -0
- package/dist/elements/testing/childOfItem.d.ts +7 -0
- package/dist/elements/testing/childOfItem.mjs +9 -0
- package/dist/index.d.ts +108 -1
- package/dist/index.mjs +13 -9
- package/package.json +8 -8
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ExperimentAssignments } from '@plitzi/sdk-shared/experiments';
|
|
2
|
+
/**
|
|
3
|
+
* The variant each of the space's A/B tests shows this visitor — what `{{ experiments.<name> }}` reads.
|
|
4
|
+
*
|
|
5
|
+
* The server's first: it drew the page with them, and a page hydrated with any other would be thrown away. Then what
|
|
6
|
+
* the visitor kept in their cookie, then a draw for an experiment none of those has — a space rendered with no server
|
|
7
|
+
* in front, or a part of it the server never sent — kept from then on, in this render and in the cookie. Over them, what
|
|
8
|
+
* a tester forced (the dev tools, `?ab=`), shown and never kept. In the builder nothing is drawn or kept: the canvas
|
|
9
|
+
* shows the variant each test's settings name, and in its preview what the Simulate visitor panel forces over them.
|
|
10
|
+
*/
|
|
11
|
+
declare const useExperiments: () => ExperimentAssignments;
|
|
12
|
+
export default useExperiments;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useEffect as e, useMemo as t, useRef as n } from "react";
|
|
2
|
+
import { useStableValue as r } from "@plitzi/sdk-shared/hooks";
|
|
3
|
+
import { documentCookies as i } from "@plitzi/sdk-shared/helpers";
|
|
4
|
+
import { useCommonStore as a, useCommonStoreGetter as o, useRenderSettings as s } from "@plitzi/sdk-shared/store";
|
|
5
|
+
import { assignExperiments as c, builderExperiments as l, declaredExperiments as u, forcedExperimentsFor as d, keptExperiments as f, writeExperiments as p } from "@plitzi/sdk-shared/experiments";
|
|
6
|
+
// src/dataSource/useExperiments.ts
|
|
7
|
+
var m = () => typeof window > "u" ? void 0 : window.location.host, h = () => {
|
|
8
|
+
let [[h, g, _, v]] = a([
|
|
9
|
+
"schema.flat",
|
|
10
|
+
"schema.components",
|
|
11
|
+
"experiments.server",
|
|
12
|
+
"experiments.qa"
|
|
13
|
+
]), { builder: y, previewMode: b } = s(), x = y && !b, S = t(() => u({
|
|
14
|
+
flat: h,
|
|
15
|
+
components: g
|
|
16
|
+
}), [h, g]), C = n({}), w = t(() => {
|
|
17
|
+
if (y) return {
|
|
18
|
+
assignments: l(S),
|
|
19
|
+
kept: {},
|
|
20
|
+
drawn: []
|
|
21
|
+
};
|
|
22
|
+
let e = {
|
|
23
|
+
...f(i(), m()),
|
|
24
|
+
...C.current,
|
|
25
|
+
..._
|
|
26
|
+
};
|
|
27
|
+
return c(S, e);
|
|
28
|
+
}, [
|
|
29
|
+
y,
|
|
30
|
+
S,
|
|
31
|
+
_
|
|
32
|
+
]);
|
|
33
|
+
for (let e of w.drawn) C.current[e] = w.assignments[e];
|
|
34
|
+
let { drawn: T, kept: E } = w, D = o("experiments.drawn"), [, O] = a("experiments.drawn");
|
|
35
|
+
e(() => {
|
|
36
|
+
T.length > 0 && (p({
|
|
37
|
+
...f(i(), m()),
|
|
38
|
+
...E
|
|
39
|
+
}), O([.../* @__PURE__ */ new Set([...D() ?? [], ...T])]));
|
|
40
|
+
}, [
|
|
41
|
+
T,
|
|
42
|
+
E,
|
|
43
|
+
D,
|
|
44
|
+
O
|
|
45
|
+
]);
|
|
46
|
+
let k = t(() => d(S, x ? {} : v ?? {}), [
|
|
47
|
+
S,
|
|
48
|
+
x,
|
|
49
|
+
v
|
|
50
|
+
]), A = r(k.ignored);
|
|
51
|
+
return e(() => {
|
|
52
|
+
A.forEach(({ name: e, variant: t, reason: n }) => console.warn(n === "undeclared" ? `[plitzi] "${e}" is forced to ${t.toUpperCase()}, but no A/B test of this space runs it: ignored. Name an experiment one of its tests runs.` : `[plitzi] "${e}" is forced to ${t.toUpperCase()}, a variant its A/B test does not have: ignored. Force one it has.`));
|
|
53
|
+
}, [A]), t(() => Object.keys(k.applied).length > 0 ? {
|
|
54
|
+
...w.assignments,
|
|
55
|
+
...k.applied
|
|
56
|
+
} : w.assignments, [w.assignments, k]);
|
|
57
|
+
};
|
|
58
|
+
export { h as default };
|
|
@@ -38,7 +38,7 @@ var n = e()({
|
|
|
38
38
|
},
|
|
39
39
|
definition: {
|
|
40
40
|
label: "Link",
|
|
41
|
-
description: "
|
|
41
|
+
description: "Moves the user to another page of the site or to an external address (its `mode`/`href` decide which). Use this to go page-to-page rather than a button + interaction. Its words are its own `content` and an icon beside them its `icon` (Font Awesome classes) — no text or fontAwesome element inside it for them. It marks itself current on the page it leads to (`aria-current`, the `current` style state); its `current` set to `section` keeps it current on every page under its path too — a menu entry for a section and its pages.",
|
|
42
42
|
items: [],
|
|
43
43
|
styleSelectors: { icon: "" }
|
|
44
44
|
},
|
|
@@ -41,6 +41,9 @@ import { default as TabContainerDeclaration } from '../structure/TabContainer/de
|
|
|
41
41
|
import { default as TabContainerBodyDeclaration } from '../structure/TabContainer/TabContainerBody/declaration';
|
|
42
42
|
import { default as TabContainerHeaderDeclaration } from '../structure/TabContainer/TabContainerHeader/declaration';
|
|
43
43
|
import { default as TabContainerItemDeclaration } from '../structure/TabContainer/TabContainerItem/declaration';
|
|
44
|
+
import { default as TimeWindowDeclaration } from '../structure/TimeWindow/declaration';
|
|
45
|
+
import { default as VariantsDeclaration } from '../testing/Variants/declaration';
|
|
46
|
+
import { default as VariantItemDeclaration } from '../testing/Variants/VariantItem/declaration';
|
|
44
47
|
export declare const elementDeclarations: {
|
|
45
48
|
readonly ApiContainer: import('@plitzi/sdk-shared/authoring').DeclaredElement<{
|
|
46
49
|
readonly type: "apiContainer";
|
|
@@ -1247,9 +1250,9 @@ export declare const elementDeclarations: {
|
|
|
1247
1250
|
}, Partial<{
|
|
1248
1251
|
title?: string | undefined;
|
|
1249
1252
|
src?: string | undefined;
|
|
1253
|
+
referrerPolicy?: "no-referrer" | "origin" | "strict-origin-when-cross-origin" | "no-referrer-when-downgrade" | undefined;
|
|
1250
1254
|
allow?: string | undefined;
|
|
1251
1255
|
loading?: "lazy" | "eager" | undefined;
|
|
1252
|
-
referrerPolicy?: "no-referrer" | "origin" | "strict-origin-when-cross-origin" | "no-referrer-when-downgrade" | undefined;
|
|
1253
1256
|
sandbox?: string | undefined;
|
|
1254
1257
|
}>>;
|
|
1255
1258
|
readonly FontAwesome: import('@plitzi/sdk-shared/authoring').DeclaredElement<{
|
|
@@ -3909,6 +3912,106 @@ export declare const elementDeclarations: {
|
|
|
3909
3912
|
systemLabel?: string | undefined;
|
|
3910
3913
|
showSystem?: boolean | undefined;
|
|
3911
3914
|
}>>;
|
|
3915
|
+
readonly TimeWindow: import('@plitzi/sdk-shared/authoring').DeclaredElement<{
|
|
3916
|
+
readonly type: "timeWindow";
|
|
3917
|
+
readonly content: {
|
|
3918
|
+
readonly attributes: {
|
|
3919
|
+
readonly startsAt: "";
|
|
3920
|
+
readonly endsAt: "";
|
|
3921
|
+
};
|
|
3922
|
+
readonly definition: {
|
|
3923
|
+
readonly label: "Time Window";
|
|
3924
|
+
readonly description: string;
|
|
3925
|
+
readonly items: [];
|
|
3926
|
+
};
|
|
3927
|
+
readonly market: {
|
|
3928
|
+
readonly category: "structure";
|
|
3929
|
+
readonly icon: "fa-regular fa-calendar";
|
|
3930
|
+
};
|
|
3931
|
+
readonly defaultStyle: {
|
|
3932
|
+
readonly style: {
|
|
3933
|
+
readonly base: {
|
|
3934
|
+
readonly default: {};
|
|
3935
|
+
};
|
|
3936
|
+
};
|
|
3937
|
+
readonly subTypes: {};
|
|
3938
|
+
};
|
|
3939
|
+
};
|
|
3940
|
+
}, Partial<{
|
|
3941
|
+
startsAt?: string | undefined;
|
|
3942
|
+
endsAt?: string | undefined;
|
|
3943
|
+
}>>;
|
|
3944
|
+
readonly Variants: import('@plitzi/sdk-shared/authoring').DeclaredElement<{
|
|
3945
|
+
readonly type: "variants";
|
|
3946
|
+
readonly attributeValues: {
|
|
3947
|
+
readonly chooseBy: readonly string[];
|
|
3948
|
+
};
|
|
3949
|
+
readonly content: {
|
|
3950
|
+
readonly attributes: {
|
|
3951
|
+
readonly chooseBy: "chance";
|
|
3952
|
+
readonly experiment: "";
|
|
3953
|
+
readonly builderVariant: 0;
|
|
3954
|
+
};
|
|
3955
|
+
readonly definition: {
|
|
3956
|
+
readonly label: "Variants";
|
|
3957
|
+
readonly description: string;
|
|
3958
|
+
readonly items: [];
|
|
3959
|
+
};
|
|
3960
|
+
readonly builder: {
|
|
3961
|
+
readonly itemsAllowed: ["variantItem"];
|
|
3962
|
+
};
|
|
3963
|
+
readonly market: {
|
|
3964
|
+
readonly category: "testing";
|
|
3965
|
+
readonly icon: "fa-solid fa-shuffle";
|
|
3966
|
+
};
|
|
3967
|
+
readonly defaultStyle: {
|
|
3968
|
+
readonly style: {
|
|
3969
|
+
readonly base: {
|
|
3970
|
+
readonly default: {};
|
|
3971
|
+
};
|
|
3972
|
+
};
|
|
3973
|
+
readonly subTypes: {};
|
|
3974
|
+
};
|
|
3975
|
+
};
|
|
3976
|
+
readonly initialItems: readonly ["variantItem", "variantItem"];
|
|
3977
|
+
}, Partial<{
|
|
3978
|
+
chooseBy?: import('@plitzi/sdk-shared/variants').ChooseBy | undefined;
|
|
3979
|
+
experiment?: string | undefined;
|
|
3980
|
+
builderVariant?: number | undefined;
|
|
3981
|
+
}>>;
|
|
3982
|
+
readonly VariantItem: import('@plitzi/sdk-shared/authoring').DeclaredElement<{
|
|
3983
|
+
readonly type: "variantItem";
|
|
3984
|
+
readonly ancestorType: "variants";
|
|
3985
|
+
readonly content: {
|
|
3986
|
+
readonly attributes: {
|
|
3987
|
+
readonly weight: 50;
|
|
3988
|
+
};
|
|
3989
|
+
readonly definition: {
|
|
3990
|
+
readonly label: "Variant";
|
|
3991
|
+
readonly description: string;
|
|
3992
|
+
readonly items: [];
|
|
3993
|
+
};
|
|
3994
|
+
readonly builder: {
|
|
3995
|
+
readonly canSnippet: false;
|
|
3996
|
+
readonly itemsNotAllowed: ["variantItem"];
|
|
3997
|
+
};
|
|
3998
|
+
readonly market: {
|
|
3999
|
+
readonly category: "testing";
|
|
4000
|
+
readonly icon: "fa-solid fa-code-branch";
|
|
4001
|
+
};
|
|
4002
|
+
readonly defaultStyle: {
|
|
4003
|
+
readonly style: {
|
|
4004
|
+
readonly base: {
|
|
4005
|
+
readonly default: {};
|
|
4006
|
+
};
|
|
4007
|
+
};
|
|
4008
|
+
readonly subTypes: {};
|
|
4009
|
+
};
|
|
4010
|
+
};
|
|
4011
|
+
}, Partial<{
|
|
4012
|
+
when?: import('@plitzi/sdk-shared').RuleGroup | undefined;
|
|
4013
|
+
weight?: number | undefined;
|
|
4014
|
+
}>>;
|
|
3912
4015
|
readonly Video: import('@plitzi/sdk-shared/authoring').DeclaredElement<{
|
|
3913
4016
|
readonly type: "video";
|
|
3914
4017
|
readonly contentAttributes: readonly ["src"];
|
|
@@ -3949,7 +4052,7 @@ export declare const elementDeclarations: {
|
|
|
3949
4052
|
}>>;
|
|
3950
4053
|
};
|
|
3951
4054
|
export type ElementDeclarationName = keyof typeof elementDeclarations;
|
|
3952
|
-
export { ApiContainerDeclaration, BlockHtmlDeclaration, BlockJsxDeclaration, ButtonDeclaration, CarouselDeclaration, CarouselTrackDeclaration, ChannelDeclaration, ContainerDeclaration, CustomDeclaration, DialogContainerDeclaration, FocusGroupDeclaration, DropdownDeclaration, DropdownPopupDeclaration, EmbedDeclaration, FontAwesomeDeclaration, FormControlDeclaration, FormDeclaration, HeadingDeclaration, ImageDeclaration, LayoutContainerDeclaration, LinkDeclaration, ListDeclaration, ListItemDeclaration, LoadingDeclaration, MarkdownDeclaration, ModalContainerDeclaration, NodeHtmlDeclaration, NotFoundDeclaration, PageDeclaration, PaginationDeclaration, ParagraphDeclaration, PlitziSdkDeclaration, ReferenceDeclaration, RichTextDeclaration, ChartDeclaration, SvgDeclaration, TabContainerBodyDeclaration, TabContainerDeclaration, TabContainerHeaderDeclaration, TabContainerItemDeclaration, TextDeclaration, ThemeToggleDeclaration, VideoDeclaration };
|
|
4055
|
+
export { ApiContainerDeclaration, BlockHtmlDeclaration, BlockJsxDeclaration, ButtonDeclaration, CarouselDeclaration, CarouselTrackDeclaration, ChannelDeclaration, ContainerDeclaration, CustomDeclaration, DialogContainerDeclaration, FocusGroupDeclaration, DropdownDeclaration, DropdownPopupDeclaration, EmbedDeclaration, FontAwesomeDeclaration, FormControlDeclaration, FormDeclaration, HeadingDeclaration, ImageDeclaration, LayoutContainerDeclaration, LinkDeclaration, ListDeclaration, ListItemDeclaration, LoadingDeclaration, MarkdownDeclaration, ModalContainerDeclaration, NodeHtmlDeclaration, NotFoundDeclaration, PageDeclaration, PaginationDeclaration, ParagraphDeclaration, PlitziSdkDeclaration, ReferenceDeclaration, RichTextDeclaration, ChartDeclaration, SvgDeclaration, TabContainerBodyDeclaration, TabContainerDeclaration, TabContainerHeaderDeclaration, TabContainerItemDeclaration, TextDeclaration, ThemeToggleDeclaration, TimeWindowDeclaration, VariantsDeclaration, VariantItemDeclaration, VideoDeclaration };
|
|
3953
4056
|
/**
|
|
3954
4057
|
* Each type's `serverTemplates`, by the type a document names: the attributes the page server evaluates against a
|
|
3955
4058
|
* context of its own, which the element runtime leaves as written and the authoring lint holds to that context.
|
|
@@ -3962,6 +4065,13 @@ export declare const serverTemplatesByType: Readonly<Record<string, readonly str
|
|
|
3962
4065
|
export declare const contentAttributesByType: Readonly<Record<string, readonly string[]>>;
|
|
3963
4066
|
/** The content attributes of `type`; none for a type no built-in element declares — it has nothing to edit there. */
|
|
3964
4067
|
export declare const contentAttributesOf: (type: string) => readonly string[];
|
|
4068
|
+
/**
|
|
4069
|
+
* Each part's container (`ancestorType`): the type a sub-element only works inside — the builder's catalogue lists it
|
|
4070
|
+
* after that one, as its part.
|
|
4071
|
+
*/
|
|
4072
|
+
export declare const ancestorTypeByType: Readonly<Record<string, string>>;
|
|
4073
|
+
/** The type `type` only works inside, for a built-in element; none for one that goes anywhere. */
|
|
4074
|
+
export declare const ancestorTypeOf: (type: string) => string | undefined;
|
|
3965
4075
|
export { interactionBasicTriggers } from '../../Element/helpers/elementConstants';
|
|
3966
4076
|
export { DOCUMENT_SCROLLS, isDocumentScroll } from '../internal/Page/declaration';
|
|
3967
4077
|
export type { DocumentScroll } from '../internal/Page/declaration';
|
|
@@ -19,75 +19,81 @@ import _ from "../form/FormControl/declaration.mjs";
|
|
|
19
19
|
import v from "../internal/LayoutContainer/declaration.mjs";
|
|
20
20
|
import y from "../internal/Loading/declaration.mjs";
|
|
21
21
|
import b from "../internal/NotFound/declaration.mjs";
|
|
22
|
-
import x, { DOCUMENT_SCROLLS as S, isDocumentScroll as
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
22
|
+
import x, { DOCUMENT_SCROLLS as S, isDocumentScroll as ee } from "../internal/Page/declaration.mjs";
|
|
23
|
+
import C from "../media/Chart/declaration.mjs";
|
|
24
|
+
import w from "../media/Embed/declaration.mjs";
|
|
25
|
+
import T from "../media/FontAwesome/declaration.mjs";
|
|
26
|
+
import E from "../media/Image/declaration.mjs";
|
|
27
|
+
import D from "../media/Svg/declaration.mjs";
|
|
28
|
+
import O from "../media/Video/declaration.mjs";
|
|
29
|
+
import k from "../provider/ApiContainer/declaration.mjs";
|
|
30
|
+
import A from "../provider/Channel/declaration.mjs";
|
|
31
|
+
import j from "../structure/Carousel/CarouselTrack/declaration.mjs";
|
|
32
|
+
import M from "../structure/Carousel/declaration.mjs";
|
|
33
|
+
import N, { NAMEABLE_CONTAINER_TAGS as te } from "../structure/Container/declaration.mjs";
|
|
34
|
+
import P from "../structure/DialogContainer/declaration.mjs";
|
|
35
|
+
import F from "../structure/FocusGroup/declaration.mjs";
|
|
36
|
+
import I from "../structure/List/declaration.mjs";
|
|
37
|
+
import L from "../structure/List/ListItem/declaration.mjs";
|
|
38
|
+
import R from "../structure/ModalContainer/declaration.mjs";
|
|
39
|
+
import z from "../structure/Pagination/declaration.mjs";
|
|
40
|
+
import B from "../structure/TabContainer/declaration.mjs";
|
|
41
|
+
import V from "../structure/TabContainer/TabContainerBody/declaration.mjs";
|
|
42
|
+
import H from "../structure/TabContainer/TabContainerHeader/declaration.mjs";
|
|
43
|
+
import U from "../structure/TabContainer/TabContainerItem/declaration.mjs";
|
|
44
|
+
import W from "../structure/TimeWindow/declaration.mjs";
|
|
45
|
+
import G from "../testing/Variants/declaration.mjs";
|
|
46
|
+
import K from "../testing/Variants/VariantItem/declaration.mjs";
|
|
47
|
+
import { interactionBasicTriggers as q } from "../../Element/helpers/elementConstants.mjs";
|
|
48
|
+
import { HTML_TAG_PARTS as J } from "../basic/RichText/classHtmlParts.mjs";
|
|
49
|
+
import { isSvgMarkup as Y } from "../media/Svg/sanitizeSvg.mjs";
|
|
47
50
|
// src/elements/declarations/index.ts
|
|
48
|
-
var
|
|
49
|
-
ApiContainer:
|
|
51
|
+
var X = {
|
|
52
|
+
ApiContainer: k,
|
|
50
53
|
BlockHtml: e,
|
|
51
54
|
BlockJsx: t,
|
|
52
55
|
Button: o,
|
|
53
|
-
Carousel:
|
|
54
|
-
CarouselTrack:
|
|
55
|
-
Channel:
|
|
56
|
-
Container:
|
|
56
|
+
Carousel: M,
|
|
57
|
+
CarouselTrack: j,
|
|
58
|
+
Channel: A,
|
|
59
|
+
Container: N,
|
|
57
60
|
Custom: n,
|
|
58
|
-
DialogContainer:
|
|
59
|
-
FocusGroup:
|
|
61
|
+
DialogContainer: P,
|
|
62
|
+
FocusGroup: F,
|
|
60
63
|
Dropdown: s,
|
|
61
64
|
DropdownPopup: c,
|
|
62
|
-
Embed:
|
|
63
|
-
FontAwesome:
|
|
65
|
+
Embed: w,
|
|
66
|
+
FontAwesome: T,
|
|
64
67
|
Form: g,
|
|
65
68
|
FormControl: _,
|
|
66
69
|
Heading: l,
|
|
67
|
-
Image:
|
|
70
|
+
Image: E,
|
|
68
71
|
LayoutContainer: v,
|
|
69
72
|
Link: u,
|
|
70
|
-
List:
|
|
71
|
-
ListItem:
|
|
73
|
+
List: I,
|
|
74
|
+
ListItem: L,
|
|
72
75
|
Loading: y,
|
|
73
76
|
Markdown: d,
|
|
74
|
-
ModalContainer:
|
|
77
|
+
ModalContainer: R,
|
|
75
78
|
NodeHtml: r,
|
|
76
79
|
NotFound: b,
|
|
77
80
|
Page: x,
|
|
78
|
-
Pagination:
|
|
81
|
+
Pagination: z,
|
|
79
82
|
Paragraph: f,
|
|
80
83
|
PlitziSdk: i,
|
|
81
84
|
Reference: a,
|
|
82
85
|
RichText: p,
|
|
83
|
-
Chart:
|
|
84
|
-
Svg:
|
|
85
|
-
TabContainer:
|
|
86
|
-
TabContainerBody:
|
|
87
|
-
TabContainerHeader:
|
|
88
|
-
TabContainerItem:
|
|
86
|
+
Chart: C,
|
|
87
|
+
Svg: D,
|
|
88
|
+
TabContainer: B,
|
|
89
|
+
TabContainerBody: V,
|
|
90
|
+
TabContainerHeader: H,
|
|
91
|
+
TabContainerItem: U,
|
|
89
92
|
Text: m,
|
|
90
93
|
ThemeToggle: h,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
TimeWindow: W,
|
|
95
|
+
Variants: G,
|
|
96
|
+
VariantItem: K,
|
|
97
|
+
Video: O
|
|
98
|
+
}, Z = Object.fromEntries(Object.values(X).flatMap((e) => "serverTemplates" in e ? [[e.type, e.serverTemplates]] : [])), Q = Object.fromEntries(Object.values(X).flatMap((e) => "contentAttributes" in e ? [[e.type, e.contentAttributes]] : [])), ne = (e) => Q[e] ?? [], $ = Object.fromEntries(Object.values(X).flatMap((e) => "ancestorType" in e ? [[e.type, e.ancestorType]] : [])), re = (e) => $[e];
|
|
99
|
+
export { k as ApiContainerDeclaration, e as BlockHtmlDeclaration, t as BlockJsxDeclaration, o as ButtonDeclaration, M as CarouselDeclaration, j as CarouselTrackDeclaration, A as ChannelDeclaration, C as ChartDeclaration, N as ContainerDeclaration, n as CustomDeclaration, S as DOCUMENT_SCROLLS, P as DialogContainerDeclaration, s as DropdownDeclaration, c as DropdownPopupDeclaration, w as EmbedDeclaration, F as FocusGroupDeclaration, T as FontAwesomeDeclaration, _ as FormControlDeclaration, g as FormDeclaration, J as HTML_TAG_PARTS, l as HeadingDeclaration, E as ImageDeclaration, v as LayoutContainerDeclaration, u as LinkDeclaration, I as ListDeclaration, L as ListItemDeclaration, y as LoadingDeclaration, d as MarkdownDeclaration, R as ModalContainerDeclaration, te as NAMEABLE_CONTAINER_TAGS, r as NodeHtmlDeclaration, b as NotFoundDeclaration, x as PageDeclaration, z as PaginationDeclaration, f as ParagraphDeclaration, i as PlitziSdkDeclaration, a as ReferenceDeclaration, p as RichTextDeclaration, D as SvgDeclaration, V as TabContainerBodyDeclaration, B as TabContainerDeclaration, H as TabContainerHeaderDeclaration, U as TabContainerItemDeclaration, m as TextDeclaration, h as ThemeToggleDeclaration, W as TimeWindowDeclaration, K as VariantItemDeclaration, G as VariantsDeclaration, O as VideoDeclaration, $ as ancestorTypeByType, re as ancestorTypeOf, Q as contentAttributesByType, ne as contentAttributesOf, X as elementDeclarations, q as interactionBasicTriggers, ee as isDocumentScroll, Y as isSvgMarkup, Z as serverTemplatesByType };
|
package/dist/elements/index.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ import { default as List } from './structure/List';
|
|
|
34
34
|
import { default as ModalContainer } from './structure/ModalContainer';
|
|
35
35
|
import { default as Pagination } from './structure/Pagination';
|
|
36
36
|
import { default as TabContainer } from './structure/TabContainer';
|
|
37
|
+
import { default as TimeWindow } from './structure/TimeWindow';
|
|
38
|
+
import { default as Variants } from './testing/Variants';
|
|
37
39
|
export * from './advanced/BlockHtml';
|
|
38
40
|
export * from './advanced/BlockJsx';
|
|
39
41
|
export * from './advanced/Custom';
|
|
@@ -69,4 +71,6 @@ export * from './structure/ModalContainer';
|
|
|
69
71
|
export * from './structure/Pagination';
|
|
70
72
|
export * from './structure/Carousel';
|
|
71
73
|
export * from './structure/TabContainer';
|
|
72
|
-
export
|
|
74
|
+
export * from './structure/TimeWindow';
|
|
75
|
+
export * from './testing/Variants';
|
|
76
|
+
export { NodeHtml, Dropdown, NotFound, Loading, Custom, Reference, BlockHtml, BlockJsx, Page, Container, FocusGroup, LayoutContainer, DialogContainer, ModalContainer, TabContainer, TimeWindow, Variants, Carousel, Heading, Image, Video, Embed, Chart, Svg, FontAwesome, Button, Paragraph, RichText, Text, ThemeToggle, List, Link, Markdown, Pagination, Form, FormControl, ApiContainer, Channel };
|
package/dist/elements/index.mjs
CHANGED
|
@@ -35,8 +35,10 @@ import N from "./structure/List/index.mjs";
|
|
|
35
35
|
import P from "./structure/ModalContainer/index.mjs";
|
|
36
36
|
import F from "./structure/Pagination/index.mjs";
|
|
37
37
|
import I from "./structure/TabContainer/index.mjs";
|
|
38
|
+
import L from "./structure/TimeWindow/index.mjs";
|
|
39
|
+
import R from "./testing/Variants/index.mjs";
|
|
38
40
|
// src/elements/index.ts
|
|
39
|
-
var
|
|
41
|
+
var z = /* @__PURE__ */ e({
|
|
40
42
|
ApiContainer: () => D,
|
|
41
43
|
BlockHtml: () => t,
|
|
42
44
|
BlockJsx: () => n,
|
|
@@ -72,6 +74,8 @@ var L = /* @__PURE__ */ e({
|
|
|
72
74
|
TabContainer: () => I,
|
|
73
75
|
Text: () => p,
|
|
74
76
|
ThemeToggle: () => m,
|
|
77
|
+
TimeWindow: () => L,
|
|
78
|
+
Variants: () => R,
|
|
75
79
|
Video: () => E
|
|
76
80
|
});
|
|
77
|
-
export { D as ApiContainer, t as BlockHtml, n as BlockJsx, o as Button, k as Carousel, O as Channel, x as Chart, A as Container, r as Custom, j as DialogContainer, s as Dropdown, S as Embed, M as FocusGroup, C as FontAwesome, h as Form, g as FormControl, c as Heading, w as Image, _ as LayoutContainer, l as Link, N as List, v as Loading, u as Markdown, P as ModalContainer, i as NodeHtml, y as NotFound, b as Page, F as Pagination, d as Paragraph, a as Reference, f as RichText, T as Svg, I as TabContainer, p as Text, m as ThemeToggle, E as Video,
|
|
81
|
+
export { D as ApiContainer, t as BlockHtml, n as BlockJsx, o as Button, k as Carousel, O as Channel, x as Chart, A as Container, r as Custom, j as DialogContainer, s as Dropdown, S as Embed, M as FocusGroup, C as FontAwesome, h as Form, g as FormControl, c as Heading, w as Image, _ as LayoutContainer, l as Link, N as List, v as Loading, u as Markdown, P as ModalContainer, i as NodeHtml, y as NotFound, b as Page, F as Pagination, d as Paragraph, a as Reference, f as RichText, T as Svg, I as TabContainer, p as Text, m as ThemeToggle, L as TimeWindow, R as Variants, E as Video, z as elements_exports };
|
|
@@ -38,9 +38,9 @@ declare const declaration: import('@plitzi/sdk-shared/authoring').DeclaredElemen
|
|
|
38
38
|
}, Partial<{
|
|
39
39
|
title?: string | undefined;
|
|
40
40
|
src?: string | undefined;
|
|
41
|
+
referrerPolicy?: "no-referrer" | "origin" | "strict-origin-when-cross-origin" | "no-referrer-when-downgrade" | undefined;
|
|
41
42
|
allow?: string | undefined;
|
|
42
43
|
loading?: "lazy" | "eager" | undefined;
|
|
43
|
-
referrerPolicy?: "no-referrer" | "origin" | "strict-origin-when-cross-origin" | "no-referrer-when-downgrade" | undefined;
|
|
44
44
|
sandbox?: string | undefined;
|
|
45
45
|
}>>;
|
|
46
46
|
export default declaration;
|
|
@@ -36,9 +36,9 @@ declare const Embed: import('react').FC<import('../../..').WithElementProps<impo
|
|
|
36
36
|
} & import('@plitzi/sdk-shared/authoring').ElementAttributesBrand<Partial<{
|
|
37
37
|
title?: string | undefined;
|
|
38
38
|
src?: string | undefined;
|
|
39
|
+
referrerPolicy?: "no-referrer" | "origin" | "strict-origin-when-cross-origin" | "no-referrer-when-downgrade" | undefined;
|
|
39
40
|
allow?: string | undefined;
|
|
40
41
|
loading?: "lazy" | "eager" | undefined;
|
|
41
|
-
referrerPolicy?: "no-referrer" | "origin" | "strict-origin-when-cross-origin" | "no-referrer-when-downgrade" | undefined;
|
|
42
42
|
sandbox?: string | undefined;
|
|
43
43
|
}>>;
|
|
44
44
|
export default Embed;
|
|
@@ -102,7 +102,7 @@ var n = e()({
|
|
|
102
102
|
},
|
|
103
103
|
definition: {
|
|
104
104
|
label: "Channel",
|
|
105
|
-
description: "
|
|
105
|
+
description: "Sends what one page publishes to every other page on the same topic, live. Realtime: every OTHER page on the same `topic` hears it within milliseconds — the page that sent it too with `echo` (its `from` is then the `me` of the channel). Hidden, it stays joined and runs its flows — its `loadStrategy` defers only its children: to leave the topic while hidden, put it inside a container that carries the condition and `loadStrategy: 'visible'`. The topic must match a channel the space declares in its settings (`channels`), e.g. `board:{{ id }}` under `board:{id}`. A topic of a private channel (`grant: true`) opens only with `grant`, bound to the grant the action that let this visitor in returned (its `realtime.grant` step). ITS DESCENDANTS bind to its source `channel_<id>`: `connected`, `members` (with the state each announced), `messages` (the last `keep`), `last` and — on a `retain: true` channel — `retained`, the latest data the server said of each type, there as the page joins (`retained.lists`). It fires `onMessage`; `onJoin` when somebody who came after this page has announced who they are, and `onLeave` when somebody goes — each with `from`, `user` and the `state` they announced; and answers `publish({ type, data, echo })` and `setPresence({ data })`; `presence` is the state this page announces (a name, a colour). Closed in the builder and anywhere without a server.",
|
|
106
106
|
items: []
|
|
107
107
|
},
|
|
108
108
|
market: {
|
|
@@ -41,8 +41,11 @@ import z from "./structure/TabContainer/Settings.mjs";
|
|
|
41
41
|
import B from "./structure/TabContainer/TabContainerBody/Settings.mjs";
|
|
42
42
|
import V from "./structure/TabContainer/TabContainerHeader/Settings.mjs";
|
|
43
43
|
import H from "./structure/TabContainer/TabContainerItem/Settings.mjs";
|
|
44
|
+
import U from "./structure/TimeWindow/Settings.mjs";
|
|
45
|
+
import W from "./testing/Variants/Settings.mjs";
|
|
46
|
+
import G from "./testing/Variants/VariantItem/Settings.mjs";
|
|
44
47
|
// src/elements/settings.ts
|
|
45
|
-
var
|
|
48
|
+
var K = {
|
|
46
49
|
dropdown: c,
|
|
47
50
|
dropdownPopup: s,
|
|
48
51
|
plitziSdk: i,
|
|
@@ -64,6 +67,9 @@ var U = {
|
|
|
64
67
|
tabContainerBody: B,
|
|
65
68
|
tabContainerHeader: V,
|
|
66
69
|
tabContainerItem: H,
|
|
70
|
+
timeWindow: U,
|
|
71
|
+
variants: W,
|
|
72
|
+
variantItem: G,
|
|
67
73
|
heading: l,
|
|
68
74
|
image: T,
|
|
69
75
|
video: D,
|
|
@@ -87,4 +93,4 @@ var U = {
|
|
|
87
93
|
apiContainer: O,
|
|
88
94
|
channel: k
|
|
89
95
|
};
|
|
90
|
-
export {
|
|
96
|
+
export { K as defaultElementsSettings };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type SettingsProps = {
|
|
2
|
+
startsAt?: string;
|
|
3
|
+
endsAt?: string;
|
|
4
|
+
onUpdate?: (key: string, value: string | boolean | number) => void;
|
|
5
|
+
};
|
|
6
|
+
/** A time window's settings: when it starts and ends showing what it holds. */
|
|
7
|
+
declare const Settings: ({ startsAt, endsAt, onUpdate }: SettingsProps) => import('react').JSX.Element;
|
|
8
|
+
export default Settings;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import e from "../../useSettingsUpdate.mjs";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import { isWindowBound as r } from "@plitzi/sdk-shared/timeWindows";
|
|
4
|
+
import i from "@plitzi/plitzi-ui/Input";
|
|
5
|
+
// src/elements/structure/TimeWindow/Settings.tsx
|
|
6
|
+
var a = (e) => r(e) ? void 0 : "Not read: write it with its offset — 2026-12-01T09:00:00Z, or +01:00 for CET.", o = ({ startsAt: r = "", endsAt: o = "", onUpdate: s }) => {
|
|
7
|
+
let c = e(s), l = a(r), u = a(o);
|
|
8
|
+
return /* @__PURE__ */ n("div", {
|
|
9
|
+
className: "flex flex-col gap-4 py-2",
|
|
10
|
+
children: [
|
|
11
|
+
/* @__PURE__ */ t(i, {
|
|
12
|
+
label: "Starts at",
|
|
13
|
+
size: "xs",
|
|
14
|
+
placeholder: "2026-12-01T09:00:00Z",
|
|
15
|
+
value: r,
|
|
16
|
+
onChange: c.text("startsAt")
|
|
17
|
+
}),
|
|
18
|
+
l && /* @__PURE__ */ t("span", {
|
|
19
|
+
className: "text-ui-fg-subtle text-xs",
|
|
20
|
+
children: l
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ t(i, {
|
|
23
|
+
label: "Ends at",
|
|
24
|
+
size: "xs",
|
|
25
|
+
placeholder: "2026-12-08T09:00:00Z",
|
|
26
|
+
value: o,
|
|
27
|
+
onChange: c.text("endsAt")
|
|
28
|
+
}),
|
|
29
|
+
u && /* @__PURE__ */ t("span", {
|
|
30
|
+
className: "text-ui-fg-subtle text-xs",
|
|
31
|
+
children: u
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ t("span", {
|
|
34
|
+
className: "text-ui-fg-subtle text-xs",
|
|
35
|
+
children: "Shown from the first instant up to the second; either left empty is no bound. Times in UTC (Z) or with their offset. While editing the canvas always shows it; its preview shows it at the date chosen in the State Manager’s Visitor tab."
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
export { o as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
export type TimeWindowProps = {
|
|
3
|
+
ref?: RefObject<HTMLElement>;
|
|
4
|
+
className?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
/** When it starts showing what it holds: ISO 8601 with the offset — `2026-12-01T09:00:00Z`. Empty, it has started. */
|
|
7
|
+
startsAt?: string;
|
|
8
|
+
/** When it stops: the same, `2026-12-08T09:00:00Z`. Empty, it never ends. */
|
|
9
|
+
endsAt?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const TimeWindow: ({ ref, className, children, startsAt, endsAt }: TimeWindowProps) => import('react').JSX.Element;
|
|
12
|
+
declare const _default: import('react').FC<import('../../..').WithElementProps<TimeWindowProps>>;
|
|
13
|
+
export default _default;
|
|
14
|
+
export { TimeWindow };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import e from "../../../Element/hocs/withElement.mjs";
|
|
2
|
+
import { RootElement as t } from "../../../Element/RootElement.mjs";
|
|
3
|
+
import { useEffect as n, useState as r } from "react";
|
|
4
|
+
import { useCommonStore as i, useRenderSettings as a } from "@plitzi/sdk-shared/store";
|
|
5
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
6
|
+
import { isWindowOpen as s, nextWindowChange as c } from "@plitzi/sdk-shared/timeWindows";
|
|
7
|
+
import l from "clsx";
|
|
8
|
+
import { HIDDEN_CLASS as u } from "@plitzi/sdk-shared/style";
|
|
9
|
+
// src/elements/structure/TimeWindow/TimeWindow.tsx
|
|
10
|
+
var d = 2 ** 31 - 1, f = ({ ref: e, className: f = "", children: p, startsAt: m = "", endsAt: h = "" }) => {
|
|
11
|
+
let [g] = i("clock"), { builder: _, previewMode: v } = a(), [y, b] = r(() => g?.at ?? Date.now());
|
|
12
|
+
n(() => {
|
|
13
|
+
b(g?.simulated ? g.at : Date.now());
|
|
14
|
+
}, [g]), n(() => {
|
|
15
|
+
let e = g?.simulated ? void 0 : c(y, m, h);
|
|
16
|
+
if (e === void 0) return;
|
|
17
|
+
let t = setTimeout(() => b(Date.now()), Math.min(d, Math.max(0, e - Date.now())));
|
|
18
|
+
return () => clearTimeout(t);
|
|
19
|
+
}, [
|
|
20
|
+
g,
|
|
21
|
+
m,
|
|
22
|
+
h,
|
|
23
|
+
y
|
|
24
|
+
]);
|
|
25
|
+
let x = _ && !v || s(y, m, h);
|
|
26
|
+
return /* @__PURE__ */ o(t, {
|
|
27
|
+
ref: e,
|
|
28
|
+
className: l("plitzi-component__time-window", f, { [u]: !x }),
|
|
29
|
+
children: x && p
|
|
30
|
+
});
|
|
31
|
+
}, p = e(f);
|
|
32
|
+
export { f as TimeWindow, p as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TimeWindowProps } from './TimeWindow';
|
|
2
|
+
import { AuthorableAttributes } from '@plitzi/sdk-shared/authoring';
|
|
3
|
+
/** What this element can be authored with — its component's own props, minus what the runtime supplies. */
|
|
4
|
+
export type TimeWindowAttributes = AuthorableAttributes<TimeWindowProps>;
|
|
5
|
+
declare const declaration: import('@plitzi/sdk-shared/authoring').DeclaredElement<{
|
|
6
|
+
readonly type: "timeWindow";
|
|
7
|
+
readonly content: {
|
|
8
|
+
readonly attributes: {
|
|
9
|
+
readonly startsAt: "";
|
|
10
|
+
readonly endsAt: "";
|
|
11
|
+
};
|
|
12
|
+
readonly definition: {
|
|
13
|
+
readonly label: "Time Window";
|
|
14
|
+
readonly description: string;
|
|
15
|
+
readonly items: [];
|
|
16
|
+
};
|
|
17
|
+
readonly market: {
|
|
18
|
+
readonly category: "structure";
|
|
19
|
+
readonly icon: "fa-regular fa-calendar";
|
|
20
|
+
};
|
|
21
|
+
readonly defaultStyle: {
|
|
22
|
+
readonly style: {
|
|
23
|
+
readonly base: {
|
|
24
|
+
readonly default: {};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
readonly subTypes: {};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}, Partial<{
|
|
31
|
+
startsAt?: string | undefined;
|
|
32
|
+
endsAt?: string | undefined;
|
|
33
|
+
}>>;
|
|
34
|
+
export default declaration;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { elementDeclaration as e } from "@plitzi/sdk-shared/authoring";
|
|
2
|
+
import { TIME_WINDOW_TYPE as t } from "@plitzi/sdk-shared/timeWindows";
|
|
3
|
+
// src/elements/structure/TimeWindow/declaration.ts
|
|
4
|
+
var n = e()({
|
|
5
|
+
type: t,
|
|
6
|
+
content: {
|
|
7
|
+
attributes: {
|
|
8
|
+
startsAt: "",
|
|
9
|
+
endsAt: ""
|
|
10
|
+
},
|
|
11
|
+
definition: {
|
|
12
|
+
label: "Time Window",
|
|
13
|
+
description: "Shows what it holds only between two instants — a sale, an event, a banner for a week: `startsAt` and `endsAt`, ISO 8601 with the offset (`2026-12-01T09:00:00Z`); either left empty is no bound. The server draws it at the instant it renders; an open page shows or hides it when the window opens or closes. Not access control: what it holds is in the space’s document, as anything a flag hides.",
|
|
14
|
+
items: []
|
|
15
|
+
},
|
|
16
|
+
market: {
|
|
17
|
+
category: "structure",
|
|
18
|
+
icon: "fa-regular fa-calendar"
|
|
19
|
+
},
|
|
20
|
+
defaultStyle: {
|
|
21
|
+
style: { base: { default: {} } },
|
|
22
|
+
subTypes: {}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
export { n as default };
|