@continuum-dev/starter-kit 0.1.4
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/LICENSE +21 -0
- package/README.md +39 -0
- package/index.d.ts +14 -0
- package/index.d.ts.map +1 -0
- package/index.js +12 -0
- package/lib/component-map.d.ts +3 -0
- package/lib/component-map.d.ts.map +1 -0
- package/lib/component-map.js +17 -0
- package/lib/primitives/actions/action-button.d.ts +3 -0
- package/lib/primitives/actions/action-button.d.ts.map +1 -0
- package/lib/primitives/actions/action-button.js +29 -0
- package/lib/primitives/content/presentation.d.ts +3 -0
- package/lib/primitives/content/presentation.d.ts.map +1 -0
- package/lib/primitives/content/presentation.js +11 -0
- package/lib/primitives/content/unknown-node.d.ts +3 -0
- package/lib/primitives/content/unknown-node.d.ts.map +1 -0
- package/lib/primitives/content/unknown-node.js +12 -0
- package/lib/primitives/fields/date-input.d.ts +3 -0
- package/lib/primitives/fields/date-input.d.ts.map +1 -0
- package/lib/primitives/fields/date-input.js +7 -0
- package/lib/primitives/fields/radio-group.d.ts +3 -0
- package/lib/primitives/fields/radio-group.d.ts.map +1 -0
- package/lib/primitives/fields/radio-group.js +18 -0
- package/lib/primitives/fields/select-input.d.ts +3 -0
- package/lib/primitives/fields/select-input.d.ts.map +1 -0
- package/lib/primitives/fields/select-input.js +8 -0
- package/lib/primitives/fields/slider-input.d.ts +3 -0
- package/lib/primitives/fields/slider-input.d.ts.map +1 -0
- package/lib/primitives/fields/slider-input.js +13 -0
- package/lib/primitives/fields/text-input.d.ts +3 -0
- package/lib/primitives/fields/text-input.d.ts.map +1 -0
- package/lib/primitives/fields/text-input.js +18 -0
- package/lib/primitives/fields/textarea-input.d.ts +3 -0
- package/lib/primitives/fields/textarea-input.d.ts.map +1 -0
- package/lib/primitives/fields/textarea-input.js +7 -0
- package/lib/primitives/fields/toggle-input.d.ts +3 -0
- package/lib/primitives/fields/toggle-input.d.ts.map +1 -0
- package/lib/primitives/fields/toggle-input.js +32 -0
- package/lib/primitives/index.d.ts +15 -0
- package/lib/primitives/index.d.ts.map +1 -0
- package/lib/primitives/index.js +14 -0
- package/lib/primitives/layout/collection-section.d.ts +3 -0
- package/lib/primitives/layout/collection-section.d.ts.map +1 -0
- package/lib/primitives/layout/collection-section.js +32 -0
- package/lib/primitives/layout/grid-section.d.ts +3 -0
- package/lib/primitives/layout/grid-section.d.ts.map +1 -0
- package/lib/primitives/layout/grid-section.js +13 -0
- package/lib/primitives/layout/group-section.d.ts +3 -0
- package/lib/primitives/layout/group-section.d.ts.map +1 -0
- package/lib/primitives/layout/group-section.js +31 -0
- package/lib/primitives/layout/row-section.d.ts +3 -0
- package/lib/primitives/layout/row-section.d.ts.map +1 -0
- package/lib/primitives/layout/row-section.js +13 -0
- package/lib/primitives/shared/container-shell.d.ts +14 -0
- package/lib/primitives/shared/container-shell.d.ts.map +1 -0
- package/lib/primitives/shared/container-shell.js +90 -0
- package/lib/primitives/shared/field-frame.d.ts +9 -0
- package/lib/primitives/shared/field-frame.d.ts.map +1 -0
- package/lib/primitives/shared/field-frame.js +40 -0
- package/lib/primitives/shared/node.d.ts +9 -0
- package/lib/primitives/shared/node.d.ts.map +1 -0
- package/lib/primitives/shared/node.js +41 -0
- package/lib/proposals/conflict-banner.d.ts +14 -0
- package/lib/proposals/conflict-banner.d.ts.map +1 -0
- package/lib/proposals/conflict-banner.js +82 -0
- package/lib/proposals/field-proposal.d.ts +7 -0
- package/lib/proposals/field-proposal.d.ts.map +1 -0
- package/lib/proposals/field-proposal.js +17 -0
- package/lib/proposals/suggestions-bar.d.ts +4 -0
- package/lib/proposals/suggestions-bar.d.ts.map +1 -0
- package/lib/proposals/suggestions-bar.js +39 -0
- package/lib/tokens.d.ts +75 -0
- package/lib/tokens.d.ts.map +1 -0
- package/lib/tokens.js +74 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bryton Cooper
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @continuum-dev/starter-kit
|
|
2
|
+
|
|
3
|
+
Website: [continuumstack.dev](https://continuumstack.dev)
|
|
4
|
+
GitHub: [brytoncooper/continuum-dev](https://github.com/brytoncooper/continuum-dev)
|
|
5
|
+
|
|
6
|
+
`@continuum-dev/starter-kit` is the fastest way to get Continuum on screen in a React app.
|
|
7
|
+
|
|
8
|
+
Continuum itself stays headless by design. The starter kit is the opinionated convenience layer:
|
|
9
|
+
|
|
10
|
+
- ready-to-use primitives for common Continuum node types
|
|
11
|
+
- a default component map
|
|
12
|
+
- proposal and suggestion UI helpers
|
|
13
|
+
- prompt helpers re-exported from `@continuum-dev/prompts`
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @continuum-dev/starter-kit react
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Use it when
|
|
22
|
+
|
|
23
|
+
- you want a polished starting point instead of building your own component map first
|
|
24
|
+
- you want proposal-safe UI ready on day one
|
|
25
|
+
- you want prompt helpers available from the same package surface
|
|
26
|
+
|
|
27
|
+
## Example
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { ContinuumProvider, ContinuumRenderer, starterKitComponentMap } from '@continuum-dev/starter-kit';
|
|
31
|
+
|
|
32
|
+
export function App() {
|
|
33
|
+
return (
|
|
34
|
+
<ContinuumProvider components={starterKitComponentMap} persist="localStorage">
|
|
35
|
+
<ContinuumRenderer view={view} />
|
|
36
|
+
</ContinuumProvider>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
```
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { ContinuumProvider, ContinuumRenderer } from '@continuum-dev/react';
|
|
2
|
+
export * from '@continuum-dev/core';
|
|
3
|
+
export type { ContinuumNodeMap, ContinuumNodeProps, ContinuumProviderProps, ContinuumPersistError, } from '@continuum-dev/react';
|
|
4
|
+
export { useContinuumAction, useContinuumConflict, useContinuumDiagnostics, useContinuumHydrated, useContinuumSession, useContinuumSnapshot, useContinuumState, useContinuumSuggestions, useContinuumViewport, } from '@continuum-dev/react';
|
|
5
|
+
export * from '@continuum-dev/prompts';
|
|
6
|
+
export { starterKitComponentMap } from './lib/component-map.js';
|
|
7
|
+
export * from './lib/primitives/index.js';
|
|
8
|
+
export { FieldFrame, inputLikeStyle } from './lib/primitives/shared/field-frame.js';
|
|
9
|
+
export { nodeDescription, nodeLabel, nodeNumberProp, nodeOptions, nodePlaceholder, readNodeProp, } from './lib/primitives/shared/node.js';
|
|
10
|
+
export * from './lib/proposals/conflict-banner.js';
|
|
11
|
+
export * from './lib/proposals/field-proposal.js';
|
|
12
|
+
export * from './lib/proposals/suggestions-bar.js';
|
|
13
|
+
export * from './lib/tokens.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/starter-kit/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACxE,cAAc,iBAAiB,CAAC;AAChC,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EACL,eAAe,EACf,SAAS,EACT,cAAc,EACd,WAAW,EACX,eAAe,EACf,YAAY,GACb,MAAM,iCAAiC,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,iBAAiB,CAAC"}
|
package/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { ContinuumProvider, ContinuumRenderer } from '@continuum-dev/react';
|
|
2
|
+
export * from '@continuum-dev/core';
|
|
3
|
+
export { useContinuumAction, useContinuumConflict, useContinuumDiagnostics, useContinuumHydrated, useContinuumSession, useContinuumSnapshot, useContinuumState, useContinuumSuggestions, useContinuumViewport, } from '@continuum-dev/react';
|
|
4
|
+
export * from '@continuum-dev/prompts';
|
|
5
|
+
export { starterKitComponentMap } from './lib/component-map.js';
|
|
6
|
+
export * from './lib/primitives/index.js';
|
|
7
|
+
export { FieldFrame, inputLikeStyle } from './lib/primitives/shared/field-frame.js';
|
|
8
|
+
export { nodeDescription, nodeLabel, nodeNumberProp, nodeOptions, nodePlaceholder, readNodeProp, } from './lib/primitives/shared/node.js';
|
|
9
|
+
export * from './lib/proposals/conflict-banner.js';
|
|
10
|
+
export * from './lib/proposals/field-proposal.js';
|
|
11
|
+
export * from './lib/proposals/suggestions-bar.js';
|
|
12
|
+
export * from './lib/tokens.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-map.d.ts","sourceRoot":"","sources":["../../../../packages/starter-kit/src/lib/component-map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAkBzD,eAAO,MAAM,sBAAsB,EAAE,gBAepC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ActionButton, CollectionSection, DateInput, GridSection, GroupSection, Presentation, RadioGroupInput, RowSection, SelectInput, SliderInput, TextareaInput, TextInput, ToggleInput, UnknownNode, } from './primitives/index.js';
|
|
2
|
+
export const starterKitComponentMap = {
|
|
3
|
+
field: TextInput,
|
|
4
|
+
select: SelectInput,
|
|
5
|
+
toggle: ToggleInput,
|
|
6
|
+
date: DateInput,
|
|
7
|
+
textarea: TextareaInput,
|
|
8
|
+
'radio-group': RadioGroupInput,
|
|
9
|
+
slider: SliderInput,
|
|
10
|
+
action: ActionButton,
|
|
11
|
+
presentation: Presentation,
|
|
12
|
+
group: GroupSection,
|
|
13
|
+
row: RowSection,
|
|
14
|
+
grid: GridSection,
|
|
15
|
+
collection: CollectionSection,
|
|
16
|
+
default: UnknownNode,
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-button.d.ts","sourceRoot":"","sources":["../../../../../../packages/starter-kit/src/lib/primitives/actions/action-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAK3D,wBAAgB,YAAY,CAAC,EAAE,UAAU,EAAE,EAAE,kBAAkB,2CA6C9D"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContinuumAction } from '@continuum-dev/react';
|
|
3
|
+
import { color, control, radius, space, type } from '../../tokens.js';
|
|
4
|
+
import { nodeDescription, nodeLabel, readNodeProp } from '../shared/node.js';
|
|
5
|
+
export function ActionButton({ definition }) {
|
|
6
|
+
const intentId = readNodeProp(definition, 'intentId') ?? '';
|
|
7
|
+
const { dispatch, isDispatching, lastResult } = useContinuumAction(intentId);
|
|
8
|
+
return (_jsxs("div", { style: {
|
|
9
|
+
display: 'grid',
|
|
10
|
+
gap: space.sm,
|
|
11
|
+
alignContent: 'start',
|
|
12
|
+
justifyItems: 'end',
|
|
13
|
+
width: '100%',
|
|
14
|
+
flex: '1 0 100%',
|
|
15
|
+
}, children: [_jsx("button", { type: "button", style: {
|
|
16
|
+
height: control.height,
|
|
17
|
+
padding: `0 ${space.lg}px`,
|
|
18
|
+
borderRadius: radius.md,
|
|
19
|
+
border: `1px solid ${color.borderStrong}`,
|
|
20
|
+
background: color.accent,
|
|
21
|
+
color: color.surface,
|
|
22
|
+
cursor: 'pointer',
|
|
23
|
+
justifySelf: 'end',
|
|
24
|
+
...type.body,
|
|
25
|
+
fontWeight: 600,
|
|
26
|
+
}, onClick: () => {
|
|
27
|
+
void dispatch(definition.id);
|
|
28
|
+
}, children: isDispatching ? 'Working…' : nodeLabel(definition) }), nodeDescription(definition) ? (_jsx("div", { style: { ...type.small, color: color.textMuted, textAlign: 'right' }, children: nodeDescription(definition) })) : null, lastResult ? (_jsx("div", { style: { ...type.small, color: color.textMuted, textAlign: 'right' }, children: lastResult.success ? 'Action completed' : 'Action failed' })) : null] }));
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../../../../../packages/starter-kit/src/lib/primitives/content/presentation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI3D,wBAAgB,YAAY,CAAC,EAAE,UAAU,EAAE,EAAE,kBAAkB,2CAc9D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { color, space, type } from '../../tokens.js';
|
|
3
|
+
import { readNodeProp } from '../shared/node.js';
|
|
4
|
+
export function Presentation({ definition }) {
|
|
5
|
+
const content = readNodeProp(definition, 'content') ?? '';
|
|
6
|
+
return (_jsx("div", { style: {
|
|
7
|
+
display: 'grid',
|
|
8
|
+
gap: space.sm,
|
|
9
|
+
padding: `${space.sm}px 0`,
|
|
10
|
+
}, children: _jsx("div", { style: { ...type.body, color: color.text }, children: content }) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unknown-node.d.ts","sourceRoot":"","sources":["../../../../../../packages/starter-kit/src/lib/primitives/content/unknown-node.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG3D,wBAAgB,WAAW,CAAC,EAAE,UAAU,EAAE,EAAE,kBAAkB,2CAe7D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { color, radius, space, type } from '../../tokens.js';
|
|
3
|
+
export function UnknownNode({ definition }) {
|
|
4
|
+
return (_jsx("div", { style: {
|
|
5
|
+
padding: space.lg,
|
|
6
|
+
borderRadius: radius.md,
|
|
7
|
+
border: `1px dashed ${color.border}`,
|
|
8
|
+
background: color.surfaceMuted,
|
|
9
|
+
...type.small,
|
|
10
|
+
color: color.textMuted,
|
|
11
|
+
}, children: `No starter-kit primitive mapped for "${definition.type}"` }));
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-input.d.ts","sourceRoot":"","sources":["../../../../../../packages/starter-kit/src/lib/primitives/fields/date-input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI3D,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,kBAAkB,2CAa5E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FieldFrame, inputLikeStyle } from '../shared/field-frame.js';
|
|
3
|
+
import { nodeDescription, nodeLabel } from '../shared/node.js';
|
|
4
|
+
export function DateInput({ value, onChange, definition }) {
|
|
5
|
+
const dateValue = value?.value ?? '';
|
|
6
|
+
return (_jsx(FieldFrame, { label: nodeLabel(definition), description: nodeDescription(definition), children: _jsx("input", { type: "date", value: dateValue, style: inputLikeStyle(), onChange: (event) => onChange({ value: event.target.value, isDirty: true }) }) }));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../../../../../packages/starter-kit/src/lib/primitives/fields/radio-group.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAgB3D,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,kBAAkB,2CAqBlF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { color, radius, space, type } from '../../tokens.js';
|
|
3
|
+
import { FieldFrame } from '../shared/field-frame.js';
|
|
4
|
+
import { nodeDescription, nodeLabel, nodeOptions } from '../shared/node.js';
|
|
5
|
+
const optionStyle = {
|
|
6
|
+
display: 'flex',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
gap: space.md,
|
|
9
|
+
padding: `${space.sm}px ${space.md}px`,
|
|
10
|
+
borderRadius: radius.md,
|
|
11
|
+
border: `1px solid ${color.borderSoft}`,
|
|
12
|
+
background: color.surfaceMuted,
|
|
13
|
+
};
|
|
14
|
+
export function RadioGroupInput({ value, onChange, definition }) {
|
|
15
|
+
const selected = value?.value ?? '';
|
|
16
|
+
const options = nodeOptions(definition);
|
|
17
|
+
return (_jsx(FieldFrame, { label: nodeLabel(definition), description: nodeDescription(definition), children: _jsx("div", { style: { display: 'grid', gap: space.sm }, children: options.map((option) => (_jsxs("label", { style: optionStyle, children: [_jsx("input", { type: "radio", name: definition.id, checked: selected === option.value, onChange: () => onChange({ value: option.value, isDirty: true }) }), _jsx("span", { style: { ...type.body, color: color.text }, children: option.label })] }, option.value))) }) }));
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-input.d.ts","sourceRoot":"","sources":["../../../../../../packages/starter-kit/src/lib/primitives/fields/select-input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI3D,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,kBAAkB,2CAoB9E"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FieldFrame, inputLikeStyle } from '../shared/field-frame.js';
|
|
3
|
+
import { nodeDescription, nodeLabel, nodeOptions } from '../shared/node.js';
|
|
4
|
+
export function SelectInput({ value, onChange, definition }) {
|
|
5
|
+
const selected = value?.value ?? '';
|
|
6
|
+
const options = nodeOptions(definition);
|
|
7
|
+
return (_jsx(FieldFrame, { label: nodeLabel(definition), description: nodeDescription(definition), children: _jsxs("select", { value: selected, style: inputLikeStyle({ cursor: 'pointer', paddingRight: 40 }), onChange: (event) => onChange({ value: event.target.value, isDirty: true }), children: [_jsx("option", { value: "", children: "Select one" }), options.map((option) => (_jsx("option", { value: option.value, children: option.label }, option.value)))] }) }));
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider-input.d.ts","sourceRoot":"","sources":["../../../../../../packages/starter-kit/src/lib/primitives/fields/slider-input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAK3D,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,kBAAkB,2CA4B9E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { color, space, type } from '../../tokens.js';
|
|
3
|
+
import { FieldFrame } from '../shared/field-frame.js';
|
|
4
|
+
import { nodeDescription, nodeLabel, nodeNumberProp } from '../shared/node.js';
|
|
5
|
+
export function SliderInput({ value, onChange, definition }) {
|
|
6
|
+
const min = nodeNumberProp(definition, 'min', 0);
|
|
7
|
+
const max = nodeNumberProp(definition, 'max', 100);
|
|
8
|
+
const fallback = Math.round((min + max) / 2);
|
|
9
|
+
const numericValue = typeof value?.value === 'number'
|
|
10
|
+
? value.value
|
|
11
|
+
: fallback;
|
|
12
|
+
return (_jsx(FieldFrame, { label: nodeLabel(definition), description: nodeDescription(definition), children: _jsxs("div", { style: { display: 'grid', gap: space.sm }, children: [_jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', ...type.small, color: color.textMuted }, children: [_jsx("span", { children: min }), _jsx("span", { style: { color: color.text }, children: numericValue }), _jsx("span", { children: max })] }), _jsx("input", { type: "range", min: min, max: max, value: numericValue, style: { width: '100%', accentColor: color.accent }, onChange: (event) => onChange({ value: Number(event.target.value), isDirty: true }) })] }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-input.d.ts","sourceRoot":"","sources":["../../../../../../packages/starter-kit/src/lib/primitives/fields/text-input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI3D,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,kBAAkB,2CA6B5E"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FieldFrame, inputLikeStyle } from '../shared/field-frame.js';
|
|
3
|
+
import { nodeDescription, nodeLabel, nodePlaceholder, readNodeProp } from '../shared/node.js';
|
|
4
|
+
export function TextInput({ value, onChange, definition }) {
|
|
5
|
+
const dataType = readNodeProp(definition, 'dataType') ?? 'string';
|
|
6
|
+
const rawValue = value?.value;
|
|
7
|
+
const displayValue = dataType === 'number'
|
|
8
|
+
? typeof rawValue === 'number'
|
|
9
|
+
? String(rawValue)
|
|
10
|
+
: ''
|
|
11
|
+
: typeof rawValue === 'string'
|
|
12
|
+
? rawValue
|
|
13
|
+
: '';
|
|
14
|
+
return (_jsx(FieldFrame, { label: nodeLabel(definition), description: nodeDescription(definition), children: _jsx("input", { type: dataType === 'number' ? 'number' : 'text', value: displayValue, placeholder: nodePlaceholder(definition) ?? `Enter ${nodeLabel(definition).toLowerCase()}`, readOnly: Boolean(readNodeProp(definition, 'readOnly')), style: inputLikeStyle(), onChange: (event) => onChange({
|
|
15
|
+
value: dataType === 'number' ? Number(event.target.value) : event.target.value,
|
|
16
|
+
isDirty: true,
|
|
17
|
+
}) }) }));
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea-input.d.ts","sourceRoot":"","sources":["../../../../../../packages/starter-kit/src/lib/primitives/fields/textarea-input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI3D,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,kBAAkB,2CAahF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FieldFrame, inputLikeStyle } from '../shared/field-frame.js';
|
|
3
|
+
import { nodeDescription, nodeLabel, nodePlaceholder } from '../shared/node.js';
|
|
4
|
+
export function TextareaInput({ value, onChange, definition }) {
|
|
5
|
+
const text = value?.value ?? '';
|
|
6
|
+
return (_jsx(FieldFrame, { label: nodeLabel(definition), description: nodeDescription(definition), children: _jsx("textarea", { value: text, placeholder: nodePlaceholder(definition) ?? `Enter ${nodeLabel(definition).toLowerCase()}`, style: inputLikeStyle({ minHeight: 120, height: 120, resize: 'vertical' }), onChange: (event) => onChange({ value: event.target.value, isDirty: true }) }) }));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle-input.d.ts","sourceRoot":"","sources":["../../../../../../packages/starter-kit/src/lib/primitives/fields/toggle-input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAiC3D,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,kBAAkB,2CAsB9E"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { color, control, radius, space, type } from '../../tokens.js';
|
|
3
|
+
import { nodeDescription, nodeLabel } from '../shared/node.js';
|
|
4
|
+
const wrapStyle = {
|
|
5
|
+
display: 'flex',
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
gap: space.md,
|
|
8
|
+
minHeight: control.height,
|
|
9
|
+
};
|
|
10
|
+
const trackStyle = (checked) => ({
|
|
11
|
+
position: 'relative',
|
|
12
|
+
width: 48,
|
|
13
|
+
height: 28,
|
|
14
|
+
borderRadius: radius.pill,
|
|
15
|
+
background: checked ? color.accent : color.surfaceInset,
|
|
16
|
+
border: `1px solid ${checked ? color.borderStrong : color.border}`,
|
|
17
|
+
flexShrink: 0,
|
|
18
|
+
});
|
|
19
|
+
const thumbStyle = (checked) => ({
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
top: 3,
|
|
22
|
+
left: checked ? 23 : 3,
|
|
23
|
+
width: 20,
|
|
24
|
+
height: 20,
|
|
25
|
+
borderRadius: radius.pill,
|
|
26
|
+
background: color.surface,
|
|
27
|
+
border: `1px solid ${checked ? color.borderStrong : color.border}`,
|
|
28
|
+
});
|
|
29
|
+
export function ToggleInput({ value, onChange, definition }) {
|
|
30
|
+
const checked = Boolean(value?.value);
|
|
31
|
+
return (_jsxs("label", { style: wrapStyle, children: [_jsxs("span", { style: trackStyle(checked), children: [_jsx("span", { style: thumbStyle(checked) }), _jsx("input", { type: "checkbox", checked: checked, style: { opacity: 0, position: 'absolute', inset: 0, cursor: 'pointer' }, onChange: (event) => onChange({ value: event.target.checked, isDirty: true }) })] }), _jsxs("span", { style: { display: 'grid', gap: space.xs }, children: [_jsx("span", { style: { ...type.section, color: color.text }, children: nodeLabel(definition) }), nodeDescription(definition) ? (_jsx("span", { style: { ...type.small, color: color.textMuted }, children: nodeDescription(definition) })) : null] })] }));
|
|
32
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { ActionButton } from './actions/action-button.js';
|
|
2
|
+
export { Presentation } from './content/presentation.js';
|
|
3
|
+
export { UnknownNode } from './content/unknown-node.js';
|
|
4
|
+
export { DateInput } from './fields/date-input.js';
|
|
5
|
+
export { RadioGroupInput } from './fields/radio-group.js';
|
|
6
|
+
export { SelectInput } from './fields/select-input.js';
|
|
7
|
+
export { SliderInput } from './fields/slider-input.js';
|
|
8
|
+
export { TextareaInput } from './fields/textarea-input.js';
|
|
9
|
+
export { TextInput } from './fields/text-input.js';
|
|
10
|
+
export { ToggleInput } from './fields/toggle-input.js';
|
|
11
|
+
export { CollectionSection } from './layout/collection-section.js';
|
|
12
|
+
export { GridSection } from './layout/grid-section.js';
|
|
13
|
+
export { GroupSection } from './layout/group-section.js';
|
|
14
|
+
export { RowSection } from './layout/row-section.js';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/starter-kit/src/lib/primitives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { ActionButton } from './actions/action-button.js';
|
|
2
|
+
export { Presentation } from './content/presentation.js';
|
|
3
|
+
export { UnknownNode } from './content/unknown-node.js';
|
|
4
|
+
export { DateInput } from './fields/date-input.js';
|
|
5
|
+
export { RadioGroupInput } from './fields/radio-group.js';
|
|
6
|
+
export { SelectInput } from './fields/select-input.js';
|
|
7
|
+
export { SliderInput } from './fields/slider-input.js';
|
|
8
|
+
export { TextareaInput } from './fields/textarea-input.js';
|
|
9
|
+
export { TextInput } from './fields/text-input.js';
|
|
10
|
+
export { ToggleInput } from './fields/toggle-input.js';
|
|
11
|
+
export { CollectionSection } from './layout/collection-section.js';
|
|
12
|
+
export { GridSection } from './layout/grid-section.js';
|
|
13
|
+
export { GroupSection } from './layout/group-section.js';
|
|
14
|
+
export { RowSection } from './layout/row-section.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-section.d.ts","sourceRoot":"","sources":["../../../../../../packages/starter-kit/src/lib/primitives/layout/collection-section.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAoB3D,wBAAgB,iBAAiB,CAAC,EAChC,UAAU,EACV,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,GACN,EAAE,kBAAkB,2CAqCpB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { color, control, radius, space, type } from '../../tokens.js';
|
|
3
|
+
import { nodeDepth, nodeDescription, nodeLabel } from '../shared/node.js';
|
|
4
|
+
const headerStyle = {
|
|
5
|
+
display: 'grid',
|
|
6
|
+
gap: space.xs,
|
|
7
|
+
};
|
|
8
|
+
const addButtonStyle = {
|
|
9
|
+
height: control.height,
|
|
10
|
+
padding: `0 ${space.md}px`,
|
|
11
|
+
borderRadius: radius.md,
|
|
12
|
+
border: `1px solid ${color.border}`,
|
|
13
|
+
background: color.surface,
|
|
14
|
+
color: color.text,
|
|
15
|
+
cursor: 'pointer',
|
|
16
|
+
flexShrink: 0,
|
|
17
|
+
};
|
|
18
|
+
export function CollectionSection({ definition, children, nodeId, canAdd, onAdd, }) {
|
|
19
|
+
const depth = nodeDepth(nodeId);
|
|
20
|
+
return (_jsxs("section", { style: {
|
|
21
|
+
display: 'grid',
|
|
22
|
+
gap: space.lg,
|
|
23
|
+
padding: depth === 0 ? space.xxl : 0,
|
|
24
|
+
borderRadius: depth === 0 ? radius.lg : 0,
|
|
25
|
+
background: depth === 0 ? color.surface : 'transparent',
|
|
26
|
+
border: depth === 0 ? `1px solid ${color.border}` : 'none',
|
|
27
|
+
}, children: [_jsxs("div", { style: headerStyle, children: [_jsx("div", { style: { ...type.section, color: color.text }, children: nodeLabel(definition) }), nodeDescription(definition) ? (_jsx("div", { style: { ...type.small, color: color.textMuted }, children: nodeDescription(definition) })) : null] }), _jsx("div", { style: { display: 'grid', gap: space.md }, children: children }), _jsx("div", { style: { display: 'flex', justifyContent: 'flex-end' }, children: _jsx("button", { type: "button", style: addButtonStyle, disabled: !canAdd, onClick: () => {
|
|
28
|
+
if (typeof onAdd === 'function') {
|
|
29
|
+
onAdd();
|
|
30
|
+
}
|
|
31
|
+
}, children: "Add item" }) })] }));
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-section.d.ts","sourceRoot":"","sources":["../../../../../../packages/starter-kit/src/lib/primitives/layout/grid-section.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAK3D,wBAAgB,WAAW,CAAC,KAAK,EAAE,kBAAkB,2CAqBpD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { space } from '../../tokens.js';
|
|
3
|
+
import { ContainerShell } from '../shared/container-shell.js';
|
|
4
|
+
import { nodeDescription, nodeLabel, readNodeProp } from '../shared/node.js';
|
|
5
|
+
export function GridSection(props) {
|
|
6
|
+
const columns = readNodeProp(props.definition, 'columns') ?? 2;
|
|
7
|
+
return (_jsx(ContainerShell, { title: nodeLabel(props.definition), description: nodeDescription(props.definition), nodeId: props.nodeId, itemIndex: props.itemIndex, canRemove: props.canRemove, onRemove: props.onRemove, layoutStyle: {
|
|
8
|
+
display: 'grid',
|
|
9
|
+
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
|
|
10
|
+
gap: space.lg,
|
|
11
|
+
alignItems: 'start',
|
|
12
|
+
}, children: props.children }));
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-section.d.ts","sourceRoot":"","sources":["../../../../../../packages/starter-kit/src/lib/primitives/layout/group-section.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAiC3D,wBAAgB,YAAY,CAAC,KAAK,EAAE,kBAAkB,2CAcrD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { space } from '../../tokens.js';
|
|
3
|
+
import { ContainerShell } from '../shared/container-shell.js';
|
|
4
|
+
import { nodeDescription, nodeLabel, readNodeProp } from '../shared/node.js';
|
|
5
|
+
function layoutStyle(definition) {
|
|
6
|
+
const layout = readNodeProp(definition, 'layout') ?? 'vertical';
|
|
7
|
+
const columns = readNodeProp(definition, 'columns') ?? 2;
|
|
8
|
+
if (layout === 'horizontal') {
|
|
9
|
+
return {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexWrap: 'wrap',
|
|
12
|
+
gap: space.lg,
|
|
13
|
+
alignItems: 'start',
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (layout === 'grid') {
|
|
17
|
+
return {
|
|
18
|
+
display: 'grid',
|
|
19
|
+
gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
|
|
20
|
+
gap: space.lg,
|
|
21
|
+
alignItems: 'start',
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
display: 'grid',
|
|
26
|
+
gap: space.lg,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function GroupSection(props) {
|
|
30
|
+
return (_jsx(ContainerShell, { title: nodeLabel(props.definition), description: nodeDescription(props.definition), nodeId: props.nodeId, itemIndex: props.itemIndex, canRemove: props.canRemove, onRemove: props.onRemove, layoutStyle: layoutStyle(props.definition), children: props.children }));
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row-section.d.ts","sourceRoot":"","sources":["../../../../../../packages/starter-kit/src/lib/primitives/layout/row-section.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAK3D,wBAAgB,UAAU,CAAC,KAAK,EAAE,kBAAkB,2CAuBnD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { space } from '../../tokens.js';
|
|
3
|
+
import { ContainerShell } from '../shared/container-shell.js';
|
|
4
|
+
import { nodeDescription, nodeLabel } from '../shared/node.js';
|
|
5
|
+
export function RowSection(props) {
|
|
6
|
+
const isCollectionItem = typeof props.itemIndex === 'number';
|
|
7
|
+
return (_jsx(ContainerShell, { title: nodeLabel(props.definition), description: nodeDescription(props.definition), nodeId: props.nodeId, itemIndex: props.itemIndex, canRemove: props.canRemove, onRemove: props.onRemove, itemRemovePlacement: isCollectionItem ? 'inline' : 'header', itemRemoveVariant: isCollectionItem ? 'icon' : 'default', layoutStyle: {
|
|
8
|
+
display: 'flex',
|
|
9
|
+
flexWrap: 'wrap',
|
|
10
|
+
alignItems: 'start',
|
|
11
|
+
gap: space.lg,
|
|
12
|
+
}, children: props.children }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
export declare function ContainerShell({ title, description, nodeId, itemIndex, canRemove, onRemove, children, layoutStyle, itemRemovePlacement, itemRemoveVariant, }: {
|
|
3
|
+
title: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
nodeId?: string;
|
|
6
|
+
itemIndex?: number;
|
|
7
|
+
canRemove?: boolean;
|
|
8
|
+
onRemove?: () => void;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
layoutStyle: CSSProperties;
|
|
11
|
+
itemRemovePlacement?: 'header' | 'inline';
|
|
12
|
+
itemRemoveVariant?: 'default' | 'icon';
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=container-shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-shell.d.ts","sourceRoot":"","sources":["../../../../../../packages/starter-kit/src/lib/primitives/shared/container-shell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAmFtD,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,WAAW,EACX,MAAM,EACN,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,mBAA8B,EAC9B,iBAA6B,GAC9B,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,EAAE,aAAa,CAAC;IAC3B,mBAAmB,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1C,iBAAiB,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;CACxC,2CAuDA"}
|