@plitzi/sdk-shared 0.37.8 → 0.37.10
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 +817 -0
- package/dist/actions/functions.d.ts +12 -3
- package/dist/actions/functions.mjs +8 -5
- package/dist/actions/index.d.ts +2 -2
- package/dist/actions/index.mjs +6 -6
- package/dist/actions/triggerParams.mjs +7 -6
- package/dist/actions/validateDocument.d.ts +3 -0
- package/dist/actions/validateDocument.mjs +89 -88
- package/dist/auth/failureChannel.d.ts +8 -2
- package/dist/auth/failureChannel.mjs +1 -3
- package/dist/authoring/elementCallbacks.d.ts +65 -0
- package/dist/authoring/elementCallbacks.mjs +72 -8
- package/dist/authoring/index.mjs +3 -3
- package/dist/builder/contexts/BuilderContext.d.ts +18 -7
- package/dist/builder/contexts/BuilderContext.mjs +2 -3
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.mjs +2 -2
- package/dist/connectors/validateManifest.d.ts +3 -0
- package/dist/connectors/validateManifest.mjs +77 -76
- package/dist/dataSource/computed.mjs +25 -29
- package/dist/dataSource/globalSources.d.ts +15 -0
- package/dist/dataSource/globalSources.mjs +13 -0
- package/dist/dataSource/index.d.ts +2 -0
- package/dist/dataSource/index.mjs +8 -7
- package/dist/devTools/DevToolsContext.mjs +2 -3
- package/dist/devTools/utils/PlitziConsole.d.ts +9 -0
- package/dist/devTools/utils/PlitziConsole.mjs +27 -7
- package/dist/elements/ComponentContext.mjs +2 -3
- package/dist/flags/flagsCookie.d.ts +26 -0
- package/dist/flags/flagsCookie.mjs +20 -0
- package/dist/flags/index.d.ts +3 -0
- package/dist/flags/index.mjs +4 -0
- package/dist/flags/resolveFlags.d.ts +60 -0
- package/dist/flags/resolveFlags.mjs +38 -0
- package/dist/flags/schemaFlag.d.ts +11 -0
- package/dist/flags/schemaFlag.mjs +9 -0
- package/dist/flags/useFlagResolution.d.ts +13 -0
- package/dist/flags/useFlagResolution.mjs +43 -0
- package/dist/helpers/eventTarget.d.ts +10 -0
- package/dist/helpers/eventTarget.mjs +4 -0
- package/dist/helpers/images.d.ts +18 -0
- package/dist/helpers/images.mjs +13 -0
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/index.mjs +21 -18
- package/dist/helpers/interval.d.ts +18 -0
- package/dist/helpers/interval.mjs +7 -0
- package/dist/helpers/isRecord.d.ts +2 -0
- package/dist/helpers/isRecord.mjs +4 -0
- package/dist/helpers/scroll.d.ts +42 -0
- package/dist/helpers/scroll.mjs +30 -0
- package/dist/helpers/sharedContext.d.ts +14 -0
- package/dist/helpers/sharedContext.mjs +9 -0
- package/dist/helpers/twigWrapper/Evaluator/Evaluator.d.ts +9 -1
- package/dist/helpers/twigWrapper/Evaluator/Evaluator.mjs +13 -8
- package/dist/helpers/twigWrapper/Evaluator/index.d.ts +1 -1
- package/dist/helpers/twigWrapper/TemplateCache/TemplateCache.mjs +1 -1
- package/dist/helpers/twigWrapper/filters/filters.mjs +38 -2
- package/dist/helpers/twigWrapper/index.d.ts +1 -0
- package/dist/helpers/twigWrapper/processTwig/processTwig.d.ts +2 -1
- package/dist/helpers/twigWrapper/processTwig/processTwig.mjs +3 -3
- package/dist/helpers/utils.mjs +4 -2
- package/dist/history/describe.mjs +4 -1
- package/dist/history/diff.d.ts +1 -1
- package/dist/history/diff.mjs +11 -9
- package/dist/history/types.d.ts +1 -1
- package/dist/hooks/index.mjs +5 -5
- package/dist/hooks/usePlitziServiceContext.d.ts +1 -2
- package/dist/hooks/usePlitziServiceContext.mjs +3 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +90 -77
- package/dist/navigation/routes.mjs +6 -4
- package/dist/network/NetworkContext.mjs +2 -3
- package/dist/network/NetworkInternalContext.d.ts +2 -4
- package/dist/network/NetworkInternalContext.mjs +2 -3
- package/dist/network/graphql/builder/Mutations/Space/SpaceAddSnippetMutation.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/Space/SpaceAddSnippetMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceAddComponentMutation.d.ts +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceAddComponentMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceDetachInstanceMutation.d.ts +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceDetachInstanceMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceRemoveComponentMutation.d.ts +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceRemoveComponentMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceUpdateComponentMutation.d.ts +4 -0
- package/dist/network/graphql/builder/Mutations/Space/components/SpaceUpdateComponentMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpacePublishFlagsMutation.d.ts +12 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpacePublishFlagsMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpaceRemoveFlagMutation.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpaceRemoveFlagMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpaceSetFlagMutation.d.ts +3 -0
- package/dist/network/graphql/builder/Mutations/Space/flags/SpaceSetFlagMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/index.d.ts +13 -30
- package/dist/network/graphql/builder/Mutations/index.mjs +164 -200
- package/dist/network/graphql/builder/Queries/InitQuery.d.ts +4 -3
- package/dist/network/graphql/builder/Queries/InitQuery.mjs +1 -1
- package/dist/network/graphql/builder/Queries/Space/SpaceActionTasksQuery.d.ts +1 -1
- package/dist/network/graphql/builder/Queries/Space/SpaceActionTasksQuery.mjs +1 -1
- package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.d.ts +16 -2
- package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.mjs +1 -1
- package/dist/network/graphql/builder/Queries/Space/SpaceVersionContentsQuery.d.ts +7 -0
- package/dist/network/graphql/builder/Queries/Space/SpaceVersionContentsQuery.mjs +4 -0
- package/dist/network/graphql/builder/Queries/index.d.ts +3 -5
- package/dist/network/graphql/builder/Queries/index.mjs +36 -38
- package/dist/network/graphql/builder/Subscriptions/SpaceEventSubscription.d.ts +1 -1
- package/dist/network/graphql/sdk/Queries/InitQuery.d.ts +2 -3
- package/dist/network/graphql/sdk/Queries/InitQuery.mjs +1 -1
- package/dist/network/graphql/sdk/Queries/index.d.ts +0 -4
- package/dist/network/graphql/sdk/Queries/index.mjs +2 -8
- package/dist/network/index.mjs +8 -7
- package/dist/network/spaceEvents.d.ts +25 -195
- package/dist/network/spaceEvents.mjs +156 -241
- package/dist/realtime/client.mjs +123 -95
- package/dist/realtime/topics.mjs +18 -17
- package/dist/schema/SchemaContext.mjs +2 -3
- package/dist/schema/anchor.d.ts +8 -0
- package/dist/schema/anchor.mjs +4 -0
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/index.mjs +6 -4
- package/dist/schema/schemaConstants.d.ts +2 -0
- package/dist/schema/schemaConstants.mjs +4 -3
- package/dist/schema/serverElements.d.ts +6 -2
- package/dist/schema/serverElements.mjs +17 -16
- package/dist/schema/snippet.d.ts +7 -0
- package/dist/schema/snippet.mjs +9 -0
- package/dist/schema/wire.d.ts +11 -0
- package/dist/schema/wire.mjs +27 -0
- package/dist/server/actions/useImagesSync.d.ts +9 -0
- package/dist/server/actions/useImagesSync.mjs +7 -0
- package/dist/server/rsc/refreshRsc.d.ts +3 -1
- package/dist/server/rsc/refreshRsc.mjs +17 -16
- package/dist/source/export.d.ts +107 -0
- package/dist/source/export.mjs +4 -0
- package/dist/source/index.d.ts +4 -0
- package/dist/source/index.mjs +3 -0
- package/dist/source/snapshot.d.ts +51 -0
- package/dist/source/snapshot.mjs +81 -0
- package/dist/state/paintedState.mjs +13 -12
- package/dist/state/runtimeStatePersist.mjs +50 -49
- package/dist/store/index.d.ts +45 -45
- package/dist/store/renderSettings.d.ts +1 -0
- package/dist/store/renderSettings.mjs +9 -5
- package/dist/style/breakpoints.d.ts +11 -0
- package/dist/style/breakpoints.mjs +8 -0
- package/dist/style/displayModes.d.ts +5 -0
- package/dist/style/displayModes.mjs +8 -0
- package/dist/style/fontValidation.mjs +52 -51
- package/dist/style/fonts.d.ts +0 -12
- package/dist/style/fonts.mjs +11 -11
- package/dist/style/index.d.ts +4 -0
- package/dist/style/index.mjs +11 -7
- package/dist/style/layoutGrid.d.ts +30 -0
- package/dist/style/layoutGrid.mjs +33 -0
- package/dist/style/notifications.d.ts +52 -0
- package/dist/style/notifications.mjs +55 -0
- package/dist/style/snippetStyle.d.ts +23 -0
- package/dist/style/snippetStyle.mjs +32 -0
- package/dist/style/styleConstants.d.ts +7 -2
- package/dist/style/styleConstants.mjs +10 -0
- package/dist/style/styleStates.d.ts +11 -2
- package/dist/style/styleStates.mjs +12 -9
- package/dist/theme/ThemeProvider.mjs +20 -20
- package/dist/theme/ThemeScope.mjs +4 -3
- package/dist/types/ActionTypes.d.ts +5 -0
- package/dist/types/CommonTypes.d.ts +3 -0
- package/dist/types/DevToolsTypes.d.ts +29 -4
- package/dist/types/ElementTypes.d.ts +6 -5
- package/dist/types/EventBridgeTypes.d.ts +2 -2
- package/dist/types/FunctionTypes.d.ts +13 -0
- package/dist/types/InteractionTypes.d.ts +5 -0
- package/dist/types/PluginTypes.d.ts +1 -1
- package/dist/types/ResourceTypes.d.ts +2 -2
- package/dist/types/SchemaTypes.d.ts +100 -3
- package/dist/types/SdkTypes.d.ts +0 -2
- package/dist/types/ServerTypes.d.ts +47 -0
- package/dist/types/SnippetTypes.d.ts +28 -0
- package/dist/types/SpaceTypes.d.ts +36 -0
- package/dist/types/StoreTypes.d.ts +39 -3
- package/dist/types/StyleTypes.d.ts +1 -1
- package/dist/types/index.d.ts +1 -2
- package/package.json +143 -138
- package/tailwind.config.js +1 -6
- package/vite.config.ts +16 -4
- package/dist/network/graphql/builder/Mutations/Segment/SegmentAddMutation.d.ts +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/SegmentAddMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/SegmentAddTemplateMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/SegmentAddTemplateMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/SegmentPublishMutation.d.ts +0 -8
- package/dist/network/graphql/builder/Mutations/Segment/SegmentPublishMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/SegmentRemoveMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/SegmentRemoveMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/SegmentUpdateMutation.d.ts +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/SegmentUpdateMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentAddElementMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentAddElementMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentCloneElementMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentCloneElementMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentMoveElementMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentMoveElementMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentRemoveElementMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentRemoveElementMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentRenameElementMutation.d.ts +0 -3
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentRenameElementMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentUpdateElementMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentUpdateElementMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentUpdateElementsMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentUpdateElementsMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceAddVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceAddVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceRemoveVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceRemoveVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceUpdateVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceUpdateVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleAddSelectorVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleAddSelectorVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleRemoveSelectorVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleRemoveSelectorVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleUpdateSelectorVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleUpdateSelectorVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleAddSelectorMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleAddSelectorMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleRemoveSelectorMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleRemoveSelectorMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleRemoveSelectorsMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleRemoveSelectorsMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleUpdateSelectorMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleUpdateSelectorMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleAddVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleAddVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleRemoveVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleRemoveVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleUpdateVariableMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleUpdateVariableMutation.mjs +0 -4
- package/dist/network/graphql/builder/Mutations/Space/SpaceAddTemplateMutation.d.ts +0 -2
- package/dist/network/graphql/builder/Mutations/Space/SpaceAddTemplateMutation.mjs +0 -4
- package/dist/network/graphql/builder/Queries/Segment/SegmentQuery.d.ts +0 -6
- package/dist/network/graphql/builder/Queries/Segment/SegmentQuery.mjs +0 -4
- package/dist/network/graphql/builder/Queries/Segment/SegmentsQuery.d.ts +0 -9
- package/dist/network/graphql/builder/Queries/Segment/SegmentsQuery.mjs +0 -4
- package/dist/network/graphql/sdk/Queries/Segment/SegmentQuery.d.ts +0 -6
- package/dist/network/graphql/sdk/Queries/Segment/SegmentQuery.mjs +0 -4
- package/dist/network/graphql/sdk/Queries/Segment/SegmentsQuery.d.ts +0 -9
- package/dist/network/graphql/sdk/Queries/Segment/SegmentsQuery.mjs +0 -4
- package/dist/segments/SegmentsContext.d.ts +0 -2
- package/dist/segments/SegmentsContext.mjs +0 -6
- package/dist/segments/index.d.ts +0 -3
- package/dist/segments/index.mjs +0 -2
- package/dist/types/SegmentTypes.d.ts +0 -41
- package/dist/types/TemplateTypes.d.ts +0 -20
- package/dist/types/TemplateTypes.mjs +0 -0
- /package/dist/types/{SegmentTypes.mjs → SnippetTypes.mjs} +0 -0
|
@@ -1,6 +1,69 @@
|
|
|
1
1
|
import { reconcileParams as e } from "./paramSpec.mjs";
|
|
2
|
+
import { SCROLL_BEHAVIORS as t, SCROLL_POSITIONS as n } from "../helpers/scroll.mjs";
|
|
2
3
|
//#region src/authoring/elementCallbacks.ts
|
|
3
|
-
var
|
|
4
|
+
var r = {
|
|
5
|
+
type: "select",
|
|
6
|
+
description: "How it moves: \"smooth\" glides there, \"auto\" jumps.",
|
|
7
|
+
default: "smooth",
|
|
8
|
+
options: [...t]
|
|
9
|
+
}, i = {
|
|
10
|
+
scrollBy: {
|
|
11
|
+
title: "Scroll By",
|
|
12
|
+
type: "callback",
|
|
13
|
+
strictParams: !0,
|
|
14
|
+
params: {
|
|
15
|
+
x: {
|
|
16
|
+
type: "text",
|
|
17
|
+
description: "How far across: pixels (\"240\") or a share of what the box shows (\"80%\"); negative goes back.",
|
|
18
|
+
default: ""
|
|
19
|
+
},
|
|
20
|
+
y: {
|
|
21
|
+
type: "text",
|
|
22
|
+
description: "How far down, the same way; negative goes up.",
|
|
23
|
+
default: ""
|
|
24
|
+
},
|
|
25
|
+
behavior: r
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
scrollTo: {
|
|
29
|
+
title: "Scroll To",
|
|
30
|
+
type: "callback",
|
|
31
|
+
strictParams: !0,
|
|
32
|
+
params: {
|
|
33
|
+
x: {
|
|
34
|
+
type: "text",
|
|
35
|
+
description: "Where across: \"start\", \"end\", pixels from the start, or a share of the way (\"50%\"). Empty stays.",
|
|
36
|
+
default: ""
|
|
37
|
+
},
|
|
38
|
+
y: {
|
|
39
|
+
type: "text",
|
|
40
|
+
description: "Where down, the same way. Empty stays.",
|
|
41
|
+
default: ""
|
|
42
|
+
},
|
|
43
|
+
behavior: r
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
scrollIntoView: {
|
|
47
|
+
title: "Scroll Into View",
|
|
48
|
+
type: "callback",
|
|
49
|
+
strictParams: !0,
|
|
50
|
+
params: {
|
|
51
|
+
block: {
|
|
52
|
+
type: "select",
|
|
53
|
+
description: "Where the element lands, top to bottom.",
|
|
54
|
+
default: "start",
|
|
55
|
+
options: [...n]
|
|
56
|
+
},
|
|
57
|
+
inline: {
|
|
58
|
+
type: "select",
|
|
59
|
+
description: "Where it lands, side to side.",
|
|
60
|
+
default: "nearest",
|
|
61
|
+
options: [...n]
|
|
62
|
+
},
|
|
63
|
+
behavior: r
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}, a = {
|
|
4
67
|
setState: {
|
|
5
68
|
title: "Update Element (set attribute / state)",
|
|
6
69
|
type: "callback",
|
|
@@ -56,16 +119,17 @@ var t = {
|
|
|
56
119
|
label: "Revert changes after interaction"
|
|
57
120
|
}
|
|
58
121
|
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
122
|
+
},
|
|
123
|
+
...i
|
|
124
|
+
}, o = (e) => Object.hasOwn(a, e) ? a[e] : void 0, s = (t, n) => {
|
|
125
|
+
let r = o(t);
|
|
126
|
+
return r ? {
|
|
63
127
|
known: !0,
|
|
64
|
-
params: e(
|
|
128
|
+
params: e(n, r.params, r.strictParams)
|
|
65
129
|
} : {
|
|
66
130
|
known: !1,
|
|
67
|
-
params:
|
|
131
|
+
params: n
|
|
68
132
|
};
|
|
69
133
|
};
|
|
70
134
|
//#endregion
|
|
71
|
-
export {
|
|
135
|
+
export { a as BUILTIN_ELEMENT_CALLBACKS, i as SCROLL_CALLBACKS, s as applyElementCallback, o as getElementCallback };
|
package/dist/authoring/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toBuilderParams as e, toInteractionCallback as t, toInteractionCallbacks as n } from "./builder.mjs";
|
|
2
2
|
import { elementDeclaration as r, valuesOf as i } from "./declare.mjs";
|
|
3
3
|
import { hiddenParams as a, invalidParams as o, missingRequiredParams as s, reconcileParams as c } from "./paramSpec.mjs";
|
|
4
|
-
import { BUILTIN_ELEMENT_CALLBACKS as l,
|
|
5
|
-
import { spaceCallbacks as
|
|
6
|
-
export { l as BUILTIN_ELEMENT_CALLBACKS, u as applyElementCallback, r as elementDeclaration,
|
|
4
|
+
import { BUILTIN_ELEMENT_CALLBACKS as l, SCROLL_CALLBACKS as u, applyElementCallback as d, getElementCallback as f } from "./elementCallbacks.mjs";
|
|
5
|
+
import { spaceCallbacks as p } from "./spaceCallbacks.mjs";
|
|
6
|
+
export { l as BUILTIN_ELEMENT_CALLBACKS, u as SCROLL_CALLBACKS, d as applyElementCallback, r as elementDeclaration, f as getElementCallback, a as hiddenParams, o as invalidParams, s as missingRequiredParams, c as reconcileParams, p as spaceCallbacks, e as toBuilderParams, t as toInteractionCallback, n as toInteractionCallbacks, i as valuesOf };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentPluginWithHOC, DropPosition, Element, EventBridgeEvent, PluginBuilder, Schema, Style } from '../../types';
|
|
2
2
|
import { Dispatch, SetStateAction } from 'react';
|
|
3
3
|
export type BuilderContextValue = {
|
|
4
|
-
mode: 'normal' | '
|
|
4
|
+
mode: 'normal' | 'snippet';
|
|
5
5
|
schemaName: string;
|
|
6
6
|
setMultiPagesMode: Dispatch<SetStateAction<boolean>>;
|
|
7
7
|
multiPagesMode: boolean;
|
|
@@ -18,27 +18,38 @@ export type BuilderContextValue = {
|
|
|
18
18
|
};
|
|
19
19
|
builderHandler: (event: EventBridgeEvent, ...data: unknown[]) => void;
|
|
20
20
|
updateElement: (elementId: string, attributeKey: string, attributeValue: unknown, category?: 'attributes' | 'definition') => void;
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Saves an element and what it holds as a snippet file in a public bucket of one of the space's CDNs, and says
|
|
23
|
+
* whether it was saved — and why not, in words for whoever asked.
|
|
24
|
+
*/
|
|
25
|
+
elementAsSnippet: (target: {
|
|
23
26
|
cdnIdentifier: string;
|
|
24
27
|
bucketIdentifier: string;
|
|
25
|
-
},
|
|
28
|
+
}, details: {
|
|
29
|
+
name: string;
|
|
30
|
+
description: string;
|
|
31
|
+
}, element: Element) => Promise<{
|
|
32
|
+
saved: true;
|
|
33
|
+
} | {
|
|
34
|
+
saved: false;
|
|
35
|
+
reason: string;
|
|
36
|
+
}>;
|
|
26
37
|
builderGetBaseElement: (otherBaseElementId?: string) => undefined | {
|
|
27
38
|
data: Element;
|
|
28
39
|
Plugin: ComponentPluginWithHOC | Record<string, ComponentPluginWithHOC>;
|
|
29
40
|
};
|
|
30
41
|
builderDropElement: {
|
|
31
|
-
(type: 'add##plitzi-
|
|
42
|
+
(type: 'add##plitzi-snippet', data: {
|
|
32
43
|
elements: Record<string, Element>;
|
|
33
44
|
baseElement?: Element;
|
|
34
45
|
style: Style;
|
|
35
46
|
variables: Schema['variables'];
|
|
36
47
|
}, dropPosition: DropPosition, toElementId: string, rootId?: string): boolean;
|
|
37
|
-
<T extends string>(type: `add##${Exclude<T, 'plitzi-
|
|
48
|
+
<T extends string>(type: `add##${Exclude<T, 'plitzi-snippet'>}`, data: {
|
|
38
49
|
id?: string;
|
|
39
50
|
element: Element;
|
|
40
51
|
}, dropPosition: DropPosition, toElementId: string, rootId?: string): boolean;
|
|
41
|
-
<T extends string>(type: `move##${Exclude<T, 'plitzi-
|
|
52
|
+
<T extends string>(type: `move##${Exclude<T, 'plitzi-snippet'>}`, data: {
|
|
42
53
|
id: string;
|
|
43
54
|
parentId: string;
|
|
44
55
|
element: Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { BODYLESS_METHODS, CONNECTOR_HTTP_METHODS, DEFAULT_READ_ENDPOINT, EMPTY_RESPONSE_METHODS, READ_ENDPOINT_NAMES, WRITE_ENDPOINT_NAMES } from './constants';
|
|
2
2
|
export { connectorTokens, getConnectorTokens } from './manifestTokens';
|
|
3
3
|
export { connectorPresets, emptyManifest } from './presets';
|
|
4
|
-
export { validateConnectorManifest } from './validateManifest';
|
|
4
|
+
export { isConnectorManifestDraft, validateConnectorManifest } from './validateManifest';
|
|
5
5
|
export type { ConnectorPreset } from './presets';
|
|
6
6
|
export type { ConnectorToken, ConnectorTokenScope } from './manifestTokens';
|
|
7
7
|
export type { ConnectorManifestIssue, ConnectorManifestReport } from './validateManifest';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BODYLESS_METHODS as e, CONNECTOR_HTTP_METHODS as t, DEFAULT_READ_ENDPOINT as n, EMPTY_RESPONSE_METHODS as r, READ_ENDPOINT_NAMES as i, WRITE_ENDPOINT_NAMES as a } from "./constants.mjs";
|
|
2
2
|
import { connectorTokens as o, getConnectorTokens as s } from "./manifestTokens.mjs";
|
|
3
3
|
import { connectorPresets as c, emptyManifest as l } from "./presets.mjs";
|
|
4
|
-
import {
|
|
5
|
-
export { e as BODYLESS_METHODS, t as CONNECTOR_HTTP_METHODS, n as DEFAULT_READ_ENDPOINT, r as EMPTY_RESPONSE_METHODS, i as READ_ENDPOINT_NAMES, a as WRITE_ENDPOINT_NAMES, c as connectorPresets, o as connectorTokens, l as emptyManifest, s as getConnectorTokens, u as validateConnectorManifest };
|
|
4
|
+
import { isConnectorManifestDraft as u, validateConnectorManifest as d } from "./validateManifest.mjs";
|
|
5
|
+
export { e as BODYLESS_METHODS, t as CONNECTOR_HTTP_METHODS, n as DEFAULT_READ_ENDPOINT, r as EMPTY_RESPONSE_METHODS, i as READ_ENDPOINT_NAMES, a as WRITE_ENDPOINT_NAMES, c as connectorPresets, o as connectorTokens, l as emptyManifest, s as getConnectorTokens, u as isConnectorManifestDraft, d as validateConnectorManifest };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ConnectorManifestDraft } from '../types';
|
|
1
2
|
/**
|
|
2
3
|
* The one connector-manifest validator.
|
|
3
4
|
*
|
|
@@ -26,3 +27,5 @@ export type ConnectorManifestReport = {
|
|
|
26
27
|
* Give it whatever you have — parsed JSON, an editor's working copy, a GraphQL argument. It never throws.
|
|
27
28
|
*/
|
|
28
29
|
export declare const validateConnectorManifest: (input: unknown) => ConnectorManifestReport;
|
|
30
|
+
/** Whether a value read from outside — a deployment's store, a request — is a manifest the engine can run. */
|
|
31
|
+
export declare const isConnectorManifestDraft: (input: unknown) => input is ConnectorManifestDraft;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { isRecord as e } from "../helpers/isRecord.mjs";
|
|
2
|
+
import { BODYLESS_METHODS as t, CONNECTOR_HTTP_METHODS as n } from "./constants.mjs";
|
|
3
|
+
import { connectorTokens as r } from "./manifestTokens.mjs";
|
|
3
4
|
//#region src/connectors/validateManifest.ts
|
|
4
|
-
var
|
|
5
|
+
var i = [
|
|
5
6
|
"offset",
|
|
6
7
|
"page",
|
|
7
8
|
"cursor"
|
|
8
|
-
],
|
|
9
|
+
], a = [
|
|
9
10
|
"text",
|
|
10
11
|
"richText",
|
|
11
12
|
"image",
|
|
@@ -20,7 +21,7 @@ var r = [
|
|
|
20
21
|
"color",
|
|
21
22
|
"option",
|
|
22
23
|
"file"
|
|
23
|
-
],
|
|
24
|
+
], o = /\{\{\s*([^}]+?)\s*\}\}/g, s = (e) => typeof e == "string" && e.trim() !== "", c = (e) => typeof e == "string" ? e : JSON.stringify(e), l = (e) => [...e.matchAll(o)].map((e) => e[1]), u = (e, t) => r.some((n) => n.scopes.includes(t) ? n.value.endsWith(".") ? e.startsWith(n.value) : e === n.value : !1), d = (e, t, n, r) => {
|
|
24
25
|
e.errors.push({
|
|
25
26
|
path: t,
|
|
26
27
|
message: n,
|
|
@@ -32,35 +33,35 @@ var r = [
|
|
|
32
33
|
message: n,
|
|
33
34
|
...r === void 0 ? {} : { hint: r }
|
|
34
35
|
});
|
|
35
|
-
}, p = (
|
|
36
|
-
if (
|
|
37
|
-
if (!
|
|
38
|
-
d(
|
|
36
|
+
}, p = (t, n, r, i) => {
|
|
37
|
+
if (n !== void 0) {
|
|
38
|
+
if (!e(n)) {
|
|
39
|
+
d(t, r, "Must be an object of string values", "Each entry is one name and its templated value");
|
|
39
40
|
return;
|
|
40
41
|
}
|
|
41
|
-
for (let [
|
|
42
|
+
for (let [e, a] of Object.entries(n)) {
|
|
42
43
|
if (typeof a != "string") {
|
|
43
|
-
d(
|
|
44
|
+
d(t, `${r}.${e}`, "Must be a string", "Values are Twig templates the server renders per request");
|
|
44
45
|
continue;
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
path: `${
|
|
47
|
+
t.templates.push({
|
|
48
|
+
path: `${r}.${e}`,
|
|
48
49
|
value: a,
|
|
49
|
-
scope:
|
|
50
|
+
scope: i
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
|
-
return
|
|
53
|
+
return n;
|
|
53
54
|
}
|
|
54
|
-
}, m = (e,
|
|
55
|
-
if (
|
|
56
|
-
i && d(e, r, "A write endpoint must declare its method", `One of ${
|
|
55
|
+
}, m = (e, t, r, i) => {
|
|
56
|
+
if (t === void 0) {
|
|
57
|
+
i && d(e, r, "A write endpoint must declare its method", `One of ${n.join(", ")}`);
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
|
-
if (typeof
|
|
60
|
-
d(e, r, `"${c(
|
|
60
|
+
if (typeof t != "string" || !n.includes(t)) {
|
|
61
|
+
d(e, r, `"${c(t)}" is not an HTTP method`, `One of ${n.join(", ")}`);
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
|
-
return
|
|
64
|
+
return t;
|
|
64
65
|
}, h = (e, t, n, r) => {
|
|
65
66
|
if (!s(t.path)) {
|
|
66
67
|
d(e, `${n}.path`, "An endpoint needs a path", "It is appended to baseUrl, e.g. \"/api/{{resource}}\"");
|
|
@@ -73,25 +74,25 @@ var r = [
|
|
|
73
74
|
});
|
|
74
75
|
}, g = (e, t, n) => {
|
|
75
76
|
if (t !== void 0) {
|
|
76
|
-
if (typeof t != "string" || !
|
|
77
|
-
d(e, n, `"${c(t)}" is not a paging style`, `One of ${
|
|
77
|
+
if (typeof t != "string" || !i.includes(t)) {
|
|
78
|
+
d(e, n, `"${c(t)}" is not a paging style`, `One of ${i.join(", ")}`);
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
81
|
return t;
|
|
81
82
|
}
|
|
82
|
-
}, _ = (
|
|
83
|
-
let
|
|
84
|
-
if (!
|
|
85
|
-
d(
|
|
83
|
+
}, _ = (n, r, i, a) => {
|
|
84
|
+
let o = `endpoints.read.${r}`;
|
|
85
|
+
if (!e(i)) {
|
|
86
|
+
d(n, o, "A read endpoint must be an object", "It declares at least a path");
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
|
-
h(
|
|
89
|
-
let s = m(
|
|
90
|
-
p(
|
|
91
|
-
let l = p(
|
|
92
|
-
if (l &&
|
|
89
|
+
h(n, i, o, "request");
|
|
90
|
+
let s = m(n, i.method, `${o}.method`, !1) ?? "GET", c = p(n, i.query, `${o}.query`, "request");
|
|
91
|
+
p(n, i.headers, `${o}.headers`, "request");
|
|
92
|
+
let l = p(n, i.body, `${o}.body`, "request"), u = g(n, i.pagination, `${o}.pagination`) ?? a;
|
|
93
|
+
if (l && t.includes(s) && f(n, `${o}.body`, `A ${s} request carries no body, so this one is never sent`, "Move these values into `query`, or read through POST if the provider expects a body"), u === void 0) return;
|
|
93
94
|
let _ = JSON.stringify({
|
|
94
|
-
path:
|
|
95
|
+
path: i.path,
|
|
95
96
|
query: c ?? {},
|
|
96
97
|
body: l ?? {}
|
|
97
98
|
}), v = {
|
|
@@ -99,70 +100,70 @@ var r = [
|
|
|
99
100
|
page: "{{page}}",
|
|
100
101
|
cursor: "{{cursor}}"
|
|
101
102
|
}[u];
|
|
102
|
-
v !== void 0 && !_.includes(v) && f(
|
|
103
|
-
}, v = (
|
|
104
|
-
let
|
|
105
|
-
if (!
|
|
106
|
-
d(
|
|
103
|
+
v !== void 0 && !_.includes(v) && f(n, `${o}.query`, `"${r}" pages by ${u} but never uses ${v}, so every page resolves to the first one`, `Put ${v} in the query (or the path) this endpoint sends`);
|
|
104
|
+
}, v = (t, n, r) => {
|
|
105
|
+
let i = `endpoints.write.${n}`;
|
|
106
|
+
if (!e(r)) {
|
|
107
|
+
d(t, i, "A write endpoint must be an object", "It declares at least a method and a path");
|
|
107
108
|
return;
|
|
108
109
|
}
|
|
109
|
-
h(
|
|
110
|
-
}, y = (
|
|
111
|
-
if (!
|
|
112
|
-
d(
|
|
110
|
+
h(t, r, i, "write"), m(t, r.method, `${i}.method`, !0), p(t, r.query, `${i}.query`, "write"), p(t, r.headers, `${i}.headers`, "write"), r.bodyPath !== void 0 && typeof r.bodyPath != "string" && d(t, `${i}.bodyPath`, "Must be a string", "It names where to nest the values, e.g. \"data\"");
|
|
111
|
+
}, y = (t, n, r) => {
|
|
112
|
+
if (!e(n)) {
|
|
113
|
+
d(t, "endpoints", "A connector must declare its endpoints", "At least one read endpoint, usually \"list\"");
|
|
113
114
|
return;
|
|
114
115
|
}
|
|
115
|
-
if (!
|
|
116
|
-
else for (let [
|
|
117
|
-
if (
|
|
118
|
-
if (!
|
|
119
|
-
d(
|
|
116
|
+
if (!e(n.read) || Object.keys(n.read).length === 0) d(t, "endpoints.read", "A connector needs at least one read endpoint", "Name it \"list\" — that is the one a provider element addresses when it names none");
|
|
117
|
+
else for (let [e, i] of Object.entries(n.read)) _(t, e, i, r);
|
|
118
|
+
if (n.write !== void 0) {
|
|
119
|
+
if (!e(n.write)) {
|
|
120
|
+
d(t, "endpoints.write", "Must be an object of endpoints keyed by name", "Omit it for a read-only connector");
|
|
120
121
|
return;
|
|
121
122
|
}
|
|
122
|
-
for (let [
|
|
123
|
+
for (let [e, r] of Object.entries(n.write)) v(t, e, r);
|
|
123
124
|
}
|
|
124
|
-
}, b = (
|
|
125
|
-
if (
|
|
126
|
-
if (!
|
|
127
|
-
d(
|
|
125
|
+
}, b = (t, n) => {
|
|
126
|
+
if (n !== void 0) {
|
|
127
|
+
if (!e(n)) {
|
|
128
|
+
d(t, "auth", "Must be an object", "Shape: { in, name, value }");
|
|
128
129
|
return;
|
|
129
130
|
}
|
|
130
|
-
if (
|
|
131
|
-
d(
|
|
131
|
+
if (n.in !== "header" && n.in !== "query" && d(t, "auth.in", "Auth travels in a header or a query parameter", "One of header, query"), s(n.name) || d(t, "auth.name", "Auth needs the name it is sent under", "e.g. \"Authorization\" for a bearer token"), typeof n.value != "string") {
|
|
132
|
+
d(t, "auth.value", "Must be a string", "A template, e.g. \"Bearer {{credential.token}}\"");
|
|
132
133
|
return;
|
|
133
134
|
}
|
|
134
|
-
|
|
135
|
+
t.templates.push({
|
|
135
136
|
path: "auth.value",
|
|
136
|
-
value:
|
|
137
|
+
value: n.value,
|
|
137
138
|
scope: "request"
|
|
138
139
|
});
|
|
139
140
|
}
|
|
140
141
|
}, x = (e, t) => {
|
|
141
142
|
let n = p(e, t, "operators", "filter");
|
|
142
143
|
if (n) for (let [t, r] of Object.entries(n)) typeof r == "string" && !r.includes("=") && d(e, `operators.${t}`, `Operator "${t}" renders no "key=value" pair, so a filter using it is dropped`, "Write the full query entry, e.g. \"filters[{{field}}][$eq]={{value}}\"");
|
|
143
|
-
}, S = (
|
|
144
|
-
if (
|
|
145
|
-
if (!
|
|
146
|
-
d(
|
|
144
|
+
}, S = (t, n) => {
|
|
145
|
+
if (n !== void 0) {
|
|
146
|
+
if (!e(n)) {
|
|
147
|
+
d(t, "fields", "Must be an object of field name → type", `Types: ${a.join(", ")}`);
|
|
147
148
|
return;
|
|
148
149
|
}
|
|
149
|
-
for (let [
|
|
150
|
+
for (let [e, r] of Object.entries(n)) (typeof r != "string" || !a.includes(r)) && d(t, `fields.${e}`, `"${c(r)}" is not a field type`, `One of ${a.join(", ")}`);
|
|
150
151
|
}
|
|
151
152
|
}, C = (e, t) => {
|
|
152
|
-
let
|
|
153
|
-
for (let t of e.templates) for (let i of l(t.value)) i.startsWith("credential.") && (
|
|
154
|
-
if (
|
|
153
|
+
let n = !1;
|
|
154
|
+
for (let t of e.templates) for (let i of l(t.value)) i.startsWith("credential.") && (n = !0), u(i, t.scope) || f(e, t.path, `{{${i}}} is not a value the engine binds here, so it renders empty`, `Tokens available in this position: ${r.filter((e) => e.scopes.includes(t.scope)).map((e) => e.value).join(", ")}`);
|
|
155
|
+
if (n && !s(t)) {
|
|
155
156
|
f(e, "credential", "This manifest reads {{credential.…}} but names no credential, so every request goes unauthenticated", "The connector still saves. Ask the space owner to create the credential and attach it — the secret is never part of the manifest.");
|
|
156
157
|
return;
|
|
157
158
|
}
|
|
158
|
-
!
|
|
159
|
-
}, w = (
|
|
160
|
-
let
|
|
159
|
+
!n && s(t) && f(e, "credential", "A credential is attached but no template reads {{credential.…}}, so it is never sent", "Reference it where the provider expects it, e.g. auth.value = \"Bearer {{credential.token}}\"");
|
|
160
|
+
}, w = (t) => {
|
|
161
|
+
let n = {
|
|
161
162
|
errors: [],
|
|
162
163
|
warnings: [],
|
|
163
164
|
templates: []
|
|
164
165
|
};
|
|
165
|
-
if (!
|
|
166
|
+
if (!e(t)) return {
|
|
166
167
|
valid: !1,
|
|
167
168
|
errors: [{
|
|
168
169
|
path: "",
|
|
@@ -171,13 +172,13 @@ var r = [
|
|
|
171
172
|
}],
|
|
172
173
|
warnings: []
|
|
173
174
|
};
|
|
174
|
-
s(
|
|
175
|
-
let
|
|
176
|
-
return b(
|
|
177
|
-
valid:
|
|
178
|
-
errors:
|
|
179
|
-
warnings:
|
|
175
|
+
s(t.baseUrl) ? /^https?:\/\//.test(t.baseUrl) || d(n, "baseUrl", "Base URL must start with http:// or https://", "The engine resolves paths against it") : d(n, "baseUrl", "A connector needs a base URL", "The origin every endpoint path is appended to"), t.credential !== void 0 && typeof t.credential != "string" && d(n, "credential", "Must be the identifier of a stored credential", "The secret itself never goes here");
|
|
176
|
+
let r = g(n, t.pagination, "pagination");
|
|
177
|
+
return b(n, t.auth), p(n, t.headers, "headers", "request"), y(n, t.endpoints, r), x(n, t.operators), S(n, t.fields), t.media !== void 0 && (e(t.media) ? t.media.baseUrl !== void 0 && !s(t.media.baseUrl) && d(n, "media.baseUrl", "Must be a non-empty string", "The origin relative media paths are rebased onto") : d(n, "media", "Must be an object", "Shape: { baseUrl }")), t.projection !== void 0 && t.projection !== "full" && d(n, "projection", "The only projection is \"full\"", "Omit it to send only the paths the page binds"), C(n, t.credential), {
|
|
178
|
+
valid: n.errors.length === 0,
|
|
179
|
+
errors: n.errors,
|
|
180
|
+
warnings: n.warnings
|
|
180
181
|
};
|
|
181
|
-
};
|
|
182
|
+
}, T = (e) => w(e).valid;
|
|
182
183
|
//#endregion
|
|
183
|
-
export { w as validateConnectorManifest };
|
|
184
|
+
export { T as isConnectorManifestDraft, w as validateConnectorManifest };
|
|
@@ -1,45 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import t from "
|
|
1
|
+
import { isRecord as e } from "../helpers/isRecord.mjs";
|
|
2
|
+
import { processTwigValue as t } from "../helpers/twigWrapper/processTwig/processTwig.mjs";
|
|
3
|
+
import { COMPUTED_GLOBALS as n } from "./globalSources.mjs";
|
|
4
|
+
import r from "@plitzi/plitzi-ui/utils/deepEqual";
|
|
3
5
|
//#region src/dataSource/computed.ts
|
|
4
|
-
var
|
|
5
|
-
let a = {}, o = i !== void 0 && Object.keys(i).length === Object.keys(
|
|
6
|
-
for (let [s, c] of Object.entries(
|
|
7
|
-
let
|
|
8
|
-
...
|
|
6
|
+
var i = (e, n, i) => {
|
|
7
|
+
let a = {}, o = i !== void 0 && Object.keys(i).length === Object.keys(e).length;
|
|
8
|
+
for (let [s, c] of Object.entries(e)) {
|
|
9
|
+
let e = t(c, {
|
|
10
|
+
...n,
|
|
9
11
|
computed: { ...a }
|
|
10
|
-
}), l = i?.[s], u = i !== void 0 && Object.hasOwn(i, s) && (l ===
|
|
11
|
-
a[s] = u ? l :
|
|
12
|
+
}), l = i?.[s], u = i !== void 0 && Object.hasOwn(i, s) && (l === e || r(l, e));
|
|
13
|
+
a[s] = u ? l : e, o &&= u;
|
|
12
14
|
}
|
|
13
15
|
return o && i ? i : a;
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
], o = (e, t, n) => {
|
|
21
|
-
let a = r(t) ? t : {};
|
|
22
|
-
return i(n) ? {
|
|
23
|
-
...e,
|
|
24
|
-
state: a,
|
|
25
|
-
computed: c(n, e, a)
|
|
16
|
+
}, a = (t) => e(t) && Object.values(t).every((e) => typeof e == "string"), o = (t, n, r) => {
|
|
17
|
+
let i = e(n) ? n : {};
|
|
18
|
+
return a(r) ? {
|
|
19
|
+
...t,
|
|
20
|
+
state: i,
|
|
21
|
+
computed: c(r, t, i)
|
|
26
22
|
} : {
|
|
27
|
-
...
|
|
28
|
-
state:
|
|
23
|
+
...t,
|
|
24
|
+
state: i
|
|
29
25
|
};
|
|
30
26
|
}, s, c = (e, t, r) => {
|
|
31
|
-
let
|
|
32
|
-
if (s?.definitions === e && s.state === r && s.globals.every((e, t) => e ===
|
|
33
|
-
let o =
|
|
34
|
-
...Object.fromEntries(
|
|
27
|
+
let a = n.map((e) => t[e]);
|
|
28
|
+
if (s?.definitions === e && s.state === r && s.globals.every((e, t) => e === a[t])) return s.computed;
|
|
29
|
+
let o = i(e, {
|
|
30
|
+
...Object.fromEntries(n.map((e, t) => [e, a[t]])),
|
|
35
31
|
state: r
|
|
36
32
|
}, s?.definitions === e ? s.computed : void 0);
|
|
37
33
|
return s = {
|
|
38
34
|
definitions: e,
|
|
39
35
|
state: r,
|
|
40
|
-
globals:
|
|
36
|
+
globals: a,
|
|
41
37
|
computed: o
|
|
42
38
|
}, o;
|
|
43
39
|
};
|
|
44
40
|
//#endregion
|
|
45
|
-
export {
|
|
41
|
+
export { i as evaluateComputed, o as liveSources };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The data sources that belong to nobody: published once for the whole space by `GlobalSources`, and named as
|
|
3
|
+
* themselves rather than as `<type>_<id>` — which is what tells them apart from a source an element publishes.
|
|
4
|
+
*
|
|
5
|
+
* One list for everything that has to know them — the runtime evaluating computed values, the authoring validator
|
|
6
|
+
* refusing a binding to a name nothing answers to, an element that may not take one of these names as its id — so a
|
|
7
|
+
* new global is a global everywhere at once.
|
|
8
|
+
*/
|
|
9
|
+
export declare const GLOBAL_SOURCES: readonly ["variables", "navigation", "auth", "state", "host", "theme", "flags", "computed"];
|
|
10
|
+
export type GlobalSource = (typeof GLOBAL_SOURCES)[number];
|
|
11
|
+
/**
|
|
12
|
+
* What a computed value is evaluated over: every global but `state`, which a flow hands it live, and `computed`, which
|
|
13
|
+
* is what is being evaluated.
|
|
14
|
+
*/
|
|
15
|
+
export declare const COMPUTED_GLOBALS: ("auth" | "navigation" | "flags" | "variables" | "theme" | "host")[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/dataSource/globalSources.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"variables",
|
|
4
|
+
"navigation",
|
|
5
|
+
"auth",
|
|
6
|
+
"state",
|
|
7
|
+
"host",
|
|
8
|
+
"theme",
|
|
9
|
+
"flags",
|
|
10
|
+
"computed"
|
|
11
|
+
], t = e.filter((e) => e !== "state" && e !== "computed");
|
|
12
|
+
//#endregion
|
|
13
|
+
export { t as COMPUTED_GLOBALS, e as GLOBAL_SOURCES };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './hooks';
|
|
2
2
|
export * from './helpers';
|
|
3
3
|
export { evaluateComputed, liveSources } from './computed';
|
|
4
|
+
export { GLOBAL_SOURCES, COMPUTED_GLOBALS } from './globalSources';
|
|
5
|
+
export type { GlobalSource } from './globalSources';
|
|
4
6
|
export { default as getBindingsDetails } from './getBindingsDetails';
|
|
5
7
|
export { default as resolveVariables } from './resolveVariables';
|
|
6
8
|
export type { VariableScope } from './resolveVariables';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import n,
|
|
3
|
-
import i from "./
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
import { COMPUTED_GLOBALS as e, GLOBAL_SOURCES as t } from "./globalSources.mjs";
|
|
2
|
+
import { evaluateComputed as n, liveSources as r } from "./computed.mjs";
|
|
3
|
+
import i, { utilityOptions as a } from "./utility/index.mjs";
|
|
4
|
+
import o from "./getBindingsDetails.mjs";
|
|
5
|
+
import s from "./helpers/getSourceName.mjs";
|
|
6
|
+
import c from "./hooks/useRegisterSource.mjs";
|
|
7
|
+
import l from "./resolveVariables.mjs";
|
|
8
|
+
export { e as COMPUTED_GLOBALS, t as GLOBAL_SOURCES, n as evaluateComputed, o as getBindingsDetails, s as getSourceName, r as liveSources, l as resolveVariables, c as useRegisterSource, i as utility, a as utilityOptions };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
var t = e({
|
|
1
|
+
import { sharedContext as e } from "../helpers/sharedContext.mjs";
|
|
2
|
+
var t = e("DevToolsContext", {
|
|
3
3
|
logs: [],
|
|
4
4
|
providers: {}
|
|
5
5
|
});
|
|
6
|
-
t.displayName = "DevToolsContext";
|
|
7
6
|
//#endregion
|
|
8
7
|
export { t as default };
|
|
@@ -17,9 +17,18 @@ declare class PlitziConsole {
|
|
|
17
17
|
listeningParams?: {
|
|
18
18
|
category: Log['category'];
|
|
19
19
|
};
|
|
20
|
+
recentLimit: number;
|
|
20
21
|
constructor(callback?: CallbackInternal, pendingLimit?: number);
|
|
21
22
|
setCallback(callback?: CallbackInternal): void;
|
|
22
23
|
processPendingLogs(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Every log as it is written, beside whatever panel takes them — what a reader in text (the agent inspector) keeps
|
|
26
|
+
* for itself. Only in a browser, as everything kept here is. `replay` hands it the last ones written first: the
|
|
27
|
+
* flows a page runs as it loads end before anything mounted later could have been listening.
|
|
28
|
+
*/
|
|
29
|
+
addListener(listener: (log: Log) => void, { replay }?: {
|
|
30
|
+
replay?: boolean;
|
|
31
|
+
}): () => void;
|
|
23
32
|
setCallbackAddProvider(callback?: CallbackAddProvider): void;
|
|
24
33
|
setCallbackRemoveProvider(callback?: CallbackRemoveProvider): void;
|
|
25
34
|
flush(hard?: boolean): void;
|