@makeswift/runtime 0.21.0 → 0.21.1
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/next/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/runtimes/react/react-runtime.js.map +1 -1
- package/dist/esm/next/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/runtimes/react/react-runtime.js.map +1 -1
- package/dist/types/runtimes/react/__tests__/react-runtime.test.d.ts +2 -0
- package/dist/types/runtimes/react/__tests__/react-runtime.test.d.ts.map +1 -0
- package/dist/types/runtimes/react/react-runtime.d.ts +4 -3
- package/dist/types/runtimes/react/react-runtime.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -36,7 +36,7 @@ async function handler(...args) {
|
|
|
36
36
|
const supportsPreviewMode = (0, import_ts_pattern.match)(args).with(routeHandlerPattern, () => false).with(apiRoutePattern, () => true).exhaustive();
|
|
37
37
|
const supportsDraftMode = (0, import_ts_pattern.match)(args).with(routeHandlerPattern, () => true).with(apiRoutePattern, () => false).exhaustive();
|
|
38
38
|
const body = {
|
|
39
|
-
version: "0.21.
|
|
39
|
+
version: "0.21.1",
|
|
40
40
|
previewMode: supportsPreviewMode,
|
|
41
41
|
draftMode: supportsDraftMode,
|
|
42
42
|
interactionMode: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtimes/react/react-runtime.ts"],"sourcesContent":["import { registerBuiltinComponents } from '../../components/builtin/register'\n\nimport { type
|
|
1
|
+
{"version":3,"sources":["../../../../src/runtimes/react/react-runtime.ts"],"sourcesContent":["import { registerBuiltinComponents } from '../../components/builtin/register'\nimport { ControlDefinition as UnifiedControlDefinition } from '@makeswift/controls'\n\nimport { type LegacyDescriptor, type DescriptorValueType } from '../../prop-controllers/descriptors'\n\nimport { registerComponentEffect, registerReactComponentEffect } from '../../state/actions'\nimport { BreakpointsInput } from '../../state/modules/breakpoints'\nimport { ComponentIcon } from '../../state/modules/components-meta'\nimport type { ComponentType } from '../../state/react-page'\n\nimport { RuntimeCore } from './runtime-core'\n\nfunction validateComponentType(type: string, component?: ComponentType): void {\n const componentName = component?.name ?? 'Component'\n if (typeof type !== 'string' || type === '') {\n throw new Error(\n `${componentName}: A non-empty string \\`type\\` is required for component registration, got ${type}`,\n )\n }\n}\n\nexport class ReactRuntime extends RuntimeCore {\n // TODO: the static methods here are deprecated and only keep here for backward-compatibility purpose.\n // We will remove them when we release a new breaking change.\n // ------------------ Deprecated API ------------------ //\n static registerComponent<\n ControlDef extends UnifiedControlDefinition,\n P extends Record<string, LegacyDescriptor | ControlDef>,\n C extends ComponentType<{ [K in keyof P]: DescriptorValueType<P[K]> }>,\n >(\n component: C,\n {\n type,\n label,\n icon = ComponentIcon.Code,\n hidden = false,\n props,\n }: { type: string; label: string; icon?: ComponentIcon; hidden?: boolean; props?: P },\n ): () => void {\n validateComponentType(type, component as unknown as ComponentType)\n\n const unregisterComponent = this.store.dispatch(\n registerComponentEffect(type, { label, icon, hidden }, props ?? {}),\n )\n\n const unregisterReactComponent = this.store.dispatch(\n registerReactComponentEffect(type, component as unknown as ComponentType),\n )\n\n return () => {\n unregisterComponent()\n unregisterReactComponent()\n }\n }\n\n // ------------------ Deprecated API ends here ------------------ //\n\n registerComponent<\n ControlDef extends UnifiedControlDefinition,\n P extends Record<string, LegacyDescriptor | ControlDef>,\n C extends ComponentType<{ [K in keyof P]: DescriptorValueType<P[K]> }>,\n >(\n component: C,\n {\n type,\n label,\n icon = ComponentIcon.Cube,\n hidden = false,\n props,\n }: { type: string; label: string; icon?: ComponentIcon; hidden?: boolean; props?: P },\n ): () => void {\n validateComponentType(type, component as unknown as ComponentType)\n\n const unregisterComponent = this.store.dispatch(\n registerComponentEffect(type, { label, icon, hidden }, props ?? {}),\n )\n\n const unregisterReactComponent = this.store.dispatch(\n registerReactComponentEffect(type, component as unknown as ComponentType),\n )\n\n return () => {\n unregisterComponent()\n unregisterReactComponent()\n }\n }\n\n constructor({ breakpoints }: { breakpoints?: BreakpointsInput } = {}) {\n super({ breakpoints })\n\n registerBuiltinComponents(this)\n }\n}\n\n// TODO: We should delete this once we remove the static methods in ReactRuntime.\nregisterBuiltinComponents(ReactRuntime)\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA0C;AAK1C,qBAAsE;AAEtE,6BAA8B;AAG9B,0BAA4B;AAE5B,SAAS,sBAAsB,MAAc,WAAiC;AAC5E,QAAM,gBAAgB,WAAW,QAAQ;AACzC,MAAI,OAAO,SAAS,YAAY,SAAS,IAAI;AAC3C,UAAM,IAAI;AAAA,MACR,GAAG,aAAa,6EAA6E,IAAI;AAAA,IACnG;AAAA,EACF;AACF;AAEO,MAAM,qBAAqB,gCAAY;AAAA;AAAA;AAAA;AAAA,EAI5C,OAAO,kBAKL,WACA;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO,qCAAc;AAAA,IACrB,SAAS;AAAA,IACT;AAAA,EACF,GACY;AACZ,0BAAsB,MAAM,SAAqC;AAEjE,UAAM,sBAAsB,KAAK,MAAM;AAAA,UACrC,wCAAwB,MAAM,EAAE,OAAO,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC;AAAA,IACpE;AAEA,UAAM,2BAA2B,KAAK,MAAM;AAAA,UAC1C,6CAA6B,MAAM,SAAqC;AAAA,IAC1E;AAEA,WAAO,MAAM;AACX,0BAAoB;AACpB,+BAAyB;AAAA,IAC3B;AAAA,EACF;AAAA;AAAA,EAIA,kBAKE,WACA;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO,qCAAc;AAAA,IACrB,SAAS;AAAA,IACT;AAAA,EACF,GACY;AACZ,0BAAsB,MAAM,SAAqC;AAEjE,UAAM,sBAAsB,KAAK,MAAM;AAAA,UACrC,wCAAwB,MAAM,EAAE,OAAO,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC;AAAA,IACpE;AAEA,UAAM,2BAA2B,KAAK,MAAM;AAAA,UAC1C,6CAA6B,MAAM,SAAqC;AAAA,IAC1E;AAEA,WAAO,MAAM;AACX,0BAAoB;AACpB,+BAAyB;AAAA,IAC3B;AAAA,EACF;AAAA,EAEA,YAAY,EAAE,YAAY,IAAwC,CAAC,GAAG;AACpE,UAAM,EAAE,YAAY,CAAC;AAErB,mDAA0B,IAAI;AAAA,EAChC;AACF;AAAA,IAGA,2CAA0B,YAAY;","names":[]}
|
|
@@ -13,7 +13,7 @@ async function handler(...args) {
|
|
|
13
13
|
const supportsPreviewMode = match(args).with(routeHandlerPattern, () => false).with(apiRoutePattern, () => true).exhaustive();
|
|
14
14
|
const supportsDraftMode = match(args).with(routeHandlerPattern, () => true).with(apiRoutePattern, () => false).exhaustive();
|
|
15
15
|
const body = {
|
|
16
|
-
version: "0.21.
|
|
16
|
+
version: "0.21.1",
|
|
17
17
|
previewMode: supportsPreviewMode,
|
|
18
18
|
draftMode: supportsDraftMode,
|
|
19
19
|
interactionMode: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtimes/react/react-runtime.ts"],"sourcesContent":["import { registerBuiltinComponents } from '../../components/builtin/register'\n\nimport { type
|
|
1
|
+
{"version":3,"sources":["../../../../src/runtimes/react/react-runtime.ts"],"sourcesContent":["import { registerBuiltinComponents } from '../../components/builtin/register'\nimport { ControlDefinition as UnifiedControlDefinition } from '@makeswift/controls'\n\nimport { type LegacyDescriptor, type DescriptorValueType } from '../../prop-controllers/descriptors'\n\nimport { registerComponentEffect, registerReactComponentEffect } from '../../state/actions'\nimport { BreakpointsInput } from '../../state/modules/breakpoints'\nimport { ComponentIcon } from '../../state/modules/components-meta'\nimport type { ComponentType } from '../../state/react-page'\n\nimport { RuntimeCore } from './runtime-core'\n\nfunction validateComponentType(type: string, component?: ComponentType): void {\n const componentName = component?.name ?? 'Component'\n if (typeof type !== 'string' || type === '') {\n throw new Error(\n `${componentName}: A non-empty string \\`type\\` is required for component registration, got ${type}`,\n )\n }\n}\n\nexport class ReactRuntime extends RuntimeCore {\n // TODO: the static methods here are deprecated and only keep here for backward-compatibility purpose.\n // We will remove them when we release a new breaking change.\n // ------------------ Deprecated API ------------------ //\n static registerComponent<\n ControlDef extends UnifiedControlDefinition,\n P extends Record<string, LegacyDescriptor | ControlDef>,\n C extends ComponentType<{ [K in keyof P]: DescriptorValueType<P[K]> }>,\n >(\n component: C,\n {\n type,\n label,\n icon = ComponentIcon.Code,\n hidden = false,\n props,\n }: { type: string; label: string; icon?: ComponentIcon; hidden?: boolean; props?: P },\n ): () => void {\n validateComponentType(type, component as unknown as ComponentType)\n\n const unregisterComponent = this.store.dispatch(\n registerComponentEffect(type, { label, icon, hidden }, props ?? {}),\n )\n\n const unregisterReactComponent = this.store.dispatch(\n registerReactComponentEffect(type, component as unknown as ComponentType),\n )\n\n return () => {\n unregisterComponent()\n unregisterReactComponent()\n }\n }\n\n // ------------------ Deprecated API ends here ------------------ //\n\n registerComponent<\n ControlDef extends UnifiedControlDefinition,\n P extends Record<string, LegacyDescriptor | ControlDef>,\n C extends ComponentType<{ [K in keyof P]: DescriptorValueType<P[K]> }>,\n >(\n component: C,\n {\n type,\n label,\n icon = ComponentIcon.Cube,\n hidden = false,\n props,\n }: { type: string; label: string; icon?: ComponentIcon; hidden?: boolean; props?: P },\n ): () => void {\n validateComponentType(type, component as unknown as ComponentType)\n\n const unregisterComponent = this.store.dispatch(\n registerComponentEffect(type, { label, icon, hidden }, props ?? {}),\n )\n\n const unregisterReactComponent = this.store.dispatch(\n registerReactComponentEffect(type, component as unknown as ComponentType),\n )\n\n return () => {\n unregisterComponent()\n unregisterReactComponent()\n }\n }\n\n constructor({ breakpoints }: { breakpoints?: BreakpointsInput } = {}) {\n super({ breakpoints })\n\n registerBuiltinComponents(this)\n }\n}\n\n// TODO: We should delete this once we remove the static methods in ReactRuntime.\nregisterBuiltinComponents(ReactRuntime)\n"],"mappings":"AAAA,SAAS,iCAAiC;AAK1C,SAAS,yBAAyB,oCAAoC;AA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F;AAGA,0BAA0B,YAAY;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-runtime.test.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/__tests__/react-runtime.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ControlDefinition as UnifiedControlDefinition } from '@makeswift/controls';
|
|
2
|
+
import { type LegacyDescriptor, type DescriptorValueType } from '../../prop-controllers/descriptors';
|
|
2
3
|
import { BreakpointsInput } from '../../state/modules/breakpoints';
|
|
3
4
|
import { ComponentIcon } from '../../state/modules/components-meta';
|
|
4
5
|
import type { ComponentType } from '../../state/react-page';
|
|
5
6
|
import { RuntimeCore } from './runtime-core';
|
|
6
7
|
export declare class ReactRuntime extends RuntimeCore {
|
|
7
|
-
static registerComponent<P extends Record<string,
|
|
8
|
+
static registerComponent<ControlDef extends UnifiedControlDefinition, P extends Record<string, LegacyDescriptor | ControlDef>, C extends ComponentType<{
|
|
8
9
|
[K in keyof P]: DescriptorValueType<P[K]>;
|
|
9
10
|
}>>(component: C, { type, label, icon, hidden, props, }: {
|
|
10
11
|
type: string;
|
|
@@ -13,7 +14,7 @@ export declare class ReactRuntime extends RuntimeCore {
|
|
|
13
14
|
hidden?: boolean;
|
|
14
15
|
props?: P;
|
|
15
16
|
}): () => void;
|
|
16
|
-
registerComponent<P extends Record<string,
|
|
17
|
+
registerComponent<ControlDef extends UnifiedControlDefinition, P extends Record<string, LegacyDescriptor | ControlDef>, C extends ComponentType<{
|
|
17
18
|
[K in keyof P]: DescriptorValueType<P[K]>;
|
|
18
19
|
}>>(component: C, { type, label, icon, hidden, props, }: {
|
|
19
20
|
type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-runtime.d.ts","sourceRoot":"","sources":["../../../../src/runtimes/react/react-runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react-runtime.d.ts","sourceR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