firstly 0.6.2 → 0.7.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/CHANGELOG.md +20 -0
- package/esm/changeLog/index.d.ts +1 -0
- package/esm/svelte/FF_Config.svelte +2 -2
- package/esm/svelte/FF_Config.svelte.js +3 -0
- package/esm/svelte/grid/DefaultInput.svelte +42 -0
- package/esm/svelte/grid/DefaultInput.svelte.d.ts +9 -0
- package/esm/svelte/grid/FF_Cell.svelte +98 -0
- package/esm/svelte/grid/FF_Cell.svelte.d.ts +10 -0
- package/esm/svelte/grid/FF_CellValue.svelte +24 -0
- package/esm/svelte/grid/FF_CellValue.svelte.d.ts +28 -0
- package/esm/svelte/grid/FF_Cell_Content.svelte +37 -0
- package/esm/svelte/grid/FF_Cell_Content.svelte.d.ts +10 -0
- package/esm/svelte/grid/FF_Cell_Error.svelte +26 -0
- package/esm/svelte/grid/FF_Cell_Error.svelte.d.ts +8 -0
- package/esm/svelte/grid/FF_Cell_Hint.svelte +26 -0
- package/esm/svelte/grid/FF_Cell_Hint.svelte.d.ts +8 -0
- package/esm/svelte/grid/FF_Cell_Label.svelte +34 -0
- package/esm/svelte/grid/FF_Cell_Label.svelte.d.ts +8 -0
- package/esm/svelte/grid/FF_Grid.svelte +385 -0
- package/esm/svelte/grid/FF_Grid.svelte.d.ts +47 -0
- package/esm/svelte/grid/GroupFields.svelte +141 -0
- package/esm/svelte/grid/GroupFields.svelte.d.ts +45 -0
- package/esm/svelte/grid/_test/FF_Cell_ContextWrapper.svelte +9 -0
- package/esm/svelte/grid/_test/FF_Cell_ContextWrapper.svelte.d.ts +18 -0
- package/esm/svelte/grid/buildCells.d.ts +16 -0
- package/esm/svelte/grid/buildCells.js +79 -0
- package/esm/svelte/grid/cellComponent.d.ts +9 -0
- package/esm/svelte/grid/cellComponent.js +31 -0
- package/esm/svelte/grid/cellConfig.d.ts +13 -0
- package/esm/svelte/grid/cellConfig.js +48 -0
- package/esm/svelte/grid/cellTypes.d.ts +168 -0
- package/esm/svelte/grid/cellTypes.js +1 -0
- package/esm/svelte/grid/index.d.ts +10 -0
- package/esm/svelte/grid/index.js +12 -0
- package/esm/svelte/grid/metaKind.d.ts +27 -0
- package/esm/svelte/grid/metaKind.js +34 -0
- package/esm/svelte/index.d.ts +3 -2
- package/esm/svelte/index.js +3 -2
- package/package.json +4 -3
- package/esm/svelte/DemoForm.svelte +0 -121
- package/esm/svelte/DemoForm.svelte.d.ts +0 -42
- package/esm/svelte/DemoGrid.svelte +0 -258
- package/esm/svelte/DemoGrid.svelte.d.ts +0 -49
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# firstly
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#293](https://github.com/jycouet/firstly/pull/293) [`b70928c`](https://github.com/jycouet/firstly/commit/b70928c23ef5e6392abfdd9c57df03e009855abe) Thanks [@jycouet](https://github.com/jycouet)! - Add the cell layer: metadata-driven grids/forms over remult.
|
|
8
|
+
- **Published** (`firstly/svelte`): `buildCells` / `displayCell` / `<FF_Cell>` / `<FF_CellValue>` / `<GroupFields>` + the `FF_Config.cell` registry, with `%` widths, configurable per-column `sortable` (`defaultSortable`), and a `component`/`props` escape (lazy `CellComponent` thunks). Config is the SSoT on the entity via a new `hub` option on `EntityOptions`. **Plus `<FF_Grid>`** - a batteries-included demo grid (default skin + input, zero setup).
|
|
9
|
+
- **Boutique** (`src/boutique/grid`, copy-own): `App_Grid` / `App_Group` shells you degit to own the look.
|
|
10
|
+
- `DemoGrid` / `DemoForm` removed.
|
|
11
|
+
|
|
12
|
+
## 0.6.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#298](https://github.com/jycouet/firstly/pull/298) [`626db86`](https://github.com/jycouet/firstly/commit/626db8664ddcd480bc941ba38c51aaee742188c3) Thanks [@jycouet](https://github.com/jycouet)! - fix(deps): declare `@kitql/helpers` as a runtime dependency
|
|
17
|
+
|
|
18
|
+
`esm/index.js` does `import * as h from '@kitql/helpers'` (and re-exports it /
|
|
19
|
+
builds `ff_Log` from it), but the package only listed it under
|
|
20
|
+
`devDependencies`. Consumers that didn't happen to hoist it got
|
|
21
|
+
`Cannot find module '@kitql/helpers'` at runtime. Moved it into `dependencies`.
|
|
22
|
+
|
|
3
23
|
## 0.6.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/esm/changeLog/index.d.ts
CHANGED
|
@@ -46,4 +46,5 @@ export declare const withChangeLog: <entityType>(options?: EntityOptions<entityT
|
|
|
46
46
|
apiRequireId?: import("remult").Allowed;
|
|
47
47
|
dataProvider?: ((defaultDataProvider: import("remult").DataProvider) => import("remult").DataProvider | Promise<import("remult").DataProvider> | undefined | null) | undefined;
|
|
48
48
|
changeLog?: false | ColumnDeciderArgs<entityType> | undefined;
|
|
49
|
+
hub?: import("../svelte").HubConfig<entityType> | undefined;
|
|
49
50
|
};
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
import { setFFConfig, type FF_ConfigValue } from './FF_Config.svelte.js'
|
|
5
5
|
|
|
6
|
-
let { children, messages, dialog, toast }: { children: Snippet } & FF_ConfigValue = $props()
|
|
6
|
+
let { children, messages, dialog, toast, cell }: { children: Snippet } & FF_ConfigValue = $props()
|
|
7
7
|
|
|
8
8
|
// Hand context a getter over our (reactive) props, not a snapshot - so descendants re-read
|
|
9
9
|
// the latest values and locale-aware message functions resolve fresh on each render.
|
|
10
|
-
setFFConfig(() => ({ messages, dialog, toast }))
|
|
10
|
+
setFFConfig(() => ({ messages, dialog, toast, cell }))
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
{@render children()}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// Default cell input bundled with the published <FF_Grid> demo (token-only, currentColor based).
|
|
3
|
+
// An app that registers its own inputs via FF_Config.cell.inputs overrides this.
|
|
4
|
+
let {
|
|
5
|
+
value = $bindable(),
|
|
6
|
+
id,
|
|
7
|
+
type = 'text',
|
|
8
|
+
placeholder,
|
|
9
|
+
}: { value?: unknown; id?: string; type?: string; placeholder?: string } = $props()
|
|
10
|
+
|
|
11
|
+
let checked = $derived(value as boolean)
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
{#if type === 'number'}
|
|
15
|
+
<input {id} {placeholder} type="number" bind:value />
|
|
16
|
+
{:else if type === 'checkbox'}
|
|
17
|
+
<input {id} type="checkbox" {checked} onchange={(e) => (value = e.currentTarget.checked)} />
|
|
18
|
+
{:else}
|
|
19
|
+
<input
|
|
20
|
+
{id}
|
|
21
|
+
{placeholder}
|
|
22
|
+
type="text"
|
|
23
|
+
value={String(value ?? '')}
|
|
24
|
+
oninput={(e) => (value = e.currentTarget.value)}
|
|
25
|
+
/>
|
|
26
|
+
{/if}
|
|
27
|
+
|
|
28
|
+
<style>
|
|
29
|
+
input {
|
|
30
|
+
width: 100%;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
padding: 5px 7px;
|
|
33
|
+
font: inherit;
|
|
34
|
+
color: inherit;
|
|
35
|
+
background: transparent;
|
|
36
|
+
border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
|
|
37
|
+
border-radius: 6px;
|
|
38
|
+
}
|
|
39
|
+
input[type='checkbox'] {
|
|
40
|
+
width: auto;
|
|
41
|
+
}
|
|
42
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
value?: unknown;
|
|
3
|
+
id?: string;
|
|
4
|
+
type?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
};
|
|
7
|
+
declare const DefaultInput: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
8
|
+
type DefaultInput = ReturnType<typeof DefaultInput>;
|
|
9
|
+
export default DefaultInput;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
|
|
4
|
+
import { getCellElementConfig, getStyle } from './cellConfig.js'
|
|
5
|
+
import type { CellProps } from './cellTypes.js'
|
|
6
|
+
import FF_Cell_Content from './FF_Cell_Content.svelte'
|
|
7
|
+
import FF_Cell_Error from './FF_Cell_Error.svelte'
|
|
8
|
+
import FF_Cell_Hint from './FF_Cell_Hint.svelte'
|
|
9
|
+
import FF_Cell_Label from './FF_Cell_Label.svelte'
|
|
10
|
+
|
|
11
|
+
type Props = { debug?: boolean; children?: Snippet; value?: unknown } & CellProps
|
|
12
|
+
|
|
13
|
+
let { children, value = $bindable(), ...props }: Props = $props()
|
|
14
|
+
|
|
15
|
+
const default_uid = $props.id()
|
|
16
|
+
let id = $derived(props.key ?? default_uid)
|
|
17
|
+
let ui = $derived(props.ui)
|
|
18
|
+
let mode = $derived(props.mode ?? 'edit')
|
|
19
|
+
let debug = $derived(props.debug === true ? true : undefined)
|
|
20
|
+
|
|
21
|
+
// getCellElementConfig() reads context, so resolve the base ONCE at init; merge reactive
|
|
22
|
+
// per-instance overrides in a $derived so a later props.content.config change re-styles.
|
|
23
|
+
const contentBase = getCellElementConfig('content')
|
|
24
|
+
const labelBase = getCellElementConfig('label')
|
|
25
|
+
let contentConfig = $derived({ ...contentBase, ...props.content?.config })
|
|
26
|
+
|
|
27
|
+
let hasError = $derived(!!props.error?.html)
|
|
28
|
+
let labelProps = $derived(
|
|
29
|
+
props.label
|
|
30
|
+
? {
|
|
31
|
+
...props.label,
|
|
32
|
+
config: {
|
|
33
|
+
...labelBase,
|
|
34
|
+
...props.label.config,
|
|
35
|
+
...(!hasError ? { width: 100 } : {}),
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
: undefined,
|
|
39
|
+
)
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<div
|
|
43
|
+
data-ff-cell
|
|
44
|
+
style:--width={ui?.width ?? 100}
|
|
45
|
+
style:--margin-left={ui?.marginLeft ?? 0}
|
|
46
|
+
style:--margin-right={ui?.marginRight ?? 0}
|
|
47
|
+
style:--width-mobile={ui?.mobile?.width ?? 100}
|
|
48
|
+
style:--margin-left-mobile={ui?.mobile?.marginLeft ?? 0}
|
|
49
|
+
style:--margin-right-mobile={ui?.mobile?.marginRight ?? 0}
|
|
50
|
+
data-ff-cell-debug={debug}
|
|
51
|
+
>
|
|
52
|
+
<FF_Cell_Label {id} elementProps={labelProps} />
|
|
53
|
+
<FF_Cell_Error {id} elementProps={props.error} />
|
|
54
|
+
{#if children}
|
|
55
|
+
<div data-ff-cells style={getStyle(contentConfig)}>{@render children?.()}</div>
|
|
56
|
+
{:else}
|
|
57
|
+
<FF_Cell_Content {id} {mode} contentProps={props.content} bind:value />
|
|
58
|
+
{/if}
|
|
59
|
+
<FF_Cell_Hint {id} elementProps={props.hint} />
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<style>
|
|
63
|
+
[data-ff-cells] {
|
|
64
|
+
width: 100%;
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-wrap: wrap;
|
|
67
|
+
}
|
|
68
|
+
[data-ff-cell] {
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: row;
|
|
71
|
+
flex-wrap: wrap;
|
|
72
|
+
align-content: flex-start;
|
|
73
|
+
box-sizing: border-box;
|
|
74
|
+
padding: var(--ff-spacing, 0.5rem);
|
|
75
|
+
flex: 1 1 calc(var(--width, 100) * 1%);
|
|
76
|
+
max-width: calc(var(--width, 100) * 1%);
|
|
77
|
+
min-width: 0;
|
|
78
|
+
margin-left: calc(var(--margin-left, 0) * 1%);
|
|
79
|
+
margin-right: calc(var(--margin-right, 0) * 1%);
|
|
80
|
+
}
|
|
81
|
+
:global([data-ff-cell] > *) {
|
|
82
|
+
flex: 0 0 100%;
|
|
83
|
+
width: 100%;
|
|
84
|
+
}
|
|
85
|
+
[data-ff-cell][data-ff-cell-debug] {
|
|
86
|
+
outline: 1px solid var(--destructive, red);
|
|
87
|
+
outline-offset: -1px;
|
|
88
|
+
}
|
|
89
|
+
@media screen and (max-width: 40rem) {
|
|
90
|
+
[data-ff-cell] {
|
|
91
|
+
flex: 1 1 calc(var(--width-mobile, 100) * 1%);
|
|
92
|
+
max-width: calc(var(--width-mobile, 100) * 1%);
|
|
93
|
+
margin-left: calc(var(--margin-left-mobile, 0) * 1%);
|
|
94
|
+
margin-right: calc(var(--margin-right-mobile, 0) * 1%);
|
|
95
|
+
padding: 0.15rem;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { CellProps } from './cellTypes.js';
|
|
3
|
+
type Props = {
|
|
4
|
+
debug?: boolean;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
value?: unknown;
|
|
7
|
+
} & CellProps;
|
|
8
|
+
declare const FFCell: import("svelte").Component<Props, {}, "value">;
|
|
9
|
+
type FFCell = ReturnType<typeof FFCell>;
|
|
10
|
+
export default FFCell;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts" generics="E">
|
|
2
|
+
// Published cell-value renderer: the ONE place that turns a resolved Cell + row into output.
|
|
3
|
+
// Render order: cellSnippet → component (props + rowToProps) → field_link <a> → displayCell.
|
|
4
|
+
// Reused by the boutique FF_Grid and any app's own App_Grid, so the component+props escape is free.
|
|
5
|
+
// resolveCellComponent returns the Component synchronously for eager `() => Comp` thunks (so
|
|
6
|
+
// {#await} renders straight through, no flash) and a Promise for lazy `() => import(...)` thunks.
|
|
7
|
+
import { displayCell } from './buildCells.js'
|
|
8
|
+
import { resolveCellComponent } from './cellComponent.js'
|
|
9
|
+
import type { Cell } from './cellTypes.js'
|
|
10
|
+
|
|
11
|
+
let { cell, row }: { cell: Cell<E>; row: E } = $props()
|
|
12
|
+
|
|
13
|
+
const resolvedComp = $derived(cell.component ? resolveCellComponent(cell.component) : undefined)
|
|
14
|
+
const compProps = $derived({ ...(cell.props ?? {}), ...(cell.rowToProps?.(row) ?? {}) })
|
|
15
|
+
const href = $derived(cell.kind === 'field_link' ? cell.field?.options.href : undefined)
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
{#if cell.cellSnippet}{@render cell.cellSnippet({
|
|
19
|
+
row,
|
|
20
|
+
cell,
|
|
21
|
+
})}{:else if cell.component}{#await resolvedComp then C}{#if C}{@const Cc = C}<Cc
|
|
22
|
+
{...compProps}
|
|
23
|
+
/>{/if}{/await}{:else if href}<a data-ff-link href={href(row)}>{displayCell(cell, row)}</a
|
|
24
|
+
>{:else}{displayCell(cell, row)}{/if}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Cell } from './cellTypes.js';
|
|
2
|
+
declare function $$render<E>(): {
|
|
3
|
+
props: {
|
|
4
|
+
cell: Cell<E>;
|
|
5
|
+
row: E;
|
|
6
|
+
};
|
|
7
|
+
exports: {};
|
|
8
|
+
bindings: "";
|
|
9
|
+
slots: {};
|
|
10
|
+
events: {};
|
|
11
|
+
};
|
|
12
|
+
declare class __sveltets_Render<E> {
|
|
13
|
+
props(): ReturnType<typeof $$render<E>>['props'];
|
|
14
|
+
events(): ReturnType<typeof $$render<E>>['events'];
|
|
15
|
+
slots(): ReturnType<typeof $$render<E>>['slots'];
|
|
16
|
+
bindings(): "";
|
|
17
|
+
exports(): {};
|
|
18
|
+
}
|
|
19
|
+
interface $$IsomorphicComponent {
|
|
20
|
+
new <E>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<E>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<E>['props']>, ReturnType<__sveltets_Render<E>['events']>, ReturnType<__sveltets_Render<E>['slots']>> & {
|
|
21
|
+
$$bindings?: ReturnType<__sveltets_Render<E>['bindings']>;
|
|
22
|
+
} & ReturnType<__sveltets_Render<E>['exports']>;
|
|
23
|
+
<E>(internal: unknown, props: ReturnType<__sveltets_Render<E>['props']> & {}): ReturnType<__sveltets_Render<E>['exports']>;
|
|
24
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
25
|
+
}
|
|
26
|
+
declare const FFCellValue: $$IsomorphicComponent;
|
|
27
|
+
type FFCellValue<E> = InstanceType<typeof FFCellValue<E>>;
|
|
28
|
+
export default FFCellValue;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getCellElementConfig, getStyle } from './cellConfig.js'
|
|
3
|
+
import type { CellContentProps, CellMode } from './cellTypes.js'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
id: string
|
|
7
|
+
contentProps?: CellContentProps
|
|
8
|
+
value?: unknown
|
|
9
|
+
mode: CellMode
|
|
10
|
+
}
|
|
11
|
+
let { id, contentProps, value = $bindable(), mode }: Props = $props()
|
|
12
|
+
const base = getCellElementConfig('content')
|
|
13
|
+
const contentConfig = $derived({ ...base, ...contentProps?.config })
|
|
14
|
+
const Component = $derived(
|
|
15
|
+
mode === 'edit'
|
|
16
|
+
? contentProps?.component
|
|
17
|
+
: (contentProps?.componentReadonly ?? contentProps?.component),
|
|
18
|
+
)
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
{#if Component}
|
|
22
|
+
<div
|
|
23
|
+
id={id + '-content'}
|
|
24
|
+
data-ff-cell-content
|
|
25
|
+
class={contentConfig.class}
|
|
26
|
+
style={getStyle(contentConfig)}
|
|
27
|
+
>
|
|
28
|
+
<Component {id} {...contentProps?.props} bind:value>
|
|
29
|
+
{#if typeof contentProps?.children === 'string'}
|
|
30
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -- trusted, app-authored content -->
|
|
31
|
+
{@html contentProps?.children}
|
|
32
|
+
{:else}
|
|
33
|
+
{contentProps?.children}
|
|
34
|
+
{/if}
|
|
35
|
+
</Component>
|
|
36
|
+
</div>
|
|
37
|
+
{/if}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CellContentProps, CellMode } from './cellTypes.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
id: string;
|
|
4
|
+
contentProps?: CellContentProps;
|
|
5
|
+
value?: unknown;
|
|
6
|
+
mode: CellMode;
|
|
7
|
+
}
|
|
8
|
+
declare const FFCellContent: import("svelte").Component<Props, {}, "value">;
|
|
9
|
+
type FFCellContent = ReturnType<typeof FFCellContent>;
|
|
10
|
+
export default FFCellContent;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getCellElementConfig, getStyle } from './cellConfig.js'
|
|
3
|
+
import type { CellElementProps } from './cellTypes.js'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
id: string
|
|
7
|
+
elementProps?: CellElementProps
|
|
8
|
+
}
|
|
9
|
+
let { id, elementProps }: Props = $props()
|
|
10
|
+
const base = getCellElementConfig('error')
|
|
11
|
+
const config = $derived({ ...base, ...elementProps?.config })
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
{#if elementProps?.html}
|
|
15
|
+
<div id={id + '-error'} data-ff-cell-error class={config.class} style={getStyle(config)}>
|
|
16
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -- trusted, app-authored error html -->
|
|
17
|
+
{@html elementProps?.html}
|
|
18
|
+
</div>
|
|
19
|
+
{/if}
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
[data-ff-cell-error] {
|
|
23
|
+
color: var(--color-error, red);
|
|
24
|
+
font-size: smaller;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CellElementProps } from './cellTypes.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
id: string;
|
|
4
|
+
elementProps?: CellElementProps;
|
|
5
|
+
}
|
|
6
|
+
declare const FFCellError: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type FFCellError = ReturnType<typeof FFCellError>;
|
|
8
|
+
export default FFCellError;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getCellElementConfig, getStyle } from './cellConfig.js'
|
|
3
|
+
import type { CellElementProps } from './cellTypes.js'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
id: string
|
|
7
|
+
elementProps?: CellElementProps
|
|
8
|
+
}
|
|
9
|
+
let { id, elementProps }: Props = $props()
|
|
10
|
+
const base = getCellElementConfig('hint')
|
|
11
|
+
const config = $derived({ ...base, ...elementProps?.config })
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
{#if elementProps?.html}
|
|
15
|
+
<div id={id + '-hint'} data-ff-cell-hint class={config.class} style={getStyle(config)}>
|
|
16
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -- trusted, app-authored hint html -->
|
|
17
|
+
{@html elementProps?.html}
|
|
18
|
+
</div>
|
|
19
|
+
{/if}
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
[data-ff-cell-hint] {
|
|
23
|
+
color: var(--muted-foreground, color-mix(in srgb, currentColor 60%, transparent));
|
|
24
|
+
font-size: smaller;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CellElementProps } from './cellTypes.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
id: string;
|
|
4
|
+
elementProps?: CellElementProps;
|
|
5
|
+
}
|
|
6
|
+
declare const FFCellHint: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type FFCellHint = ReturnType<typeof FFCellHint>;
|
|
8
|
+
export default FFCellHint;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getCellElementConfig, getStyle } from './cellConfig.js'
|
|
3
|
+
import type { CellElementProps } from './cellTypes.js'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
id: string
|
|
7
|
+
elementProps?: CellElementProps
|
|
8
|
+
}
|
|
9
|
+
let { id, elementProps }: Props = $props()
|
|
10
|
+
const base = getCellElementConfig('label')
|
|
11
|
+
const config = $derived({ ...base, ...elementProps?.config })
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
{#if elementProps}
|
|
15
|
+
<label
|
|
16
|
+
id={id + '-label'}
|
|
17
|
+
data-ff-cell-label
|
|
18
|
+
for={id}
|
|
19
|
+
class={config.class}
|
|
20
|
+
style={getStyle(config)}
|
|
21
|
+
>
|
|
22
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -- trusted, app-authored caption -->
|
|
23
|
+
{@html elementProps?.html}
|
|
24
|
+
</label>
|
|
25
|
+
{/if}
|
|
26
|
+
|
|
27
|
+
<style>
|
|
28
|
+
[data-ff-cell-label] {
|
|
29
|
+
display: block;
|
|
30
|
+
max-width: 100%;
|
|
31
|
+
min-width: 0;
|
|
32
|
+
overflow-wrap: anywhere;
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CellElementProps } from './cellTypes.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
id: string;
|
|
4
|
+
elementProps?: CellElementProps;
|
|
5
|
+
}
|
|
6
|
+
declare const FFCellLabel: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type FFCellLabel = ReturnType<typeof FFCellLabel>;
|
|
8
|
+
export default FFCellLabel;
|