@makeswift/runtime 0.28.8-canary.0 → 0.28.8-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/graphql-api-client.js +1 -1
- package/dist/cjs/api/makeswift-api-resources-client.js +25 -11
- package/dist/cjs/api/makeswift-api-resources-client.js.map +1 -1
- package/dist/cjs/api/rest-api-client.js +1 -1
- package/dist/cjs/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/client/index.js +1 -1
- package/dist/cjs/next/components/framework-provider/app-router/index.js +0 -2
- package/dist/cjs/next/components/framework-provider/app-router/index.js.map +1 -1
- package/dist/cjs/next/components/framework-provider/index.js +1 -1
- package/dist/cjs/next/components/framework-provider/index.js.map +1 -1
- package/dist/cjs/runtimes/react/components/ElementData.js +2 -2
- package/dist/cjs/runtimes/react/components/ElementData.js.map +1 -1
- package/dist/cjs/runtimes/react/components/framework-context.js +18 -12
- package/dist/cjs/runtimes/react/components/framework-context.js.map +1 -1
- package/dist/cjs/runtimes/react/components/hooks/use-framework-context.js +1 -5
- package/dist/cjs/runtimes/react/components/hooks/use-framework-context.js.map +1 -1
- package/dist/cjs/runtimes/react/components/resolve-props.js +43 -0
- package/dist/cjs/runtimes/react/components/resolve-props.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-control-defs.js +40 -0
- package/dist/cjs/runtimes/react/hooks/use-control-defs.js.map +1 -0
- package/dist/cjs/runtimes/react/runtime-core.js +13 -0
- package/dist/cjs/runtimes/react/runtime-core.js.map +1 -1
- package/dist/cjs/testing/fixtures/index.js +4 -2
- package/dist/cjs/testing/fixtures/index.js.map +1 -1
- package/dist/cjs/testing/fixtures/snippet.js +36 -0
- package/dist/cjs/testing/fixtures/snippet.js.map +1 -0
- package/dist/cjs/unstable-framework-support/index.js +2 -8
- package/dist/cjs/unstable-framework-support/index.js.map +1 -1
- package/dist/esm/api/graphql-api-client.js +1 -1
- package/dist/esm/api/makeswift-api-resources-client.js +15 -11
- package/dist/esm/api/makeswift-api-resources-client.js.map +1 -1
- package/dist/esm/api/rest-api-client.js +1 -1
- package/dist/esm/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/next/components/framework-provider/app-router/index.js +0 -4
- package/dist/esm/next/components/framework-provider/app-router/index.js.map +1 -1
- package/dist/esm/next/components/framework-provider/index.js +4 -2
- package/dist/esm/next/components/framework-provider/index.js.map +1 -1
- package/dist/esm/runtimes/react/components/ElementData.js +1 -1
- package/dist/esm/runtimes/react/components/ElementData.js.map +1 -1
- package/dist/esm/runtimes/react/components/framework-context.js +19 -8
- package/dist/esm/runtimes/react/components/framework-context.js.map +1 -1
- package/dist/esm/runtimes/react/components/hooks/use-framework-context.js +1 -5
- package/dist/esm/runtimes/react/components/hooks/use-framework-context.js.map +1 -1
- package/dist/esm/runtimes/react/components/resolve-props.js +19 -0
- package/dist/esm/runtimes/react/components/resolve-props.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-control-defs.js +16 -0
- package/dist/esm/runtimes/react/hooks/use-control-defs.js.map +1 -0
- package/dist/esm/runtimes/react/runtime-core.js +13 -0
- package/dist/esm/runtimes/react/runtime-core.js.map +1 -1
- package/dist/esm/testing/fixtures/index.js +2 -1
- package/dist/esm/testing/fixtures/index.js.map +1 -1
- package/dist/esm/testing/fixtures/snippet.js +12 -0
- package/dist/esm/testing/fixtures/snippet.js.map +1 -0
- package/dist/esm/unstable-framework-support/index.js +2 -8
- package/dist/esm/unstable-framework-support/index.js.map +1 -1
- package/dist/types/api/makeswift-api-resources-client.d.ts.map +1 -1
- package/dist/types/next/components/framework-provider/app-router/index.d.ts +1 -1
- package/dist/types/next/components/framework-provider/app-router/index.d.ts.map +1 -1
- package/dist/types/next/components/framework-provider/index.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/__tests__/framework-context.test.d.ts +3 -0
- package/dist/types/runtimes/react/components/__tests__/framework-context.test.d.ts.map +1 -0
- package/dist/types/runtimes/react/components/framework-context.d.ts +4 -6
- package/dist/types/runtimes/react/components/framework-context.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/hooks/use-framework-context.d.ts +1 -2
- package/dist/types/runtimes/react/components/hooks/use-framework-context.d.ts.map +1 -1
- package/dist/types/runtimes/react/components/resolve-props.d.ts +7 -0
- package/dist/types/runtimes/react/components/resolve-props.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-control-defs.d.ts +6 -0
- package/dist/types/runtimes/react/hooks/use-control-defs.d.ts.map +1 -0
- package/dist/types/runtimes/react/runtime-core.d.ts +4 -2
- package/dist/types/runtimes/react/runtime-core.d.ts.map +1 -1
- package/dist/types/testing/fixtures/index.d.ts +2 -1
- package/dist/types/testing/fixtures/index.d.ts.map +1 -1
- package/dist/types/testing/fixtures/snippet.d.ts +6 -0
- package/dist/types/testing/fixtures/snippet.d.ts.map +1 -0
- package/dist/types/unstable-framework-support/index.d.ts +1 -1
- package/dist/types/unstable-framework-support/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/cjs/runtimes/react/controls.js +0 -59
- package/dist/cjs/runtimes/react/controls.js.map +0 -1
- package/dist/esm/runtimes/react/controls.js +0 -25
- package/dist/esm/runtimes/react/controls.js.map +0 -1
- package/dist/types/runtimes/react/controls.d.ts +0 -9
- package/dist/types/runtimes/react/controls.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/unstable-framework-support/index.ts"],"sourcesContent":["export {\n type SiteVersion,\n serializeSiteVersion,\n deserializeSiteVersion,\n secondsUntilSiteVersionExpiration,\n} from '../api/site-version'\n\nexport {\n type ApiHandlerUserConfig,\n createApiHandler,\n type SitePublishedWebhookPayloadData,\n} from '../api-handler'\nexport { SET_COOKIE_HEADER, cookieSettingOptions } from '../api-handler/cookies'\nexport { REDIRECT_SEARCH_PARAM, redirectLiveHandler } from '../api-handler/handlers/redirect-live'\nexport { toApiRequest, pipeResponseTo } from '../api-handler/node-request-response'\nexport { MAKESWIFT_SITE_VERSION_COOKIE, SearchParams } from '../api-handler/preview'\n\nexport { MakeswiftClient } from '../client'\n\nexport { type BreakpointsInput as Breakpoints } from '../state/modules/breakpoints'\n\nexport {\n FrameworkContext,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/unstable-framework-support/index.ts"],"sourcesContent":["export {\n type SiteVersion,\n serializeSiteVersion,\n deserializeSiteVersion,\n secondsUntilSiteVersionExpiration,\n} from '../api/site-version'\n\nexport {\n type ApiHandlerUserConfig,\n createApiHandler,\n type SitePublishedWebhookPayloadData,\n} from '../api-handler'\nexport { SET_COOKIE_HEADER, cookieSettingOptions } from '../api-handler/cookies'\nexport { REDIRECT_SEARCH_PARAM, redirectLiveHandler } from '../api-handler/handlers/redirect-live'\nexport { toApiRequest, pipeResponseTo } from '../api-handler/node-request-response'\nexport { MAKESWIFT_SITE_VERSION_COOKIE, SearchParams } from '../api-handler/preview'\n\nexport { MakeswiftClient } from '../client'\n\nexport { type BreakpointsInput as Breakpoints } from '../state/modules/breakpoints'\n\nexport {\n type FrameworkContext,\n FrameworkContextProvider,\n} from '../runtimes/react/components/framework-context'\n\nexport { MakeswiftComponent } from '../runtimes/react/components/MakeswiftComponent'\nexport { Page } from '../runtimes/react/components/page'\nexport { RuntimeProvider } from '../runtimes/react/components/RuntimeProvider'\nexport { Slot } from '../runtimes/react/components/Slot'\n\nexport { GoogleFontLink } from '../runtimes/react/components/GoogleFontLink'\nexport { MakeswiftFonts } from '../runtimes/react/components/MakeswiftFonts'\n\nexport {\n createRootStyleCache,\n RootStyleRegistry,\n DefaultRootStyleRegistry,\n styleTagHtml,\n StyleTagSSR,\n type RootStyleProps,\n} from '../runtimes/react/root-style-registry'\n\nexport { ReactRuntime, type StoreKey } from '../runtimes/react/react-runtime'\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAKO;AAEP,yBAIO;AACP,qBAAwD;AACxD,2BAA2D;AAC3D,mCAA6C;AAC7C,qBAA4D;AAE5D,oBAAgC;AAIhC,+BAGO;AAEP,gCAAmC;AACnC,kBAAqB;AACrB,6BAAgC;AAChC,kBAAqB;AAErB,4BAA+B;AAC/B,4BAA+B;AAE/B,iCAOO;AAEP,2BAA4C;","names":[]}
|
|
@@ -9,7 +9,7 @@ class MakeswiftGraphQLApiClient {
|
|
|
9
9
|
graphqlClient;
|
|
10
10
|
constructor({ endpoint }) {
|
|
11
11
|
this.graphqlClient = new GraphQLClient(endpoint, {
|
|
12
|
-
"makeswift-runtime-version": "0.28.8-canary.
|
|
12
|
+
"makeswift-runtime-version": "0.28.8-canary.2"
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
async createTableRecord(tableId, columns) {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { configureClientStore } from "../state/api-client/client-store";
|
|
2
2
|
import { ApiResourcesClient } from "./api-resources-client";
|
|
3
|
-
import { MakeswiftGraphQLApiClient } from "./graphql-api-client";
|
|
4
|
-
import { MakeswiftRestAPIClient } from "./rest-api-client";
|
|
5
3
|
class MakeswiftApiResourcesClient extends ApiResourcesClient {
|
|
6
4
|
restApiClient;
|
|
7
5
|
graphQlClient;
|
|
@@ -15,29 +13,35 @@ class MakeswiftApiResourcesClient extends ApiResourcesClient {
|
|
|
15
13
|
super({
|
|
16
14
|
store: configureClientStore({ preloadedState })
|
|
17
15
|
});
|
|
18
|
-
this.restApiClient =
|
|
19
|
-
|
|
16
|
+
this.restApiClient = (async () => {
|
|
17
|
+
const { MakeswiftRestAPIClient } = await import("./rest-api-client");
|
|
18
|
+
return new MakeswiftRestAPIClient({ fetch, apiKey, apiOrigin });
|
|
19
|
+
})();
|
|
20
|
+
this.graphQlClient = (async () => {
|
|
21
|
+
const { MakeswiftGraphQLApiClient } = await import("./graphql-api-client");
|
|
22
|
+
return new MakeswiftGraphQLApiClient({ endpoint: graphqlApiEndpoint });
|
|
23
|
+
})();
|
|
20
24
|
}
|
|
21
25
|
async fetchSwatchImpl(id, version) {
|
|
22
|
-
return this.restApiClient.getSwatch(id, version);
|
|
26
|
+
return (await this.restApiClient).getSwatch(id, version);
|
|
23
27
|
}
|
|
24
28
|
async fetchFileImpl(id, _version) {
|
|
25
|
-
return this.graphQlClient.getFile(id);
|
|
29
|
+
return (await this.graphQlClient).getFile(id);
|
|
26
30
|
}
|
|
27
31
|
async fetchTypographyImpl(id, version) {
|
|
28
|
-
return this.restApiClient.getTypography(id, version);
|
|
32
|
+
return (await this.restApiClient).getTypography(id, version);
|
|
29
33
|
}
|
|
30
34
|
async fetchGlobalElementImpl(id, version) {
|
|
31
|
-
return this.restApiClient.getGlobalElement(id, version);
|
|
35
|
+
return (await this.restApiClient).getGlobalElement(id, version);
|
|
32
36
|
}
|
|
33
37
|
async fetchLocalizedGlobalElementImpl(id, version, locale) {
|
|
34
|
-
return this.restApiClient.getLocalizedGlobalElement(id, locale, version);
|
|
38
|
+
return (await this.restApiClient).getLocalizedGlobalElement(id, locale, version);
|
|
35
39
|
}
|
|
36
40
|
async fetchPagePathnameSliceImpl(id, version, locale) {
|
|
37
|
-
return this.restApiClient.getPagePathnameSlice(id, version, { locale });
|
|
41
|
+
return (await this.restApiClient).getPagePathnameSlice(id, version, { locale });
|
|
38
42
|
}
|
|
39
43
|
async fetchTableImpl(id, _version) {
|
|
40
|
-
return this.graphQlClient.getTable(id);
|
|
44
|
+
return (await this.graphQlClient).getTable(id);
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
47
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/api/makeswift-api-resources-client.ts"],"sourcesContent":["import { type State as ApiClientState } from '../state/api-client/state'\nimport { configureClientStore } from '../state/api-client/client-store'\n\nimport {\n type File,\n type GlobalElement,\n type LocalizedGlobalElement,\n type PagePathnameSlice,\n type Swatch,\n type Table,\n type Typography,\n type HttpFetch,\n} from './types'\n\nimport { ApiResourcesClient } from './api-resources-client'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/api/makeswift-api-resources-client.ts"],"sourcesContent":["import { type State as ApiClientState } from '../state/api-client/state'\nimport { configureClientStore } from '../state/api-client/client-store'\n\nimport {\n type File,\n type GlobalElement,\n type LocalizedGlobalElement,\n type PagePathnameSlice,\n type Swatch,\n type Table,\n type Typography,\n type HttpFetch,\n} from './types'\n\nimport { ApiResourcesClient } from './api-resources-client'\nimport { type SiteVersion } from './site-version'\n\n// see the comment in `MakeswiftApiResourcesClient` constructor below\nimport { type MakeswiftGraphQLApiClient } from './graphql-api-client'\nimport { type MakeswiftRestAPIClient } from './rest-api-client'\n\n/**\n * Server-side implementation that makes direct authenticated requests to the Makeswift API.\n * Requires an API key.\n *\n * For client-side usage, see `HostApiResourcesClient`, which goes through the host via\n * `/api/makeswift/...` endpoints.\n */\nexport class MakeswiftApiResourcesClient extends ApiResourcesClient {\n private restApiClient: Promise<MakeswiftRestAPIClient>\n private graphQlClient: Promise<MakeswiftGraphQLApiClient>\n\n constructor({\n fetch,\n apiKey,\n apiOrigin,\n graphqlApiEndpoint,\n preloadedState,\n }: {\n fetch: HttpFetch\n apiKey: string\n apiOrigin: string\n graphqlApiEndpoint: string\n preloadedState: Partial<ApiClientState>\n }) {\n super({\n store: configureClientStore({ preloadedState }),\n })\n\n // `MakeswiftApiResourcesClient` is used by the runtime and therefore will be imported\n // on the client; lazy import server-side REST/GraphQL clients to avoid unnecessarily\n // pulling their code into a client bundle.\n //\n // (we can't easily lazy-load `MakeswiftApiResourcesClient` itself, at it will make its\n // construction async, but because it shares most of its implementation with\n // `HostApiResourcesClient`, the overhead of this module on its own is negligible)\n this.restApiClient = (async () => {\n const { MakeswiftRestAPIClient } = await import('./rest-api-client')\n return new MakeswiftRestAPIClient({ fetch, apiKey, apiOrigin })\n })()\n\n this.graphQlClient = (async () => {\n const { MakeswiftGraphQLApiClient } = await import('./graphql-api-client')\n return new MakeswiftGraphQLApiClient({ endpoint: graphqlApiEndpoint })\n })()\n }\n\n protected async fetchSwatchImpl(id: string, version: SiteVersion | null): Promise<Swatch | null> {\n return (await this.restApiClient).getSwatch(id, version)\n }\n\n protected async fetchFileImpl(id: string, _version: SiteVersion | null): Promise<File | null> {\n // files are unversioned\n return (await this.graphQlClient).getFile(id)\n }\n\n protected async fetchTypographyImpl(\n id: string,\n version: SiteVersion | null,\n ): Promise<Typography | null> {\n return (await this.restApiClient).getTypography(id, version)\n }\n\n protected async fetchGlobalElementImpl(\n id: string,\n version: SiteVersion | null,\n ): Promise<GlobalElement | null> {\n return (await this.restApiClient).getGlobalElement(id, version)\n }\n\n protected async fetchLocalizedGlobalElementImpl(\n id: string,\n version: SiteVersion | null,\n locale: string,\n ): Promise<LocalizedGlobalElement | null> {\n return (await this.restApiClient).getLocalizedGlobalElement(id, locale, version)\n }\n\n protected async fetchPagePathnameSliceImpl(\n id: string,\n version: SiteVersion | null,\n locale: string | null | undefined,\n ): Promise<PagePathnameSlice | null> {\n return (await this.restApiClient).getPagePathnameSlice(id, version, { locale })\n }\n\n protected async fetchTableImpl(id: string, _version: SiteVersion | null): Promise<Table | null> {\n // tables are unversioned\n return (await this.graphQlClient).getTable(id)\n }\n}\n"],"mappings":"AACA,SAAS,4BAA4B;AAarC,SAAS,0BAA0B;AAc5B,MAAM,oCAAoC,mBAAmB;AAAA,EAC1D;AAAA,EACA;AAAA,EAER,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAMG;AACD,UAAM;AAAA,MACJ,OAAO,qBAAqB,EAAE,eAAe,CAAC;AAAA,IAChD,CAAC;AASD,SAAK,iBAAiB,YAAY;AAChC,YAAM,EAAE,uBAAuB,IAAI,MAAM,OAAO,mBAAmB;AACnE,aAAO,IAAI,uBAAuB,EAAE,OAAO,QAAQ,UAAU,CAAC;AAAA,IAChE,GAAG;AAEH,SAAK,iBAAiB,YAAY;AAChC,YAAM,EAAE,0BAA0B,IAAI,MAAM,OAAO,sBAAsB;AACzE,aAAO,IAAI,0BAA0B,EAAE,UAAU,mBAAmB,CAAC;AAAA,IACvE,GAAG;AAAA,EACL;AAAA,EAEA,MAAgB,gBAAgB,IAAY,SAAqD;AAC/F,YAAQ,MAAM,KAAK,eAAe,UAAU,IAAI,OAAO;AAAA,EACzD;AAAA,EAEA,MAAgB,cAAc,IAAY,UAAoD;AAE5F,YAAQ,MAAM,KAAK,eAAe,QAAQ,EAAE;AAAA,EAC9C;AAAA,EAEA,MAAgB,oBACd,IACA,SAC4B;AAC5B,YAAQ,MAAM,KAAK,eAAe,cAAc,IAAI,OAAO;AAAA,EAC7D;AAAA,EAEA,MAAgB,uBACd,IACA,SAC+B;AAC/B,YAAQ,MAAM,KAAK,eAAe,iBAAiB,IAAI,OAAO;AAAA,EAChE;AAAA,EAEA,MAAgB,gCACd,IACA,SACA,QACwC;AACxC,YAAQ,MAAM,KAAK,eAAe,0BAA0B,IAAI,QAAQ,OAAO;AAAA,EACjF;AAAA,EAEA,MAAgB,2BACd,IACA,SACA,QACmC;AACnC,YAAQ,MAAM,KAAK,eAAe,qBAAqB,IAAI,SAAS,EAAE,OAAO,CAAC;AAAA,EAChF;AAAA,EAEA,MAAgB,eAAe,IAAY,UAAqD;AAE9F,YAAQ,MAAM,KAAK,eAAe,SAAS,EAAE;AAAA,EAC/C;AACF;","names":[]}
|
|
@@ -113,7 +113,7 @@ class MakeswiftRestAPIClient {
|
|
|
113
113
|
const requestHeaders = new Headers({
|
|
114
114
|
"x-api-key": this.apiKey,
|
|
115
115
|
"makeswift-site-api-key": this.apiKey,
|
|
116
|
-
"makeswift-runtime-version": "0.28.8-canary.
|
|
116
|
+
"makeswift-runtime-version": "0.28.8-canary.2"
|
|
117
117
|
});
|
|
118
118
|
if (siteVersion?.token) {
|
|
119
119
|
requestUrl.searchParams.set("version", siteVersion.version);
|
|
@@ -8,7 +8,7 @@ async function manifestHandler(req, { apiKey, manifest }) {
|
|
|
8
8
|
return ApiResponse.json({ message: "Unauthorized" }, { status: 401 });
|
|
9
9
|
}
|
|
10
10
|
return ApiResponse.json({
|
|
11
|
-
version: "0.28.8-canary.
|
|
11
|
+
version: "0.28.8-canary.2",
|
|
12
12
|
interactionMode: true,
|
|
13
13
|
clientSideNavigation: false,
|
|
14
14
|
elementFromPoint: false,
|
package/dist/esm/client/index.js
CHANGED
|
@@ -669,7 +669,7 @@ Received "${apiKey}" instead.`
|
|
|
669
669
|
headers: {
|
|
670
670
|
"x-api-key": this.apiKey,
|
|
671
671
|
"makeswift-site-api-key": this.apiKey,
|
|
672
|
-
"makeswift-runtime-version": "0.28.8-canary.
|
|
672
|
+
"makeswift-runtime-version": "0.28.8-canary.2",
|
|
673
673
|
"content-type": "application/json"
|
|
674
674
|
},
|
|
675
675
|
body: JSON.stringify({ token }),
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DefaultHead
|
|
3
|
-
} from "../../../../runtimes/react/components/framework-context";
|
|
4
1
|
import { HeadSnippet } from "./HeadSnippet";
|
|
5
2
|
const context = {
|
|
6
3
|
// The App Router uses built-in React Canary releases, which include all stable
|
|
7
4
|
// React 19 features, so we can simply use our default head implementation
|
|
8
|
-
Head: DefaultHead,
|
|
9
5
|
HeadSnippet
|
|
10
6
|
};
|
|
11
7
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/next/components/framework-provider/app-router/index.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/next/components/framework-provider/app-router/index.ts"],"sourcesContent":["import { type FrameworkContext } from '../../../../runtimes/react/components/framework-context'\n\nimport { HeadSnippet } from './HeadSnippet'\n\nexport const context: Pick<FrameworkContext, 'HeadSnippet'> = {\n // The App Router uses built-in React Canary releases, which include all stable\n // React 19 features, so we can simply use our default head implementation\n HeadSnippet,\n}\n"],"mappings":"AAEA,SAAS,mBAAmB;AAErB,MAAM,UAAiD;AAAA;AAAA;AAAA,EAG5D;AACF;","names":[]}
|
|
@@ -3,7 +3,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import NextImage from "next/image";
|
|
5
5
|
import { useIsPagesRouter } from "../../hooks/use-is-pages-router";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
FrameworkContextProvider
|
|
8
|
+
} from "../../../runtimes/react/components/framework-context";
|
|
7
9
|
import { context as appRouterContext } from "./app-router";
|
|
8
10
|
import { context as pagesRouterContext } from "./pages-router";
|
|
9
11
|
import { Link } from "./link";
|
|
@@ -20,7 +22,7 @@ function FrameworkProvider({
|
|
|
20
22
|
}),
|
|
21
23
|
[isPagesRouter]
|
|
22
24
|
);
|
|
23
|
-
return /* @__PURE__ */ jsx(
|
|
25
|
+
return /* @__PURE__ */ jsx(FrameworkContextProvider, { value: context, children });
|
|
24
26
|
}
|
|
25
27
|
export {
|
|
26
28
|
FrameworkProvider
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/next/components/framework-provider/index.tsx"],"sourcesContent":["'use client'\n\nimport { type PropsWithChildren, useMemo } from 'react'\nimport NextImage from 'next/image'\n\nimport { useIsPagesRouter } from '../../hooks/use-is-pages-router'\nimport { FrameworkContext
|
|
1
|
+
{"version":3,"sources":["../../../../../src/next/components/framework-provider/index.tsx"],"sourcesContent":["'use client'\n\nimport { type PropsWithChildren, useMemo } from 'react'\nimport NextImage from 'next/image'\n\nimport { useIsPagesRouter } from '../../hooks/use-is-pages-router'\nimport {\n type FrameworkContext,\n FrameworkContextProvider,\n} from '../../../runtimes/react/components/framework-context'\n\nimport { context as appRouterContext } from './app-router'\nimport { context as pagesRouterContext } from './pages-router'\nimport { Link } from './link'\n\nexport function FrameworkProvider({\n children,\n forcePagesRouter,\n}: PropsWithChildren<{ forcePagesRouter?: boolean }>) {\n const isPagesRouter = useIsPagesRouter() || forcePagesRouter\n const context = useMemo<Partial<FrameworkContext>>(\n () => ({\n ...(isPagesRouter ? pagesRouterContext : appRouterContext),\n Image: NextImage,\n Link,\n }),\n [isPagesRouter],\n )\n\n return <FrameworkContextProvider value={context}>{children}</FrameworkContextProvider>\n}\n"],"mappings":";AA6BS;AA3BT,SAAiC,eAAe;AAChD,OAAO,eAAe;AAEtB,SAAS,wBAAwB;AACjC;AAAA,EAEE;AAAA,OACK;AAEP,SAAS,WAAW,wBAAwB;AAC5C,SAAS,WAAW,0BAA0B;AAC9C,SAAS,YAAY;AAEd,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AACF,GAAsD;AACpD,QAAM,gBAAgB,iBAAiB,KAAK;AAC5C,QAAM,UAAU;AAAA,IACd,OAAO;AAAA,MACL,GAAI,gBAAgB,qBAAqB;AAAA,MACzC,OAAO;AAAA,MACP;AAAA,IACF;AAAA,IACA,CAAC,aAAa;AAAA,EAChB;AAEA,SAAO,oBAAC,4BAAyB,OAAO,SAAU,UAAS;AAC7D;","names":[]}
|
|
@@ -5,7 +5,7 @@ import { useBuiltinSuspense } from "../hooks/use-builtin-suspense";
|
|
|
5
5
|
import { useComponent } from "../hooks/use-component";
|
|
6
6
|
import { canAcceptRef } from "../utils/can-accept-ref";
|
|
7
7
|
import { FallbackComponent } from "../../../components/shared/FallbackComponent";
|
|
8
|
-
import { ResolveProps } from "
|
|
8
|
+
import { ResolveProps } from "./resolve-props";
|
|
9
9
|
import { ActivityOrFallback } from "./activity-with-fallback";
|
|
10
10
|
const ElementData = memo(
|
|
11
11
|
forwardRef(function ElementData2({ elementData }, ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/components/ElementData.tsx"],"sourcesContent":["import { Ref, forwardRef, memo, ReactNode } from 'react'\n\nimport { ElementData as ReactPageElementData } from '../../../state/read-only-state'\nimport { useBuiltinSuspense } from '../hooks/use-builtin-suspense'\nimport { useComponent } from '../hooks/use-component'\nimport { canAcceptRef } from '../utils/can-accept-ref'\nimport { FallbackComponent } from '../../../components/shared/FallbackComponent'\nimport { ResolveProps } from '
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/components/ElementData.tsx"],"sourcesContent":["import { Ref, forwardRef, memo, ReactNode } from 'react'\n\nimport { ElementData as ReactPageElementData } from '../../../state/read-only-state'\nimport { useBuiltinSuspense } from '../hooks/use-builtin-suspense'\nimport { useComponent } from '../hooks/use-component'\nimport { canAcceptRef } from '../utils/can-accept-ref'\nimport { FallbackComponent } from '../../../components/shared/FallbackComponent'\nimport { ResolveProps } from './resolve-props'\nimport { ActivityOrFallback } from './activity-with-fallback'\n\ntype ElementDataProps = {\n elementData: ReactPageElementData\n}\n\nexport const ElementData = memo(\n forwardRef(function ElementData({ elementData }: ElementDataProps, ref: Ref<unknown>): ReactNode {\n const Component = useComponent(elementData.type)\n const builtinSuspense = useBuiltinSuspense(elementData.type)\n\n if (Component == null) {\n console.warn(`Unknown component '${elementData.type}'`, { elementData })\n return <FallbackComponent ref={ref as Ref<HTMLDivElement>} text=\"Component not found\" />\n }\n\n const forwardRef = canAcceptRef(Component)\n\n return (\n <ActivityOrFallback suspenseFallback={builtinSuspense}>\n <ResolveProps element={elementData}>\n {props =>\n forwardRef ? (\n <Component {...props} key={elementData.key} ref={ref} />\n ) : (\n <Component {...props} key={elementData.key} />\n )\n }\n </ResolveProps>\n </ActivityOrFallback>\n )\n }),\n)\n"],"mappings":"AAqBa;AAUC;AA/Bd,SAAc,YAAY,YAAuB;AAGjD,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AAM5B,MAAM,cAAc;AAAA,EACzB,WAAW,SAASA,aAAY,EAAE,YAAY,GAAqB,KAA8B;AAC/F,UAAM,YAAY,aAAa,YAAY,IAAI;AAC/C,UAAM,kBAAkB,mBAAmB,YAAY,IAAI;AAE3D,QAAI,aAAa,MAAM;AACrB,cAAQ,KAAK,sBAAsB,YAAY,IAAI,KAAK,EAAE,YAAY,CAAC;AACvE,aAAO,oBAAC,qBAAkB,KAAiC,MAAK,uBAAsB;AAAA,IACxF;AAEA,UAAMC,cAAa,aAAa,SAAS;AAEzC,WACE,oBAAC,sBAAmB,kBAAkB,iBACpC,8BAAC,gBAAa,SAAS,aACpB,qBACCA,cACE,8BAAC,aAAW,GAAG,OAAO,KAAK,YAAY,KAAK,KAAU,IAEtD,8BAAC,aAAW,GAAG,OAAO,KAAK,YAAY,KAAK,GAGlD,GACF;AAAA,EAEJ,CAAC;AACH;","names":["ElementData","forwardRef"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import {
|
|
3
|
+
forwardRef,
|
|
3
4
|
createContext,
|
|
4
|
-
|
|
5
|
+
useContext,
|
|
6
|
+
useMemo
|
|
5
7
|
} from "react";
|
|
6
8
|
import { BaseHeadSnippet } from "./page/HeadSnippet";
|
|
7
9
|
const DefaultHead = ({ children }) => /* @__PURE__ */ jsx(Fragment, { children });
|
|
@@ -24,17 +26,26 @@ const DefaultImage = ({ priority, fill, style, ...props }) => /* @__PURE__ */ js
|
|
|
24
26
|
const DefaultLink = forwardRef(
|
|
25
27
|
({ linkType, ...props }, ref) => /* @__PURE__ */ jsx("a", { ...props, ref })
|
|
26
28
|
);
|
|
27
|
-
const FrameworkContext = createContext({
|
|
29
|
+
const FrameworkContext = createContext({});
|
|
30
|
+
const FrameworkContextProvider = ({
|
|
31
|
+
value,
|
|
32
|
+
children
|
|
33
|
+
}) => {
|
|
34
|
+
const parentContext = useContext(FrameworkContext);
|
|
35
|
+
const mergedContext = useMemo(() => ({ ...parentContext, ...value }), [parentContext, value]);
|
|
36
|
+
return /* @__PURE__ */ jsx(FrameworkContext.Provider, { value: mergedContext, children });
|
|
37
|
+
};
|
|
38
|
+
const defaultContext = {
|
|
28
39
|
Head: DefaultHead,
|
|
29
40
|
HeadSnippet: DefaultHeadSnippet,
|
|
30
41
|
Image: DefaultImage,
|
|
31
42
|
Link: DefaultLink
|
|
32
|
-
}
|
|
43
|
+
};
|
|
44
|
+
function useFrameworkContext() {
|
|
45
|
+
return { ...defaultContext, ...useContext(FrameworkContext) };
|
|
46
|
+
}
|
|
33
47
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
DefaultImage,
|
|
37
|
-
DefaultLink,
|
|
38
|
-
FrameworkContext
|
|
48
|
+
FrameworkContextProvider,
|
|
49
|
+
useFrameworkContext
|
|
39
50
|
};
|
|
40
51
|
//# sourceMappingURL=framework-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/components/framework-context.tsx"],"sourcesContent":["import {\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/components/framework-context.tsx"],"sourcesContent":["import {\n type ReactNode,\n type PropsWithChildren,\n type CSSProperties,\n type ComponentPropsWithoutRef,\n type MouseEvent,\n type ForwardRefExoticComponent,\n type RefAttributes,\n forwardRef,\n createContext,\n useContext,\n useMemo,\n} from 'react'\n\nimport { type LinkData } from '@makeswift/prop-controllers'\n\nimport { type Snippet } from '../../../client'\n\nimport { BaseHeadSnippet } from './page/HeadSnippet'\n\ntype HeadComponent = (props: { children: ReactNode }) => ReactNode\ntype HeadSnippet = (props: { snippet: Snippet }) => ReactNode\ntype ImageComponent = (props: {\n src: string\n alt: string\n sizes?: string\n width?: number\n height?: number\n priority?: boolean\n fill?: boolean\n style?: CSSProperties\n}) => ReactNode\n\ntype LinkProps = Omit<ComponentPropsWithoutRef<'a'>, 'onClick'> & {\n linkType?: LinkData['type']\n onClick?: (event: MouseEvent<HTMLAnchorElement>) => unknown\n}\n\ntype LinkComponent = ForwardRefExoticComponent<RefAttributes<HTMLAnchorElement> & LinkProps>\n\nexport type FrameworkContext = {\n Head: HeadComponent\n HeadSnippet: HeadSnippet\n Image: ImageComponent\n Link: LinkComponent\n}\n\n// React 19 automatically hoists metadata tags to the <head>\nconst DefaultHead = ({ children }: PropsWithChildren) => <>{children}</>\n\nconst DefaultHeadSnippet = BaseHeadSnippet\n\nconst DefaultImage: ImageComponent = ({ priority, fill, style, ...props }) => (\n <img\n {...props}\n style={{\n ...(fill\n ? {\n height: '100%',\n width: '100%',\n objectFit: 'cover',\n }\n : {}),\n ...style,\n }}\n loading={priority ? 'eager' : 'lazy'}\n />\n)\n\nconst DefaultLink: LinkComponent = forwardRef<HTMLAnchorElement, LinkProps>(\n ({ linkType, ...props }, ref) => <a {...props} ref={ref} />,\n)\n\nconst FrameworkContext = createContext<Partial<FrameworkContext>>({})\n\nexport const FrameworkContextProvider = ({\n value,\n children,\n}: PropsWithChildren<{ value: Partial<FrameworkContext> }>) => {\n const parentContext = useContext(FrameworkContext)\n const mergedContext = useMemo(() => ({ ...parentContext, ...value }), [parentContext, value])\n\n return <FrameworkContext.Provider value={mergedContext}>{children}</FrameworkContext.Provider>\n}\n\nconst defaultContext: FrameworkContext = {\n Head: DefaultHead,\n HeadSnippet: DefaultHeadSnippet,\n Image: DefaultImage,\n Link: DefaultLink,\n}\n\nexport function useFrameworkContext(): FrameworkContext {\n return { ...defaultContext, ...useContext(FrameworkContext) }\n}\n"],"mappings":"AAgDyD;AAhDzD;AAAA,EAQE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMP,SAAS,uBAAuB;AA8BhC,MAAM,cAAc,CAAC,EAAE,SAAS,MAAyB,gCAAG,UAAS;AAErE,MAAM,qBAAqB;AAE3B,MAAM,eAA+B,CAAC,EAAE,UAAU,MAAM,OAAO,GAAG,MAAM,MACtE;AAAA,EAAC;AAAA;AAAA,IACE,GAAG;AAAA,IACJ,OAAO;AAAA,MACL,GAAI,OACA;AAAA,QACE,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,WAAW;AAAA,MACb,IACA,CAAC;AAAA,MACL,GAAG;AAAA,IACL;AAAA,IACA,SAAS,WAAW,UAAU;AAAA;AAChC;AAGF,MAAM,cAA6B;AAAA,EACjC,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,oBAAC,OAAG,GAAG,OAAO,KAAU;AAC3D;AAEA,MAAM,mBAAmB,cAAyC,CAAC,CAAC;AAE7D,MAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA;AACF,MAA+D;AAC7D,QAAM,gBAAgB,WAAW,gBAAgB;AACjD,QAAM,gBAAgB,QAAQ,OAAO,EAAE,GAAG,eAAe,GAAG,MAAM,IAAI,CAAC,eAAe,KAAK,CAAC;AAE5F,SAAO,oBAAC,iBAAiB,UAAjB,EAA0B,OAAO,eAAgB,UAAS;AACpE;AAEA,MAAM,iBAAmC;AAAA,EACvC,MAAM;AAAA,EACN,aAAa;AAAA,EACb,OAAO;AAAA,EACP,MAAM;AACR;AAEO,SAAS,sBAAwC;AACtD,SAAO,EAAE,GAAG,gBAAgB,GAAG,WAAW,gBAAgB,EAAE;AAC9D;","names":[]}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FrameworkContext } from "../framework-context";
|
|
3
|
-
function useFrameworkContext() {
|
|
4
|
-
return useContext(FrameworkContext);
|
|
5
|
-
}
|
|
1
|
+
import { useFrameworkContext } from "../framework-context";
|
|
6
2
|
export {
|
|
7
3
|
useFrameworkContext
|
|
8
4
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/runtimes/react/components/hooks/use-framework-context.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/runtimes/react/components/hooks/use-framework-context.tsx"],"sourcesContent":["export { useFrameworkContext } from '../framework-context'\n"],"mappings":"AAAA,SAAS,2BAA2B;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useControlDefs } from "../hooks/use-control-defs";
|
|
2
|
+
import { useResolvedProps } from "../hooks/use-resolved-props";
|
|
3
|
+
import { resolveLegacyDescriptorProp } from "../legacy-controls";
|
|
4
|
+
function ResolveProps({
|
|
5
|
+
element,
|
|
6
|
+
children: renderComponent
|
|
7
|
+
}) {
|
|
8
|
+
const [legacyDescriptors, definitions] = useControlDefs({ elementType: element.type });
|
|
9
|
+
const resolvedProps = useResolvedProps(definitions, element.props, element.key);
|
|
10
|
+
const renderFn = Object.entries(legacyDescriptors).reduceRight(
|
|
11
|
+
(renderFn2, [propName, descriptor]) => (props) => resolveLegacyDescriptorProp(descriptor, propName, element.props[propName], props, renderFn2),
|
|
12
|
+
renderComponent
|
|
13
|
+
);
|
|
14
|
+
return renderFn(resolvedProps);
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
ResolveProps
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=resolve-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/components/resolve-props.tsx"],"sourcesContent":["import { type ReactNode } from 'react'\n\nimport { type ElementData } from '../../../state/read-only-state'\n\nimport { useControlDefs } from '../hooks/use-control-defs'\nimport { useResolvedProps } from '../hooks/use-resolved-props'\n\nimport { resolveLegacyDescriptorProp } from '../legacy-controls'\n\nexport function ResolveProps({\n element,\n children: renderComponent,\n}: {\n element: ElementData\n children: (props: Record<string, unknown>) => ReactNode\n}): ReactNode {\n const [legacyDescriptors, definitions] = useControlDefs({ elementType: element.type })\n\n const resolvedProps = useResolvedProps(definitions, element.props, element.key)\n\n const renderFn = Object.entries(legacyDescriptors).reduceRight(\n (renderFn, [propName, descriptor]) =>\n props =>\n resolveLegacyDescriptorProp(descriptor, propName, element.props[propName], props, renderFn),\n renderComponent,\n )\n\n return renderFn(resolvedProps)\n}\n"],"mappings":"AAIA,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AAEjC,SAAS,mCAAmC;AAErC,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA,UAAU;AACZ,GAGc;AACZ,QAAM,CAAC,mBAAmB,WAAW,IAAI,eAAe,EAAE,aAAa,QAAQ,KAAK,CAAC;AAErF,QAAM,gBAAgB,iBAAiB,aAAa,QAAQ,OAAO,QAAQ,GAAG;AAE9E,QAAM,WAAW,OAAO,QAAQ,iBAAiB,EAAE;AAAA,IACjD,CAACA,WAAU,CAAC,UAAU,UAAU,MAC9B,WACE,4BAA4B,YAAY,UAAU,QAAQ,MAAM,QAAQ,GAAG,OAAOA,SAAQ;AAAA,IAC9F;AAAA,EACF;AAEA,SAAO,SAAS,aAAa;AAC/B;","names":["renderFn"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useRef } from "react";
|
|
2
|
+
import { partitionRecord } from "../../../utils/partition";
|
|
3
|
+
import { getComponentPropControllerDescriptors } from "../../../state/read-only-state";
|
|
4
|
+
import { isLegacyDescriptor } from "../../../prop-controllers/descriptors";
|
|
5
|
+
import { useStore } from "./use-store";
|
|
6
|
+
function useControlDefs({
|
|
7
|
+
elementType
|
|
8
|
+
}) {
|
|
9
|
+
const store = useStore();
|
|
10
|
+
const all = getComponentPropControllerDescriptors(store.getState(), elementType) ?? {};
|
|
11
|
+
return useRef(partitionRecord(all, isLegacyDescriptor)).current;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
useControlDefs
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=use-control-defs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/runtimes/react/hooks/use-control-defs.ts"],"sourcesContent":["import { useRef } from 'react'\n\nimport { ControlDefinition } from '@makeswift/controls'\n\nimport { partitionRecord } from '../../../utils/partition'\n\nimport { getComponentPropControllerDescriptors } from '../../../state/read-only-state'\nimport { type LegacyDescriptor, isLegacyDescriptor } from '../../../prop-controllers/descriptors'\n\nimport { useStore } from './use-store'\n\nexport function useControlDefs({\n elementType,\n}: {\n elementType: string\n}): readonly [Record<string, LegacyDescriptor>, Record<string, ControlDefinition>] {\n const store = useStore()\n const all = getComponentPropControllerDescriptors(store.getState(), elementType) ?? {}\n return useRef(partitionRecord(all, isLegacyDescriptor)).current\n}\n"],"mappings":"AAAA,SAAS,cAAc;AAIvB,SAAS,uBAAuB;AAEhC,SAAS,6CAA6C;AACtD,SAAgC,0BAA0B;AAE1D,SAAS,gBAAgB;AAElB,SAAS,eAAe;AAAA,EAC7B;AACF,GAEmF;AACjF,QAAM,QAAQ,SAAS;AACvB,QAAM,MAAM,sCAAsC,MAAM,SAAS,GAAG,WAAW,KAAK,CAAC;AACrF,SAAO,OAAO,gBAAgB,KAAK,kBAAkB,CAAC,EAAE;AAC1D;","names":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HostApiResourcesClient } from "../../api/host-api-resources-client";
|
|
2
|
+
import { MakeswiftApiResourcesClient } from "../../api/makeswift-api-resources-client";
|
|
2
3
|
import {
|
|
3
4
|
parseBreakpointsInput
|
|
4
5
|
} from "../../state/modules/breakpoints";
|
|
@@ -23,6 +24,7 @@ class RuntimeCore {
|
|
|
23
24
|
// requested site version, which should be the only site version for which the store is requested
|
|
24
25
|
ttlCheck: RefCountedMap.TTLCheck.ON_RETAIN | RefCountedMap.TTLCheck.ON_RELEASE
|
|
25
26
|
});
|
|
27
|
+
apiKey;
|
|
26
28
|
protoStore;
|
|
27
29
|
appOrigin;
|
|
28
30
|
apiOrigin;
|
|
@@ -31,12 +33,14 @@ class RuntimeCore {
|
|
|
31
33
|
constructor({
|
|
32
34
|
appOrigin = "https://app.makeswift.com",
|
|
33
35
|
apiOrigin = "https://api.makeswift.com",
|
|
36
|
+
apiKey,
|
|
34
37
|
breakpoints,
|
|
35
38
|
requestKey,
|
|
36
39
|
fetch
|
|
37
40
|
}) {
|
|
38
41
|
this.appOrigin = validateOrigin(appOrigin, "appOrigin");
|
|
39
42
|
this.apiOrigin = validateOrigin(apiOrigin, "apiOrigin");
|
|
43
|
+
this.apiKey = apiKey;
|
|
40
44
|
this.requestKey = requestKey;
|
|
41
45
|
this.fetch = fetch;
|
|
42
46
|
this.protoStore = configureProtoStore({
|
|
@@ -89,6 +93,15 @@ class RuntimeCore {
|
|
|
89
93
|
return new URL("graphql", this.apiOrigin).href;
|
|
90
94
|
}
|
|
91
95
|
createApiResourcesClient(preloadedState) {
|
|
96
|
+
if (isServer() && this.apiKey) {
|
|
97
|
+
return new MakeswiftApiResourcesClient({
|
|
98
|
+
fetch: this.fetch,
|
|
99
|
+
apiKey: this.apiKey,
|
|
100
|
+
apiOrigin: this.apiOrigin,
|
|
101
|
+
graphqlApiEndpoint: this.graphqlApiEndpoint,
|
|
102
|
+
preloadedState
|
|
103
|
+
});
|
|
104
|
+
}
|
|
92
105
|
return new HostApiResourcesClient({
|
|
93
106
|
fetch: this.fetch,
|
|
94
107
|
preloadedState
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtimes/react/runtime-core.ts"],"sourcesContent":["import { type SerializableReplacementContext } from '@makeswift/controls'\n\nimport { HostApiResourcesClient } from '../../api/host-api-resources-client'\nimport { type HttpFetch } from '../../api/types'\nimport { type SiteVersion } from '../../api/site-version'\n\nimport {\n Breakpoints,\n BreakpointsInput,\n parseBreakpointsInput,\n} from '../../state/modules/breakpoints'\n\nimport { copyElementTree } from '../../state/ops/copy-element-tree'\n\nimport { getBreakpoints, type Element, type ElementData } from '../../state/read-only-state'\nimport {\n configureProtoStore,\n configureReadWriteStore,\n type ProtoStore,\n type Store,\n} from '../../state/store'\n\nimport { RefCountedMap } from '../../utils/ref-counted-map'\nimport { isServer } from '../../utils/is-server'\n\nexport type StoreKey = {\n siteVersion: SiteVersion | null\n locale: string | undefined\n}\n\nconst VERSION_TAG_LIVE = 'ref:live'\n\nexport class RuntimeCore {\n // The unowned entry TTL affects performance, not correctness. The TTL controls how long an unretained store stays\n // in the map. If an entry expires and is removed from the map before React commits, the store remains retained\n // via `<StoreContext.Provider>`. The only impact is that future lookups will create a new store instance instead of\n // reusing the existing one, reducing cache efficiency.\n private readonly activeStores = new RefCountedMap<string | null, Store>({\n unownedEntryTtlMs: 1000,\n // Checking on retain/release is sufficient on the client, and we don't need to check on get on the server\n // as the only scenario in which we add the store to the map is when the runtime is already bound to the\n // requested site version, which should be the only site version for which the store is requested\n ttlCheck: RefCountedMap.TTLCheck.ON_RETAIN | RefCountedMap.TTLCheck.ON_RELEASE,\n })\n\n readonly protoStore: ProtoStore\n readonly appOrigin: string\n readonly apiOrigin: string\n readonly requestKey: StoreKey | undefined\n readonly fetch: HttpFetch\n\n constructor({\n appOrigin = 'https://app.makeswift.com',\n apiOrigin = 'https://api.makeswift.com',\n breakpoints,\n requestKey,\n fetch,\n }: {\n appOrigin?: string\n apiOrigin?: string\n breakpoints?: BreakpointsInput\n requestKey?: StoreKey\n fetch: HttpFetch\n }) {\n this.appOrigin = validateOrigin(appOrigin, 'appOrigin')\n this.apiOrigin = validateOrigin(apiOrigin, 'apiOrigin')\n this.requestKey = requestKey\n this.fetch = fetch\n\n this.protoStore = configureProtoStore({\n name: 'Runtime proto-store',\n breakpoints: breakpoints ? parseBreakpointsInput(breakpoints) : undefined,\n })\n }\n\n getOrCreateStore({ siteVersion, locale }: StoreKey): Store {\n const key = storeCacheKey({ siteVersion, locale })\n\n const createStore = () => {\n // API resources client includes an in-memory cache of the site's resources and thus also has to be versioned\n const apiResourcesClient = this.createApiResourcesClient({ siteVersion, locale })\n\n // TODO: we need to decouple editability from the site version; specifically, previewing\n // a draft version of the site should not lead to switching to the read-write state\n const isReadOnly = siteVersion == null\n\n return configureReadWriteStore({\n name: `Runtime read-write store (site version: ${key})`,\n appOrigin: this.appOrigin,\n apiResourcesClient,\n preloadedState: { ...this.protoStore.getState(), siteVersion, isReadOnly, locale },\n })\n }\n\n // On the server, stores are ephemeral by default so SSR does not retain them in a long-lived runtime.\n // The exception is a runtime that is already bound to the requested site version & locale, where we\n // can safely reuse the store across multiple root regions and benefit from the host API client's\n // in-memory cache.\n //\n // On the client, stores are reference-counted by site version so multiple root regions can share a store\n // instance, which preserves the pre-v0.17 per-site-version store behavior without requiring a separate\n // runtime per root.\n const usePersistentStore = this.shouldUsePersistentStore(key)\n return usePersistentStore ? this.activeStores.getOrCreate(key, createStore) : createStore()\n }\n\n retainStore({ siteVersion, locale }: StoreKey, store: Store): void {\n const key = storeCacheKey({ siteVersion, locale })\n\n if (!this.shouldUsePersistentStore(key)) {\n console.error('RuntimeCore: attempt to retain an ephemeral store', { key })\n return\n }\n\n if (this.activeStores.retain(key, store)) {\n store.startBreakpointWatch()\n }\n }\n\n releaseStore({ siteVersion, locale }: StoreKey, store: Store): void {\n const key = storeCacheKey({ siteVersion, locale })\n\n if (!this.shouldUsePersistentStore(key)) {\n console.error('RuntimeCore: attempt to release an ephemeral store', { key })\n return\n }\n\n if (this.activeStores.release(key, store)) {\n store.stopBreakpointWatch()\n }\n }\n\n copyElementTree(\n elementTree: ElementData,\n replacementContext: SerializableReplacementContext,\n ): Element {\n return copyElementTree(this.protoStore.getState(), elementTree, replacementContext)\n }\n\n getBreakpoints(): Breakpoints {\n return getBreakpoints(this.protoStore.getState())\n }\n\n get graphqlApiEndpoint(): string {\n return new URL('graphql', this.apiOrigin).href\n }\n\n private createApiResourcesClient(preloadedState: {\n siteVersion: SiteVersion | null\n locale: string | undefined\n }) {\n return new HostApiResourcesClient({\n fetch: this.fetch,\n preloadedState,\n })\n }\n\n private shouldUsePersistentStore(key: string): boolean {\n // don't persist stores on the server unless the runtime instance is bound to a request\n // and the requested store matches the request's site version and locale\n return !isServer() || (this.requestKey !== undefined && storeCacheKey(this.requestKey) === key)\n }\n}\n\nconst storeCacheKey = ({ siteVersion, locale }: StoreKey): string =>\n `${siteVersionTag(siteVersion)}/${locale ?? 'default'}`\n\nconst siteVersionTag = (siteVersion: SiteVersion | null): string =>\n siteVersion?.version ?? VERSION_TAG_LIVE\n\nfunction validateOrigin(url: string, name: string): string {\n try {\n return new URL(url).origin\n } catch {\n throw new Error(`The Makeswift runtime received an invalid \\`${name}\\` parameter: \"${url}\".`)\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/runtimes/react/runtime-core.ts"],"sourcesContent":["import { type SerializableReplacementContext } from '@makeswift/controls'\n\nimport { ApiResourcesClient } from '../../api/api-resources-client'\nimport { HostApiResourcesClient } from '../../api/host-api-resources-client'\nimport { MakeswiftApiResourcesClient } from '../../api/makeswift-api-resources-client'\nimport { type HttpFetch } from '../../api/types'\nimport { type SiteVersion } from '../../api/site-version'\n\nimport {\n type Breakpoints,\n type BreakpointsInput,\n parseBreakpointsInput,\n} from '../../state/modules/breakpoints'\n\nimport { copyElementTree } from '../../state/ops/copy-element-tree'\n\nimport { getBreakpoints, type Element, type ElementData } from '../../state/read-only-state'\nimport {\n configureProtoStore,\n configureReadWriteStore,\n type ProtoStore,\n type Store,\n} from '../../state/store'\n\nimport { RefCountedMap } from '../../utils/ref-counted-map'\nimport { isServer } from '../../utils/is-server'\n\nexport type StoreKey = {\n siteVersion: SiteVersion | null\n locale: string | undefined\n}\n\nconst VERSION_TAG_LIVE = 'ref:live'\n\nexport class RuntimeCore {\n // The unowned entry TTL affects performance, not correctness. The TTL controls how long an unretained store stays\n // in the map. If an entry expires and is removed from the map before React commits, the store remains retained\n // via `<StoreContext.Provider>`. The only impact is that future lookups will create a new store instance instead of\n // reusing the existing one, reducing cache efficiency.\n private readonly activeStores = new RefCountedMap<string | null, Store>({\n unownedEntryTtlMs: 1000,\n // Checking on retain/release is sufficient on the client, and we don't need to check on get on the server\n // as the only scenario in which we add the store to the map is when the runtime is already bound to the\n // requested site version, which should be the only site version for which the store is requested\n ttlCheck: RefCountedMap.TTLCheck.ON_RETAIN | RefCountedMap.TTLCheck.ON_RELEASE,\n })\n\n private readonly apiKey: string | undefined\n\n readonly protoStore: ProtoStore\n readonly appOrigin: string\n readonly apiOrigin: string\n readonly requestKey: StoreKey | undefined\n readonly fetch: HttpFetch\n\n constructor({\n appOrigin = 'https://app.makeswift.com',\n apiOrigin = 'https://api.makeswift.com',\n apiKey,\n breakpoints,\n requestKey,\n fetch,\n }: {\n appOrigin?: string\n apiOrigin?: string\n apiKey?: string\n breakpoints?: BreakpointsInput\n requestKey?: StoreKey\n fetch: HttpFetch\n }) {\n this.appOrigin = validateOrigin(appOrigin, 'appOrigin')\n this.apiOrigin = validateOrigin(apiOrigin, 'apiOrigin')\n this.apiKey = apiKey\n this.requestKey = requestKey\n this.fetch = fetch\n\n this.protoStore = configureProtoStore({\n name: 'Runtime proto-store',\n breakpoints: breakpoints ? parseBreakpointsInput(breakpoints) : undefined,\n })\n }\n\n getOrCreateStore({ siteVersion, locale }: StoreKey): Store {\n const key = storeCacheKey({ siteVersion, locale })\n\n const createStore = () => {\n // API resources client includes an in-memory cache of the site's resources and thus also has to be versioned\n const apiResourcesClient = this.createApiResourcesClient({ siteVersion, locale })\n\n // TODO: we need to decouple editability from the site version; specifically, previewing\n // a draft version of the site should not lead to switching to the read-write state\n const isReadOnly = siteVersion == null\n\n return configureReadWriteStore({\n name: `Runtime read-write store (site version: ${key})`,\n appOrigin: this.appOrigin,\n apiResourcesClient,\n preloadedState: { ...this.protoStore.getState(), siteVersion, isReadOnly, locale },\n })\n }\n\n // On the server, stores are ephemeral by default so SSR does not retain them in a long-lived runtime.\n // The exception is a runtime that is already bound to the requested site version & locale, where we\n // can safely reuse the store across multiple root regions and benefit from the host API client's\n // in-memory cache.\n //\n // On the client, stores are reference-counted by site version so multiple root regions can share a store\n // instance, which preserves the pre-v0.17 per-site-version store behavior without requiring a separate\n // runtime per root.\n const usePersistentStore = this.shouldUsePersistentStore(key)\n return usePersistentStore ? this.activeStores.getOrCreate(key, createStore) : createStore()\n }\n\n retainStore({ siteVersion, locale }: StoreKey, store: Store): void {\n const key = storeCacheKey({ siteVersion, locale })\n\n if (!this.shouldUsePersistentStore(key)) {\n console.error('RuntimeCore: attempt to retain an ephemeral store', { key })\n return\n }\n\n if (this.activeStores.retain(key, store)) {\n store.startBreakpointWatch()\n }\n }\n\n releaseStore({ siteVersion, locale }: StoreKey, store: Store): void {\n const key = storeCacheKey({ siteVersion, locale })\n\n if (!this.shouldUsePersistentStore(key)) {\n console.error('RuntimeCore: attempt to release an ephemeral store', { key })\n return\n }\n\n if (this.activeStores.release(key, store)) {\n store.stopBreakpointWatch()\n }\n }\n\n copyElementTree(\n elementTree: ElementData,\n replacementContext: SerializableReplacementContext,\n ): Element {\n return copyElementTree(this.protoStore.getState(), elementTree, replacementContext)\n }\n\n getBreakpoints(): Breakpoints {\n return getBreakpoints(this.protoStore.getState())\n }\n\n get graphqlApiEndpoint(): string {\n return new URL('graphql', this.apiOrigin).href\n }\n\n private createApiResourcesClient(preloadedState: {\n siteVersion: SiteVersion | null\n locale: string | undefined\n }): ApiResourcesClient {\n if (isServer() && this.apiKey) {\n return new MakeswiftApiResourcesClient({\n fetch: this.fetch,\n apiKey: this.apiKey,\n apiOrigin: this.apiOrigin,\n graphqlApiEndpoint: this.graphqlApiEndpoint,\n preloadedState,\n })\n }\n\n return new HostApiResourcesClient({\n fetch: this.fetch,\n preloadedState,\n })\n }\n\n private shouldUsePersistentStore(key: string): boolean {\n // don't persist stores on the server unless the runtime instance is bound to a request\n // and the requested store matches the request's site version and locale\n return !isServer() || (this.requestKey !== undefined && storeCacheKey(this.requestKey) === key)\n }\n}\n\nconst storeCacheKey = ({ siteVersion, locale }: StoreKey): string =>\n `${siteVersionTag(siteVersion)}/${locale ?? 'default'}`\n\nconst siteVersionTag = (siteVersion: SiteVersion | null): string =>\n siteVersion?.version ?? VERSION_TAG_LIVE\n\nfunction validateOrigin(url: string, name: string): string {\n try {\n return new URL(url).origin\n } catch {\n throw new Error(`The Makeswift runtime received an invalid \\`${name}\\` parameter: \"${url}\".`)\n }\n}\n"],"mappings":"AAGA,SAAS,8BAA8B;AACvC,SAAS,mCAAmC;AAI5C;AAAA,EAGE;AAAA,OACK;AAEP,SAAS,uBAAuB;AAEhC,SAAS,sBAAsD;AAC/D;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AAEP,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AAOzB,MAAM,mBAAmB;AAElB,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,EAKN,eAAe,IAAI,cAAoC;AAAA,IACtE,mBAAmB;AAAA;AAAA;AAAA;AAAA,IAInB,UAAU,cAAc,SAAS,YAAY,cAAc,SAAS;AAAA,EACtE,CAAC;AAAA,EAEgB;AAAA,EAER;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY;AAAA,IACV,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAOG;AACD,SAAK,YAAY,eAAe,WAAW,WAAW;AACtD,SAAK,YAAY,eAAe,WAAW,WAAW;AACtD,SAAK,SAAS;AACd,SAAK,aAAa;AAClB,SAAK,QAAQ;AAEb,SAAK,aAAa,oBAAoB;AAAA,MACpC,MAAM;AAAA,MACN,aAAa,cAAc,sBAAsB,WAAW,IAAI;AAAA,IAClE,CAAC;AAAA,EACH;AAAA,EAEA,iBAAiB,EAAE,aAAa,OAAO,GAAoB;AACzD,UAAM,MAAM,cAAc,EAAE,aAAa,OAAO,CAAC;AAEjD,UAAM,cAAc,MAAM;AAExB,YAAM,qBAAqB,KAAK,yBAAyB,EAAE,aAAa,OAAO,CAAC;AAIhF,YAAM,aAAa,eAAe;AAElC,aAAO,wBAAwB;AAAA,QAC7B,MAAM,2CAA2C,GAAG;AAAA,QACpD,WAAW,KAAK;AAAA,QAChB;AAAA,QACA,gBAAgB,EAAE,GAAG,KAAK,WAAW,SAAS,GAAG,aAAa,YAAY,OAAO;AAAA,MACnF,CAAC;AAAA,IACH;AAUA,UAAM,qBAAqB,KAAK,yBAAyB,GAAG;AAC5D,WAAO,qBAAqB,KAAK,aAAa,YAAY,KAAK,WAAW,IAAI,YAAY;AAAA,EAC5F;AAAA,EAEA,YAAY,EAAE,aAAa,OAAO,GAAa,OAAoB;AACjE,UAAM,MAAM,cAAc,EAAE,aAAa,OAAO,CAAC;AAEjD,QAAI,CAAC,KAAK,yBAAyB,GAAG,GAAG;AACvC,cAAQ,MAAM,qDAAqD,EAAE,IAAI,CAAC;AAC1E;AAAA,IACF;AAEA,QAAI,KAAK,aAAa,OAAO,KAAK,KAAK,GAAG;AACxC,YAAM,qBAAqB;AAAA,IAC7B;AAAA,EACF;AAAA,EAEA,aAAa,EAAE,aAAa,OAAO,GAAa,OAAoB;AAClE,UAAM,MAAM,cAAc,EAAE,aAAa,OAAO,CAAC;AAEjD,QAAI,CAAC,KAAK,yBAAyB,GAAG,GAAG;AACvC,cAAQ,MAAM,sDAAsD,EAAE,IAAI,CAAC;AAC3E;AAAA,IACF;AAEA,QAAI,KAAK,aAAa,QAAQ,KAAK,KAAK,GAAG;AACzC,YAAM,oBAAoB;AAAA,IAC5B;AAAA,EACF;AAAA,EAEA,gBACE,aACA,oBACS;AACT,WAAO,gBAAgB,KAAK,WAAW,SAAS,GAAG,aAAa,kBAAkB;AAAA,EACpF;AAAA,EAEA,iBAA8B;AAC5B,WAAO,eAAe,KAAK,WAAW,SAAS,CAAC;AAAA,EAClD;AAAA,EAEA,IAAI,qBAA6B;AAC/B,WAAO,IAAI,IAAI,WAAW,KAAK,SAAS,EAAE;AAAA,EAC5C;AAAA,EAEQ,yBAAyB,gBAGV;AACrB,QAAI,SAAS,KAAK,KAAK,QAAQ;AAC7B,aAAO,IAAI,4BAA4B;AAAA,QACrC,OAAO,KAAK;AAAA,QACZ,QAAQ,KAAK;AAAA,QACb,WAAW,KAAK;AAAA,QAChB,oBAAoB,KAAK;AAAA,QACzB;AAAA,MACF,CAAC;AAAA,IACH;AAEA,WAAO,IAAI,uBAAuB;AAAA,MAChC,OAAO,KAAK;AAAA,MACZ;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEQ,yBAAyB,KAAsB;AAGrD,WAAO,CAAC,SAAS,KAAM,KAAK,eAAe,UAAa,cAAc,KAAK,UAAU,MAAM;AAAA,EAC7F;AACF;AAEA,MAAM,gBAAgB,CAAC,EAAE,aAAa,OAAO,MAC3C,GAAG,eAAe,WAAW,CAAC,IAAI,UAAU,SAAS;AAEvD,MAAM,iBAAiB,CAAC,gBACtB,aAAa,WAAW;AAE1B,SAAS,eAAe,KAAa,MAAsB;AACzD,MAAI;AACF,WAAO,IAAI,IAAI,GAAG,EAAE;AAAA,EACtB,QAAQ;AACN,UAAM,IAAI,MAAM,+CAA+C,IAAI,kBAAkB,GAAG,IAAI;AAAA,EAC9F;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/testing/fixtures/index.ts"],"sourcesContent":["export * from './origins'\nexport * from './site-version'\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../../../../src/testing/fixtures/index.ts"],"sourcesContent":["export * from './origins'\nexport * from './resources'\nexport * from './site-version'\nexport * from './snippet'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/testing/fixtures/snippet.ts"],"sourcesContent":["import { type Snippet } from '../../client/page-snapshot'\n\nexport const createSnippet = ({ id, code }: { id: string; code: string }): Snippet => ({\n id,\n code,\n location: 'HEAD',\n liveEnabled: true,\n builderEnabled: true,\n cleanup: null,\n})\n"],"mappings":"AAEO,MAAM,gBAAgB,CAAC,EAAE,IAAI,KAAK,OAA8C;AAAA,EACrF;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,SAAS;AACX;","names":[]}
|
|
@@ -12,10 +12,7 @@ import { toApiRequest, pipeResponseTo } from "../api-handler/node-request-respon
|
|
|
12
12
|
import { MAKESWIFT_SITE_VERSION_COOKIE, SearchParams } from "../api-handler/preview";
|
|
13
13
|
import { MakeswiftClient } from "../client";
|
|
14
14
|
import {
|
|
15
|
-
|
|
16
|
-
DefaultHead,
|
|
17
|
-
DefaultHeadSnippet,
|
|
18
|
-
DefaultImage
|
|
15
|
+
FrameworkContextProvider
|
|
19
16
|
} from "../runtimes/react/components/framework-context";
|
|
20
17
|
import { MakeswiftComponent } from "../runtimes/react/components/MakeswiftComponent";
|
|
21
18
|
import { Page } from "../runtimes/react/components/page";
|
|
@@ -32,11 +29,8 @@ import {
|
|
|
32
29
|
} from "../runtimes/react/root-style-registry";
|
|
33
30
|
import { ReactRuntime } from "../runtimes/react/react-runtime";
|
|
34
31
|
export {
|
|
35
|
-
DefaultHead,
|
|
36
|
-
DefaultHeadSnippet,
|
|
37
|
-
DefaultImage,
|
|
38
32
|
DefaultRootStyleRegistry,
|
|
39
|
-
|
|
33
|
+
FrameworkContextProvider,
|
|
40
34
|
GoogleFontLink,
|
|
41
35
|
MAKESWIFT_SITE_VERSION_COOKIE,
|
|
42
36
|
MakeswiftClient,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/unstable-framework-support/index.ts"],"sourcesContent":["export {\n type SiteVersion,\n serializeSiteVersion,\n deserializeSiteVersion,\n secondsUntilSiteVersionExpiration,\n} from '../api/site-version'\n\nexport {\n type ApiHandlerUserConfig,\n createApiHandler,\n type SitePublishedWebhookPayloadData,\n} from '../api-handler'\nexport { SET_COOKIE_HEADER, cookieSettingOptions } from '../api-handler/cookies'\nexport { REDIRECT_SEARCH_PARAM, redirectLiveHandler } from '../api-handler/handlers/redirect-live'\nexport { toApiRequest, pipeResponseTo } from '../api-handler/node-request-response'\nexport { MAKESWIFT_SITE_VERSION_COOKIE, SearchParams } from '../api-handler/preview'\n\nexport { MakeswiftClient } from '../client'\n\nexport { type BreakpointsInput as Breakpoints } from '../state/modules/breakpoints'\n\nexport {\n FrameworkContext,\n
|
|
1
|
+
{"version":3,"sources":["../../../src/unstable-framework-support/index.ts"],"sourcesContent":["export {\n type SiteVersion,\n serializeSiteVersion,\n deserializeSiteVersion,\n secondsUntilSiteVersionExpiration,\n} from '../api/site-version'\n\nexport {\n type ApiHandlerUserConfig,\n createApiHandler,\n type SitePublishedWebhookPayloadData,\n} from '../api-handler'\nexport { SET_COOKIE_HEADER, cookieSettingOptions } from '../api-handler/cookies'\nexport { REDIRECT_SEARCH_PARAM, redirectLiveHandler } from '../api-handler/handlers/redirect-live'\nexport { toApiRequest, pipeResponseTo } from '../api-handler/node-request-response'\nexport { MAKESWIFT_SITE_VERSION_COOKIE, SearchParams } from '../api-handler/preview'\n\nexport { MakeswiftClient } from '../client'\n\nexport { type BreakpointsInput as Breakpoints } from '../state/modules/breakpoints'\n\nexport {\n type FrameworkContext,\n FrameworkContextProvider,\n} from '../runtimes/react/components/framework-context'\n\nexport { MakeswiftComponent } from '../runtimes/react/components/MakeswiftComponent'\nexport { Page } from '../runtimes/react/components/page'\nexport { RuntimeProvider } from '../runtimes/react/components/RuntimeProvider'\nexport { Slot } from '../runtimes/react/components/Slot'\n\nexport { GoogleFontLink } from '../runtimes/react/components/GoogleFontLink'\nexport { MakeswiftFonts } from '../runtimes/react/components/MakeswiftFonts'\n\nexport {\n createRootStyleCache,\n RootStyleRegistry,\n DefaultRootStyleRegistry,\n styleTagHtml,\n StyleTagSSR,\n type RootStyleProps,\n} from '../runtimes/react/root-style-registry'\n\nexport { ReactRuntime, type StoreKey } from '../runtimes/react/react-runtime'\n"],"mappings":"AAAA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EAEE;AAAA,OAEK;AACP,SAAS,mBAAmB,4BAA4B;AACxD,SAAS,uBAAuB,2BAA2B;AAC3D,SAAS,cAAc,sBAAsB;AAC7C,SAAS,+BAA+B,oBAAoB;AAE5D,SAAS,uBAAuB;AAIhC;AAAA,EAEE;AAAA,OACK;AAEP,SAAS,0BAA0B;AACnC,SAAS,YAAY;AACrB,SAAS,uBAAuB;AAChC,SAAS,YAAY;AAErB,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAE/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,oBAAmC;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeswift-api-resources-client.d.ts","sourceRoot":"","sources":["../../../src/api/makeswift-api-resources-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAGxE,OAAO,EACL,KAAK,IAAI,EACT,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"makeswift-api-resources-client.d.ts","sourceRoot":"","sources":["../../../src/api/makeswift-api-resources-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAGxE,OAAO,EACL,KAAK,IAAI,EACT,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,MAAM,EACX,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAMjD;;;;;;GAMG;AACH,qBAAa,2BAA4B,SAAQ,kBAAkB;IACjE,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,aAAa,CAAoC;gBAE7C,EACV,KAAK,EACL,MAAM,EACN,SAAS,EACT,kBAAkB,EAClB,cAAc,GACf,EAAE;QACD,KAAK,EAAE,SAAS,CAAA;QAChB,MAAM,EAAE,MAAM,CAAA;QACd,SAAS,EAAE,MAAM,CAAA;QACjB,kBAAkB,EAAE,MAAM,CAAA;QAC1B,cAAc,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;KACxC;cAuBe,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;cAIhF,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;cAK7E,mBAAmB,CACjC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,WAAW,GAAG,IAAI,GAC1B,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;cAIb,sBAAsB,CACpC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,WAAW,GAAG,IAAI,GAC1B,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;cAIhB,+BAA+B,CAC7C,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,WAAW,GAAG,IAAI,EAC3B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC;cAIzB,0BAA0B,CACxC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,WAAW,GAAG,IAAI,EAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAChC,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;cAIpB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;CAIhG"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type FrameworkContext } from '../../../../runtimes/react/components/framework-context';
|
|
2
|
-
export declare const context: Pick<FrameworkContext, '
|
|
2
|
+
export declare const context: Pick<FrameworkContext, 'HeadSnippet'>;
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/next/components/framework-provider/app-router/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/next/components/framework-provider/app-router/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,yDAAyD,CAAA;AAI/F,eAAO,MAAM,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,aAAa,CAIzD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/framework-provider/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAW,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/framework-provider/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,iBAAiB,EAAW,MAAM,OAAO,CAAA;AAavD,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,gBAAgB,GACjB,EAAE,iBAAiB,CAAC;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,2CAYnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-context.test.d.ts","sourceRoot":"","sources":["../../../../../../src/runtimes/react/components/__tests__/framework-context.test.tsx"],"names":[],"mappings":"AAAA,8BAA8B"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type ReactNode, type PropsWithChildren, type CSSProperties, type ComponentPropsWithoutRef, type MouseEvent, type ForwardRefExoticComponent, type RefAttributes } from 'react';
|
|
2
2
|
import { type LinkData } from '@makeswift/prop-controllers';
|
|
3
3
|
import { type Snippet } from '../../../client';
|
|
4
|
-
import { BaseHeadSnippet } from './page/HeadSnippet';
|
|
5
4
|
type HeadComponent = (props: {
|
|
6
5
|
children: ReactNode;
|
|
7
6
|
}) => ReactNode;
|
|
@@ -29,10 +28,9 @@ export type FrameworkContext = {
|
|
|
29
28
|
Image: ImageComponent;
|
|
30
29
|
Link: LinkComponent;
|
|
31
30
|
};
|
|
32
|
-
export declare const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export declare
|
|
36
|
-
export declare const FrameworkContext: import("react").Context<FrameworkContext>;
|
|
31
|
+
export declare const FrameworkContextProvider: ({ value, children, }: PropsWithChildren<{
|
|
32
|
+
value: Partial<FrameworkContext>;
|
|
33
|
+
}>) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function useFrameworkContext(): FrameworkContext;
|
|
37
35
|
export {};
|
|
38
36
|
//# sourceMappingURL=framework-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-context.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/components/framework-context.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"framework-context.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/components/framework-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EACf,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EAKnB,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAI9C,KAAK,aAAa,GAAG,CAAC,KAAK,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,KAAK,SAAS,CAAA;AAClE,KAAK,WAAW,GAAG,CAAC,KAAK,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,KAAK,SAAS,CAAA;AAC7D,KAAK,cAAc,GAAG,CAAC,KAAK,EAAE;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,KAAK,SAAS,CAAA;AAEf,KAAK,SAAS,GAAG,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,GAAG;IAChE,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,OAAO,CAAA;CAC5D,CAAA;AAED,KAAK,aAAa,GAAG,yBAAyB,CAAC,aAAa,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAC,CAAA;AAE5F,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,aAAa,CAAA;IACnB,WAAW,EAAE,WAAW,CAAA;IACxB,KAAK,EAAE,cAAc,CAAA;IACrB,IAAI,EAAE,aAAa,CAAA;CACpB,CAAA;AA8BD,eAAO,MAAM,wBAAwB,GAAI,sBAGtC,iBAAiB,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;CAAE,CAAC,4CAKzD,CAAA;AASD,wBAAgB,mBAAmB,IAAI,gBAAgB,CAEtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-framework-context.d.ts","sourceRoot":"","sources":["../../../../../../src/runtimes/react/components/hooks/use-framework-context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-framework-context.d.ts","sourceRoot":"","sources":["../../../../../../src/runtimes/react/components/hooks/use-framework-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA"}
|