@makeswift/runtime 0.28.8-canary.20 → 0.28.8-canary.22
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/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/controls/slot.js.map +1 -1
- package/dist/cjs/runtimes/react/controls/node-value/editable-node-value.js +42 -0
- package/dist/cjs/runtimes/react/controls/node-value/editable-node-value.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/node-value/index.js +51 -0
- package/dist/cjs/runtimes/react/controls/node-value/index.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/slot/index.js +29 -0
- package/dist/cjs/runtimes/react/controls/slot/index.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/slot/render-slot.js +37 -0
- package/dist/cjs/runtimes/react/controls/slot/render-slot.js.map +1 -0
- package/dist/cjs/runtimes/react/controls/{slot.js → slot/slot-value.js} +31 -26
- package/dist/cjs/runtimes/react/controls/slot/slot-value.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-resolved-value-override.js +58 -0
- package/dist/cjs/runtimes/react/hooks/use-resolved-value-override.js.map +1 -0
- package/dist/cjs/runtimes/react/hooks/use-selector.js +8 -2
- package/dist/cjs/runtimes/react/hooks/use-selector.js.map +1 -1
- package/dist/cjs/state/actions/internal/read-write-action-types.js +2 -0
- package/dist/cjs/state/actions/internal/read-write-action-types.js.map +1 -1
- package/dist/cjs/state/actions/internal/read-write-actions.js +16 -0
- package/dist/cjs/state/actions/internal/read-write-actions.js.map +1 -1
- package/dist/cjs/state/modules/read-write/resolved-value-overrides.js +70 -0
- package/dist/cjs/state/modules/read-write/resolved-value-overrides.js.map +1 -0
- package/dist/cjs/state/read-write-state.js +24 -1
- package/dist/cjs/state/read-write-state.js.map +1 -1
- package/dist/esm/api/graphql-api-client.js +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/controls/slot.js.map +1 -1
- package/dist/esm/runtimes/react/controls/node-value/editable-node-value.js +21 -0
- package/dist/esm/runtimes/react/controls/node-value/editable-node-value.js.map +1 -0
- package/dist/esm/runtimes/react/controls/node-value/index.js +17 -0
- package/dist/esm/runtimes/react/controls/node-value/index.js.map +1 -0
- package/dist/esm/runtimes/react/controls/slot/index.js +5 -0
- package/dist/esm/runtimes/react/controls/slot/index.js.map +1 -0
- package/dist/esm/runtimes/react/controls/slot/render-slot.js +13 -0
- package/dist/esm/runtimes/react/controls/slot/render-slot.js.map +1 -0
- package/dist/esm/runtimes/react/controls/{slot.js → slot/slot-value.js} +34 -23
- package/dist/esm/runtimes/react/controls/slot/slot-value.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-resolved-value-override.js +35 -0
- package/dist/esm/runtimes/react/hooks/use-resolved-value-override.js.map +1 -0
- package/dist/esm/runtimes/react/hooks/use-selector.js +8 -2
- package/dist/esm/runtimes/react/hooks/use-selector.js.map +1 -1
- package/dist/esm/state/actions/internal/read-write-action-types.js +2 -0
- package/dist/esm/state/actions/internal/read-write-action-types.js.map +1 -1
- package/dist/esm/state/actions/internal/read-write-actions.js +14 -0
- package/dist/esm/state/actions/internal/read-write-actions.js.map +1 -1
- package/dist/esm/state/modules/read-write/resolved-value-overrides.js +43 -0
- package/dist/esm/state/modules/read-write/resolved-value-overrides.js.map +1 -0
- package/dist/esm/state/read-write-state.js +22 -1
- package/dist/esm/state/read-write-state.js.map +1 -1
- package/dist/types/controls/slot.d.ts +1 -1
- package/dist/types/controls/slot.d.ts.map +1 -1
- package/dist/types/runtimes/react/controls/node-value/editable-node-value.d.ts +7 -0
- package/dist/types/runtimes/react/controls/node-value/editable-node-value.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/node-value/index.d.ts +6 -0
- package/dist/types/runtimes/react/controls/node-value/index.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/slot/index.d.ts +2 -0
- package/dist/types/runtimes/react/controls/slot/index.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/slot/render-slot.d.ts +9 -0
- package/dist/types/runtimes/react/controls/slot/render-slot.d.ts.map +1 -0
- package/dist/types/runtimes/react/controls/{slot.d.ts → slot/slot-value.d.ts} +7 -7
- package/dist/types/runtimes/react/controls/slot/slot-value.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-resolved-value-override.d.ts +5 -0
- package/dist/types/runtimes/react/hooks/use-resolved-value-override.d.ts.map +1 -0
- package/dist/types/runtimes/react/hooks/use-selector.d.ts +2 -5
- package/dist/types/runtimes/react/hooks/use-selector.d.ts.map +1 -1
- package/dist/types/state/actions/index.d.ts +2 -0
- package/dist/types/state/actions/index.d.ts.map +1 -1
- package/dist/types/state/actions/internal/action-types.d.ts +2 -0
- package/dist/types/state/actions/internal/action-types.d.ts.map +1 -1
- package/dist/types/state/actions/internal/read-write-action-types.d.ts +2 -0
- package/dist/types/state/actions/internal/read-write-action-types.d.ts.map +1 -1
- package/dist/types/state/actions/internal/read-write-actions.d.ts +19 -1
- package/dist/types/state/actions/internal/read-write-actions.d.ts.map +1 -1
- package/dist/types/state/modules/read-write/resolved-value-overrides.d.ts +15 -0
- package/dist/types/state/modules/read-write/resolved-value-overrides.d.ts.map +1 -0
- package/dist/types/state/read-write-state.d.ts +7 -0
- package/dist/types/state/read-write-state.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/runtimes/react/controls/slot.js.map +0 -1
- package/dist/esm/runtimes/react/controls/slot.js.map +0 -1
- package/dist/types/runtimes/react/controls/slot.d.ts.map +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { isKnownAction } from "../../actions";
|
|
2
|
+
import { ReadWriteActionTypes } from "../../actions/internal/read-write-action-types";
|
|
3
|
+
function getInitialState() {
|
|
4
|
+
return { overrides: /* @__PURE__ */ new Map() };
|
|
5
|
+
}
|
|
6
|
+
const compositeKey = ({ elementKey, propPath }) => `${elementKey}@${propPath}`;
|
|
7
|
+
function hasValueOverride(state, documentKey, instanceKey) {
|
|
8
|
+
return state.overrides.get(documentKey)?.has(compositeKey(instanceKey)) ?? false;
|
|
9
|
+
}
|
|
10
|
+
function getValueOverride(state, documentKey, instanceKey) {
|
|
11
|
+
return state.overrides.get(documentKey)?.get(compositeKey(instanceKey));
|
|
12
|
+
}
|
|
13
|
+
function reducer(state = getInitialState(), action) {
|
|
14
|
+
if (!isKnownAction(action))
|
|
15
|
+
return state;
|
|
16
|
+
switch (action.type) {
|
|
17
|
+
case ReadWriteActionTypes.SET_RESOLVED_VALUE_OVERRIDE: {
|
|
18
|
+
const { documentKey, instanceKey, value } = action.payload;
|
|
19
|
+
return {
|
|
20
|
+
...state,
|
|
21
|
+
overrides: new Map(state.overrides).set(
|
|
22
|
+
documentKey,
|
|
23
|
+
new Map(state.overrides.get(documentKey) ?? []).set(compositeKey(instanceKey), value)
|
|
24
|
+
)
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
case ReadWriteActionTypes.CLEAR_RESOLVED_VALUE_OVERRIDE: {
|
|
28
|
+
const { documentKey, instanceKey } = action.payload;
|
|
29
|
+
const nextOverrides = new Map(state.overrides.get(documentKey) ?? []);
|
|
30
|
+
const deleted = nextOverrides.delete(compositeKey(instanceKey));
|
|
31
|
+
return deleted ? { ...state, overrides: new Map(state.overrides).set(documentKey, nextOverrides) } : state;
|
|
32
|
+
}
|
|
33
|
+
default:
|
|
34
|
+
return state;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
getInitialState,
|
|
39
|
+
getValueOverride,
|
|
40
|
+
hasValueOverride,
|
|
41
|
+
reducer
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=resolved-value-overrides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/state/modules/read-write/resolved-value-overrides.ts"],"sourcesContent":["import { type ControlInstanceKey } from '@makeswift/controls'\n\nimport { type Action, type UnknownAction, isKnownAction } from '../../actions'\nimport { ReadWriteActionTypes } from '../../actions/internal/read-write-action-types'\n\nimport { Branded } from '../../../utils/branded'\n\nexport type ResolvedValueKey = ControlInstanceKey\nexport type ResolvedValue = unknown\n\ntype CompositeKey = Branded<string, 'CompositeResolvedValueKey'>\n\nexport type State = {\n overrides: Map<string, Map<CompositeKey, ResolvedValue>>\n}\n\nexport function getInitialState(): State {\n return { overrides: new Map() }\n}\n\nconst compositeKey = ({ elementKey, propPath }: ResolvedValueKey): CompositeKey =>\n `${elementKey}@${propPath}` as CompositeKey\n\nexport function hasValueOverride(\n state: State,\n documentKey: string,\n instanceKey: ResolvedValueKey,\n): boolean {\n return state.overrides.get(documentKey)?.has(compositeKey(instanceKey)) ?? false\n}\n\nexport function getValueOverride(\n state: State,\n documentKey: string,\n instanceKey: ResolvedValueKey,\n): ResolvedValue {\n return state.overrides.get(documentKey)?.get(compositeKey(instanceKey))\n}\n\nexport function reducer(state: State = getInitialState(), action: Action | UnknownAction) {\n if (!isKnownAction(action)) return state\n\n switch (action.type) {\n case ReadWriteActionTypes.SET_RESOLVED_VALUE_OVERRIDE: {\n const { documentKey, instanceKey, value } = action.payload\n return {\n ...state,\n overrides: new Map(state.overrides).set(\n documentKey,\n new Map(state.overrides.get(documentKey) ?? []).set(compositeKey(instanceKey), value),\n ),\n }\n }\n\n case ReadWriteActionTypes.CLEAR_RESOLVED_VALUE_OVERRIDE: {\n const { documentKey, instanceKey } = action.payload\n const nextOverrides = new Map(state.overrides.get(documentKey) ?? [])\n\n const deleted = nextOverrides.delete(compositeKey(instanceKey))\n return deleted\n ? { ...state, overrides: new Map(state.overrides).set(documentKey, nextOverrides) }\n : state\n }\n\n default:\n return state\n }\n}\n"],"mappings":"AAEA,SAA0C,qBAAqB;AAC/D,SAAS,4BAA4B;AAa9B,SAAS,kBAAyB;AACvC,SAAO,EAAE,WAAW,oBAAI,IAAI,EAAE;AAChC;AAEA,MAAM,eAAe,CAAC,EAAE,YAAY,SAAS,MAC3C,GAAG,UAAU,IAAI,QAAQ;AAEpB,SAAS,iBACd,OACA,aACA,aACS;AACT,SAAO,MAAM,UAAU,IAAI,WAAW,GAAG,IAAI,aAAa,WAAW,CAAC,KAAK;AAC7E;AAEO,SAAS,iBACd,OACA,aACA,aACe;AACf,SAAO,MAAM,UAAU,IAAI,WAAW,GAAG,IAAI,aAAa,WAAW,CAAC;AACxE;AAEO,SAAS,QAAQ,QAAe,gBAAgB,GAAG,QAAgC;AACxF,MAAI,CAAC,cAAc,MAAM;AAAG,WAAO;AAEnC,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK,qBAAqB,6BAA6B;AACrD,YAAM,EAAE,aAAa,aAAa,MAAM,IAAI,OAAO;AACnD,aAAO;AAAA,QACL,GAAG;AAAA,QACH,WAAW,IAAI,IAAI,MAAM,SAAS,EAAE;AAAA,UAClC;AAAA,UACA,IAAI,IAAI,MAAM,UAAU,IAAI,WAAW,KAAK,CAAC,CAAC,EAAE,IAAI,aAAa,WAAW,GAAG,KAAK;AAAA,QACtF;AAAA,MACF;AAAA,IACF;AAAA,IAEA,KAAK,qBAAqB,+BAA+B;AACvD,YAAM,EAAE,aAAa,YAAY,IAAI,OAAO;AAC5C,YAAM,gBAAgB,IAAI,IAAI,MAAM,UAAU,IAAI,WAAW,KAAK,CAAC,CAAC;AAEpE,YAAM,UAAU,cAAc,OAAO,aAAa,WAAW,CAAC;AAC9D,aAAO,UACH,EAAE,GAAG,OAAO,WAAW,IAAI,IAAI,MAAM,SAAS,EAAE,IAAI,aAAa,aAAa,EAAE,IAChF;AAAA,IACN;AAAA,IAEA;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
|
|
@@ -4,6 +4,7 @@ import * as BoxModels from "./modules/read-write/box-models";
|
|
|
4
4
|
import * as Pointer from "./modules/read-write/pointer";
|
|
5
5
|
import * as PropControllers from "./modules/read-write/prop-controllers";
|
|
6
6
|
import * as ElementImperativeHandles from "./modules/read-write/element-imperative-handles";
|
|
7
|
+
import * as ResolvedValueOverrides from "./modules/read-write/resolved-value-overrides";
|
|
7
8
|
import * as ReadOnlyState from "./read-only-state";
|
|
8
9
|
import { createBox, getBox, parse } from "./modules/read-write/box-models";
|
|
9
10
|
const reducers = {
|
|
@@ -12,7 +13,8 @@ const reducers = {
|
|
|
12
13
|
boxModels: BoxModels.reducer,
|
|
13
14
|
pointer: Pointer.reducer,
|
|
14
15
|
propControllers: PropControllers.reducer,
|
|
15
|
-
elementImperativeHandles: ElementImperativeHandles.reducer
|
|
16
|
+
elementImperativeHandles: ElementImperativeHandles.reducer,
|
|
17
|
+
resolvedValueOverrides: ResolvedValueOverrides.reducer
|
|
16
18
|
};
|
|
17
19
|
function createRootReducer() {
|
|
18
20
|
return combineReducers(reducers);
|
|
@@ -90,6 +92,23 @@ function getPropController(state, {
|
|
|
90
92
|
propName
|
|
91
93
|
);
|
|
92
94
|
}
|
|
95
|
+
function getResolvedValueOverridesStateSlice(state) {
|
|
96
|
+
return state.resolvedValueOverrides;
|
|
97
|
+
}
|
|
98
|
+
function hasResolvedValueOverride(state, documentKey, instanceKey) {
|
|
99
|
+
return ResolvedValueOverrides.hasValueOverride(
|
|
100
|
+
getResolvedValueOverridesStateSlice(state),
|
|
101
|
+
documentKey,
|
|
102
|
+
instanceKey
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
function getResolvedValueOverride(state, documentKey, instanceKey) {
|
|
106
|
+
return ResolvedValueOverrides.getValueOverride(
|
|
107
|
+
getResolvedValueOverridesStateSlice(state),
|
|
108
|
+
documentKey,
|
|
109
|
+
instanceKey
|
|
110
|
+
);
|
|
111
|
+
}
|
|
93
112
|
function setupBuilderProxy(builderProxy) {
|
|
94
113
|
return (dispatch) => {
|
|
95
114
|
return builderProxy.setup({ onHostAction: (action) => dispatch(action) });
|
|
@@ -110,6 +129,8 @@ export {
|
|
|
110
129
|
getPropController,
|
|
111
130
|
getPropControllers,
|
|
112
131
|
getPropControllersHandle,
|
|
132
|
+
getResolvedValueOverride,
|
|
133
|
+
hasResolvedValueOverride,
|
|
113
134
|
parse,
|
|
114
135
|
setupBuilderProxy
|
|
115
136
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/state/read-write-state.ts"],"sourcesContent":["import { combineReducers, type ThunkAction, type ThunkDispatch } from '@reduxjs/toolkit'\n\nimport * as Documents from './modules/read-write/read-write-documents'\nimport * as BoxModels from './modules/read-write/box-models'\nimport * as Pointer from './modules/read-write/pointer'\nimport * as PropControllers from './modules/read-write/prop-controllers'\nimport * as ElementImperativeHandles from './modules/read-write/element-imperative-handles'\n\nimport { type Action } from './actions'\n\nimport { ElementImperativeHandle } from '../runtimes/react/element-imperative-handle'\n\nimport { BuilderAPIProxy } from './builder-api/proxy'\nimport * as ReadOnlyState from './read-only-state'\n\nexport type { Operation } from './modules/read-write/read-write-documents'\nexport type { BoxModelHandle } from './modules/read-write/box-models'\nexport { createBox, getBox, parse } from './modules/read-write/box-models'\n\nconst reducers = {\n ...ReadOnlyState.reducers,\n documents: Documents.reducer,\n boxModels: BoxModels.reducer,\n pointer: Pointer.reducer,\n propControllers: PropControllers.reducer,\n elementImperativeHandles: ElementImperativeHandles.reducer,\n}\n\nexport function createRootReducer() {\n return combineReducers(reducers)\n}\n\nexport type State = Omit<ReadOnlyState.State, 'documents'> & {\n documents: Documents.State\n boxModels: BoxModels.State\n pointer: Pointer.State\n propControllers: PropControllers.State\n elementImperativeHandles: ElementImperativeHandles.State\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction getDocumentsStateSlice(state: State): Documents.State {\n return state.documents\n}\n\nexport function getDocuments(state: State): Documents.State {\n return Documents.getDocuments(getDocumentsStateSlice(state))\n}\n\nexport function getDocument(state: State, documentKey: string): Documents.Document | null {\n return Documents.getDocument(getDocumentsStateSlice(state), documentKey)\n}\n\nfunction getBoxModelsStateSlice(state: State): BoxModels.State {\n return state.boxModels\n}\n\nexport function getMeasurables(state: State): Map<string, Map<string, BoxModels.Measurable>> {\n return BoxModels.getMeasurables(getBoxModelsStateSlice(state))\n}\n\nexport function getBoxModels(state: State): Map<string, Map<string, BoxModels.BoxDisplayModel>> {\n return BoxModels.getBoxModels(getBoxModelsStateSlice(state))\n}\n\nexport function getBoxModel(\n state: State,\n documentKey: string,\n elementKey: string,\n): BoxModels.BoxDisplayModel | null {\n return BoxModels.getBoxModel(getBoxModelsStateSlice(state), documentKey, elementKey)\n}\n\nexport function getPointer(state: State): Pointer.Point | null {\n return Pointer.getPointer(state.pointer)\n}\n\nexport function getElementImperativeHandles(\n state: State,\n): Map<string, Map<string, ElementImperativeHandle>> {\n return ElementImperativeHandles.getElementImperativeHandles(state.elementImperativeHandles)\n}\n\nexport function getElementImperativeHandlesContainingElement(\n state: State,\n element: Element,\n): Map<string, Map<string, ElementImperativeHandle>> {\n const elementImperativeHandles = getElementImperativeHandles(state)\n const filteredElementImperativeHandles = new Map<string, Map<string, ElementImperativeHandle>>()\n\n for (const [documentKey, byElementKey] of elementImperativeHandles) {\n const filteredByElementKey = new Map<string, ElementImperativeHandle>()\n\n for (const [elementKey, elementImperativeHandle] of byElementKey) {\n const handleElement = elementImperativeHandle.getDomNode()\n\n if (handleElement?.contains(element)) {\n filteredByElementKey.set(elementKey, elementImperativeHandle)\n }\n }\n\n if (filteredByElementKey.size > 0) {\n filteredElementImperativeHandles.set(documentKey, filteredByElementKey)\n }\n }\n\n return filteredElementImperativeHandles\n}\n\nfunction getPropControllersStateSlice(state: State): PropControllers.State {\n return state.propControllers\n}\n\nexport function getPropControllers(\n state: State,\n { documentKey, elementKey }: { documentKey: string; elementKey: string },\n) {\n return PropControllers.getPropControllers(\n getPropControllersStateSlice(state),\n documentKey,\n elementKey,\n )\n}\n\nexport function getPropControllersHandle(\n state: State,\n { documentKey, elementKey }: { documentKey: string; elementKey: string },\n) {\n return PropControllers.getPropControllersHandle(\n getPropControllersStateSlice(state),\n documentKey,\n elementKey,\n )\n}\n\nexport function getPropController(\n state: State,\n {\n documentKey,\n elementKey,\n propName,\n }: { documentKey: string; elementKey: string; propName: string },\n) {\n return PropControllers.getPropController(\n getPropControllersStateSlice(state),\n documentKey,\n elementKey,\n propName,\n )\n}\n\nexport function setupBuilderProxy(\n builderProxy: BuilderAPIProxy,\n): ThunkAction<VoidFunction, State, unknown, Action> {\n return dispatch => {\n return builderProxy.setup({ onHostAction: action => dispatch(action) })\n }\n}\n"],"mappings":"AAAA,SAAS,uBAA6D;AAEtE,YAAY,eAAe;AAC3B,YAAY,eAAe;AAC3B,YAAY,aAAa;AACzB,YAAY,qBAAqB;AACjC,YAAY,8BAA8B;
|
|
1
|
+
{"version":3,"sources":["../../../src/state/read-write-state.ts"],"sourcesContent":["import { combineReducers, type ThunkAction, type ThunkDispatch } from '@reduxjs/toolkit'\n\nimport * as Documents from './modules/read-write/read-write-documents'\nimport * as BoxModels from './modules/read-write/box-models'\nimport * as Pointer from './modules/read-write/pointer'\nimport * as PropControllers from './modules/read-write/prop-controllers'\nimport * as ElementImperativeHandles from './modules/read-write/element-imperative-handles'\nimport * as ResolvedValueOverrides from './modules/read-write/resolved-value-overrides'\n\nimport { type Action } from './actions'\n\nimport { ElementImperativeHandle } from '../runtimes/react/element-imperative-handle'\n\nimport { BuilderAPIProxy } from './builder-api/proxy'\nimport * as ReadOnlyState from './read-only-state'\n\nexport type { Operation } from './modules/read-write/read-write-documents'\nexport type { BoxModelHandle } from './modules/read-write/box-models'\nexport { createBox, getBox, parse } from './modules/read-write/box-models'\nexport type { ResolvedValueKey, ResolvedValue } from './modules/read-write/resolved-value-overrides'\n\nconst reducers = {\n ...ReadOnlyState.reducers,\n documents: Documents.reducer,\n boxModels: BoxModels.reducer,\n pointer: Pointer.reducer,\n propControllers: PropControllers.reducer,\n elementImperativeHandles: ElementImperativeHandles.reducer,\n resolvedValueOverrides: ResolvedValueOverrides.reducer,\n}\n\nexport function createRootReducer() {\n return combineReducers(reducers)\n}\n\nexport type State = Omit<ReadOnlyState.State, 'documents'> & {\n documents: Documents.State\n boxModels: BoxModels.State\n pointer: Pointer.State\n propControllers: PropControllers.State\n elementImperativeHandles: ElementImperativeHandles.State\n resolvedValueOverrides: ResolvedValueOverrides.State\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction getDocumentsStateSlice(state: State): Documents.State {\n return state.documents\n}\n\nexport function getDocuments(state: State): Documents.State {\n return Documents.getDocuments(getDocumentsStateSlice(state))\n}\n\nexport function getDocument(state: State, documentKey: string): Documents.Document | null {\n return Documents.getDocument(getDocumentsStateSlice(state), documentKey)\n}\n\nfunction getBoxModelsStateSlice(state: State): BoxModels.State {\n return state.boxModels\n}\n\nexport function getMeasurables(state: State): Map<string, Map<string, BoxModels.Measurable>> {\n return BoxModels.getMeasurables(getBoxModelsStateSlice(state))\n}\n\nexport function getBoxModels(state: State): Map<string, Map<string, BoxModels.BoxDisplayModel>> {\n return BoxModels.getBoxModels(getBoxModelsStateSlice(state))\n}\n\nexport function getBoxModel(\n state: State,\n documentKey: string,\n elementKey: string,\n): BoxModels.BoxDisplayModel | null {\n return BoxModels.getBoxModel(getBoxModelsStateSlice(state), documentKey, elementKey)\n}\n\nexport function getPointer(state: State): Pointer.Point | null {\n return Pointer.getPointer(state.pointer)\n}\n\nexport function getElementImperativeHandles(\n state: State,\n): Map<string, Map<string, ElementImperativeHandle>> {\n return ElementImperativeHandles.getElementImperativeHandles(state.elementImperativeHandles)\n}\n\nexport function getElementImperativeHandlesContainingElement(\n state: State,\n element: Element,\n): Map<string, Map<string, ElementImperativeHandle>> {\n const elementImperativeHandles = getElementImperativeHandles(state)\n const filteredElementImperativeHandles = new Map<string, Map<string, ElementImperativeHandle>>()\n\n for (const [documentKey, byElementKey] of elementImperativeHandles) {\n const filteredByElementKey = new Map<string, ElementImperativeHandle>()\n\n for (const [elementKey, elementImperativeHandle] of byElementKey) {\n const handleElement = elementImperativeHandle.getDomNode()\n\n if (handleElement?.contains(element)) {\n filteredByElementKey.set(elementKey, elementImperativeHandle)\n }\n }\n\n if (filteredByElementKey.size > 0) {\n filteredElementImperativeHandles.set(documentKey, filteredByElementKey)\n }\n }\n\n return filteredElementImperativeHandles\n}\n\nfunction getPropControllersStateSlice(state: State): PropControllers.State {\n return state.propControllers\n}\n\nexport function getPropControllers(\n state: State,\n { documentKey, elementKey }: { documentKey: string; elementKey: string },\n) {\n return PropControllers.getPropControllers(\n getPropControllersStateSlice(state),\n documentKey,\n elementKey,\n )\n}\n\nexport function getPropControllersHandle(\n state: State,\n { documentKey, elementKey }: { documentKey: string; elementKey: string },\n) {\n return PropControllers.getPropControllersHandle(\n getPropControllersStateSlice(state),\n documentKey,\n elementKey,\n )\n}\n\nexport function getPropController(\n state: State,\n {\n documentKey,\n elementKey,\n propName,\n }: { documentKey: string; elementKey: string; propName: string },\n) {\n return PropControllers.getPropController(\n getPropControllersStateSlice(state),\n documentKey,\n elementKey,\n propName,\n )\n}\n\nfunction getResolvedValueOverridesStateSlice(state: State): ResolvedValueOverrides.State {\n return state.resolvedValueOverrides\n}\n\nexport function hasResolvedValueOverride(\n state: State,\n documentKey: string,\n instanceKey: ResolvedValueOverrides.ResolvedValueKey,\n): boolean {\n return ResolvedValueOverrides.hasValueOverride(\n getResolvedValueOverridesStateSlice(state),\n documentKey,\n instanceKey,\n )\n}\n\nexport function getResolvedValueOverride(\n state: State,\n documentKey: string,\n instanceKey: ResolvedValueOverrides.ResolvedValueKey,\n): ResolvedValueOverrides.ResolvedValue {\n return ResolvedValueOverrides.getValueOverride(\n getResolvedValueOverridesStateSlice(state),\n documentKey,\n instanceKey,\n )\n}\n\nexport function setupBuilderProxy(\n builderProxy: BuilderAPIProxy,\n): ThunkAction<VoidFunction, State, unknown, Action> {\n return dispatch => {\n return builderProxy.setup({ onHostAction: action => dispatch(action) })\n }\n}\n"],"mappings":"AAAA,SAAS,uBAA6D;AAEtE,YAAY,eAAe;AA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
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
2
|
import { SlotDefinition as BaseSlotDefinition, SlotControl, type DeserializedRecord, type ResourceResolver, type Stylesheet, type Resolvable, type DataType } from '@makeswift/controls';
|
|
3
3
|
export type SlotPlaceholderConfig = {
|
|
4
4
|
builderOnly?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../../src/controls/slot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../../src/controls/slot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EACL,cAAc,IAAI,kBAAkB,EACpC,WAAW,EAEX,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,QAAQ,EACd,MAAM,qBAAqB,CAAA;AAI5B,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAYD,MAAM,MAAM,UAAU,GAAG;IACvB,oBAAoB,CAAC,EAAE,qBAAqB,CAAA;CAC7C,CAAA;AAED,uBAAe,cAAe,SAAQ,kBAAkB,CAAC,SAAS,EAAE,UAAU,CAAC;CAAG;AAElF,qBAAa,cAAe,SAAQ,cAAc;IAChD,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,cAAc;gBAQhD,MAAM,GAAE,UAAe;IAInC,YAAY,CACV,IAAI,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,SAAS,EAC1C,SAAS,EAAE,gBAAgB,EAC3B,WAAW,EAAE,UAAU,EACvB,OAAO,CAAC,EAAE,WAAW,GACpB,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC;CAWrC;AAED,wBAAgB,IAAI,CAAC,MAAM,GAAE,UAAe,GAAG,cAAc,CAE5D;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ReactNode, type PropsWithChildren } from 'react';
|
|
2
|
+
import { type ControlInstanceKey } from '@makeswift/controls';
|
|
3
|
+
export declare const EditableNodeValue: ({ instanceKey, children: value, }: PropsWithChildren<{
|
|
4
|
+
instanceKey: ControlInstanceKey | undefined;
|
|
5
|
+
}>) => ReactNode;
|
|
6
|
+
export default EditableNodeValue;
|
|
7
|
+
//# sourceMappingURL=editable-node-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editable-node-value.d.ts","sourceRoot":"","sources":["../../../../../../src/runtimes/react/controls/node-value/editable-node-value.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAE9D,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAO7D,eAAO,MAAM,iBAAiB,GAAI,mCAG/B,iBAAiB,CAAC;IAAE,WAAW,EAAE,kBAAkB,GAAG,SAAS,CAAA;CAAE,CAAC,KAAG,SAkBvE,CAAA;AAED,eAAe,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
import { type ControlInstanceKey } from '@makeswift/controls';
|
|
3
|
+
export declare const NodeValue: import("react").NamedExoticComponent<PropsWithChildren<{
|
|
4
|
+
instanceKey: ControlInstanceKey | undefined;
|
|
5
|
+
}>>;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/runtimes/react/controls/node-value/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,iBAAiB,EAAc,MAAM,OAAO,CAAA;AAE1E,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAO7D,eAAO,MAAM,SAAS;iBAGc,kBAAkB,GAAG,SAAS;GAGhE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/runtimes/react/controls/slot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { SlotDefinition, SlotControl, type DataType } from '@makeswift/controls';
|
|
3
|
+
import { type SlotConfig } from '../../../../controls/slot';
|
|
4
|
+
export declare function renderSlot({ data, control, config, }: {
|
|
5
|
+
data: DataType<SlotDefinition<ReactNode>> | undefined;
|
|
6
|
+
control: SlotControl | null;
|
|
7
|
+
config: SlotConfig;
|
|
8
|
+
}): ReactNode;
|
|
9
|
+
//# sourceMappingURL=render-slot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-slot.d.ts","sourceRoot":"","sources":["../../../../../../src/runtimes/react/controls/slot/render-slot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEhF,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAI3D,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,OAAO,EACP,MAAM,GACP,EAAE;IACD,IAAI,EAAE,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,GAAG,SAAS,CAAA;IACrD,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;IAC3B,MAAM,EAAE,UAAU,CAAA;CACnB,GAAG,SAAS,CAWZ"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, ElementType, ReactNode } from 'react';
|
|
2
|
-
import { SlotDefinition, SlotControl, type DataType } from '@makeswift/controls';
|
|
3
|
-
import { type SlotConfig, type SlotPlaceholderConfig } from '
|
|
4
|
-
export declare
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ElementType, type ReactNode } from 'react';
|
|
2
|
+
import { SlotDefinition, SlotControl, type DataType, type ControlInstanceKey } from '@makeswift/controls';
|
|
3
|
+
import { type SlotConfig, type SlotPlaceholderConfig } from '../../../../controls/slot';
|
|
4
|
+
export declare const SlotValue: import("react").NamedExoticComponent<{
|
|
5
5
|
data: DataType<SlotDefinition<ReactNode>> | undefined;
|
|
6
|
-
|
|
6
|
+
instanceKey: ControlInstanceKey | undefined;
|
|
7
7
|
config: SlotConfig;
|
|
8
|
-
}
|
|
8
|
+
}>;
|
|
9
9
|
type SlotProps<T extends ElementType> = {
|
|
10
10
|
as?: T;
|
|
11
11
|
control: SlotControl | null;
|
|
@@ -32,4 +32,4 @@ type SlotPlaceholderProps = {
|
|
|
32
32
|
};
|
|
33
33
|
declare function SlotPlaceholder({ control, placeholder }: SlotPlaceholderProps): ReactNode;
|
|
34
34
|
export {};
|
|
35
|
-
//# sourceMappingURL=slot.d.ts.map
|
|
35
|
+
//# sourceMappingURL=slot-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot-value.d.ts","sourceRoot":"","sources":["../../../../../../src/runtimes/react/controls/slot/slot-value.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAChB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAA;AAId,OAAO,EACL,cAAc,EACd,WAAW,EACX,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACxB,MAAM,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I,EACJ,KAAK,EACL,QAAQ,EACR,SAAS,EACT,GAAG,WAAW,EACf,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,MAAM,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CA4B1F;AAED,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;IAC3B,WAAW,CAAC,EAAE,qBAAqB,CAAA;CACpC,CAAA;AAKD,iBAAS,eAAe,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,oBAAoB,GAAG,SAAS,CAoElF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ResolvedValueKey, type ResolvedValue } from '../../../state/read-write-state';
|
|
2
|
+
export declare const DisableResolvedValueOverride: import("react").Context<import("@makeswift/controls").ControlInstanceKey | undefined>;
|
|
3
|
+
export declare function useIsResolvedValueOverrideDisabled(instanceKey: ResolvedValueKey | undefined): boolean;
|
|
4
|
+
export declare const useResolvedValueOverride: (instanceKey: ResolvedValueKey | undefined) => [ResolvedValue, boolean];
|
|
5
|
+
//# sourceMappingURL=use-resolved-value-override.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-resolved-value-override.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/hooks/use-resolved-value-override.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAGnB,MAAM,iCAAiC,CAAA;AAMxC,eAAO,MAAM,4BAA4B,uFAAyD,CAAA;AAElG,wBAAgB,kCAAkC,CAChD,WAAW,EAAE,gBAAgB,GAAG,SAAS,GACxC,OAAO,CAMT;AAED,eAAO,MAAM,wBAAwB,GACnC,aAAa,gBAAgB,GAAG,SAAS,KACxC,CAAC,aAAa,EAAE,OAAO,CAgBzB,CAAA"}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { type State
|
|
2
|
-
|
|
3
|
-
type State = ReadOnlyState | ReadWriteState;
|
|
4
|
-
export declare function useSelector<R>(selector: (state: State) => R): R;
|
|
5
|
-
export {};
|
|
1
|
+
import { type State } from '../../../state/unified-state';
|
|
2
|
+
export declare function useSelector<R>(selector: (state: State) => R, isEqual?: (a: R, b: R) => boolean): R;
|
|
6
3
|
//# sourceMappingURL=use-selector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-selector.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/hooks/use-selector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-selector.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/hooks/use-selector.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAIzD,wBAAgB,WAAW,CAAC,CAAC,EAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,EAC7B,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAChC,CAAC,CAUH"}
|
|
@@ -14,6 +14,8 @@ export declare const ActionTypes: {
|
|
|
14
14
|
readonly UNREGISTER_PROP_CONTROLLERS_HANDLE: "UNREGISTER_PROP_CONTROLLERS_HANDLE";
|
|
15
15
|
readonly REGISTER_MEASURABLE: "REGISTER_MEASURABLE";
|
|
16
16
|
readonly UNREGISTER_MEASURABLE: "UNREGISTER_MEASURABLE";
|
|
17
|
+
readonly SET_RESOLVED_VALUE_OVERRIDE: "SET_RESOLVED_VALUE_OVERRIDE";
|
|
18
|
+
readonly CLEAR_RESOLVED_VALUE_OVERRIDE: "CLEAR_RESOLVED_VALUE_OVERRIDE";
|
|
17
19
|
readonly UPDATE_API_CLIENT_CACHE: "UPDATE_API_CLIENT_CACHE";
|
|
18
20
|
readonly CLEAR_API_CLIENT_CACHE: "CLEAR_API_CLIENT_CACHE";
|
|
19
21
|
readonly API_RESOURCE_FULFILLED: "API_RESOURCE_FULFILLED";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/state/actions/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE3D,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,aAAa,CAAA;AAE9D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAA;AAGhD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/state/actions/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE3D,OAAO,EAAE,KAAK,UAAU,EAAmB,MAAM,aAAa,CAAA;AAE9D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAA;AAGhD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAId,CAAA;AAEV,MAAM,MAAM,MAAM,GAAG,UAAU,GAAG,aAAa,GAAG,cAAc,CAAA;AAEhE,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAE/D"}
|
|
@@ -9,6 +9,8 @@ export declare const InternalActionTypes: {
|
|
|
9
9
|
readonly UNREGISTER_PROP_CONTROLLERS_HANDLE: "UNREGISTER_PROP_CONTROLLERS_HANDLE";
|
|
10
10
|
readonly REGISTER_MEASURABLE: "REGISTER_MEASURABLE";
|
|
11
11
|
readonly UNREGISTER_MEASURABLE: "UNREGISTER_MEASURABLE";
|
|
12
|
+
readonly SET_RESOLVED_VALUE_OVERRIDE: "SET_RESOLVED_VALUE_OVERRIDE";
|
|
13
|
+
readonly CLEAR_RESOLVED_VALUE_OVERRIDE: "CLEAR_RESOLVED_VALUE_OVERRIDE";
|
|
12
14
|
readonly UPDATE_API_CLIENT_CACHE: "UPDATE_API_CLIENT_CACHE";
|
|
13
15
|
readonly CLEAR_API_CLIENT_CACHE: "CLEAR_API_CLIENT_CACHE";
|
|
14
16
|
readonly API_RESOURCE_FULFILLED: "API_RESOURCE_FULFILLED";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-types.d.ts","sourceRoot":"","sources":["../../../../../src/state/actions/internal/action-types.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"action-types.d.ts","sourceRoot":"","sources":["../../../../../src/state/actions/internal/action-types.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGtB,CAAA"}
|
|
@@ -9,6 +9,8 @@ export declare const ReadWriteActionTypes: {
|
|
|
9
9
|
readonly UNREGISTER_PROP_CONTROLLERS_HANDLE: "UNREGISTER_PROP_CONTROLLERS_HANDLE";
|
|
10
10
|
readonly REGISTER_MEASURABLE: "REGISTER_MEASURABLE";
|
|
11
11
|
readonly UNREGISTER_MEASURABLE: "UNREGISTER_MEASURABLE";
|
|
12
|
+
readonly SET_RESOLVED_VALUE_OVERRIDE: "SET_RESOLVED_VALUE_OVERRIDE";
|
|
13
|
+
readonly CLEAR_RESOLVED_VALUE_OVERRIDE: "CLEAR_RESOLVED_VALUE_OVERRIDE";
|
|
12
14
|
readonly UPDATE_API_CLIENT_CACHE: "UPDATE_API_CLIENT_CACHE";
|
|
13
15
|
readonly CLEAR_API_CLIENT_CACHE: "CLEAR_API_CLIENT_CACHE";
|
|
14
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-write-action-types.d.ts","sourceRoot":"","sources":["../../../../../src/state/actions/internal/read-write-action-types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"read-write-action-types.d.ts","sourceRoot":"","sources":["../../../../../src/state/actions/internal/read-write-action-types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;CAqBvB,CAAA"}
|
|
@@ -5,6 +5,7 @@ import { ElementImperativeHandle } from '../../../runtimes/react/element-imperat
|
|
|
5
5
|
import { type DescriptorsByComponentType } from '../../modules/prop-controller-descriptors';
|
|
6
6
|
import { type Measurable } from '../../modules/read-write/box-models';
|
|
7
7
|
import { type PropControllersHandle } from '../../modules/read-write/prop-controllers';
|
|
8
|
+
import { type ResolvedValueKey, type ResolvedValue } from '../../modules/read-write/resolved-value-overrides';
|
|
8
9
|
import { type Action } from '../../actions';
|
|
9
10
|
import { type DocumentPayload } from '../../shared-api';
|
|
10
11
|
import { type SerializedState as APIClientCache } from '../../api-client/state';
|
|
@@ -82,6 +83,21 @@ type UnregisterMeasurableAction = {
|
|
|
82
83
|
elementKey: string;
|
|
83
84
|
};
|
|
84
85
|
};
|
|
86
|
+
type SetResolvedValueOverrideAction = {
|
|
87
|
+
type: typeof ReadWriteActionTypes.SET_RESOLVED_VALUE_OVERRIDE;
|
|
88
|
+
payload: {
|
|
89
|
+
documentKey: string;
|
|
90
|
+
instanceKey: ResolvedValueKey;
|
|
91
|
+
value: ResolvedValue;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
type ClearResolvedValueOverrideAction = {
|
|
95
|
+
type: typeof ReadWriteActionTypes.CLEAR_RESOLVED_VALUE_OVERRIDE;
|
|
96
|
+
payload: {
|
|
97
|
+
documentKey: string;
|
|
98
|
+
instanceKey: ResolvedValueKey;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
85
101
|
type UpdateAPIClientCache = {
|
|
86
102
|
type: typeof ReadWriteActionTypes.UPDATE_API_CLIENT_CACHE;
|
|
87
103
|
payload: APIClientCache;
|
|
@@ -89,7 +105,7 @@ type UpdateAPIClientCache = {
|
|
|
89
105
|
type ClearAPIClientCache = {
|
|
90
106
|
type: typeof ReadWriteActionTypes.CLEAR_API_CLIENT_CACHE;
|
|
91
107
|
};
|
|
92
|
-
export type ReadWriteAction = FlushActionBufferAction | ChangeElementTreeAction | RegisterComponentHandleAction | UnregisterComponentHandleAction | RegisterPropControllersHandleAction | UnregisterPropControllersHandleAction | RegisterPropControllersAction | UnregisterPropControllersAction | RegisterMeasurableAction | UnregisterMeasurableAction | UpdateAPIClientCache | ClearAPIClientCache;
|
|
108
|
+
export type ReadWriteAction = FlushActionBufferAction | ChangeElementTreeAction | RegisterComponentHandleAction | UnregisterComponentHandleAction | RegisterPropControllersHandleAction | UnregisterPropControllersHandleAction | RegisterPropControllersAction | UnregisterPropControllersAction | RegisterMeasurableAction | UnregisterMeasurableAction | SetResolvedValueOverrideAction | ClearResolvedValueOverrideAction | UpdateAPIClientCache | ClearAPIClientCache;
|
|
93
109
|
export declare function flushActionBuffer(): {
|
|
94
110
|
type: "FLUSH_ACTION_BUFFER";
|
|
95
111
|
};
|
|
@@ -104,6 +120,8 @@ export declare function unregisterPropControllers(documentKey: string, elementKe
|
|
|
104
120
|
export declare function registerPropControllersEffect(documentKey: string, elementKey: string, propControllers: Record<string, ControlInstance>): ThunkAction<() => void, unknown, unknown, ReadWriteAction>;
|
|
105
121
|
export declare function registerMeasurable(documentKey: string, elementKey: string, measurable: Measurable): RegisterMeasurableAction;
|
|
106
122
|
export declare function unregisterMeasurable(documentKey: string, elementKey: string): UnregisterMeasurableAction;
|
|
123
|
+
export declare function setResolvedValueOverride(payload: SetResolvedValueOverrideAction['payload']): SetResolvedValueOverrideAction;
|
|
124
|
+
export declare function clearResolvedValueOverride(payload: ClearResolvedValueOverrideAction['payload']): ClearResolvedValueOverrideAction;
|
|
107
125
|
export declare function registerMeasurableEffect(documentKey: string, elementKey: string, measurable: Measurable): ThunkAction<() => void, unknown, unknown, ReadWriteAction>;
|
|
108
126
|
export declare function updateAPIClientCache(payload: APIClientCache): UpdateAPIClientCache;
|
|
109
127
|
export declare function clearAPIClientCache(): ClearAPIClientCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-write-actions.d.ts","sourceRoot":"","sources":["../../../../../src/state/actions/internal/read-write-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAA;AAE3F,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,2CAA2C,CAAA;AAC3F,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qCAAqC,CAAA;AACrE,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,2CAA2C,CAAA;
|
|
1
|
+
{"version":3,"file":"read-write-actions.d.ts","sourceRoot":"","sources":["../../../../../src/state/actions/internal/read-write-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAA;AAE3F,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,2CAA2C,CAAA;AAC3F,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qCAAqC,CAAA;AACrE,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,2CAA2C,CAAA;AACtF,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AAG,oBAAoB,CAElF;AAED,wBAAgB,mBAAmB,IAAI,mBAAmB,CAEzD;AAED,wBAAgB,qBAAqB,CAAC,EACpC,WAAW,EACX,UAAU,EACV,aAAa,GACd,EAAE;IACD,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACtB,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAuB9E"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ControlInstanceKey } from '@makeswift/controls';
|
|
2
|
+
import { type Action, type UnknownAction } from '../../actions';
|
|
3
|
+
import { Branded } from '../../../utils/branded';
|
|
4
|
+
export type ResolvedValueKey = ControlInstanceKey;
|
|
5
|
+
export type ResolvedValue = unknown;
|
|
6
|
+
type CompositeKey = Branded<string, 'CompositeResolvedValueKey'>;
|
|
7
|
+
export type State = {
|
|
8
|
+
overrides: Map<string, Map<CompositeKey, ResolvedValue>>;
|
|
9
|
+
};
|
|
10
|
+
export declare function getInitialState(): State;
|
|
11
|
+
export declare function hasValueOverride(state: State, documentKey: string, instanceKey: ResolvedValueKey): boolean;
|
|
12
|
+
export declare function getValueOverride(state: State, documentKey: string, instanceKey: ResolvedValueKey): ResolvedValue;
|
|
13
|
+
export declare function reducer(state: State | undefined, action: Action | UnknownAction): State;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=resolved-value-overrides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolved-value-overrides.d.ts","sourceRoot":"","sources":["../../../../../src/state/modules/read-write/resolved-value-overrides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAE7D,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAiB,MAAM,eAAe,CAAA;AAG9E,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAEhD,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,CAAA;AACjD,MAAM,MAAM,aAAa,GAAG,OAAO,CAAA;AAEnC,KAAK,YAAY,GAAG,OAAO,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAA;AAEhE,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,CAAA;CACzD,CAAA;AAED,wBAAgB,eAAe,IAAI,KAAK,CAEvC;AAKD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,gBAAgB,GAC5B,OAAO,CAET;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,gBAAgB,GAC5B,aAAa,CAEf;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,YAAoB,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,SA4BvF"}
|
|
@@ -4,6 +4,7 @@ import * as BoxModels from './modules/read-write/box-models';
|
|
|
4
4
|
import * as Pointer from './modules/read-write/pointer';
|
|
5
5
|
import * as PropControllers from './modules/read-write/prop-controllers';
|
|
6
6
|
import * as ElementImperativeHandles from './modules/read-write/element-imperative-handles';
|
|
7
|
+
import * as ResolvedValueOverrides from './modules/read-write/resolved-value-overrides';
|
|
7
8
|
import { type Action } from './actions';
|
|
8
9
|
import { ElementImperativeHandle } from '../runtimes/react/element-imperative-handle';
|
|
9
10
|
import { BuilderAPIProxy } from './builder-api/proxy';
|
|
@@ -11,12 +12,14 @@ import * as ReadOnlyState from './read-only-state';
|
|
|
11
12
|
export type { Operation } from './modules/read-write/read-write-documents';
|
|
12
13
|
export type { BoxModelHandle } from './modules/read-write/box-models';
|
|
13
14
|
export { createBox, getBox, parse } from './modules/read-write/box-models';
|
|
15
|
+
export type { ResolvedValueKey, ResolvedValue } from './modules/read-write/resolved-value-overrides';
|
|
14
16
|
export declare function createRootReducer(): import("@reduxjs/toolkit").Reducer<{
|
|
15
17
|
documents: import("./modules/read-only-documents").State;
|
|
16
18
|
boxModels: BoxModels.State;
|
|
17
19
|
pointer: Pointer.State;
|
|
18
20
|
propControllers: PropControllers.State;
|
|
19
21
|
elementImperativeHandles: ElementImperativeHandles.State;
|
|
22
|
+
resolvedValueOverrides: ResolvedValueOverrides.State;
|
|
20
23
|
siteVersion: import("./modules/site-version").State;
|
|
21
24
|
isReadOnly: boolean;
|
|
22
25
|
locale: import("./modules/locale").State;
|
|
@@ -33,6 +36,7 @@ export declare function createRootReducer(): import("@reduxjs/toolkit").Reducer<
|
|
|
33
36
|
pointer: Pointer.State | undefined;
|
|
34
37
|
propControllers: PropControllers.State | undefined;
|
|
35
38
|
elementImperativeHandles: ElementImperativeHandles.State | undefined;
|
|
39
|
+
resolvedValueOverrides: ResolvedValueOverrides.State | undefined;
|
|
36
40
|
siteVersion: import("./modules/site-version").State | undefined;
|
|
37
41
|
isReadOnly: boolean | undefined;
|
|
38
42
|
locale: import("./modules/locale").State | undefined;
|
|
@@ -50,6 +54,7 @@ export type State = Omit<ReadOnlyState.State, 'documents'> & {
|
|
|
50
54
|
pointer: Pointer.State;
|
|
51
55
|
propControllers: PropControllers.State;
|
|
52
56
|
elementImperativeHandles: ElementImperativeHandles.State;
|
|
57
|
+
resolvedValueOverrides: ResolvedValueOverrides.State;
|
|
53
58
|
};
|
|
54
59
|
export type Dispatch = ThunkDispatch<State, unknown, Action>;
|
|
55
60
|
export declare function getDocuments(state: State): Documents.State;
|
|
@@ -121,5 +126,7 @@ export declare function getPropController(state: State, { documentKey, elementKe
|
|
|
121
126
|
} | null | undefined)[] | {
|
|
122
127
|
[key: string]: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | /*elided*/ any | /*elided*/ any | null | undefined)[] | /*elided*/ any | null | undefined)[] | /*elided*/ any | null | undefined)[] | /*elided*/ any | null | undefined)[] | /*elided*/ any | null | undefined)[] | /*elided*/ any | null | undefined)[] | /*elided*/ any | null | undefined)[] | /*elided*/ any | null | undefined)[] | /*elided*/ any | null | undefined)[] | /*elided*/ any | null | undefined)[] | /*elided*/ any | null | undefined)[] | /*elided*/ any | null | undefined;
|
|
123
128
|
} | null | undefined>> | null;
|
|
129
|
+
export declare function hasResolvedValueOverride(state: State, documentKey: string, instanceKey: ResolvedValueOverrides.ResolvedValueKey): boolean;
|
|
130
|
+
export declare function getResolvedValueOverride(state: State, documentKey: string, instanceKey: ResolvedValueOverrides.ResolvedValueKey): ResolvedValueOverrides.ResolvedValue;
|
|
124
131
|
export declare function setupBuilderProxy(builderProxy: BuilderAPIProxy): ThunkAction<VoidFunction, State, unknown, Action>;
|
|
125
132
|
//# sourceMappingURL=read-write-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-write-state.d.ts","sourceRoot":"","sources":["../../../src/state/read-write-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAExF,OAAO,KAAK,SAAS,MAAM,2CAA2C,CAAA;AACtE,OAAO,KAAK,SAAS,MAAM,iCAAiC,CAAA;AAC5D,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAA;AACvD,OAAO,KAAK,eAAe,MAAM,uCAAuC,CAAA;AACxE,OAAO,KAAK,wBAAwB,MAAM,iDAAiD,CAAA;
|
|
1
|
+
{"version":3,"file":"read-write-state.d.ts","sourceRoot":"","sources":["../../../src/state/read-write-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAExF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EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,0IAOzE;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,KAAK,EACZ,EACE,WAAW,EACX,UAAU,EACV,QAAQ,GACT,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;8BAQjE;AAMD,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,sBAAsB,CAAC,gBAAgB,GACnD,OAAO,CAMT;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,sBAAsB,CAAC,gBAAgB,GACnD,sBAAsB,CAAC,aAAa,CAMtC;AAED,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,eAAe,GAC5B,WAAW,CAAC,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAInD"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/controls/slot.tsx"],"sourcesContent":["'use client'\n\nimport { ComponentPropsWithoutRef, ElementType, ReactNode, useEffect, useState, memo } from 'react'\nimport { cx } from '@emotion/css'\n\nimport { SlotDefinition, SlotControl, type DataType } from '@makeswift/controls'\n\nimport { type SlotConfig, type SlotPlaceholderConfig } from '../../../controls/slot'\nimport { Element } from '../components/Element'\nimport { useIsInBuilder } from '../hooks/use-is-in-builder'\nimport { getIndexes } from '../../../components/utils/columns'\nimport { useResponsiveStyle } from '../../../components/utils/responsive-style'\nimport { useStyle } from '../use-style'\nimport { pollBoxModel } from '../poll-box-model'\n\nexport function renderSlot(props: {\n data: DataType<SlotDefinition<ReactNode>> | undefined\n control: SlotControl | null\n config: SlotConfig\n}): ReactNode {\n return <SlotValue {...props} />\n}\n\nconst SlotValue = memo(\n ({\n data,\n control,\n config,\n }: {\n data: DataType<SlotDefinition<ReactNode>> | undefined\n control: SlotControl | null\n config: SlotConfig\n }): ReactNode => {\n // TODO(miguel): While the UI shouldn't allow the state, we should probably check that at least\n // one element is visible.\n if (data == null || data.elements.length === 0) {\n return <Slot.Placeholder control={control} placeholder={config.unstable_placeholder} />\n }\n\n return (\n <Slot control={control}>\n {data.elements.map((element, i) => (\n <Slot.Item key={element.key} control={control} grid={data.columns} index={i}>\n <Element element={element} />\n </Slot.Item>\n ))}\n </Slot>\n )\n },\n)\n\ntype SlotProps<T extends ElementType> = {\n as?: T\n control: SlotControl | null\n children?: ReactNode\n className?: string\n}\n\nexport function Slot<T extends ElementType = 'div'>({\n as,\n control,\n children,\n className,\n ...restOfProps\n}: SlotProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof SlotProps<T>>) {\n const As = as ?? 'div'\n const [element, setElement] = useState<Element | null>(null)\n const baseClassName = useStyle({\n display: 'flex',\n flexWrap: 'wrap',\n width: '100%',\n })\n\n useEffect(() => {\n if (element == null || control == null) return\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => control.changeContainerBoxModel(boxModel),\n })\n }, [element, control])\n\n return (\n <As {...restOfProps} ref={setElement} className={cx(baseClassName, className)}>\n {children}\n </As>\n )\n}\n\nSlot.Placeholder = SlotPlaceholder\n\nSlot.Item = SlotItem\n\ntype SlotItemProps<T extends ElementType> = {\n as?: T\n control: SlotControl | null\n // @arvin: review for correctness\n grid: DataType<SlotDefinition<ReactNode>> extends undefined\n ? undefined\n : NonNullable<DataType<SlotDefinition<ReactNode>>>['columns']\n index: number\n children?: ReactNode\n className?: string\n}\n\nfunction SlotItem<T extends ElementType = 'div'>({\n as,\n control,\n grid,\n index,\n children,\n className,\n ...restOfProps\n}: SlotItemProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof SlotItemProps<T>>): ReactNode {\n const As = as ?? 'div'\n const [element, setElement] = useState<Element | null>(null)\n const baseClassName = useStyle({\n display: 'flex',\n ...useResponsiveStyle([grid], ([{ count = 12, spans = [[12]] } = {}]) => {\n const [rowIndex, columnIndex] = getIndexes(spans, index)\n const span = spans[rowIndex][columnIndex]\n const flexBasis = `calc(100% * ${(span / count).toFixed(5)})`\n\n return span === 0 ? { display: 'none' } : { flexBasis, minWidth: flexBasis }\n }),\n })\n\n useEffect(() => {\n if (element == null || control == null) return\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => control.changeItemBoxModel(index, boxModel),\n })\n }, [element, control, index])\n\n return (\n <As {...restOfProps} ref={setElement} className={cx(baseClassName, className)}>\n {children}\n </As>\n )\n}\n\ntype SlotPlaceholderProps = {\n control: SlotControl | null\n placeholder?: SlotPlaceholderConfig\n}\n\nconst DEFAULT_SHOW_PLACEHOLDER_IN_BUILDER_ONLY = false\nconst DEFAULT_PLACEHOLDER_HEIGHT_PX = 80\n\nfunction SlotPlaceholder({ control, placeholder }: SlotPlaceholderProps): ReactNode {\n const isInBuilder = useIsInBuilder()\n const [element, setElement] = useState<Element | null>(null)\n\n // TODO: When ready, we can default to only showing the slot placeholder in\n // the builder\n const showInBuilderOnly = placeholder?.builderOnly ?? DEFAULT_SHOW_PLACEHOLDER_IN_BUILDER_ONLY\n const placeholderHeight = placeholder?.height ?? DEFAULT_PLACEHOLDER_HEIGHT_PX\n const text = placeholder?.text\n\n const hidePlaceholder = showInBuilderOnly && !isInBuilder\n\n useEffect(() => {\n if (element == null || control == null) return\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => control.changeContainerBoxModel(boxModel),\n })\n }, [element, control])\n\n return (\n <div\n ref={setElement}\n className={useStyle({\n width: '100%',\n background: 'rgba(161, 168, 194, 0.18)',\n })}\n style={{\n height: hidePlaceholder ? 0 : placeholderHeight,\n visibility: hidePlaceholder ? 'hidden' : undefined,\n }}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"100%\"\n height=\"100%\"\n className={useStyle({ overflow: 'visible', padding: 8 })}\n >\n <rect\n x={0}\n y={0}\n width=\"100%\"\n height=\"100%\"\n strokeWidth={2}\n strokeDasharray=\"4 2\"\n fill=\"none\"\n stroke=\"rgba(161, 168, 194, 0.40)\"\n rx=\"4\"\n ry=\"4\"\n />\n {text != null && (\n <text\n x=\"50%\"\n y=\"50%\"\n dominantBaseline=\"central\"\n textAnchor=\"middle\"\n fill=\"rgba(161, 168, 194, 0.80)\"\n fontSize=\"14px\"\n fontFamily=\"sans-serif\"\n style={{ userSelect: 'none' }}\n >\n {text}\n </text>\n )}\n </svg>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBS;AAlBT,mBAA4F;AAC5F,iBAAmB;AAKnB,qBAAwB;AACxB,+BAA+B;AAC/B,qBAA2B;AAC3B,8BAAmC;AACnC,uBAAyB;AACzB,4BAA6B;AAEtB,SAAS,WAAW,OAIb;AACZ,SAAO,4CAAC,aAAW,GAAG,OAAO;AAC/B;AAEA,MAAM,gBAAY;AAAA,EAChB,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAIiB;AAGf,QAAI,QAAQ,QAAQ,KAAK,SAAS,WAAW,GAAG;AAC9C,aAAO,4CAAC,KAAK,aAAL,EAAiB,SAAkB,aAAa,OAAO,sBAAsB;AAAA,IACvF;AAEA,WACE,4CAAC,QAAK,SACH,eAAK,SAAS,IAAI,CAAC,SAAS,MAC3B,4CAAC,KAAK,MAAL,EAA4B,SAAkB,MAAM,KAAK,SAAS,OAAO,GACxE,sDAAC,0BAAQ,SAAkB,KADb,QAAQ,GAExB,CACD,GACH;AAAA,EAEJ;AACF;AASO,SAAS,KAAoC;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAyE;AACvE,QAAM,KAAK,MAAM;AACjB,QAAM,CAAC,SAAS,UAAU,QAA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YACC,QAAQ,QACP;AAAA,cAAC;AAAA;AAAA,gBACC,GAAE;AAAA,gBACF,GAAE;AAAA,gBACF,kBAAiB;AAAA,gBACjB,YAAW;AAAA,gBACX,MAAK;AAAA,gBACL,UAAS;AAAA,gBACT,YAAW;AAAA,gBACX,OAAO,EAAE,YAAY,OAAO;AAAA,gBAE3B;AAAA;AAAA,YACH;AAAA;AAAA;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/runtimes/react/controls/slot.tsx"],"sourcesContent":["'use client'\n\nimport { ComponentPropsWithoutRef, ElementType, ReactNode, useEffect, useState, memo } from 'react'\nimport { cx } from '@emotion/css'\n\nimport { SlotDefinition, SlotControl, type DataType } from '@makeswift/controls'\n\nimport { type SlotConfig, type SlotPlaceholderConfig } from '../../../controls/slot'\nimport { Element } from '../components/Element'\nimport { useIsInBuilder } from '../hooks/use-is-in-builder'\nimport { getIndexes } from '../../../components/utils/columns'\nimport { useResponsiveStyle } from '../../../components/utils/responsive-style'\nimport { useStyle } from '../use-style'\nimport { pollBoxModel } from '../poll-box-model'\n\nexport function renderSlot(props: {\n data: DataType<SlotDefinition<ReactNode>> | undefined\n control: SlotControl | null\n config: SlotConfig\n}): ReactNode {\n return <SlotValue {...props} />\n}\n\nconst SlotValue = memo(\n ({\n data,\n control,\n config,\n }: {\n data: DataType<SlotDefinition<ReactNode>> | undefined\n control: SlotControl | null\n config: SlotConfig\n }): ReactNode => {\n // TODO(miguel): While the UI shouldn't allow the state, we should probably check that at least\n // one element is visible.\n if (data == null || data.elements.length === 0) {\n return <Slot.Placeholder control={control} placeholder={config.unstable_placeholder} />\n }\n\n return (\n <Slot control={control}>\n {data.elements.map((element, i) => (\n <Slot.Item key={element.key} control={control} grid={data.columns} index={i}>\n <Element element={element} />\n </Slot.Item>\n ))}\n </Slot>\n )\n },\n)\n\ntype SlotProps<T extends ElementType> = {\n as?: T\n control: SlotControl | null\n children?: ReactNode\n className?: string\n}\n\nexport function Slot<T extends ElementType = 'div'>({\n as,\n control,\n children,\n className,\n ...restOfProps\n}: SlotProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof SlotProps<T>>) {\n const As = as ?? 'div'\n const [element, setElement] = useState<Element | null>(null)\n const baseClassName = useStyle({\n display: 'flex',\n flexWrap: 'wrap',\n width: '100%',\n })\n\n useEffect(() => {\n if (element == null || control == null) return\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => control.changeContainerBoxModel(boxModel),\n })\n }, [element, control])\n\n return (\n <As {...restOfProps} ref={setElement} className={cx(baseClassName, className)}>\n {children}\n </As>\n )\n}\n\nSlot.Placeholder = SlotPlaceholder\n\nSlot.Item = SlotItem\n\ntype SlotItemProps<T extends ElementType> = {\n as?: T\n control: SlotControl | null\n // @arvin: review for correctness\n grid: DataType<SlotDefinition<ReactNode>> extends undefined\n ? undefined\n : NonNullable<DataType<SlotDefinition<ReactNode>>>['columns']\n index: number\n children?: ReactNode\n className?: string\n}\n\nfunction SlotItem<T extends ElementType = 'div'>({\n as,\n control,\n grid,\n index,\n children,\n className,\n ...restOfProps\n}: SlotItemProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof SlotItemProps<T>>): ReactNode {\n const As = as ?? 'div'\n const [element, setElement] = useState<Element | null>(null)\n const baseClassName = useStyle({\n display: 'flex',\n ...useResponsiveStyle([grid], ([{ count = 12, spans = [[12]] } = {}]) => {\n const [rowIndex, columnIndex] = getIndexes(spans, index)\n const span = spans[rowIndex][columnIndex]\n const flexBasis = `calc(100% * ${(span / count).toFixed(5)})`\n\n return span === 0 ? { display: 'none' } : { flexBasis, minWidth: flexBasis }\n }),\n })\n\n useEffect(() => {\n if (element == null || control == null) return\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => control.changeItemBoxModel(index, boxModel),\n })\n }, [element, control, index])\n\n return (\n <As {...restOfProps} ref={setElement} className={cx(baseClassName, className)}>\n {children}\n </As>\n )\n}\n\ntype SlotPlaceholderProps = {\n control: SlotControl | null\n placeholder?: SlotPlaceholderConfig\n}\n\nconst DEFAULT_SHOW_PLACEHOLDER_IN_BUILDER_ONLY = false\nconst DEFAULT_PLACEHOLDER_HEIGHT_PX = 80\n\nfunction SlotPlaceholder({ control, placeholder }: SlotPlaceholderProps): ReactNode {\n const isInBuilder = useIsInBuilder()\n const [element, setElement] = useState<Element | null>(null)\n\n // TODO: When ready, we can default to only showing the slot placeholder in\n // the builder\n const showInBuilderOnly = placeholder?.builderOnly ?? DEFAULT_SHOW_PLACEHOLDER_IN_BUILDER_ONLY\n const placeholderHeight = placeholder?.height ?? DEFAULT_PLACEHOLDER_HEIGHT_PX\n const text = placeholder?.text\n\n const hidePlaceholder = showInBuilderOnly && !isInBuilder\n\n useEffect(() => {\n if (element == null || control == null) return\n\n return pollBoxModel({\n element,\n onBoxModelChange: boxModel => control.changeContainerBoxModel(boxModel),\n })\n }, [element, control])\n\n return (\n <div\n ref={setElement}\n className={useStyle({\n width: '100%',\n background: 'rgba(161, 168, 194, 0.18)',\n })}\n style={{\n height: hidePlaceholder ? 0 : placeholderHeight,\n visibility: hidePlaceholder ? 'hidden' : undefined,\n }}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"100%\"\n height=\"100%\"\n className={useStyle({ overflow: 'visible', padding: 8 })}\n >\n <rect\n x={0}\n y={0}\n width=\"100%\"\n height=\"100%\"\n strokeWidth={2}\n strokeDasharray=\"4 2\"\n fill=\"none\"\n stroke=\"rgba(161, 168, 194, 0.40)\"\n rx=\"4\"\n ry=\"4\"\n />\n {text != null && (\n <text\n x=\"50%\"\n y=\"50%\"\n dominantBaseline=\"central\"\n textAnchor=\"middle\"\n fill=\"rgba(161, 168, 194, 0.80)\"\n fontSize=\"14px\"\n fontFamily=\"sans-serif\"\n style={{ userSelect: 'none' }}\n >\n {text}\n </text>\n )}\n </svg>\n </div>\n )\n}\n"],"mappings":";AAoBS,cAoKH,YApKG;AA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,YAAU,MAAM;AACd,QAAI,WAAW,QAAQ,WAAW;AAAM;AAExC,WAAO,aAAa;AAAA,MAClB;AAAA,MACA,kBAAkB,cAAY,QAAQ,wBAAwB,QAAQ;AAAA,IACxE,CAAC;AAAA,EACH,GAAG,CAAC,SAAS,OAAO,CAAC;AAErB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,WAAW,SAAS;AAAA,QAClB,OAAO;AAAA,QACP,YAAY;AAAA,MACd,CAAC;AAAA,MACD,OAAO;AAAA,QACL,QAAQ,kBAAkB,IAAI;AAAA,QAC9B,YAAY,kBAAkB,WAAW;AAAA,MAC3C;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,OAAM;AAAA,UACN,OAAM;AAAA,UACN,QAAO;AAAA,UACP,WAAW,SAAS,EAAE,UAAU,WAAW,SAAS,EAAE,CAAC;AAAA,UAEvD;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,GAAG;AAAA,gBACH,GAAG;AAAA,gBACH,OAAM;AAAA,gBACN,QAAO;AAAA,gBACP,aAAa;AAAA,gBACb,iBAAgB;AAAA,gBAChB,MAAK;AAAA,gBACL,QAAO;AAAA,gBACP,IAAG;AAAA,gBACH,IAAG;AAAA;AAAA,YACL;AAAA,YACC,QAAQ,QACP;AAAA,cAAC;AAAA;AAAA,gBACC,GAAE;AAAA,gBACF,GAAE;AAAA,gBACF,kBAAiB;AAAA,gBACjB,YAAW;AAAA,gBACX,MAAK;AAAA,gBACL,UAAS;AAAA,gBACT,YAAW;AAAA,gBACX,OAAO,EAAE,YAAY,OAAO;AAAA,gBAE3B;AAAA;AAAA,YACH;AAAA;AAAA;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../../../../src/runtimes/react/controls/slot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,WAAW,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