@pathscale/ui 0.0.98 → 0.0.100

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.
@@ -0,0 +1,9 @@
1
+ import type { TableProps } from "../table";
2
+ import type { StreamingColumnDef } from "./types";
3
+ export type StreamingTableProps<TData> = {
4
+ data: TData[];
5
+ columns: StreamingColumnDef<TData>[];
6
+ getRowId?: (row: TData) => string;
7
+ } & Omit<TableProps, "children">;
8
+ declare const StreamingTable: <TData>(props: StreamingTableProps<TData>) => import("solid-js").JSX.Element;
9
+ export default StreamingTable;
@@ -0,0 +1,7 @@
1
+ export interface RowStore<T> {
2
+ id: string;
3
+ data: () => T;
4
+ patch: (partial: Partial<T>) => void;
5
+ replace: (newData: T) => void;
6
+ }
7
+ export declare function createRowStore<T>(id: string, initial: T): RowStore<T>;
@@ -0,0 +1,10 @@
1
+ import { type RowStore } from "./createRowStore";
2
+ export interface StreamingTableStore<T> {
3
+ rows: () => RowStore<T>[];
4
+ loadInitial: (rows: T[], getId: (row: T) => string) => void;
5
+ upsertRow: (row: T, getId: (row: T) => string) => void;
6
+ upsertRows: (rows: T[], getId: (row: T) => string) => void;
7
+ updateRow: (id: string, patch: Partial<T>) => void;
8
+ removeRow: (id: string) => void;
9
+ }
10
+ export declare function createStreamingTableStore<T>(): StreamingTableStore<T>;
@@ -0,0 +1,3 @@
1
+ export { default as StreamingTable } from "./StreamingTable";
2
+ export type { StreamingTableProps } from "./StreamingTable";
3
+ export type { StreamingColumnDef } from "./types";
@@ -0,0 +1,17 @@
1
+ import type { JSX } from "solid-js";
2
+ export interface StreamingColumnDef<T> {
3
+ /** Header text or JSX element */
4
+ header: JSX.Element | string;
5
+ /** For simple field access */
6
+ accessorKey?: keyof T & string;
7
+ /** For computed access */
8
+ accessorFn?: (row: T) => any;
9
+ /** Custom cell renderer */
10
+ cell?: (ctx: {
11
+ row: {
12
+ original: T;
13
+ };
14
+ }) => JSX.Element;
15
+ /** Extra config (sorting, filters, etc.) */
16
+ meta?: Record<string, any>;
17
+ }
package/dist/index.d.ts CHANGED
@@ -75,6 +75,9 @@ export { default as Swap } from "./components/swap";
75
75
  export { default as Table, EnhancedTable } from "./components/table";
76
76
  export type { TableProps } from "./components/table";
77
77
  export type { EnhancedTableProps } from "./components/table/EnhancedTable";
78
+ export { StreamingTable } from "./components/streaming-table";
79
+ export type { StreamingTableProps } from "./components/streaming-table";
80
+ export type { StreamingColumnDef } from "./components/streaming-table";
78
81
  export { default as Tabs } from "./components/tabs";
79
82
  export type { RadioTabProps, TabProps, TabsProps } from "./components/tabs";
80
83
  export { default as Textarea } from "./components/textarea";
package/dist/index.js CHANGED
@@ -11917,6 +11917,138 @@ const EnhancedTable = EnhancedTable_EnhancedTable;
11917
11917
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.delegateEvents)([
11918
11918
  "click"
11919
11919
  ]);
11920
+ function createRowStore(id, initial) {
11921
+ const [data, setData] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(initial);
11922
+ return {
11923
+ id,
11924
+ data,
11925
+ patch: (partial)=>{
11926
+ setData((prev)=>({
11927
+ ...prev,
11928
+ ...partial
11929
+ }));
11930
+ },
11931
+ replace: (newData)=>{
11932
+ setData(()=>newData);
11933
+ }
11934
+ };
11935
+ }
11936
+ function createStreamingTableStore() {
11937
+ const [rowStores, setRowStores] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)([]);
11938
+ function loadInitial(rows, getId) {
11939
+ const stores = rows.map((r)=>createRowStore(getId(r), r));
11940
+ setRowStores(stores);
11941
+ }
11942
+ function upsertRow(row, getId) {
11943
+ const id = getId(row);
11944
+ const stores = rowStores();
11945
+ const existing = stores.find((s)=>s.id === id);
11946
+ if (existing) return void existing.replace(row);
11947
+ setRowStores([
11948
+ ...stores,
11949
+ createRowStore(id, row)
11950
+ ]);
11951
+ }
11952
+ function upsertRows(rows, getId) {
11953
+ rows.forEach((row)=>upsertRow(row, getId));
11954
+ }
11955
+ function updateRow(id, patch) {
11956
+ const stores = rowStores();
11957
+ const existing = stores.find((s)=>s.id === id);
11958
+ if (existing) existing.patch(patch);
11959
+ }
11960
+ function removeRow(id) {
11961
+ const stores = rowStores().filter((s)=>s.id !== id);
11962
+ setRowStores(stores);
11963
+ }
11964
+ return {
11965
+ rows: rowStores,
11966
+ loadInitial,
11967
+ upsertRow,
11968
+ upsertRows,
11969
+ updateRow,
11970
+ removeRow
11971
+ };
11972
+ }
11973
+ const StreamingTable_StreamingTable = (props)=>{
11974
+ const [local, tableProps] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
11975
+ "data",
11976
+ "columns",
11977
+ "getRowId"
11978
+ ]);
11979
+ const store = createStreamingTableStore();
11980
+ const resolveId = (row)=>{
11981
+ if (local.getRowId) return local.getRowId(row);
11982
+ const anyRow = row;
11983
+ if (null != anyRow.id) return String(anyRow.id);
11984
+ return JSON.stringify(anyRow);
11985
+ };
11986
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
11987
+ const incoming = local.data ?? [];
11988
+ const idSet = new Set();
11989
+ incoming.forEach((row)=>{
11990
+ const id = resolveId(row);
11991
+ idSet.add(id);
11992
+ store.upsertRow(row, resolveId);
11993
+ });
11994
+ const current = store.rows();
11995
+ current.forEach((r)=>{
11996
+ if (!idSet.has(r.id)) store.removeRow(r.id);
11997
+ });
11998
+ });
11999
+ return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.mergeProps)(tableProps, {
12000
+ get children () {
12001
+ return [
12002
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Head, {
12003
+ get children () {
12004
+ return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Row, {
12005
+ get children () {
12006
+ return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
12007
+ get each () {
12008
+ return local.columns;
12009
+ },
12010
+ children: (col)=>(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.HeadCell, {
12011
+ get children () {
12012
+ return col.header;
12013
+ }
12014
+ })
12015
+ });
12016
+ }
12017
+ });
12018
+ }
12019
+ }),
12020
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Body, {
12021
+ get children () {
12022
+ return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
12023
+ get each () {
12024
+ return store.rows();
12025
+ },
12026
+ children: (rowStore)=>(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Row, {
12027
+ get children () {
12028
+ return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
12029
+ get each () {
12030
+ return local.columns;
12031
+ },
12032
+ children: (col)=>(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(table_Table.Cell, {
12033
+ get children () {
12034
+ return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.memo)(()=>!!col.cell)() ? col.cell({
12035
+ row: {
12036
+ original: rowStore.data()
12037
+ }
12038
+ }) : (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.memo)(()=>!!col.accessorKey)() ? rowStore.data()[col.accessorKey] : (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.memo)(()=>!!col.accessorFn)() ? col.accessorFn(rowStore.data()) : "";
12039
+ }
12040
+ })
12041
+ });
12042
+ }
12043
+ })
12044
+ });
12045
+ }
12046
+ })
12047
+ ];
12048
+ }
12049
+ }));
12050
+ };
12051
+ const StreamingTable = StreamingTable_StreamingTable;
11920
12052
  var Tab_tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<a role=tab>");
11921
12053
  const Tab = (props)=>{
11922
12054
  const [local, others] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
@@ -12509,4 +12641,4 @@ const WindowMockup = (props)=>{
12509
12641
  })();
12510
12642
  };
12511
12643
  const windowmockup_WindowMockup = WindowMockup;
12512
- export { accordion_Accordion as Accordion, alert_Alert as Alert, artboard_Artboard as Artboard, avatar as Avatar, background_Background as Background, Badge, bottom_sheet_BottomSheet as BottomSheet, Breadcrumbs, breadcrumbs_BreadcrumbsItem as BreadcrumbsItem, browsermockup_BrowserMockup as BrowserMockup, button_Button as Button, Calendar, card_Card as Card, carousel_Carousel as Carousel, chatbubble_ChatBubble as ChatBubble, checkbox_Checkbox as Checkbox, codemockup_CodeMockup as CodeMockup, CodeMockupLine, collapse_Collapse as Collapse, CollapseContent, CollapseDetails, CollapseTitle, connectionstatus_ConnectionStatus as ConnectionStatus, CopyButton, countdown_Countdown as Countdown, diff_Diff as Diff, divider as Divider, dock as Dock, Drawer, dropdown as Dropdown, EnhancedTable, FileInput, flex_Flex as Flex, footer_Footer as Footer, form_Form as Form, Grid, hero_Hero as Hero, icon_Icon as Icon, indicator_Indicator as Indicator, input as Input, join_Join as Join, kbd_Kbd as Kbd, link_Link as Link, loading_Loading as Loading, mask as Mask, menu_Menu as Menu, modal_Modal as Modal, navbar_Navbar as Navbar, pagination_Pagination as Pagination, phonemockup_PhoneMockup as PhoneMockup, Progress, props_table_PropsTable as PropsTable, radialprogress_RadialProgress as RadialProgress, radio_Radio as Radio, range_Range as Range, Rating, select_Select as Select, showcase_ShowcaseBlock as ShowcaseBlock, showcase_section_ShowcaseSection as ShowcaseSection, sidenav_Sidenav as Sidenav, sidenav_SidenavButton as SidenavButton, sidenav_SidenavGroup as SidenavGroup, sidenav_SidenavItem as SidenavItem, sidenav_SidenavLink as SidenavLink, sidenav_SidenavMenu as SidenavMenu, skeleton_Skeleton as Skeleton, Stack, stat_card_StatCard as StatCard, stats_Stats as Stats, status_Status as Status, steps as Steps, Summary, SvgBackground, Swap, table_Table as Table, tabs_Tabs as Tabs, textarea_Textarea as Textarea, Timeline, timeline_TimelineEnd as TimelineEnd, timeline_TimelineItem as TimelineItem, timeline_TimelineMiddle as TimelineMiddle, timeline_TimelineStart as TimelineStart, toast_Toast as Toast, ToastContainer, toggle_Toggle as Toggle, tooltip_Tooltip as Tooltip, windowmockup_WindowMockup as WindowMockup, connectionstatus_ConnectionStatus as default, toastStore, useDesktop, useFormValidation };
12644
+ export { accordion_Accordion as Accordion, alert_Alert as Alert, artboard_Artboard as Artboard, avatar as Avatar, background_Background as Background, Badge, bottom_sheet_BottomSheet as BottomSheet, Breadcrumbs, breadcrumbs_BreadcrumbsItem as BreadcrumbsItem, browsermockup_BrowserMockup as BrowserMockup, button_Button as Button, Calendar, card_Card as Card, carousel_Carousel as Carousel, chatbubble_ChatBubble as ChatBubble, checkbox_Checkbox as Checkbox, codemockup_CodeMockup as CodeMockup, CodeMockupLine, collapse_Collapse as Collapse, CollapseContent, CollapseDetails, CollapseTitle, connectionstatus_ConnectionStatus as ConnectionStatus, CopyButton, countdown_Countdown as Countdown, diff_Diff as Diff, divider as Divider, dock as Dock, Drawer, dropdown as Dropdown, EnhancedTable, FileInput, flex_Flex as Flex, footer_Footer as Footer, form_Form as Form, Grid, hero_Hero as Hero, icon_Icon as Icon, indicator_Indicator as Indicator, input as Input, join_Join as Join, kbd_Kbd as Kbd, link_Link as Link, loading_Loading as Loading, mask as Mask, menu_Menu as Menu, modal_Modal as Modal, navbar_Navbar as Navbar, pagination_Pagination as Pagination, phonemockup_PhoneMockup as PhoneMockup, Progress, props_table_PropsTable as PropsTable, radialprogress_RadialProgress as RadialProgress, radio_Radio as Radio, range_Range as Range, Rating, select_Select as Select, showcase_ShowcaseBlock as ShowcaseBlock, showcase_section_ShowcaseSection as ShowcaseSection, sidenav_Sidenav as Sidenav, sidenav_SidenavButton as SidenavButton, sidenav_SidenavGroup as SidenavGroup, sidenav_SidenavItem as SidenavItem, sidenav_SidenavLink as SidenavLink, sidenav_SidenavMenu as SidenavMenu, skeleton_Skeleton as Skeleton, Stack, stat_card_StatCard as StatCard, stats_Stats as Stats, status_Status as Status, steps as Steps, StreamingTable, Summary, SvgBackground, Swap, table_Table as Table, tabs_Tabs as Tabs, textarea_Textarea as Textarea, Timeline, timeline_TimelineEnd as TimelineEnd, timeline_TimelineItem as TimelineItem, timeline_TimelineMiddle as TimelineMiddle, timeline_TimelineStart as TimelineStart, toast_Toast as Toast, ToastContainer, toggle_Toggle as Toggle, tooltip_Tooltip as Tooltip, windowmockup_WindowMockup as WindowMockup, connectionstatus_ConnectionStatus as default, toastStore, useDesktop, useFormValidation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pathscale/ui",
3
- "version": "0.0.98",
3
+ "version": "0.0.100",
4
4
  "author": "pathscale",
5
5
  "repository": {
6
6
  "type": "git",