@player-tools/dsl 0.3.0 → 0.4.0--canary.25.709
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/index.cjs.js +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.esm.js +2 -2
- package/package.json +4 -3
- package/src/compiler/schema.ts +1 -1
- package/src/switch.tsx +2 -2
- package/src/template.tsx +21 -18
- package/src/utils.tsx +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -535,7 +535,7 @@ const Template = (props) => {
|
|
|
535
535
|
}, [proxyRef, outputProp, outputElement.items]);
|
|
536
536
|
return /* @__PURE__ */ React__default["default"].createElement("proxy", {
|
|
537
537
|
ref: proxyRef
|
|
538
|
-
}, reactJsonReconciler.createPortal(/* @__PURE__ */ React__default["default"].createElement(OptionalIDSuffixProvider, {
|
|
538
|
+
}, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, reactJsonReconciler.createPortal(/* @__PURE__ */ React__default["default"].createElement(OptionalIDSuffixProvider, {
|
|
539
539
|
wrapperRef: valueRef,
|
|
540
540
|
templateIndex: `_index${baseContext.depth === 0 ? "" : baseContext.depth}_`
|
|
541
541
|
}, /* @__PURE__ */ React__default["default"].createElement(TemplateProvider, null, /* @__PURE__ */ React__default["default"].createElement("object", null, /* @__PURE__ */ React__default["default"].createElement("property", {
|
|
@@ -547,7 +547,7 @@ const Template = (props) => {
|
|
|
547
547
|
}, props.children)))), outputElement), /* @__PURE__ */ React__default["default"].createElement("value", {
|
|
548
548
|
ref: valueRef,
|
|
549
549
|
value: void 0
|
|
550
|
-
}));
|
|
550
|
+
})));
|
|
551
551
|
};
|
|
552
552
|
|
|
553
553
|
const bindingSymbol = Symbol("binding");
|
package/dist/index.d.ts
CHANGED
|
@@ -198,7 +198,7 @@ declare function normalizeText(options: {
|
|
|
198
198
|
/** The current node */
|
|
199
199
|
node: React$1.ReactNode;
|
|
200
200
|
/** A component to render a text asset */
|
|
201
|
-
TextComp?: React$1.ComponentType
|
|
201
|
+
TextComp?: React$1.ComponentType<React$1.PropsWithChildren>;
|
|
202
202
|
}): React$1.ReactNode;
|
|
203
203
|
/** Create a collection if needed */
|
|
204
204
|
declare function normalizeToCollection(options: {
|
|
@@ -207,8 +207,8 @@ declare function normalizeToCollection(options: {
|
|
|
207
207
|
/** A Text asset */
|
|
208
208
|
TextComp?: React$1.ComponentType;
|
|
209
209
|
/** A collection asset */
|
|
210
|
-
CollectionComp?: React$1.ComponentType
|
|
211
|
-
}): React$1.
|
|
210
|
+
CollectionComp?: React$1.ComponentType<React$1.PropsWithChildren>;
|
|
211
|
+
}): string | number | boolean | React$1.ReactFragment | JSX.Element | null | undefined;
|
|
212
212
|
|
|
213
213
|
interface SwitchProps {
|
|
214
214
|
/** defaults to a staticSwitch */
|
package/dist/index.esm.js
CHANGED
|
@@ -525,7 +525,7 @@ const Template = (props) => {
|
|
|
525
525
|
}, [proxyRef, outputProp, outputElement.items]);
|
|
526
526
|
return /* @__PURE__ */ React.createElement("proxy", {
|
|
527
527
|
ref: proxyRef
|
|
528
|
-
}, createPortal(/* @__PURE__ */ React.createElement(OptionalIDSuffixProvider, {
|
|
528
|
+
}, /* @__PURE__ */ React.createElement(React.Fragment, null, createPortal(/* @__PURE__ */ React.createElement(OptionalIDSuffixProvider, {
|
|
529
529
|
wrapperRef: valueRef,
|
|
530
530
|
templateIndex: `_index${baseContext.depth === 0 ? "" : baseContext.depth}_`
|
|
531
531
|
}, /* @__PURE__ */ React.createElement(TemplateProvider, null, /* @__PURE__ */ React.createElement("object", null, /* @__PURE__ */ React.createElement("property", {
|
|
@@ -537,7 +537,7 @@ const Template = (props) => {
|
|
|
537
537
|
}, props.children)))), outputElement), /* @__PURE__ */ React.createElement("value", {
|
|
538
538
|
ref: valueRef,
|
|
539
539
|
value: void 0
|
|
540
|
-
}));
|
|
540
|
+
})));
|
|
541
541
|
};
|
|
542
542
|
|
|
543
543
|
const bindingSymbol = Symbol("binding");
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@player-tools/dsl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0--canary.25.709",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
7
7
|
},
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"react": "^
|
|
9
|
+
"react": "^18.2.0",
|
|
10
|
+
"@types/react": "^18.0.27"
|
|
10
11
|
},
|
|
11
12
|
"dependencies": {
|
|
12
|
-
"@player-ui/types": "
|
|
13
|
+
"@player-ui/types": "0.4.0-next.6",
|
|
13
14
|
"@types/mkdirp": "^1.0.2",
|
|
14
15
|
"@types/signale": "^1.4.2",
|
|
15
16
|
"chalk": "^4.0.1",
|
package/src/compiler/schema.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Schema, Language } from '@player-ui/types';
|
|
|
2
2
|
import signale from 'signale';
|
|
3
3
|
import { dequal } from 'dequal';
|
|
4
4
|
import { SyncWaterfallHook } from 'tapable-ts';
|
|
5
|
-
import { binding as b } from '
|
|
5
|
+
import { binding as b } from '../string-templates';
|
|
6
6
|
import type { BindingTemplateInstance } from '../string-templates';
|
|
7
7
|
|
|
8
8
|
const bindingSymbol = Symbol('binding');
|
package/src/switch.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { PropsWithChildren } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { ArrayNode, JsonNode, ObjectNode } from 'react-json-reconciler';
|
|
4
|
-
import { flattenNodes
|
|
5
|
-
import { SlotContext } from '
|
|
4
|
+
import { flattenNodes } from 'react-json-reconciler';
|
|
5
|
+
import { SlotContext } from './components';
|
|
6
6
|
import { IDSuffixProvider, OptionalIDSuffixProvider } from './auto-id';
|
|
7
7
|
import type {
|
|
8
8
|
BindingTemplateInstance,
|
package/src/template.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable react/jsx-no-useless-fragment */
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import type { ObjectNode, JsonNode } from 'react-json-reconciler';
|
|
3
4
|
import {
|
|
@@ -163,24 +164,26 @@ export const Template = (props: TemplateProps) => {
|
|
|
163
164
|
|
|
164
165
|
return (
|
|
165
166
|
<proxy ref={proxyRef}>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
<
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
167
|
+
<>
|
|
168
|
+
{createPortal(
|
|
169
|
+
<OptionalIDSuffixProvider
|
|
170
|
+
wrapperRef={valueRef}
|
|
171
|
+
templateIndex={`_index${
|
|
172
|
+
baseContext.depth === 0 ? '' : baseContext.depth
|
|
173
|
+
}_`}
|
|
174
|
+
>
|
|
175
|
+
<TemplateProvider>
|
|
176
|
+
<object>
|
|
177
|
+
<property name="data">{props.data.toValue()}</property>
|
|
178
|
+
<property name="output">{outputProp}</property>
|
|
179
|
+
<property name="value">{props.children}</property>
|
|
180
|
+
</object>
|
|
181
|
+
</TemplateProvider>
|
|
182
|
+
</OptionalIDSuffixProvider>,
|
|
183
|
+
outputElement
|
|
184
|
+
)}
|
|
185
|
+
<value ref={valueRef} value={undefined} />
|
|
186
|
+
</>
|
|
184
187
|
</proxy>
|
|
185
188
|
);
|
|
186
189
|
};
|
package/src/utils.tsx
CHANGED
|
@@ -56,7 +56,7 @@ export function normalizeText(options: {
|
|
|
56
56
|
node: React.ReactNode;
|
|
57
57
|
|
|
58
58
|
/** A component to render a text asset */
|
|
59
|
-
TextComp?: React.ComponentType
|
|
59
|
+
TextComp?: React.ComponentType<React.PropsWithChildren>;
|
|
60
60
|
}): React.ReactNode {
|
|
61
61
|
const { node, TextComp } = options;
|
|
62
62
|
|
|
@@ -88,7 +88,7 @@ export function normalizeToCollection(options: {
|
|
|
88
88
|
TextComp?: React.ComponentType;
|
|
89
89
|
|
|
90
90
|
/** A collection asset */
|
|
91
|
-
CollectionComp?: React.ComponentType
|
|
91
|
+
CollectionComp?: React.ComponentType<React.PropsWithChildren>;
|
|
92
92
|
}) {
|
|
93
93
|
const { node, CollectionComp } = options;
|
|
94
94
|
|