@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
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ElementData } from '../../../state/read-only-state';
|
|
3
|
+
export declare function ResolveProps({ element, children: renderComponent, }: {
|
|
4
|
+
element: ElementData;
|
|
5
|
+
children: (props: Record<string, unknown>) => ReactNode;
|
|
6
|
+
}): ReactNode;
|
|
7
|
+
//# sourceMappingURL=resolve-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-props.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/components/resolve-props.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAOjE,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,QAAQ,EAAE,eAAe,GAC1B,EAAE;IACD,OAAO,EAAE,WAAW,CAAA;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,SAAS,CAAA;CACxD,GAAG,SAAS,CAaZ"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ControlDefinition } from '@makeswift/controls';
|
|
2
|
+
import { type LegacyDescriptor } from '../../../prop-controllers/descriptors';
|
|
3
|
+
export declare function useControlDefs({ elementType, }: {
|
|
4
|
+
elementType: string;
|
|
5
|
+
}): readonly [Record<string, LegacyDescriptor>, Record<string, ControlDefinition>];
|
|
6
|
+
//# sourceMappingURL=use-control-defs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-control-defs.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/hooks/use-control-defs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAKvD,OAAO,EAAE,KAAK,gBAAgB,EAAsB,MAAM,uCAAuC,CAAA;AAIjG,wBAAgB,cAAc,CAAC,EAC7B,WAAW,GACZ,EAAE;IACD,WAAW,EAAE,MAAM,CAAA;CACpB,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAIjF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type SerializableReplacementContext } from '@makeswift/controls';
|
|
2
2
|
import { type HttpFetch } from '../../api/types';
|
|
3
3
|
import { type SiteVersion } from '../../api/site-version';
|
|
4
|
-
import { Breakpoints, BreakpointsInput } from '../../state/modules/breakpoints';
|
|
4
|
+
import { type Breakpoints, type BreakpointsInput } from '../../state/modules/breakpoints';
|
|
5
5
|
import { type Element, type ElementData } from '../../state/read-only-state';
|
|
6
6
|
import { type ProtoStore, type Store } from '../../state/store';
|
|
7
7
|
export type StoreKey = {
|
|
@@ -10,14 +10,16 @@ export type StoreKey = {
|
|
|
10
10
|
};
|
|
11
11
|
export declare class RuntimeCore {
|
|
12
12
|
private readonly activeStores;
|
|
13
|
+
private readonly apiKey;
|
|
13
14
|
readonly protoStore: ProtoStore;
|
|
14
15
|
readonly appOrigin: string;
|
|
15
16
|
readonly apiOrigin: string;
|
|
16
17
|
readonly requestKey: StoreKey | undefined;
|
|
17
18
|
readonly fetch: HttpFetch;
|
|
18
|
-
constructor({ appOrigin, apiOrigin, breakpoints, requestKey, fetch, }: {
|
|
19
|
+
constructor({ appOrigin, apiOrigin, apiKey, breakpoints, requestKey, fetch, }: {
|
|
19
20
|
appOrigin?: string;
|
|
20
21
|
apiOrigin?: string;
|
|
22
|
+
apiKey?: string;
|
|
21
23
|
breakpoints?: BreakpointsInput;
|
|
22
24
|
requestKey?: StoreKey;
|
|
23
25
|
fetch: HttpFetch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-core.d.ts","sourceRoot":"","sources":["../../../../src/runtimes/react/runtime-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"runtime-core.d.ts","sourceRoot":"","sources":["../../../../src/runtimes/react/runtime-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,qBAAqB,CAAA;AAKzE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEzD,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EAEtB,MAAM,iCAAiC,CAAA;AAIxC,OAAO,EAAkB,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC5F,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,KAAK,EACX,MAAM,mBAAmB,CAAA;AAK1B,MAAM,MAAM,QAAQ,GAAG;IACrB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAA;IAC/B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3B,CAAA;AAID,qBAAa,WAAW;IAKtB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAM3B;IAEF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAE3C,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAA;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAA;IACzC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;gBAEb,EACV,SAAuC,EACvC,SAAuC,EACvC,MAAM,EACN,WAAW,EACX,UAAU,EACV,KAAK,GACN,EAAE;QACD,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,WAAW,CAAC,EAAE,gBAAgB,CAAA;QAC9B,UAAU,CAAC,EAAE,QAAQ,CAAA;QACrB,KAAK,EAAE,SAAS,CAAA;KACjB;IAaD,gBAAgB,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,QAAQ,GAAG,KAAK;IA+B1D,WAAW,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAalE,YAAY,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAanE,eAAe,CACb,WAAW,EAAE,WAAW,EACxB,kBAAkB,EAAE,8BAA8B,GACjD,OAAO;IAIV,cAAc,IAAI,WAAW;IAI7B,IAAI,kBAAkB,IAAI,MAAM,CAE/B;IAED,OAAO,CAAC,wBAAwB;IAoBhC,OAAO,CAAC,wBAAwB;CAKjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/fixtures/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/fixtures/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snippet.d.ts","sourceRoot":"","sources":["../../../../src/testing/fixtures/snippet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,eAAO,MAAM,aAAa,GAAI,cAAc;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,KAAG,OAOzE,CAAA"}
|
|
@@ -6,7 +6,7 @@ export { toApiRequest, pipeResponseTo } from '../api-handler/node-request-respon
|
|
|
6
6
|
export { MAKESWIFT_SITE_VERSION_COOKIE, SearchParams } from '../api-handler/preview';
|
|
7
7
|
export { MakeswiftClient } from '../client';
|
|
8
8
|
export { type BreakpointsInput as Breakpoints } from '../state/modules/breakpoints';
|
|
9
|
-
export { FrameworkContext,
|
|
9
|
+
export { type FrameworkContext, FrameworkContextProvider, } from '../runtimes/react/components/framework-context';
|
|
10
10
|
export { MakeswiftComponent } from '../runtimes/react/components/MakeswiftComponent';
|
|
11
11
|
export { Page } from '../runtimes/react/components/page';
|
|
12
12
|
export { RuntimeProvider } from '../runtimes/react/components/RuntimeProvider';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/unstable-framework-support/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,KAAK,+BAA+B,GACrC,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAChF,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAClG,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AACnF,OAAO,EAAE,6BAA6B,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAEpF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C,OAAO,EAAE,KAAK,gBAAgB,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAEnF,OAAO,EACL,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/unstable-framework-support/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,iCAAiC,GAClC,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,KAAK,oBAAoB,EACzB,gBAAgB,EAChB,KAAK,+BAA+B,GACrC,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAChF,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAClG,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AACnF,OAAO,EAAE,6BAA6B,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAEpF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAE3C,OAAO,EAAE,KAAK,gBAAgB,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAEnF,OAAO,EACL,KAAK,gBAAgB,EACrB,wBAAwB,GACzB,MAAM,gDAAgD,CAAA;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAA;AACpF,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAA;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAA;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAA;AAE5E,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,wBAAwB,EACxB,YAAY,EACZ,WAAW,EACX,KAAK,cAAc,GACpB,MAAM,uCAAuC,CAAA;AAE9C,OAAO,EAAE,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,iCAAiC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makeswift/runtime",
|
|
3
|
-
"version": "0.28.8-canary.
|
|
3
|
+
"version": "0.28.8-canary.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "makeswift/makeswift",
|
|
@@ -239,8 +239,8 @@
|
|
|
239
239
|
"uuid": "^9.0.0",
|
|
240
240
|
"zod": "^3.21.4",
|
|
241
241
|
"@makeswift/controls": "0.1.20",
|
|
242
|
-
"@makeswift/
|
|
243
|
-
"@makeswift/
|
|
242
|
+
"@makeswift/next-plugin": "0.6.1",
|
|
243
|
+
"@makeswift/prop-controllers": "0.4.14"
|
|
244
244
|
},
|
|
245
245
|
"devDependencies": {
|
|
246
246
|
"@emotion/jest": "^11.11.0",
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var controls_exports = {};
|
|
30
|
-
__export(controls_exports, {
|
|
31
|
-
ResolveProps: () => ResolveProps
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(controls_exports);
|
|
34
|
-
var import_react = require("react");
|
|
35
|
-
var import_partition = require("../../utils/partition");
|
|
36
|
-
var State = __toESM(require("../../state/read-only-state"));
|
|
37
|
-
var import_descriptors = require("../../prop-controllers/descriptors");
|
|
38
|
-
var import_use_store = require("./hooks/use-store");
|
|
39
|
-
var import_legacy_controls = require("./legacy-controls");
|
|
40
|
-
var import_use_resolved_props = require("./hooks/use-resolved-props");
|
|
41
|
-
function useControlDefs(elementType) {
|
|
42
|
-
const store = (0, import_use_store.useStore)();
|
|
43
|
-
const all = State.getComponentPropControllerDescriptors(store.getState(), elementType) ?? {};
|
|
44
|
-
return (0, import_react.useRef)((0, import_partition.partitionRecord)(all, import_descriptors.isLegacyDescriptor)).current;
|
|
45
|
-
}
|
|
46
|
-
function ResolveProps({ element, children: renderComponent }) {
|
|
47
|
-
const [legacyDescriptors, definitions] = useControlDefs(element.type);
|
|
48
|
-
const resolvedProps = (0, import_use_resolved_props.useResolvedProps)(definitions, element.props, element.key);
|
|
49
|
-
const renderFn = Object.entries(legacyDescriptors).reduceRight(
|
|
50
|
-
(renderFn2, [propName, descriptor]) => (props) => (0, import_legacy_controls.resolveLegacyDescriptorProp)(descriptor, propName, element.props[propName], props, renderFn2),
|
|
51
|
-
renderComponent
|
|
52
|
-
);
|
|
53
|
-
return renderFn(resolvedProps);
|
|
54
|
-
}
|
|
55
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
-
0 && (module.exports = {
|
|
57
|
-
ResolveProps
|
|
58
|
-
});
|
|
59
|
-
//# sourceMappingURL=controls.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtimes/react/controls.tsx"],"sourcesContent":["import { useRef, ReactNode } from 'react'\n\nimport { ControlDefinition } from '@makeswift/controls'\n\nimport { partitionRecord } from '../../utils/partition'\n\nimport * as State from '../../state/read-only-state'\nimport { isLegacyDescriptor, LegacyDescriptor } from '../../prop-controllers/descriptors'\n\nimport { useStore } from './hooks/use-store'\n\nimport { resolveLegacyDescriptorProp } from './legacy-controls'\nimport { useResolvedProps } from './hooks/use-resolved-props'\n\ntype PropsValueProps = {\n element: State.ElementData\n children(props: Record<string, unknown>): ReactNode\n}\n\nfunction useControlDefs(\n elementType: string,\n): readonly [Record<string, LegacyDescriptor>, Record<string, ControlDefinition>] {\n const store = useStore()\n const all = State.getComponentPropControllerDescriptors(store.getState(), elementType) ?? {}\n return useRef(partitionRecord(all, isLegacyDescriptor)).current\n}\n\nexport function ResolveProps({ element, children: renderComponent }: PropsValueProps): ReactNode {\n const [legacyDescriptors, definitions] = useControlDefs(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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkC;AAIlC,uBAAgC;AAEhC,YAAuB;AACvB,yBAAqD;AAErD,uBAAyB;AAEzB,6BAA4C;AAC5C,gCAAiC;AAOjC,SAAS,eACP,aACgF;AAChF,QAAM,YAAQ,2BAAS;AACvB,QAAM,MAAM,MAAM,sCAAsC,MAAM,SAAS,GAAG,WAAW,KAAK,CAAC;AAC3F,aAAO,yBAAO,kCAAgB,KAAK,qCAAkB,CAAC,EAAE;AAC1D;AAEO,SAAS,aAAa,EAAE,SAAS,UAAU,gBAAgB,GAA+B;AAC/F,QAAM,CAAC,mBAAmB,WAAW,IAAI,eAAe,QAAQ,IAAI;AAEpE,QAAM,oBAAgB,4CAAiB,aAAa,QAAQ,OAAO,QAAQ,GAAG;AAE9E,QAAM,WAAW,OAAO,QAAQ,iBAAiB,EAAE;AAAA,IACjD,CAACA,WAAU,CAAC,UAAU,UAAU,MAC9B,eACE,oDAA4B,YAAY,UAAU,QAAQ,MAAM,QAAQ,GAAG,OAAOA,SAAQ;AAAA,IAC9F;AAAA,EACF;AAEA,SAAO,SAAS,aAAa;AAC/B;","names":["renderFn"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { useRef } from "react";
|
|
2
|
-
import { partitionRecord } from "../../utils/partition";
|
|
3
|
-
import * as State from "../../state/read-only-state";
|
|
4
|
-
import { isLegacyDescriptor } from "../../prop-controllers/descriptors";
|
|
5
|
-
import { useStore } from "./hooks/use-store";
|
|
6
|
-
import { resolveLegacyDescriptorProp } from "./legacy-controls";
|
|
7
|
-
import { useResolvedProps } from "./hooks/use-resolved-props";
|
|
8
|
-
function useControlDefs(elementType) {
|
|
9
|
-
const store = useStore();
|
|
10
|
-
const all = State.getComponentPropControllerDescriptors(store.getState(), elementType) ?? {};
|
|
11
|
-
return useRef(partitionRecord(all, isLegacyDescriptor)).current;
|
|
12
|
-
}
|
|
13
|
-
function ResolveProps({ element, children: renderComponent }) {
|
|
14
|
-
const [legacyDescriptors, definitions] = useControlDefs(element.type);
|
|
15
|
-
const resolvedProps = useResolvedProps(definitions, element.props, element.key);
|
|
16
|
-
const renderFn = Object.entries(legacyDescriptors).reduceRight(
|
|
17
|
-
(renderFn2, [propName, descriptor]) => (props) => resolveLegacyDescriptorProp(descriptor, propName, element.props[propName], props, renderFn2),
|
|
18
|
-
renderComponent
|
|
19
|
-
);
|
|
20
|
-
return renderFn(resolvedProps);
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
ResolveProps
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=controls.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtimes/react/controls.tsx"],"sourcesContent":["import { useRef, ReactNode } from 'react'\n\nimport { ControlDefinition } from '@makeswift/controls'\n\nimport { partitionRecord } from '../../utils/partition'\n\nimport * as State from '../../state/read-only-state'\nimport { isLegacyDescriptor, LegacyDescriptor } from '../../prop-controllers/descriptors'\n\nimport { useStore } from './hooks/use-store'\n\nimport { resolveLegacyDescriptorProp } from './legacy-controls'\nimport { useResolvedProps } from './hooks/use-resolved-props'\n\ntype PropsValueProps = {\n element: State.ElementData\n children(props: Record<string, unknown>): ReactNode\n}\n\nfunction useControlDefs(\n elementType: string,\n): readonly [Record<string, LegacyDescriptor>, Record<string, ControlDefinition>] {\n const store = useStore()\n const all = State.getComponentPropControllerDescriptors(store.getState(), elementType) ?? {}\n return useRef(partitionRecord(all, isLegacyDescriptor)).current\n}\n\nexport function ResolveProps({ element, children: renderComponent }: PropsValueProps): ReactNode {\n const [legacyDescriptors, definitions] = useControlDefs(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":"AAAA,SAAS,cAAyB;AAIlC,SAAS,uBAAuB;AAEhC,YAAY,WAAW;AACvB,SAAS,0BAA4C;AAErD,SAAS,gBAAgB;AAEzB,SAAS,mCAAmC;AAC5C,SAAS,wBAAwB;AAOjC,SAAS,eACP,aACgF;AAChF,QAAM,QAAQ,SAAS;AACvB,QAAM,MAAM,MAAM,sCAAsC,MAAM,SAAS,GAAG,WAAW,KAAK,CAAC;AAC3F,SAAO,OAAO,gBAAgB,KAAK,kBAAkB,CAAC,EAAE;AAC1D;AAEO,SAAS,aAAa,EAAE,SAAS,UAAU,gBAAgB,GAA+B;AAC/F,QAAM,CAAC,mBAAmB,WAAW,IAAI,eAAe,QAAQ,IAAI;AAEpE,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"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import * as State from '../../state/read-only-state';
|
|
3
|
-
type PropsValueProps = {
|
|
4
|
-
element: State.ElementData;
|
|
5
|
-
children(props: Record<string, unknown>): ReactNode;
|
|
6
|
-
};
|
|
7
|
-
export declare function ResolveProps({ element, children: renderComponent }: PropsValueProps): ReactNode;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=controls.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../../src/runtimes/react/controls.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,SAAS,EAAE,MAAM,OAAO,CAAA;AAMzC,OAAO,KAAK,KAAK,MAAM,6BAA6B,CAAA;AAQpD,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,KAAK,CAAC,WAAW,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;CACpD,CAAA;AAUD,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE,eAAe,GAAG,SAAS,CAa/F"}
|