@warkypublic/svelix 0.1.39 → 0.1.40
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/components/BetterMenu/BetterMenuAsyncButton.svelte +41 -24
- package/dist/components/BetterMenu/BetterMenuAsyncButton.svelte.d.ts +1 -1
- package/dist/components/BetterMenu/types.d.ts +2 -1
- package/dist/components/ContentEditor/subcomponents/AudioPlayer.svelte +2 -3
- package/dist/components/ContentEditor/subcomponents/ImageViewer.svelte +2 -3
- package/dist/components/ContentEditor/subcomponents/VideoPlayer.svelte +2 -3
- package/dist/components/Former/FormerButtonArea.svelte +3 -2
- package/dist/components/Former/FormerDrawer.svelte +130 -124
- package/dist/components/Former/FormerDrawer.svelte.d.ts +1 -1
- package/dist/components/FormerControllers/InlineWrapper.svelte +4 -34
- package/dist/components/Gridler/components/GridlerFull.svelte +1 -0
- package/dist/components/Gridler/components/GridlerFullWithFormerPreview.svelte +340 -0
- package/dist/components/Gridler/components/GridlerFullWithFormerPreview.svelte.d.ts +3 -0
- package/dist/components/Gridler/components/GridlerSearch.svelte +2 -4
- package/dist/components/Gridler/components/GridlerSearchToggle.svelte +2 -4
- package/dist/components/Gridler/types.d.ts +1 -0
- package/dist/components/Icons/IconAdd.svelte +8 -0
- package/dist/components/Icons/IconAdd.svelte.d.ts +7 -0
- package/dist/components/Icons/IconAlertCircle.svelte +9 -0
- package/dist/components/Icons/IconAlertCircle.svelte.d.ts +7 -0
- package/dist/components/Icons/IconAlertTriangle.svelte +9 -0
- package/dist/components/Icons/IconAlertTriangle.svelte.d.ts +7 -0
- package/dist/components/Icons/IconCamera.svelte +8 -0
- package/dist/components/Icons/IconCamera.svelte.d.ts +7 -0
- package/dist/components/Icons/IconClose.svelte +7 -0
- package/dist/components/Icons/IconClose.svelte.d.ts +7 -0
- package/dist/components/Icons/IconEdit.svelte +8 -0
- package/dist/components/Icons/IconEdit.svelte.d.ts +7 -0
- package/dist/components/Icons/IconFilter.svelte +7 -0
- package/dist/components/Icons/IconFilter.svelte.d.ts +7 -0
- package/dist/components/Icons/IconSearch.svelte +8 -0
- package/dist/components/Icons/IconSearch.svelte.d.ts +7 -0
- package/dist/components/Icons/IconSort.svelte +11 -0
- package/dist/components/Icons/IconSort.svelte.d.ts +8 -0
- package/dist/components/Icons/IconTrash.svelte +10 -0
- package/dist/components/Icons/IconTrash.svelte.d.ts +7 -0
- package/dist/components/Icons/index.d.ts +11 -0
- package/dist/components/Icons/index.js +11 -0
- package/dist/components/Icons/strings.d.ts +11 -0
- package/dist/components/Icons/strings.js +15 -0
- package/dist/components/Screenshot/Screenshot.svelte +2 -15
- package/dist/components/SvarkGrid/components/SvarkHeaderFilterCell.svelte +4 -13
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/llm/README.md +93 -0
- package/package.json +19 -20
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { CaptureScreen } from "./Screenshot.util";
|
|
3
|
+
import IconCamera from '../Icons/IconCamera.svelte';
|
|
3
4
|
|
|
4
5
|
let screenshot = $state("");
|
|
5
6
|
|
|
@@ -17,21 +18,7 @@
|
|
|
17
18
|
onclick={capture}
|
|
18
19
|
class="flex items-center gap-2 rounded bg-blue-500 px-4 py-2 text-white transition-colors hover:bg-blue-600"
|
|
19
20
|
>
|
|
20
|
-
<
|
|
21
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
22
|
-
width="20"
|
|
23
|
-
height="20"
|
|
24
|
-
viewBox="0 0 24 24"
|
|
25
|
-
fill="none"
|
|
26
|
-
stroke="currentColor"
|
|
27
|
-
stroke-width="2"
|
|
28
|
-
stroke-linecap="round"
|
|
29
|
-
stroke-linejoin="round"
|
|
30
|
-
aria-hidden="true"
|
|
31
|
-
>
|
|
32
|
-
<path d="M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z" />
|
|
33
|
-
<circle cx="12" cy="13" r="3" />
|
|
34
|
-
</svg>
|
|
21
|
+
<IconCamera size={20} />
|
|
35
22
|
Capture Screenshot
|
|
36
23
|
</button>
|
|
37
24
|
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
import type { BetterMenuStore } from '../../BetterMenu/store';
|
|
5
5
|
import type { GridColumnFilters } from '../../Types/generic_grid';
|
|
6
6
|
import SvarkColumnFilterForm from './SvarkColumnFilterForm.svelte';
|
|
7
|
+
import IconSort from '../../Icons/IconSort.svelte';
|
|
8
|
+
import IconFilter from '../../Icons/IconFilter.svelte';
|
|
7
9
|
|
|
8
10
|
type IApi = any;
|
|
9
11
|
type IColumn = any;
|
|
@@ -96,13 +98,7 @@
|
|
|
96
98
|
{#if typeof sortMark.index !== 'undefined'}
|
|
97
99
|
<span class="svark-sort-index">{sortMark.index + 1}</span>
|
|
98
100
|
{/if}
|
|
99
|
-
<
|
|
100
|
-
{#if sortMark.order === 'asc'}
|
|
101
|
-
<path fill="currentColor" d="M7 14l5-5 5 5H7z" />
|
|
102
|
-
{:else}
|
|
103
|
-
<path fill="currentColor" d="M7 10l5 5 5-5H7z" />
|
|
104
|
-
{/if}
|
|
105
|
-
</svg>
|
|
101
|
+
<IconSort direction={sortMark.order} size={14} />
|
|
106
102
|
</div>
|
|
107
103
|
{/if}
|
|
108
104
|
|
|
@@ -117,12 +113,7 @@
|
|
|
117
113
|
onclick={onIconClick}
|
|
118
114
|
data-testid={`svarkgrid-filter-${columnId}`}
|
|
119
115
|
>
|
|
120
|
-
<
|
|
121
|
-
<path
|
|
122
|
-
fill="currentColor"
|
|
123
|
-
d="M3 5a1 1 0 0 1 1-1h16a1 1 0 0 1 .8 1.6L14 13.5V19a1 1 0 0 1-1.45.9l-3-1.5A1 1 0 0 1 9 17.5v-4L3.2 5.6A1 1 0 0 1 3 5Z"
|
|
124
|
-
/>
|
|
125
|
-
</svg>
|
|
116
|
+
<IconFilter size={14} />
|
|
126
117
|
</button>
|
|
127
118
|
{/if}
|
|
128
119
|
</div>
|
package/dist/components/index.js
CHANGED
package/llm/README.md
CHANGED
|
@@ -18,6 +18,99 @@ This folder contains AI-readable documentation that ships with the package.
|
|
|
18
18
|
- [plans/canvasgrid.md](./plans/canvasgrid.md)
|
|
19
19
|
- [gridler-events.md](./gridler-events.md)
|
|
20
20
|
|
|
21
|
+
## Implementation Patterns
|
|
22
|
+
|
|
23
|
+
### Standard Entity Page
|
|
24
|
+
|
|
25
|
+
GridlerFull and FormerDrawer are siblings. GridlerFull handles display/filtering; its `menuItems` and row events (`onRowDblClick`, `onRowContextMenu`) open a `FormerDrawer`. The drawer receives `request` (`insert` | `update` | `delete`), `bind:values`, and an `onAPICall` handler. Field controls go inside a `{#snippet children(state)}` block.
|
|
26
|
+
|
|
27
|
+
```svelte
|
|
28
|
+
<script lang="ts">
|
|
29
|
+
import GridlerFull from '@warkypublic/svelix/GridlerFull';
|
|
30
|
+
import FormerDrawer from '@warkypublic/svelix/FormerDrawer';
|
|
31
|
+
import TextInputCtrl from '@warkypublic/svelix/TextInputCtrl';
|
|
32
|
+
import NativeSelectCtrl from '@warkypublic/svelix/NativeSelectCtrl';
|
|
33
|
+
import type { FormRequestType } from '@warkypublic/svelix/Former';
|
|
34
|
+
import { iconAddSvg, iconEditSvg, iconTrashSvg } from '@warkypublic/svelix/Icons';
|
|
35
|
+
|
|
36
|
+
let drawerOpen = $state(false);
|
|
37
|
+
let formMode = $state<FormRequestType>('update');
|
|
38
|
+
let formValues = $state<MyRow | undefined>(undefined);
|
|
39
|
+
let selectedItems = $state<Record<string, unknown>[]>([]);
|
|
40
|
+
|
|
41
|
+
function openForm(mode: FormRequestType, row?: MyRow) {
|
|
42
|
+
formMode = mode;
|
|
43
|
+
formValues = row ? { ...row } : { id: 0, name: '' };
|
|
44
|
+
drawerOpen = true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const menuItems = [
|
|
48
|
+
{ id: 'add', label: 'Add', icon: iconAddSvg, kind: 'item', onselect: () => openForm('insert') },
|
|
49
|
+
{ id: 'sep', label: '', kind: 'separator' },
|
|
50
|
+
{ id: 'edit', label: 'Edit', icon: iconEditSvg, kind: 'item', onselect: () => openForm('update', selectedItems[0] as MyRow) },
|
|
51
|
+
{ id: 'delete', label: 'Delete', icon: iconTrashSvg, kind: 'item', onselect: () => openForm('delete', selectedItems[0] as MyRow) },
|
|
52
|
+
];
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<GridlerFull
|
|
56
|
+
{columns}
|
|
57
|
+
{data}
|
|
58
|
+
uniqueID="id"
|
|
59
|
+
{menuItems}
|
|
60
|
+
onRowDblClick={(_row, rowData) => openForm('update', rowData as MyRow)}
|
|
61
|
+
onSelectedItemsChange={(items) => (selectedItems = items)}
|
|
62
|
+
/>
|
|
63
|
+
|
|
64
|
+
<FormerDrawer
|
|
65
|
+
bind:opened={drawerOpen}
|
|
66
|
+
bind:values={formValues}
|
|
67
|
+
request={formMode}
|
|
68
|
+
uniqueKeyField="id"
|
|
69
|
+
layout={{ title: 'Employee', buttonArea: 'bottom' }}
|
|
70
|
+
onAPICall={async (_mode, _req, data) => { /* call backend */ return data; }}
|
|
71
|
+
afterSave={(data) => { /* update local rows state */ }}
|
|
72
|
+
onClose={() => { drawerOpen = false; }}
|
|
73
|
+
>
|
|
74
|
+
{#snippet children(state)}
|
|
75
|
+
{@const isReadonly = state.request === 'delete'}
|
|
76
|
+
<TextInputCtrl
|
|
77
|
+
label="Name" name="name"
|
|
78
|
+
value={state.values?.name ?? ''}
|
|
79
|
+
disabled={isReadonly}
|
|
80
|
+
onchange={(v) => state.setState('values', { ...state.values, name: v })}
|
|
81
|
+
/>
|
|
82
|
+
<NativeSelectCtrl
|
|
83
|
+
label="Status" name="status"
|
|
84
|
+
value={state.values?.status ?? ''}
|
|
85
|
+
{options}
|
|
86
|
+
disabled={isReadonly}
|
|
87
|
+
onchange={(v) => state.setState('values', { ...state.values, status: v })}
|
|
88
|
+
/>
|
|
89
|
+
{/snippet}
|
|
90
|
+
</FormerDrawer>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Component roles
|
|
94
|
+
|
|
95
|
+
- **GridlerFull** — data grid with burger menu (`menuItems`), row events (`onRowDblClick`, `onRowContextMenu`, `onSelectedItemsChange`), filtering and pagination
|
|
96
|
+
- **FormerDrawer** — slide-out drawer form for Add/Edit/Delete; `request` controls mode; fields go in `{#snippet children(state)}`; `state.setState('values', ...)` updates field values; `onAPICall` is the save handler; `afterSave` updates local state
|
|
97
|
+
- **FormerControllers** — `TextInputCtrl`, `NumberInputCtrl`, `NativeSelectCtrl`, etc.; use `disabled` for delete readonly mode
|
|
98
|
+
- **ErrorBoundary** — wraps async components to catch render and fetch errors
|
|
99
|
+
- **ContentEditor** — edit JSON, Markdown, code, or documents as a FormerDrawer field
|
|
100
|
+
- **VTree** — hierarchical/tree data display
|
|
101
|
+
- **BetterMenu** — context menus or nav menus
|
|
102
|
+
- **Boxer** — single or multi-value lookup control backed by a data source; used as a FormerDrawer field
|
|
103
|
+
- **GlobalStateStore** — central store for all app state and API data
|
|
104
|
+
- **resolvespec-js** — connects components to the backend via specs passed to GridlerFull, FormerDrawer, Boxer, etc.
|
|
105
|
+
|
|
106
|
+
### Data flow
|
|
107
|
+
|
|
108
|
+
```text
|
|
109
|
+
GlobalStateStore ↔ resolvespec-js ↔ Backend API
|
|
110
|
+
↑
|
|
111
|
+
GridlerFull / FormerDrawer / Boxer
|
|
112
|
+
```
|
|
113
|
+
|
|
21
114
|
## Installed package paths
|
|
22
115
|
|
|
23
116
|
When `@warkypublic/svelix` is installed, this documentation is available at:
|
package/package.json
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warkypublic/svelix",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.40",
|
|
4
4
|
"description": "Svelte 5 component library with Skeleton UI and Tailwind CSS",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite dev",
|
|
8
|
-
"build": "vite build && pnpm run package",
|
|
9
|
-
"preview": "vite preview",
|
|
10
|
-
"package": "svelte-kit sync && svelte-package && mkdir -p dist/css && cp src/lib/css/tailwind-source.css dist/css/tailwind-source.css && publint",
|
|
11
|
-
"prepublishOnly": "npm run package",
|
|
12
|
-
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
13
|
-
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
14
|
-
"storybook": "storybook dev -p 6006",
|
|
15
|
-
"build-storybook": "storybook build",
|
|
16
|
-
"lint": "eslint .",
|
|
17
|
-
"lint:fix": "eslint . --fix",
|
|
18
|
-
"test": "vitest run --project unit",
|
|
19
|
-
"test:unit": "vitest run --project unit",
|
|
20
|
-
"test:watch": "vitest --project unit",
|
|
21
|
-
"test:e2e": "playwright test",
|
|
22
|
-
"test:e2e:ui": "playwright test --ui"
|
|
23
|
-
},
|
|
24
6
|
"exports": {
|
|
25
7
|
".": {
|
|
26
8
|
"types": "./dist/index.d.ts",
|
|
@@ -102,5 +84,22 @@
|
|
|
102
84
|
"isomorphic-dompurify": "^3.9.0",
|
|
103
85
|
"katex": "^0.16.45",
|
|
104
86
|
"monaco-editor": "^0.55.1"
|
|
87
|
+
},
|
|
88
|
+
"scripts": {
|
|
89
|
+
"dev": "vite dev",
|
|
90
|
+
"build": "vite build && pnpm run package",
|
|
91
|
+
"preview": "vite preview",
|
|
92
|
+
"package": "svelte-kit sync && svelte-package && mkdir -p dist/css && cp src/lib/css/tailwind-source.css dist/css/tailwind-source.css && publint",
|
|
93
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
94
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
95
|
+
"storybook": "storybook dev -p 6006",
|
|
96
|
+
"build-storybook": "storybook build",
|
|
97
|
+
"lint": "eslint .",
|
|
98
|
+
"lint:fix": "eslint . --fix",
|
|
99
|
+
"test": "vitest run --project unit",
|
|
100
|
+
"test:unit": "vitest run --project unit",
|
|
101
|
+
"test:watch": "vitest --project unit",
|
|
102
|
+
"test:e2e": "playwright test",
|
|
103
|
+
"test:e2e:ui": "playwright test --ui"
|
|
105
104
|
}
|
|
106
|
-
}
|
|
105
|
+
}
|