@plaudit/gutenberg-api-extensions 2.64.1 → 2.65.0
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/build/blocks/basic-custom-block-bindings-support.js +4 -5
- package/build/blocks/basic-custom-block-bindings-support.js.map +1 -1
- package/build/blocks/common-native-property-constructors.js +2 -3
- package/build/blocks/common-native-property-constructors.js.map +1 -1
- package/build/blocks/layered-styles-impl.js +2 -3
- package/build/blocks/layered-styles-impl.js.map +1 -1
- package/build/blocks/simple-block.js.map +1 -1
- package/build/blocks/simple-native-property-api.js +2 -3
- package/build/blocks/simple-native-property-api.js.map +1 -1
- package/build/blocks/simple-native-property-impl.js +9 -10
- package/build/blocks/simple-native-property-impl.js.map +1 -1
- package/build/editor/post-featured-image.js +2 -3
- package/build/editor/post-featured-image.js.map +1 -1
- package/build/editor/simple-gutenberg-endpoints-impl.d.ts +1 -1
- package/build/editor/simple-gutenberg-endpoints-impl.js +2 -3
- package/build/editor/simple-gutenberg-endpoints-impl.js.map +1 -1
- package/build/index.d.ts +5 -0
- package/build/index.js +2 -3
- package/build/index.js.map +1 -1
- package/build/lib/gutenberg-api-extensions-state/custom-block-bindings-support-logic.d.ts +10 -2
- package/build/lib/gutenberg-api-extensions-state/custom-block-bindings-support-logic.js +9 -0
- package/build/lib/gutenberg-api-extensions-state/custom-block-bindings-support-logic.js.map +1 -1
- package/build/lib/gutenberg-api-extensions-state/general-logic.d.ts +29 -0
- package/build/lib/gutenberg-api-extensions-state/general-logic.js +34 -0
- package/build/lib/gutenberg-api-extensions-state/general-logic.js.map +1 -0
- package/build/lib/gutenberg-api-extensions-state/layered-block-styles-logic.d.ts +13 -4
- package/build/lib/gutenberg-api-extensions-state/layered-block-styles-logic.js +17 -0
- package/build/lib/gutenberg-api-extensions-state/layered-block-styles-logic.js.map +1 -1
- package/build/lib/gutenberg-api-extensions-state/snp-logic.d.ts +24 -8
- package/build/lib/gutenberg-api-extensions-state/snp-logic.js +44 -0
- package/build/lib/gutenberg-api-extensions-state/snp-logic.js.map +1 -1
- package/build/lib/gutenberg-api-extensions-state.d.ts +78 -65
- package/build/lib/gutenberg-api-extensions-state.js +35 -93
- package/build/lib/gutenberg-api-extensions-state.js.map +1 -1
- package/build/lib/helpers.d.ts +20 -0
- package/build/lib/helpers.js +10 -0
- package/build/lib/helpers.js.map +1 -1
- package/build/lib/useful-types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,104 +1,46 @@
|
|
|
1
|
-
import { createReduxStore, register } from "@wordpress/data";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { combineReducers, createReduxStore, register } from "@wordpress/data";
|
|
2
|
+
import { customBlockBindingsSupportLogic, customBlockBindingsSupportLogicActions, customBlockBindingsSupportLogicSelectors } from "./gutenberg-api-extensions-state/custom-block-bindings-support-logic";
|
|
3
|
+
import { generalLogic, generalLogicActions, generalLogicSelectors } from "./gutenberg-api-extensions-state/general-logic";
|
|
4
|
+
import { layeredBlockStylesLogic, layeredBlockStylesLogicActions, layeredBlockStylesLogicSelectors } from "./gutenberg-api-extensions-state/layered-block-styles-logic";
|
|
5
|
+
import { snpLogic, snpLogicActions, snpLogicSelectors } from "./gutenberg-api-extensions-state/snp-logic";
|
|
6
|
+
import { combineSelectors } from "./helpers";
|
|
7
7
|
const DEFAULT_STATE = {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
customBlockBindingsSupportLogic: {
|
|
9
|
+
customBlockBindingsSupport: {}
|
|
10
|
+
},
|
|
11
|
+
layeredBlockStylesLogic: {
|
|
12
|
+
layeredBlockStyles: {}
|
|
13
|
+
},
|
|
14
|
+
snpLogic: {
|
|
15
|
+
desiccatedProperties: {},
|
|
16
|
+
preppedProperties: {},
|
|
17
|
+
extraPropTransforms: {},
|
|
18
|
+
computedExtraPropTransforms: {}
|
|
19
|
+
},
|
|
20
|
+
generalLogic: {
|
|
21
|
+
baselineBlockAttrs: {}, features: {}
|
|
22
|
+
}
|
|
10
23
|
};
|
|
11
|
-
export const store = createReduxStore('gutenberg-api-extensions
|
|
24
|
+
export const store = createReduxStore('plaudit/gutenberg-api-extensions', {
|
|
12
25
|
initialState: DEFAULT_STATE,
|
|
13
|
-
reducer(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
case "ADD_LAYERED_BLOCK_STYLES":
|
|
20
|
-
return produce(state, (result) => {
|
|
21
|
-
const blockLayeredStyles = result.layeredBlockStyles[action.blockName] ?? (result.layeredBlockStyles[action.blockName] = {});
|
|
22
|
-
for (const layer of action.properties) {
|
|
23
|
-
blockLayeredStyles[layer.name] = layer;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
case "SET_LAYERED_BLOCK_STYLES":
|
|
27
|
-
return produce(state, (result) => {
|
|
28
|
-
result.layeredBlockStyles[action.blockName] = action.properties;
|
|
29
|
-
});
|
|
30
|
-
case "ADD_PROPERTIES":
|
|
31
|
-
return produce(state, (result) => {
|
|
32
|
-
if (Array.isArray(action.blockName)) {
|
|
33
|
-
for (const bn of action.blockName) {
|
|
34
|
-
addProperties(bn, action.properties, result.desiccatedProperties);
|
|
35
|
-
result.preppedProperties[bn] = undefined;
|
|
36
|
-
result.extraPropTransforms[bn] = undefined;
|
|
37
|
-
result.computedExtraPropTransforms[bn] = undefined;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
addProperties(action.blockName, action.properties, result.desiccatedProperties);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
case "ADD_OR_UPDATE_EXTRA_PROP_TRANSFORM":
|
|
45
|
-
return produce(state, (result) => {
|
|
46
|
-
const blockTransforms = result.extraPropTransforms[action.blockName] ?? (result.extraPropTransforms[action.blockName] = {});
|
|
47
|
-
if (blockTransforms[action.propPath]) {
|
|
48
|
-
blockTransforms[action.propPath].styleProperty = action.extraPropTransform.styleProperty;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
blockTransforms[action.propPath] = action.extraPropTransform;
|
|
52
|
-
}
|
|
53
|
-
result.computedExtraPropTransforms[action.blockName] = undefined;
|
|
54
|
-
});
|
|
55
|
-
case "SET_PREPPED_PROPERTIES":
|
|
56
|
-
return produce(state, (result) => {
|
|
57
|
-
result.preppedProperties[action.blockName] = action.properties;
|
|
58
|
-
});
|
|
59
|
-
case "SET_EXTRA_PROP_TRANSFORMS":
|
|
60
|
-
return produce(state, (result) => {
|
|
61
|
-
result.extraPropTransforms[action.blockName] = action.extraPropTransforms;
|
|
62
|
-
});
|
|
63
|
-
case "SET_COMPUTED_EXTRA_PROP_TRANSFORMS":
|
|
64
|
-
return produce(state, (result) => {
|
|
65
|
-
result.computedExtraPropTransforms[action.blockName] = action.computedExtraPropTransforms;
|
|
66
|
-
});
|
|
67
|
-
case "RECORD_BASELINE_BLOCK_ATTRS":
|
|
68
|
-
return produce(state, (result) => {
|
|
69
|
-
if (!(action.attrs.name in result.baselineBlockAttrs)) {
|
|
70
|
-
result.baselineBlockAttrs[action.attrs.name] = clone(action.attrs);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
case "SET_FEATURE_PROP":
|
|
74
|
-
return produce(state, (result) => {
|
|
75
|
-
(result.features[action.feature] ?? (result.features[action.feature] = {}))[action.prop] = action.value;
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return state;
|
|
79
|
-
},
|
|
26
|
+
reducer: combineReducers({
|
|
27
|
+
customBlockBindingsSupportLogic,
|
|
28
|
+
layeredBlockStylesLogic,
|
|
29
|
+
snpLogic,
|
|
30
|
+
generalLogic
|
|
31
|
+
}),
|
|
80
32
|
actions: {
|
|
81
33
|
...customBlockBindingsSupportLogicActions,
|
|
82
34
|
...layeredBlockStylesLogicActions,
|
|
83
35
|
...snpLogicActions,
|
|
84
|
-
|
|
85
|
-
return { type: "RECORD_BASELINE_BLOCK_ATTRS", attrs };
|
|
86
|
-
},
|
|
87
|
-
setFeatureProp(feature, prop, value) {
|
|
88
|
-
return { type: "SET_FEATURE_PROP", feature, prop, value };
|
|
89
|
-
}
|
|
36
|
+
...generalLogicActions
|
|
90
37
|
},
|
|
91
|
-
selectors: {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
},
|
|
98
|
-
featureProp(state, feature, prop) {
|
|
99
|
-
return state.features[feature]?.[prop];
|
|
100
|
-
}
|
|
101
|
-
}
|
|
38
|
+
selectors: combineSelectors({
|
|
39
|
+
customBlockBindingsSupportLogic: customBlockBindingsSupportLogicSelectors,
|
|
40
|
+
layeredBlockStylesLogic: layeredBlockStylesLogicSelectors,
|
|
41
|
+
snpLogic: snpLogicSelectors,
|
|
42
|
+
generalLogic: generalLogicSelectors
|
|
43
|
+
})
|
|
102
44
|
});
|
|
103
45
|
register(store);
|
|
104
46
|
//# sourceMappingURL=gutenberg-api-extensions-state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gutenberg-api-extensions-state.js","sourceRoot":"","sources":["../../src/lib/gutenberg-api-extensions-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAY,QAAQ,EAA0B,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"gutenberg-api-extensions-state.js","sourceRoot":"","sources":["../../src/lib/gutenberg-api-extensions-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,gBAAgB,EAAY,QAAQ,EAA0B,MAAM,iBAAiB,CAAC;AAG/G,OAAO,EACN,+BAA+B,EAAE,sCAAsC,EAA0C,wCAAwC,EAEzJ,MAAM,sEAAsE,CAAC;AAC9E,OAAO,EAAC,YAAY,EAAE,mBAAmB,EAAuB,qBAAqB,EAAoB,MAAM,gDAAgD,CAAC;AAChK,OAAO,EACN,uBAAuB,EAAE,8BAA8B,EAAkC,gCAAgC,EACzH,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAmB,iBAAiB,EAAgB,MAAM,4CAA4C,CAAC;AACxI,OAAO,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAY3C,MAAM,aAAa,GAAU;IAC5B,+BAA+B,EAAE;QAChC,0BAA0B,EAAE,EAAE;KAC9B;IACD,uBAAuB,EAAE;QACxB,kBAAkB,EAAE,EAAE;KACtB;IACD,QAAQ,EAAE;QACT,oBAAoB,EAAE,EAAE;QACxB,iBAAiB,EAAE,EAAE;QACrB,mBAAmB,EAAE,EAAE;QACvB,2BAA2B,EAAE,EAAE;KAC/B;IACD,YAAY,EAAE;QACb,kBAAkB,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE;KACpC;CACD,CAAC;AAWF,MAAM,CAAC,MAAM,KAAK,GAAG,gBAAgB,CAAC,kCAAkC,EAAE;IACzE,YAAY,EAAE,aAAa;IAC3B,OAAO,EAAE,eAAe,CAAC;QACxB,+BAA+B;QAC/B,uBAAuB;QACvB,QAAQ;QACR,YAAY;KACZ,CAAC;IACF,OAAO,EAAE;QACR,GAAG,sCAAsC;QACzC,GAAG,8BAA8B;QACjC,GAAG,eAAe;QAClB,GAAG,mBAAmB;KACtB;IACD,SAAS,EAAE,gBAAgB,CAAC;QAC3B,+BAA+B,EAAE,wCAAwC;QACzE,uBAAuB,EAAE,gCAAgC;QACzD,QAAQ,EAAE,iBAAiB;QAC3B,YAAY,EAAE,qBAAqB;KACnC,CAAC;CACF,CAAC,CAAC;AACH,QAAQ,CAAC,KAAK,CAAC,CAAC"}
|
package/build/lib/helpers.d.ts
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
+
import type { SubsequentArgsOfFunc } from "./useful-types";
|
|
1
2
|
export declare function clone(value: any): any;
|
|
3
|
+
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
|
|
4
|
+
type SelectorsForT<S, ST> = S extends {
|
|
5
|
+
[SELECTOR in string]: (state: any, ...args: any[]) => any;
|
|
6
|
+
} ? {
|
|
7
|
+
[SL in keyof S]: (state: ST, ...args: SubsequentArgsOfFunc<S[SL]>) => ReturnType<S[SL]>;
|
|
8
|
+
} : never;
|
|
9
|
+
type StateFromSelectorsArg<S extends SelectorsArg<any>> = {
|
|
10
|
+
[K in keyof S]: Parameters<S[K][keyof S[K]]>[0];
|
|
11
|
+
};
|
|
12
|
+
type CombinedSelectors<S extends SelectorsArg<any>> = UnionToIntersection<{
|
|
13
|
+
[K in keyof S]: SelectorsForT<S[K], StateFromSelectorsArg<S>>;
|
|
14
|
+
}[keyof S]>;
|
|
15
|
+
type SelectorsArg<S extends {}> = {
|
|
16
|
+
[K in keyof S]: {
|
|
17
|
+
[SELECTOR in string]: (state: S[K], ...args: any[]) => any;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare function combineSelectors<S extends SelectorsArg<any>>(selectors: S): CombinedSelectors<typeof selectors>;
|
|
21
|
+
export {};
|
package/build/lib/helpers.js
CHANGED
|
@@ -7,4 +7,14 @@ export function clone(value) {
|
|
|
7
7
|
}
|
|
8
8
|
return typeof value === 'object' ? Object.fromEntries(Object.entries(value).map(([k, v]) => [k, clone(v)])) : value;
|
|
9
9
|
}
|
|
10
|
+
export function combineSelectors(selectors) {
|
|
11
|
+
return Object.fromEntries(Object.entries(selectors).flatMap(sel => {
|
|
12
|
+
const key = sel[0];
|
|
13
|
+
return (Object.entries(sel[1])).map(nestedSel => {
|
|
14
|
+
return [nestedSel[0], (state, ...args) => {
|
|
15
|
+
return nestedSel[1](state[key], ...args);
|
|
16
|
+
}];
|
|
17
|
+
});
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
10
20
|
//# sourceMappingURL=helpers.js.map
|
package/build/lib/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/lib/helpers.ts"],"names":[],"mappings":"
|
|
1
|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J,CAAC,CAAC,CAAwC,CAAC;AAC5C,CAAC"}
|
|
@@ -7,3 +7,4 @@ export type NormalizedReduxActionExtractor<V> = V extends {
|
|
|
7
7
|
type: string;
|
|
8
8
|
} ? ReturnType<V> : never);
|
|
9
9
|
export type WordPressMetaActions = NormalizedReduxActionExtractor<typeof MetaActions>;
|
|
10
|
+
export type SubsequentArgsOfFunc<F> = F extends (arg: any, ...args: infer R) => any ? R : never;
|