@webstudio-is/react-sdk 0.0.0-021f2d4

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/lib/runtime.js ADDED
@@ -0,0 +1,213 @@
1
+ // src/context.tsx
2
+ import { createContext, useContext, useMemo } from "react";
3
+ import {
4
+ createJsonStringifyProxy,
5
+ isPlainObject
6
+ } from "@webstudio-is/sdk/runtime";
7
+ var ReactSdkContext = createContext({
8
+ assetBaseUrl: "/",
9
+ imageLoader: ({ src }) => src,
10
+ resources: {}
11
+ });
12
+ var useResource = (name) => {
13
+ const { resources } = useContext(ReactSdkContext);
14
+ const resource = resources[name];
15
+ const resourceMemozied = useMemo(
16
+ () => isPlainObject(resource) ? createJsonStringifyProxy(resource) : resource,
17
+ [resource]
18
+ );
19
+ return resourceMemozied;
20
+ };
21
+
22
+ // src/hook.ts
23
+ var getClosestInstance = (instancePath, currentInstance, closestComponent) => {
24
+ let matched = false;
25
+ for (const instance of instancePath) {
26
+ if (currentInstance === instance) {
27
+ matched = true;
28
+ }
29
+ if (matched && instance.component === closestComponent) {
30
+ return instance;
31
+ }
32
+ }
33
+ };
34
+
35
+ // src/variable-state.tsx
36
+ import { useState, useMemo as useMemo2 } from "react";
37
+ import {
38
+ createJsonStringifyProxy as createJsonStringifyProxy2,
39
+ isPlainObject as isPlainObject2
40
+ } from "@webstudio-is/sdk/runtime";
41
+ var useVariableState = (initialState) => {
42
+ const [state, setState] = useState(initialState);
43
+ const value = useMemo2(
44
+ () => isPlainObject2(state) ? createJsonStringifyProxy2(state) : state,
45
+ [state]
46
+ );
47
+ return [value, setState];
48
+ };
49
+
50
+ // src/page-settings-meta.tsx
51
+ import { useEffect, useState as useState2 } from "react";
52
+ import { jsx } from "react/jsx-runtime";
53
+ var isElementRenderedWithReact = (element) => {
54
+ return Object.keys(element).some((key) => key.startsWith("__react"));
55
+ };
56
+ var isServer = typeof window === "undefined";
57
+ var Meta = (props) => {
58
+ const [localProps, setLocalProps] = useState2();
59
+ useEffect(() => {
60
+ const selector = `meta[${props.name ? `name="${props.name}"` : `property="${props.property}"`}]`;
61
+ let allMetas = document.querySelectorAll(selector);
62
+ for (const meta of allMetas) {
63
+ if (!isElementRenderedWithReact(meta)) {
64
+ meta.remove();
65
+ }
66
+ }
67
+ allMetas = document.querySelectorAll(selector);
68
+ if (allMetas.length === 0) {
69
+ setLocalProps(props);
70
+ }
71
+ }, [props]);
72
+ if (isServer) {
73
+ return /* @__PURE__ */ jsx("meta", { ...props });
74
+ }
75
+ if (localProps === void 0) {
76
+ return;
77
+ }
78
+ return /* @__PURE__ */ jsx("meta", { ...localProps });
79
+ };
80
+ var PageSettingsMeta = ({
81
+ url,
82
+ host,
83
+ siteName,
84
+ pageMeta,
85
+ imageLoader
86
+ }) => {
87
+ const metas = [];
88
+ if (url !== void 0) {
89
+ metas.push({
90
+ property: "og:url",
91
+ content: url
92
+ });
93
+ }
94
+ if (pageMeta.title) {
95
+ metas.push({
96
+ property: "og:title",
97
+ content: pageMeta.title
98
+ });
99
+ }
100
+ metas.push({ property: "og:type", content: "website" });
101
+ if (siteName) {
102
+ metas.push({
103
+ property: "og:site_name",
104
+ content: siteName
105
+ });
106
+ }
107
+ if (pageMeta.excludePageFromSearch) {
108
+ metas.push({
109
+ name: "robots",
110
+ content: "noindex, nofollow"
111
+ });
112
+ }
113
+ if (pageMeta.description) {
114
+ metas.push({
115
+ name: "description",
116
+ content: pageMeta.description
117
+ });
118
+ metas.push({
119
+ property: "og:description",
120
+ content: pageMeta.description
121
+ });
122
+ }
123
+ if (pageMeta.socialImageAssetName) {
124
+ metas.push({
125
+ property: "og:image",
126
+ content: `https://${host}${imageLoader({
127
+ src: pageMeta.socialImageAssetName,
128
+ // Do not transform social image (not enough information do we need to do this)
129
+ format: "raw"
130
+ })}`
131
+ });
132
+ } else if (pageMeta.socialImageUrl) {
133
+ metas.push({
134
+ property: "og:image",
135
+ content: pageMeta.socialImageUrl
136
+ });
137
+ }
138
+ metas.push(...pageMeta.custom);
139
+ return metas.map((meta, index) => /* @__PURE__ */ jsx(Meta, { ...meta }, index));
140
+ };
141
+
142
+ // src/page-settings-title.tsx
143
+ import { useEffect as useEffect2, useState as useState3 } from "react";
144
+ import { jsx as jsx2 } from "react/jsx-runtime";
145
+ var isServer2 = typeof window === "undefined";
146
+ var PageSettingsTitle = (props) => {
147
+ const [localProps, setLocalProps] = useState3();
148
+ useEffect2(() => {
149
+ const selector = `head > title`;
150
+ let allTitles = document.querySelectorAll(selector);
151
+ for (const meta of allTitles) {
152
+ if (!isElementRenderedWithReact(meta)) {
153
+ meta.remove();
154
+ }
155
+ }
156
+ allTitles = document.querySelectorAll(selector);
157
+ if (allTitles.length === 0) {
158
+ setLocalProps(props);
159
+ }
160
+ }, [props]);
161
+ if (isServer2) {
162
+ return /* @__PURE__ */ jsx2("title", { ...props });
163
+ }
164
+ if (localProps === void 0) {
165
+ return;
166
+ }
167
+ return /* @__PURE__ */ jsx2("title", { ...localProps });
168
+ };
169
+
170
+ // src/page-settings-canonical-link.tsx
171
+ import { useEffect as useEffect3, useState as useState4 } from "react";
172
+ import { jsx as jsx3 } from "react/jsx-runtime";
173
+ var isServer3 = typeof window === "undefined";
174
+ var PageSettingsCanonicalLink = (props) => {
175
+ const [localProps, setLocalProps] = useState4();
176
+ useEffect3(() => {
177
+ const selector = `head > link[rel="canonical"]`;
178
+ let allLinks = document.querySelectorAll(selector);
179
+ for (const meta of allLinks) {
180
+ if (!isElementRenderedWithReact(meta)) {
181
+ meta.remove();
182
+ }
183
+ }
184
+ allLinks = document.querySelectorAll(selector);
185
+ if (allLinks.length === 0) {
186
+ setLocalProps(props);
187
+ }
188
+ }, [props]);
189
+ if (isServer3) {
190
+ return /* @__PURE__ */ jsx3("link", { rel: "canonical", ...props });
191
+ }
192
+ if (localProps === void 0) {
193
+ return;
194
+ }
195
+ return /* @__PURE__ */ jsx3("link", { rel: "canonical", ...localProps });
196
+ };
197
+
198
+ // src/runtime.ts
199
+ var xmlNodeTagSuffix = "-ws-xml-node-fb77f896-8e96-40b9-b8f8-90a4e70d724a";
200
+ var getIndexWithinAncestorFromComponentProps = (props) => {
201
+ return props["data-ws-index"];
202
+ };
203
+ export {
204
+ PageSettingsCanonicalLink,
205
+ PageSettingsMeta,
206
+ PageSettingsTitle,
207
+ ReactSdkContext,
208
+ getClosestInstance,
209
+ getIndexWithinAncestorFromComponentProps,
210
+ useResource,
211
+ useVariableState,
212
+ xmlNodeTagSuffix
213
+ };
@@ -0,0 +1,37 @@
1
+ import type { Instances, Instance, Props, Scope, DataSources, Prop } from "@webstudio-is/sdk";
2
+ import type { IndexesWithinAncestors } from "./instance-utils";
3
+ export declare const generateJsxElement: ({ context, scope, instance, props, dataSources, usedDataSources, indexesWithinAncestors, children, classesMap, }: {
4
+ context?: "expression" | "jsx";
5
+ scope: Scope;
6
+ instance: Instance;
7
+ props: Props;
8
+ dataSources: DataSources;
9
+ usedDataSources: DataSources;
10
+ indexesWithinAncestors: IndexesWithinAncestors;
11
+ children: string;
12
+ classesMap?: Map<string, Array<string>>;
13
+ }) => string;
14
+ export declare const generateJsxChildren: ({ scope, children, instances, props, dataSources, usedDataSources, indexesWithinAncestors, classesMap, excludePlaceholders, }: {
15
+ scope: Scope;
16
+ children: Instance["children"];
17
+ instances: Instances;
18
+ props: Props;
19
+ dataSources: DataSources;
20
+ usedDataSources: DataSources;
21
+ indexesWithinAncestors: IndexesWithinAncestors;
22
+ classesMap?: Map<string, Array<string>>;
23
+ excludePlaceholders?: boolean;
24
+ }) => string;
25
+ export declare const generateWebstudioComponent: ({ scope, name, rootInstanceId, parameters, instances, props, dataSources, indexesWithinAncestors, classesMap, }: {
26
+ scope: Scope;
27
+ name: string;
28
+ rootInstanceId: Instance["id"];
29
+ parameters: Extract<Prop, {
30
+ type: "parameter";
31
+ }>[];
32
+ instances: Instances;
33
+ props: Props;
34
+ dataSources: DataSources;
35
+ indexesWithinAncestors: IndexesWithinAncestors;
36
+ classesMap: Map<string, Array<string>>;
37
+ }) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { componentAttribute, idAttribute, selectorIdAttribute } from "../props";
2
+ export type AnyComponent = React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & WebstudioComponentSystemProps & React.RefAttributes<HTMLElement>>;
3
+ export type Components = Map<string, AnyComponent>;
4
+ export type WebstudioComponentSystemProps = {
5
+ [componentAttribute]: string;
6
+ [idAttribute]: string;
7
+ [selectorIdAttribute]: string;
8
+ };
@@ -0,0 +1,26 @@
1
+ import type { ImageLoader } from "@webstudio-is/image";
2
+ export type Params = {
3
+ /**
4
+ * When rendering a published version, there is no renderer defined.
5
+ * - canvas is the builder canvas in dev mode
6
+ * - preview is the preview mode in builder
7
+ */
8
+ renderer?: "canvas" | "preview";
9
+ /**
10
+ * Base url or base path for any asset with ending slash.
11
+ * Used to load assets like fonts or images in styles
12
+ * Concatinated with "name".
13
+ *
14
+ * For example
15
+ * /s/uploads/
16
+ * /asset/file/
17
+ * https://assets-dev.webstudio.is/
18
+ * https://assets.webstudio.is/
19
+ */
20
+ assetBaseUrl: string;
21
+ };
22
+ export declare const ReactSdkContext: import("react").Context<Params & {
23
+ imageLoader: ImageLoader;
24
+ resources: Record<string, any>;
25
+ }>;
26
+ export declare const useResource: (name: string) => any;
@@ -0,0 +1,20 @@
1
+ import { type TransformValue } from "@webstudio-is/css-engine";
2
+ import { type Assets, type Breakpoints, type Instances, type Props, type StyleSourceSelections, type Styles, type WsComponentMeta } from "@webstudio-is/sdk";
3
+ export type CssConfig = {
4
+ assets: Assets;
5
+ instances: Instances;
6
+ props: Props;
7
+ breakpoints: Breakpoints;
8
+ styles: Styles;
9
+ styleSourceSelections: StyleSourceSelections;
10
+ componentMetas: Map<string, WsComponentMeta>;
11
+ assetBaseUrl: string;
12
+ atomic: boolean;
13
+ };
14
+ export declare const createImageValueTransformer: (assets: Assets, { assetBaseUrl }: {
15
+ assetBaseUrl: string;
16
+ }) => TransformValue;
17
+ export declare const generateCss: ({ assets, instances, props, breakpoints, styles, styleSourceSelections, componentMetas, assetBaseUrl, atomic, }: CssConfig) => {
18
+ cssText: string;
19
+ classes: Map<string, string[]>;
20
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { StyleSheetRegular } from "@webstudio-is/css-engine";
2
+ import type { Assets } from "@webstudio-is/sdk";
3
+ export declare const addGlobalRules: (sheet: StyleSheetRegular, { assets, assetBaseUrl }: {
4
+ assets: Assets;
5
+ assetBaseUrl: string;
6
+ }) => void;
@@ -0,0 +1,2 @@
1
+ export * from "./global-rules";
2
+ export * from "./css";
@@ -0,0 +1,54 @@
1
+ import type { Instance, WebstudioFragment, WsEmbedTemplate, EmbedTemplateInstance, WsComponentMeta } from "@webstudio-is/sdk";
2
+ export declare const generateDataFromEmbedTemplate: (treeTemplate: WsEmbedTemplate, metas: Map<Instance["component"], WsComponentMeta>, generateId?: () => string) => WebstudioFragment;
3
+ export declare const namespaceMeta: (meta: WsComponentMeta, namespace: string, components: Set<EmbedTemplateInstance["component"]>) => {
4
+ type: "control" | "embed" | "container" | "rich-text-child";
5
+ description?: string | undefined;
6
+ category?: "data" | "xml" | "hidden" | "media" | "general" | "typography" | "forms" | "localization" | "radix" | "internal" | undefined;
7
+ label?: string | undefined;
8
+ order?: number | undefined;
9
+ template?: ({
10
+ value: string;
11
+ type: "text";
12
+ placeholder?: boolean | undefined;
13
+ } | {
14
+ value: string;
15
+ type: "expression";
16
+ } | EmbedTemplateInstance)[] | undefined;
17
+ states?: {
18
+ label: string;
19
+ selector: string;
20
+ category?: "states" | "component-states" | undefined;
21
+ }[] | undefined;
22
+ constraints?: {
23
+ relation: "ancestor" | "parent" | "self" | "child" | "descendant";
24
+ component?: {
25
+ $eq?: string | undefined;
26
+ $neq?: string | undefined;
27
+ $in?: string[] | undefined;
28
+ $nin?: string[] | undefined;
29
+ } | undefined;
30
+ tag?: {
31
+ $eq?: string | undefined;
32
+ $neq?: string | undefined;
33
+ $in?: string[] | undefined;
34
+ $nin?: string[] | undefined;
35
+ } | undefined;
36
+ } | {
37
+ relation: "ancestor" | "parent" | "self" | "child" | "descendant";
38
+ component?: {
39
+ $eq?: string | undefined;
40
+ $neq?: string | undefined;
41
+ $in?: string[] | undefined;
42
+ $nin?: string[] | undefined;
43
+ } | undefined;
44
+ tag?: {
45
+ $eq?: string | undefined;
46
+ $neq?: string | undefined;
47
+ $in?: string[] | undefined;
48
+ $nin?: string[] | undefined;
49
+ } | undefined;
50
+ }[] | undefined;
51
+ indexWithinAncestor?: string | undefined;
52
+ icon: string;
53
+ presetStyle?: import("@webstudio-is/sdk").PresetStyle;
54
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,34 @@
1
+ import type { Instance, Prop } from "@webstudio-is/sdk";
2
+ import type { IndexesWithinAncestors } from "./instance-utils";
3
+ export type InstanceData = {
4
+ id: Instance["id"];
5
+ instanceKey: string;
6
+ component: Instance["component"];
7
+ };
8
+ /**
9
+ * Hooks are subscriptions to builder events
10
+ * with limited way to interact with it.
11
+ * Called independently from components.
12
+ */
13
+ export type HookContext = {
14
+ indexesWithinAncestors: IndexesWithinAncestors;
15
+ getPropValue: (instanceData: InstanceData, propName: Prop["name"]) => unknown;
16
+ setMemoryProp: (instanceData: InstanceData, propName: Prop["name"], value: unknown) => void;
17
+ };
18
+ export type InstancePath = InstanceData[];
19
+ type NavigatorEvent = {
20
+ /**
21
+ * List of instances from selected to the root
22
+ */
23
+ instancePath: InstancePath;
24
+ };
25
+ export type Hook = {
26
+ onNavigatorSelect?: (context: HookContext, event: NavigatorEvent) => void;
27
+ onNavigatorUnselect?: (context: HookContext, event: NavigatorEvent) => void;
28
+ };
29
+ /**
30
+ * Find closest matching instance by component name
31
+ * by lookup in instance path
32
+ */
33
+ export declare const getClosestInstance: (instancePath: InstancePath, currentInstance: InstanceData, closestComponent: InstanceData["component"]) => InstanceData | undefined;
34
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ export * from "./remix";
2
+ export * from "./css/index";
3
+ export * from "./components/components-utils";
4
+ export * from "./embed-template";
5
+ export * from "./props";
6
+ export type * from "./context";
7
+ export { getIndexesWithinAncestors } from "./instance-utils";
8
+ export type * from "./hook";
9
+ export { generateWebstudioComponent, generateJsxElement, generateJsxChildren, } from "./component-generator";
@@ -0,0 +1,3 @@
1
+ import type { Instance, Instances, WsComponentMeta } from "@webstudio-is/sdk";
2
+ export type IndexesWithinAncestors = Map<Instance["id"], number>;
3
+ export declare const getIndexesWithinAncestors: (metas: Map<Instance["component"], WsComponentMeta>, instances: Instances, rootIds: Instance["id"][]) => IndexesWithinAncestors;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ type PageSettingsCanonicalLinkProps = {
2
+ href: string;
3
+ };
4
+ /**
5
+ * Link canonical tag are deduplicated on the server using the HTMLRewriter interface.
6
+ * This is not full deduplication. We simply skip rendering Page Setting link
7
+ * if it has already been rendered using HeadSlot/HeadLink.
8
+ * To prevent React on the client from re-adding the removed link tag, we skip rendering them client-side.
9
+ * This approach works because React retains server-rendered link tag as long as they are not re-rendered by the client.
10
+ *
11
+ * The following component behavior ensures this:
12
+ * 1. On the server: Render link tag as usual.
13
+ * 2. On the client: Before rendering, remove any link tag with the same `name` or `property` that were not rendered by Client React,
14
+ * and then proceed with rendering as usual.
15
+ */
16
+ export declare const PageSettingsCanonicalLink: (props: PageSettingsCanonicalLinkProps) => import("react/jsx-runtime").JSX.Element | undefined;
17
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { ImageLoader } from "@webstudio-is/image";
2
+ import type { PageMeta } from "@webstudio-is/sdk";
3
+ export declare const isElementRenderedWithReact: (element: Element) => boolean;
4
+ export declare const PageSettingsMeta: ({ url, host, siteName, pageMeta, imageLoader, }: {
5
+ url?: string;
6
+ host: string;
7
+ siteName: string;
8
+ pageMeta: PageMeta;
9
+ imageLoader: ImageLoader;
10
+ }) => import("react/jsx-runtime").JSX.Element[];
@@ -0,0 +1,17 @@
1
+ type PageSettingsTitleProps = {
2
+ children: string;
3
+ };
4
+ /**
5
+ * Title tags are deduplicated on the server using the HTMLRewriter interface.
6
+ * This is not full deduplication. We simply skip rendering Page Setting title
7
+ * if it has already been rendered using HeadSlot/HeadTitle.
8
+ * To prevent React on the client from re-adding the removed title tag, we skip rendering them client-side.
9
+ * This approach works because React retains server-rendered title tag as long as they are not re-rendered by the client.
10
+ *
11
+ * The following component behavior ensures this:
12
+ * 1. On the server: Render title tag as usual.
13
+ * 2. On the client: Before rendering, remove any title tag with the same `name` or `property` that were not rendered by Client React,
14
+ * and then proceed with rendering as usual.
15
+ */
16
+ export declare const PageSettingsTitle: (props: PageSettingsTitleProps) => import("react/jsx-runtime").JSX.Element | undefined;
17
+ export {};
@@ -0,0 +1,106 @@
1
+ import { type Prop, type Assets, type Pages, type ImageAsset } from "@webstudio-is/sdk";
2
+ export declare const normalizeProps: ({ props, assetBaseUrl, assets, uploadingImageAssets, pages, source, }: {
3
+ props: Prop[];
4
+ assetBaseUrl: string;
5
+ assets: Assets;
6
+ uploadingImageAssets: ImageAsset[];
7
+ pages: Pages;
8
+ source: "canvas" | "prebuild";
9
+ }) => ({
10
+ value: number;
11
+ type: "number";
12
+ name: string;
13
+ id: string;
14
+ instanceId: string;
15
+ required?: boolean | undefined;
16
+ } | {
17
+ value: string;
18
+ type: "string";
19
+ name: string;
20
+ id: string;
21
+ instanceId: string;
22
+ required?: boolean | undefined;
23
+ } | {
24
+ value: boolean;
25
+ type: "boolean";
26
+ name: string;
27
+ id: string;
28
+ instanceId: string;
29
+ required?: boolean | undefined;
30
+ } | {
31
+ type: "json";
32
+ name: string;
33
+ id: string;
34
+ instanceId: string;
35
+ value?: unknown;
36
+ required?: boolean | undefined;
37
+ } | {
38
+ value: string;
39
+ type: "asset";
40
+ name: string;
41
+ id: string;
42
+ instanceId: string;
43
+ required?: boolean | undefined;
44
+ } | {
45
+ value: (string | {
46
+ instanceId: string;
47
+ pageId: string;
48
+ }) & (string | {
49
+ instanceId: string;
50
+ pageId: string;
51
+ } | undefined);
52
+ type: "page";
53
+ name: string;
54
+ id: string;
55
+ instanceId: string;
56
+ required?: boolean | undefined;
57
+ } | {
58
+ value: string[];
59
+ type: "string[]";
60
+ name: string;
61
+ id: string;
62
+ instanceId: string;
63
+ required?: boolean | undefined;
64
+ } | {
65
+ value: string;
66
+ type: "parameter";
67
+ name: string;
68
+ id: string;
69
+ instanceId: string;
70
+ required?: boolean | undefined;
71
+ } | {
72
+ value: string;
73
+ type: "resource";
74
+ name: string;
75
+ id: string;
76
+ instanceId: string;
77
+ required?: boolean | undefined;
78
+ } | {
79
+ value: string;
80
+ type: "expression";
81
+ name: string;
82
+ id: string;
83
+ instanceId: string;
84
+ required?: boolean | undefined;
85
+ } | {
86
+ value: {
87
+ code: string;
88
+ type: "execute";
89
+ args: string[];
90
+ }[];
91
+ type: "action";
92
+ name: string;
93
+ id: string;
94
+ instanceId: string;
95
+ required?: boolean | undefined;
96
+ })[];
97
+ export declare const idAttribute: "data-ws-id";
98
+ export declare const selectorIdAttribute: "data-ws-selector";
99
+ export declare const componentAttribute: "data-ws-component";
100
+ export declare const showAttribute: "data-ws-show";
101
+ export declare const indexAttribute: "data-ws-index";
102
+ export declare const collapsedAttribute: "data-ws-collapsed";
103
+ export declare const textContentAttribute: "data-ws-text-content";
104
+ export declare const editablePlaceholderVariable: "--data-ws-editable-placeholder";
105
+ export declare const editingPlaceholderVariable: "--data-ws-editing-placeholder";
106
+ export declare const isAttributeNameSafe: (attributeName: string) => boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * transforms url pattern subset to remix route format
3
+ *
4
+ * /:name/ -> .$name. - named dynamic segment
5
+ * /:name?/ -> .($name). - optional dynamic segment
6
+ * /* -> .$ - splat in the end of pattern
7
+ * /:name* -> .$ - named splat which gets specified name at runtime
8
+ *
9
+ */
10
+ export declare const generateRemixRoute: (pathname: string) => string;
11
+ /**
12
+ * generates a function to convert remix params to compatible with url pattern groups
13
+ *
14
+ * for /:name* pattern
15
+ * params["*"] is replaced with params["name"]
16
+ *
17
+ * for /* pattern
18
+ * params["*"] is replaced with params[0]
19
+ */
20
+ export declare const generateRemixParams: (pathname: string) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ export * from "./context";
2
+ export * from "./hook";
3
+ export * from "./variable-state";
4
+ export { PageSettingsMeta } from "./page-settings-meta";
5
+ export { PageSettingsTitle } from "./page-settings-title";
6
+ export { PageSettingsCanonicalLink } from "./page-settings-canonical-link";
7
+ /**
8
+ * React has issues rendering certain elements, such as errors when a <link> element has children.
9
+ * To render XML, we wrap it with an <svg> tag and add a suffix to avoid React's default behavior on these elements.
10
+ */
11
+ export declare const xmlNodeTagSuffix = "-ws-xml-node-fb77f896-8e96-40b9-b8f8-90a4e70d724a";
12
+ export declare const getIndexWithinAncestorFromComponentProps: (props: Record<string, unknown>) => string | undefined;
@@ -0,0 +1,2 @@
1
+ import { type Dispatch, type SetStateAction } from "react";
2
+ export declare const useVariableState: <S>(initialState: S | (() => S)) => [S, Dispatch<SetStateAction<S>>];