@svgrid/enterprise 2.6.3 → 2.6.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.
@@ -9,7 +9,9 @@
9
9
  * shell, grids, charts, KPIs, forms - not just the accent.
10
10
  *
11
11
  * Pure + node-safe (studio subtree): plain data + helpers, so the same tokens
12
- * drive the browser preview and the emitted `+layout.svelte` / `app.css`.
12
+ * drive the browser preview and every emitted output - `app.css` for the full
13
+ * app and the fragment, the `<svelte:head>` of the CLI `add` scaffolds - via
14
+ * `themeTokenCss` below, the single place the token CSS is built.
13
15
  */
14
16
  import { type ThemeMode, type ThemePalette, type ThemePreset } from '@svgrid/grid/themes';
15
17
  import type { ProjectTheme } from './project.js';
@@ -30,5 +32,19 @@ export declare function resolveThemeTokens(theme?: ProjectTheme): Record<string,
30
32
  /** Resolve the `--sg-*` tokens for a project theme in an EXPLICIT mode (for the
31
33
  * generated app's light/dark switcher, which ships both token sets). */
32
34
  export declare function resolveThemeTokensFor(theme: ProjectTheme | undefined, mode: 'light' | 'dark'): Record<string, string>;
35
+ /**
36
+ * The `--sg-*` token rules for a project theme, as CSS text. `:root` carries
37
+ * the mode picked in Studio (what the server-rendered page shows before
38
+ * hydration), and both palettes are scoped by `[data-theme]` on `<html>` for
39
+ * the generated app's light/dark switcher. An explicit accent override is
40
+ * applied to both. No theme -> the default preset, so every output is themed.
41
+ *
42
+ * `layer` wraps the rules in a cascade layer. Use it for drop-in outputs (the
43
+ * fragment, `svgrid-studio add`): layered declarations lose to unlayered ones,
44
+ * so a host app that already defines its own `--sg-*` tokens keeps winning.
45
+ */
46
+ export declare function themeTokenCss(theme?: ProjectTheme, opts?: {
47
+ layer?: string;
48
+ }): string;
33
49
  /** An inline `style` string (`--sg-x: y; ...; color-scheme; font-family`) for previews. */
34
50
  export declare function themeStyleString(theme?: ProjectTheme): string;
@@ -9,7 +9,9 @@
9
9
  * shell, grids, charts, KPIs, forms - not just the accent.
10
10
  *
11
11
  * Pure + node-safe (studio subtree): plain data + helpers, so the same tokens
12
- * drive the browser preview and the emitted `+layout.svelte` / `app.css`.
12
+ * drive the browser preview and every emitted output - `app.css` for the full
13
+ * app and the fragment, the `<svelte:head>` of the CLI `add` scaffolds - via
14
+ * `themeTokenCss` below, the single place the token CSS is built.
13
15
  */
14
16
  import { themePresets, defaultThemePreset, getThemePreset, resolveThemeTokens as resolveTokens, } from '@svgrid/grid/themes';
15
17
  /** The built-in Studio themes, in gallery order (default first). */
@@ -33,6 +35,29 @@ export function resolveThemeTokensFor(theme, mode) {
33
35
  const preset = getStudioTheme(theme?.preset) ?? defaultStudioTheme;
34
36
  return resolveTokens(preset, mode, theme?.accent);
35
37
  }
38
+ /**
39
+ * The `--sg-*` token rules for a project theme, as CSS text. `:root` carries
40
+ * the mode picked in Studio (what the server-rendered page shows before
41
+ * hydration), and both palettes are scoped by `[data-theme]` on `<html>` for
42
+ * the generated app's light/dark switcher. An explicit accent override is
43
+ * applied to both. No theme -> the default preset, so every output is themed.
44
+ *
45
+ * `layer` wraps the rules in a cascade layer. Use it for drop-in outputs (the
46
+ * fragment, `svgrid-studio add`): layered declarations lose to unlayered ones,
47
+ * so a host app that already defines its own `--sg-*` tokens keeps winning.
48
+ */
49
+ export function themeTokenCss(theme, opts = {}) {
50
+ const decl = (m) => Object.entries(m).map(([k, v]) => ` ${k}: ${v};`).join('\n');
51
+ const mode = isDarkTheme(theme) ? 'dark' : 'light';
52
+ const light = resolveThemeTokensFor(theme, 'light');
53
+ const dark = resolveThemeTokensFor(theme, 'dark');
54
+ const rules = [
55
+ `:root {\n${decl(mode === 'dark' ? dark : light)}\n color-scheme: ${mode};\n}`,
56
+ `:root[data-theme="light"] {\n${decl(light)}\n color-scheme: light;\n}`,
57
+ `:root[data-theme="dark"] {\n${decl(dark)}\n color-scheme: dark;\n}`,
58
+ ].join('\n');
59
+ return opts.layer ? `@layer ${opts.layer} {\n${rules}\n}` : rules;
60
+ }
36
61
  /** An inline `style` string (`--sg-x: y; ...; color-scheme; font-family`) for previews. */
37
62
  export function themeStyleString(theme) {
38
63
  const tokens = resolveThemeTokens(theme);
@@ -6639,7 +6639,7 @@ export const GENERATED_UI_SURFACE = {
6639
6639
  "key": "sortable",
6640
6640
  "label": "Sortable",
6641
6641
  "type": "boolean",
6642
- "description": "Convenience shortcuts to switch a whole capability on without wiring `features` or the finer-grained props by hand. Every capability is OFF by default - a bare grid is a plain read-only table - so set the shortcut `true` to opt in. (`false` / omitted both leave it off; the shortcut is mainly there to turn things ON.) `sortable` - column sorting (injects `rowSortingFeature`) `filterable` - column filtering (injects `columnFilteringFeature`) `editable` - inline cell editing (alias of `enableInlineEditing`) `groupable` - row grouping controls(alias of `showGroupingControls`, also injects `columnGroupingFeature`) `pageable` - pagination footer (alias of `showPagination`) Fine-grained props (`enableInlineEditing`, `showPagination`, ...) still work; the shortcut wins only when it is explicitly set.",
6642
+ "description": "Convenience shortcuts to switch a whole capability on without wiring `features` or the finer-grained props by hand. Every capability is OFF by default - a bare grid is a plain read-only table - so set the shortcut `true` to opt in. (`false` / omitted both leave it off; the shortcut is mainly there to turn things ON.) `sortable` - column sorting (injects `rowSortingFeature`) `filterable` - column filtering (injects `columnFilteringFeature`) `editable` - inline cell editing (alias of `enableInlineEditing`) `selectable` - cell selection (alias of `enableCellSelection`) `groupable` - row grouping controls(alias of `showGroupingControls`, also injects `columnGroupingFeature`) `pageable` - pagination footer (alias of `showPagination`) Fine-grained props (`enableInlineEditing`, `showPagination`, ...) still work; the shortcut wins only when it is explicitly set.",
6643
6643
  "group": "common"
6644
6644
  },
6645
6645
  {
@@ -6654,6 +6654,13 @@ export const GENERATED_UI_SURFACE = {
6654
6654
  "type": "boolean",
6655
6655
  "group": "common"
6656
6656
  },
6657
+ {
6658
+ "key": "selectable",
6659
+ "label": "Selectable",
6660
+ "type": "boolean",
6661
+ "description": "Cell selection - click a cell to select it, drag or shift-click to extend the selection to a range. Alias of `enableCellSelection`, and the highest priority of the three inputs that decide it: `selectable` -> `enableCellSelection` -> `selectionMode`. NOTE the asymmetry with its siblings, which are all off until you opt in: this one is **ON by default**, because `selectionMode` defaults to `'both'`. It is named here so the capability is discoverable next to the other shortcuts, and so `selectable={false}` is a one-word way to turn cell selection off (the longhand being `selectionMode=\"none\"`, which also removes the row-selection surface). This is the CELL surface only. The selection **checkbox column** is the other half of `selectionMode`, controlled by `showRowSelection` - also on by default, and it needs no feature import (verified: the column renders and toggles rows with an empty `features` set). Use `selectionMode` when you want to move both surfaces at once.",
6662
+ "group": "common"
6663
+ },
6657
6664
  {
6658
6665
  "key": "treeData",
6659
6666
  "label": "Tree Data",
package/dist/version.d.ts CHANGED
@@ -10,4 +10,4 @@
10
10
  *
11
11
  * `version.test.ts` asserts this matches `package.json`, so the two cannot drift.
12
12
  */
13
- export declare const SVGRID_VERSION = "2.6.3";
13
+ export declare const SVGRID_VERSION = "2.6.4";
package/dist/version.js CHANGED
@@ -10,4 +10,4 @@
10
10
  *
11
11
  * `version.test.ts` asserts this matches `package.json`, so the two cannot drift.
12
12
  */
13
- export const SVGRID_VERSION = '2.6.3';
13
+ export const SVGRID_VERSION = '2.6.4';
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "commercial",
5
5
  "url": "https://svgrid.com/pricing"
6
6
  },
7
- "version": "2.6.3",
7
+ "version": "2.6.4",
8
8
  "description": "Enterprise feature pack for SvGrid: Excel (xlsx) and PDF export, Excel/CSV/JSON import, pivot tables with a drag-and-drop designer, paginated print, Kanban board and scheduler renderers, no-code alerts and batch editing. CSV, TSV and JSON export are already free in @svgrid/grid. Requires a paid license key.",
9
9
  "license": "SEE LICENSE IN LICENSE",
10
10
  "author": "jQWidgets <sales@jqwidgets.com>",
@@ -65,7 +65,7 @@
65
65
  "jszip": "^3.10.0",
66
66
  "pdfmake": "^0.2.0",
67
67
  "svelte": "^5.0.0",
68
- "@svgrid/grid": "^2.6.7"
68
+ "@svgrid/grid": "^2.6.17"
69
69
  },
70
70
  "peerDependenciesMeta": {
71
71
  "jszip": {
@@ -83,7 +83,7 @@
83
83
  "svelte": "^5.55.5",
84
84
  "typescript": "6.0.3",
85
85
  "vite": "^8.2.1",
86
- "@svgrid/grid": "^2.6.7"
86
+ "@svgrid/grid": "^2.6.17"
87
87
  },
88
88
  "repository": {
89
89
  "type": "git",
@@ -113,8 +113,8 @@
113
113
  "scripts": {
114
114
  "test": "vitest run",
115
115
  "test:types": "tsc -p tsconfig.json --noEmit",
116
- "build": "svelte-package --input ./src --output ./dist && node ../../tools/strip-dist-tests.mjs ./dist && node ./scripts/build-cdn.mjs && node ./scripts/build-node.mjs && node ./scripts/build-designer.mjs",
117
- "build:lib": "svelte-package --input ./src --output ./dist && node ../../tools/strip-dist-tests.mjs ./dist",
116
+ "build": "svelte-package --input ./src --output ./dist && node ../../tools/strip-dist-tests.mjs ./dist && node ../../tools/add-dist-extensions.mjs ./dist && node ./scripts/build-cdn.mjs && node ./scripts/build-node.mjs && node ./scripts/build-designer.mjs",
117
+ "build:lib": "svelte-package --input ./src --output ./dist && node ../../tools/strip-dist-tests.mjs ./dist && node ../../tools/add-dist-extensions.mjs ./dist",
118
118
  "build:cdn": "node ./scripts/build-cdn.mjs",
119
119
  "build:node": "node ./scripts/build-node.mjs",
120
120
  "build:designer": "node ./scripts/build-designer.mjs",
@@ -1 +0,0 @@
1
- import{D as e,H as t,I as n,J as r,K as i,L as a,M as o,P as s,R as c,U as l,W as u,X as d,Z as f,at as p,b as m,bt as h,ct as g,d as _,dt as v,f as y,g as b,it as x,k as S,l as C,mt as w,o as ee,p as te,pt as T,r as E,rt as D,s as ne,st as O,u as re,vt as k,x as A}from"./disclose-version-CIm4S9xS.js";import{c as j,i as M,l as ie,n as ae,o as oe,s as se,t as ce,u as le}from"./js-scroller.svelte-C7LaeUEW.js";import{a as ue,i as N,r as de}from"./dismissable-2EZKoens.js";var P=0;function F(e,t){if(e==null)return[];if(e instanceof Set||Array.isArray(e)){let n=[...e];return t?n:n.slice(0,1)}return[e]}function I(e,t){return e instanceof Set?e:new Set(F(e,t))}function fe(e){let t=`sv-lb-${P++}`,n=()=>e.options(),r=()=>e.multiple?.()??!1,a=()=>e.disabled?.()??!1,o=g(0),s=v(()=>I(e.value(),r())),c=v(()=>F(e.value(),r())),l=v(()=>n().map((e,t)=>e.disabled?-1:t).filter(e=>e>=0));f(()=>{let e=n()[i(o)];(!e||e.disabled)&&O(o,i(l)[0]??0,!0)});let u=e=>i(s).has(e),d=e=>e===i(o),p=e=>`${t}-opt-${e}`;function m(e){let t=n()[e];t&&!t.disabled&&O(o,e,!0)}function h(t){let c=n()[t];if(!(!c||c.disabled||a())){if(O(o,t,!0),r()){let t=new Set(i(s));t.has(c.value)?t.delete(c.value):t.add(c.value),e.onChange?.(e.value()instanceof Set?t:[...t])}else e.onChange?.(c.value)}}function _(e){let t=i(l);if(!t.length)return;let n=t[(t.indexOf(i(o))+e+t.length)%t.length];n!=null&&O(o,n,!0)}let y=()=>{O(o,i(l)[0]??0,!0)},b=()=>{O(o,i(l).at(-1)??0,!0)},x=M();function S(e){let t=x.push(e.toLowerCase()),r=ie(n(),t,i(o));r>=0&&O(o,r,!0)}function C(e){if(!a())switch(e.key){case`ArrowDown`:e.preventDefault(),_(1);break;case`ArrowUp`:e.preventDefault(),_(-1);break;case`Home`:e.preventDefault(),y();break;case`End`:e.preventDefault(),b();break;case` `:case`Enter`:e.preventDefault(),h(i(o));break;default:j(e)&&S(e.key)}}let w=()=>({id:e.id?.(),invalid:e.invalid?.(),required:e.required?.(),error:e.error?.(),hint:e.hint?.(),ariaLabel:e.ariaLabel?.()});return{get activeIndex(){return i(o)},get selectedValues(){return i(c)},isSelected:u,isActive:d,setActive:m,pick:h,move:_,first:y,last:b,onKeydown:C,rootProps:()=>({role:`listbox`,id:e.id?.(),"aria-multiselectable":r(),"aria-disabled":a(),"aria-activedescendant":n()[i(o)]?p(i(o)):void 0,...N(w()),tabindex:a()?-1:0,onkeydown:C}),optionProps:e=>{let t=n()[e];return{role:`option`,id:p(e),"aria-selected":t?u(t.value):!1,"aria-disabled":t?.disabled,"data-idx":e,"data-active":d(e)?``:void 0,"data-selected":t&&u(t.value)?``:void 0,onclick:()=>h(e),onpointermove:()=>m(e)}}}}var pe=c(`<span aria-hidden="true"></span>`),me=c(`<span class="sv-listbox__check svelte-j44quc" aria-hidden="true"> </span>`),he=c(`<span class="sv-listbox__label svelte-j44quc"> </span>`),ge=c(`<!> <!>`,1),_e=c(`<div><!></div>`),ve=c(`<div class="sv-listbox__group svelte-j44quc" role="presentation"> </div>`),ye=c(`<div class="sv-listbox__sb svelte-j44quc" aria-hidden="true"><div></div></div>`),be=c(`<div class="sv-listbox__vp svelte-j44quc"></div> <!>`,1),xe=c(`<div class="sv-listbox__group svelte-j44quc" role="presentation"> </div>`),Se=c(`<!> <!>`,1),Ce=c(`<input type="hidden"/>`),we=c(`<div><!></div> <!>`,1);function L(t,c){w(c,!0);let j=(t,r=h)=>{var i=ge(),l=x(i),u=e=>{var t=pe();let i;d(e=>i=A(t,1,`sv-listbox__box svelte-j44quc`,null,i,e),[()=>({"is-on":G(r())})]),n(e,t)},f=e=>{var t=me(),i=D(t,!0);k(t),d(e=>s(i,e),[()=>G(r())?`✓`:``]),n(e,t)};o(l,e=>{P()?e(u):N()&&e(f,1)});var m=p(l,2),g=t=>{var i=a(),o=x(i);e(o,()=>c.item??c.itemTemplate,r),n(t,i)},_=e=>{var t=he(),i=D(t,!0);k(t),d(()=>s(i,r().label)),n(e,t)};o(m,e=>{c.item??c.itemTemplate?e(g):e(_,-1)}),n(t,i)},M=(e,t=h,r=h,i=h,a=h)=>{var o=_e();_(o,(e,t,n)=>({class:`sv-listbox__opt`,...e,[C]:t,[re]:n}),[()=>W.optionProps(r()),()=>({"is-selected":G(t()),"is-active":W.isActive(r()),"is-disabled":t().disabled}),()=>({height:`${i()??Oe(t())}px`,transform:a()==null?void 0:`translateY(${a()}px)`})],void 0,void 0,`svelte-j44quc`);var s=D(o);j(s,t),k(o),n(e,o)},ie=E(c,`value`,3,null),N=E(c,`multiple`,3,!1),P=E(c,`checkbox`,3,!1),F=E(c,`block`,3,!1),I=E(c,`disabled`,3,!1),L=E(c,`size`,3,`md`),R=E(c,`rows`,3,7),Te=E(c,`virtual`,3,!1),z=E(c,`rowHeight`,3,32),Ee=E(c,`groupHeaderHeight`,3,28),B=E(c,`invalid`,3,!1),V=E(c,`required`,3,!1),De=ue(`sv-lb`),H=v(()=>c.id??De),U=v(()=>le(c.options)),W=fe({options:()=>i(U),value:()=>ie(),onChange:e=>c.onChange?.(e),multiple:()=>N(),disabled:()=>I(),ariaLabel:()=>c.ariaLabel,id:()=>i(H),invalid:()=>B(),required:()=>V(),error:()=>c.error,hint:()=>c.hint}),G=e=>W.isSelected(e.value),K=v(()=>typeof z()==`number`?z():32),Oe=e=>typeof z()==`function`?z()(e,e.index):z(),q=v(Te),J=g(null),Y=g(0),X=v(()=>oe(i(U),{rowHeight:z(),groupHeaderHeight:Ee()})),ke=v(()=>!i(X).hasGroups&&typeof z()==`number`),Ae=v(()=>i(ke)?i(K):e=>i(X).sizeAt(e)),Z=v(()=>i(Y)>0?i(Y):Math.max(1,R()*i(K))),Q=ae(r(()=>({count:i(X).entries.length,estimateSize:i(Ae),overscan:6,viewportHeight:i(Z)})));f(()=>{let e=i(X).entries.length,t=i(Ae);r(()=>Q.setOptions({count:e,estimateSize:t}))}),f(()=>{let e=i(Z);r(()=>Q.setViewportHeight(e))});let je=v(()=>(Q.version,Q.getVirtualItems())),Me=v(()=>(Q.version,Q.getTotalSize())),$=ce({virtualizer:Q,totalSize:()=>i(Me),viewport:()=>i(Z),lineStep:()=>i(K)});f(()=>{let e=W.activeIndex;if(i(q)){let t=i(X).optionFlatIndex[e];if(t==null)return;r(()=>$.ensureIndexVisible(t))}else queueMicrotask(()=>i(J)?.querySelector(`[data-idx="${e}"]`)?.scrollIntoView({block:`nearest`}))}),de(t,{get id(){return i(H)},get label(){return c.label},get hint(){return c.hint},get error(){return c.error},get required(){return V()},get dir(){return c.dir},get block(){return F()},children:(e,t)=>{var r=we(),f=x(r);_(f,e=>({class:`sv-listbox sv-listbox--${L()??``}`,onwheel:i(q)?$.onWheel:void 0,...e,[C]:{"is-invalid":B(),"is-virtual":i(q),"is-checkbox":P(),"is-block":F()},[re]:{"--sv-rows":R(),"--sv-row-h":`${i(K)}px`}}),[()=>W.rootProps()],void 0,void 0,`svelte-j44quc`);var h=D(f),g=e=>{var t=be(),r=x(t);S(r,21,()=>i(je),e=>e.key,(e,t)=>{let r=v(()=>i(X).entries[i(t).index]);var c=a(),l=x(c),u=e=>{var a=ve();let o;var c=D(a,!0);k(a),d(()=>{o=m(a,``,o,{height:`${i(t).size}px`,transform:`translateY(${i(t).start-$.scrollOffset}px)`}),s(c,i(r).label)}),n(e,a)},f=e=>{M(e,()=>i(r).opt,()=>i(r).opt.index,()=>i(t).size,()=>i(t).start-$.scrollOffset)};o(l,e=>{i(r)?.type===`group`?e(u):i(r)&&e(f,1)}),n(e,c)}),k(r);var c=p(r,2),f=e=>{var t=ye(),r=D(t);let i,a;k(t),d(()=>{i=A(r,1,`sv-listbox__thumb svelte-j44quc`,null,i,{"is-dragging":$.dragging}),a=m(r,``,a,{height:`${$.thumbH}px`,transform:`translateY(${$.thumbTop}px)`})}),l(`pointerdown`,t,function(...e){$.onTrackDown?.apply(this,e)}),l(`pointerdown`,r,function(...e){$.onThumbDown?.apply(this,e)}),l(`pointermove`,r,function(...e){$.onThumbMove?.apply(this,e)}),l(`pointerup`,r,function(...e){$.onThumbUp?.apply(this,e)}),u(`pointercancel`,r,function(...e){$.onThumbUp?.apply(this,e)}),n(e,t)};o(c,e=>{$.maxOffset>0&&e(f)}),l(`pointerdown`,r,function(...e){$.onContentDown?.apply(this,e)}),l(`pointermove`,r,function(...e){$.onContentMove?.apply(this,e)}),l(`pointerup`,r,function(...e){$.onContentUp?.apply(this,e)}),u(`pointercancel`,r,function(...e){$.onContentUp?.apply(this,e)}),ne(r,`clientHeight`,e=>O(Y,e)),n(e,t)},w=e=>{var t=a(),r=x(t);S(r,17,()=>se(i(U)),e=>e.group??` `,(e,t)=>{var r=Se(),a=x(r),c=e=>{var r=xe(),a=D(r,!0);k(r),d(()=>s(a,i(t).group)),n(e,r)};o(a,e=>{i(t).group!=null&&e(c)});var l=p(a,2);S(l,17,()=>i(t).options,e=>e.index,(e,t)=>{M(e,()=>i(t),()=>i(t).index)}),n(e,r)}),n(e,t)};o(h,e=>{i(q)?e(g):e(w,-1)}),k(f),ee(f,e=>O(J,e),()=>i(J));var T=p(f,2),E=e=>{var t=a(),r=x(t);S(r,16,()=>W.selectedValues,e=>e,(e,t)=>{var r=Ce();y(r),d(()=>{te(r,`name`,c.name),b(r,t)}),n(e,r)}),n(e,t)};o(T,e=>{c.name&&e(E)}),n(e,r)},$$slots:{default:!0}}),T()}t([`pointerdown`,`pointermove`,`pointerup`]);export{L as t};