@trismegisto/primitives 3.3.10 → 3.3.11

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 CHANGED
@@ -1,56 +1,56 @@
1
- Hermes License 1.0
2
-
3
- Copyright (c) 2026 Lucas Ribeiro. All rights reserved except as granted below.
4
-
5
- 1. Use. You may, free of charge, install and use this software (the "Library"),
6
- unmodified, for any purpose, including commercial purposes.
7
-
8
- 2. Applications. You may include the unmodified Library in an application or
9
- service you build and distribute or make that application available to others
10
- (for example, a compiled web application bundle, a container image or an
11
- installed program), provided the Library is not offered as a separate,
12
- standalone component and this license notice is kept with it.
13
-
14
- 3. No modification. You may not modify, adapt, translate or create derivative
15
- works of the Library.
16
-
17
- 4. No redistribution. Except as allowed in section 2, you may not publish,
18
- redistribute, sublicense, sell or otherwise make available the Library —
19
- including as a package in a public or private registry, a fork or a copy of
20
- its source code.
21
-
22
- 5. Notice. You must keep this license and the copyright notice with every copy
23
- of the Library.
24
-
25
- 6. No warranty. The Library is provided "as is", without warranty of any kind,
26
- express or implied. In no event shall the author be liable for any claim,
27
- damages or other liability arising from the use of the Library.
28
-
29
- 7. Third-party components. Some files in the Library are, or are derived from,
30
- third-party software and fonts. They are identified in the NOTICE files, in
31
- the LICENSES folders and in the font license files shipped with the package,
32
- and remain under their own licenses. Nothing in this license limits the
33
- rights those licenses grant for those parts.
34
-
35
- ---
36
-
37
- Licença Hermes 1.0 (tradução de referência; em caso de divergência vale o texto em inglês)
38
-
39
- 1. Uso. Você pode, gratuitamente, instalar e usar esta biblioteca, sem modificações,
40
- para qualquer finalidade, inclusive comercial.
41
- 2. Aplicações. Você pode incluir a biblioteca, sem modificações, numa aplicação ou
42
- serviço seu e distribuir ou disponibilizar essa aplicação (por exemplo, o bundle de
43
- um app web, uma imagem de container ou um programa instalado), desde que a biblioteca
44
- não seja oferecida como componente avulso e este aviso de licença a acompanhe.
45
- 3. Sem modificação. Você não pode modificar, adaptar, traduzir nem criar obras
46
- derivadas da biblioteca.
47
- 4. Sem redistribuição. Fora o permitido no item 2, você não pode publicar, redistribuir,
48
- sublicenciar, vender ou disponibilizar a biblioteca — inclusive como pacote num
49
- registry público ou privado, fork ou cópia do código-fonte.
50
- 5. Aviso. Mantenha esta licença e o aviso de copyright em todas as cópias.
51
- 6. Sem garantia. A biblioteca é fornecida "como está", sem garantia de qualquer tipo.
52
- 7. Componentes de terceiros. Alguns arquivos da biblioteca são, ou derivam de, software
53
- e fontes de terceiros. Eles estão identificados nos arquivos NOTICE, nas pastas
54
- LICENSES e nos arquivos de licença das fontes que acompanham o pacote, e continuam
55
- sob as licenças originais. Nada nesta licença limita os direitos que elas concedem
56
- sobre essas partes.
1
+ Hermes License 1.0
2
+
3
+ Copyright (c) 2026 Lucas Ribeiro. All rights reserved except as granted below.
4
+
5
+ 1. Use. You may, free of charge, install and use this software (the "Library"),
6
+ unmodified, for any purpose, including commercial purposes.
7
+
8
+ 2. Applications. You may include the unmodified Library in an application or
9
+ service you build and distribute or make that application available to others
10
+ (for example, a compiled web application bundle, a container image or an
11
+ installed program), provided the Library is not offered as a separate,
12
+ standalone component and this license notice is kept with it.
13
+
14
+ 3. No modification. You may not modify, adapt, translate or create derivative
15
+ works of the Library.
16
+
17
+ 4. No redistribution. Except as allowed in section 2, you may not publish,
18
+ redistribute, sublicense, sell or otherwise make available the Library —
19
+ including as a package in a public or private registry, a fork or a copy of
20
+ its source code.
21
+
22
+ 5. Notice. You must keep this license and the copyright notice with every copy
23
+ of the Library.
24
+
25
+ 6. No warranty. The Library is provided "as is", without warranty of any kind,
26
+ express or implied. In no event shall the author be liable for any claim,
27
+ damages or other liability arising from the use of the Library.
28
+
29
+ 7. Third-party components. Some files in the Library are, or are derived from,
30
+ third-party software and fonts. They are identified in the NOTICE files, in
31
+ the LICENSES folders and in the font license files shipped with the package,
32
+ and remain under their own licenses. Nothing in this license limits the
33
+ rights those licenses grant for those parts.
34
+
35
+ ---
36
+
37
+ Licença Hermes 1.0 (tradução de referência; em caso de divergência vale o texto em inglês)
38
+
39
+ 1. Uso. Você pode, gratuitamente, instalar e usar esta biblioteca, sem modificações,
40
+ para qualquer finalidade, inclusive comercial.
41
+ 2. Aplicações. Você pode incluir a biblioteca, sem modificações, numa aplicação ou
42
+ serviço seu e distribuir ou disponibilizar essa aplicação (por exemplo, o bundle de
43
+ um app web, uma imagem de container ou um programa instalado), desde que a biblioteca
44
+ não seja oferecida como componente avulso e este aviso de licença a acompanhe.
45
+ 3. Sem modificação. Você não pode modificar, adaptar, traduzir nem criar obras
46
+ derivadas da biblioteca.
47
+ 4. Sem redistribuição. Fora o permitido no item 2, você não pode publicar, redistribuir,
48
+ sublicenciar, vender ou disponibilizar a biblioteca — inclusive como pacote num
49
+ registry público ou privado, fork ou cópia do código-fonte.
50
+ 5. Aviso. Mantenha esta licença e o aviso de copyright em todas as cópias.
51
+ 6. Sem garantia. A biblioteca é fornecida "como está", sem garantia de qualquer tipo.
52
+ 7. Componentes de terceiros. Alguns arquivos da biblioteca são, ou derivam de, software
53
+ e fontes de terceiros. Eles estão identificados nos arquivos NOTICE, nas pastas
54
+ LICENSES e nos arquivos de licença das fontes que acompanham o pacote, e continuam
55
+ sob as licenças originais. Nada nesta licença limita os direitos que elas concedem
56
+ sobre essas partes.
package/README.md CHANGED
@@ -1,116 +1,116 @@
1
- # @trismegisto/primitives
2
-
3
- Comportamento e lógica do Hermes **sem framework**: stores de estado (tema, toast, abas, workspace, data
4
- grid, árvore, kanban…), teclado e foco, posicionamento de menus e popovers, datas, máscaras, atalhos e os
5
- catálogos de texto (pt-BR embutido, en/es à parte) com `formatMessage`/`pluralMessage`.
6
-
7
- Na cadeia de camadas (`tokens ← icons ← primitives ← core ← angular ← maps · charts · spine`) é onde mora
8
- toda regra de comportamento. O `@trismegisto/angular` só liga inputs e outputs a estas funções; um wrapper para
9
- outro framework faria o mesmo.
10
-
11
- ## Instalação
12
-
13
- ```bash
14
- npm install @trismegisto/primitives @trismegisto/icons @trismegisto/tokens
15
- ```
16
-
17
- `@trismegisto/icons` e `@trismegisto/tokens` são `peerDependencies`. Num app Angular, instale os cinco pacotes base
18
- juntos e na mesma versão (ver [`@trismegisto/angular`](../angular/README.md)).
19
-
20
- ## Pontos de entrada
21
-
22
- | Import | Conteúdo |
23
- | --- | --- |
24
- | `@trismegisto/primitives` | Tudo abaixo, mais a reexportação de `@trismegisto/icons` (registro e desenho de ícones) e de `HERMES_FAMILIES`/`HermesFamily`/`HermesThemeName` do `@trismegisto/tokens` |
25
- | `@trismegisto/primitives/messages/en` | `HERMES_MESSAGES_EN` |
26
- | `@trismegisto/primitives/messages/es` | `HERMES_MESSAGES_ES` |
27
-
28
- Só o catálogo pt-BR (`HERMES_MESSAGES_PT_BR`) está na entrada principal. en e es ficam em entradas próprias
29
- para não pesarem no bundle de quem não usa; o `@trismegisto/angular` os baixa sob demanda no primeiro
30
- `setLocale`.
31
-
32
- ## Quando usar direto
33
-
34
- Num app Angular, quase nunca: use `@trismegisto/angular`, que já envolve estas funções em serviços, signals e
35
- componentes. O uso direto faz sentido para:
36
-
37
- - **Funções utilitárias** que o app chama em validadores ou formatação: `applyMask`, `unmask`,
38
- `isMaskComplete` (máscaras `cpf`/`cnpj`/`cep`/`phone` ou padrão), `toIsoDate`, `formatDisplayDate`,
39
- `displayDatePattern`, `addDays`, `formatMessage`, `pluralMessage`.
40
- - **Dado em HTML e em URL** (`html.ts`): `escapeHtml(valor)` para texto que vai a um sink de HTML (`[innerHTML]`,
41
- tooltip do motor de gráficos); `formatMessageHtml`/`pluralMessageHtml` para mensagem do catálogo COM marcação
42
- (`<strong>`) cujo parâmetro vem de dado — o template fica, o parâmetro é escapado; `urlPath` para caminho com id:
43
- `` `${api}${urlPath`/apps/${id}`}` `` aplica `encodeURIComponent` a cada valor e recusa `''`, `.` e `..`.
44
- - **Overlay que o app move para o `<body>`**: chame `copyThemeScope(origem, nó)` para o nó levar
45
- `data-theme`, `data-family`, `data-density` e `data-font` do contexto (sem isso ele volta ao tema padrão).
46
- - **Wrapper para outro framework**: os stores (`createThemeStore`, `createToastStore`,
47
- `createShortcutRegistry`, `createWorkspaceStore`…) e os montadores de classe CSS (`buttonClass`,
48
- `iconButtonClass`…) que geram as classes `hm-*` do `@trismegisto/core`.
49
-
50
- ## Exemplo sem framework: tema
51
-
52
- ```ts
53
- import { createThemeStore, themeHostProps, DEFAULT_THEME_CONFIG } from '@trismegisto/primitives';
54
-
55
- const store = createThemeStore(
56
- { ...DEFAULT_THEME_CONFIG, storagePrefix: 'meuapp' },
57
- { storage: localStorage, prefersDark: () => matchMedia('(prefers-color-scheme: dark)').matches },
58
- );
59
-
60
- function apply(root: HTMLElement) {
61
- const { attributes, styles } = themeHostProps(store.getState());
62
- for (const [name, value] of Object.entries(attributes)) root.setAttribute(name, value);
63
- for (const [name, value] of Object.entries(styles)) root.style.setProperty(name, value);
64
- }
65
-
66
- apply(document.body);
67
- store.subscribe(() => apply(document.body));
68
- store.setMode('system'); // 'light' | 'dark' | 'system'
69
- store.setDensity('compact');
70
- ```
71
-
72
- `themeHostProps` devolve os atributos `data-theme`/`data-family`/`data-density`/`data-font` e as custom
73
- properties de cor da família. É exatamente o que a diretiva `hermesTheme` do Angular aplica. As escolhas
74
- ficam salvas no `storage` com o prefixo (`<prefixo>_theme`, `<prefixo>_theme_family`, `<prefixo>_density`…).
75
-
76
- ## Exemplo: textos
77
-
78
- ```ts
79
- import { HERMES_MESSAGES_PT_BR, formatMessage, pluralMessage } from '@trismegisto/primitives';
80
-
81
- formatMessage('Remover {label}', { label: 'Arquivo.pdf' });
82
- pluralMessage({ one: '{count} item', other: '{count} itens' }, 3, 'pt-BR');
83
- ```
84
-
85
- Texto com variável é sempre template nomeado (`{nome}`) e contagem é `PluralMessage` com
86
- `Intl.PluralRules`: nunca prefixo + concatenação nem `if (n === 1)`.
87
-
88
- ## Ambiente em tempo de execução (`config.json`)
89
-
90
- `loadRuntimeConfig(environment, { file?, required? })` carrega o ambiente do app em tempo de execução, para
91
- cada versão gerar **uma imagem só**: busca `config.json` (ou `file`) relativo ao base href, sem cache, e mescla o
92
- JSON **no próprio** `environment`, em profundidade (objetos mesclam; arrays e valores simples substituem; chaves
93
- novas entram). Sem o arquivo (404, rede, `index.html` do fallback de SPA): com `required` lança erro, sem ele
94
- avisa e segue. JSON inválido lança sempre. Chame antes de iniciar o app:
95
-
96
- ```ts
97
- import { loadRuntimeConfig } from '@trismegisto/primitives';
98
-
99
- loadRuntimeConfig(environment, { required: !isDevMode() })
100
- .then(() => bootstrapApplication(AppComponent, appConfig))
101
- .catch((e) => console.error(e));
102
- ```
103
-
104
- Num app com o `@trismegisto/spine`, importe dele (reexporta esta função) e siga o exemplo do README do spine,
105
- com o `applyRuntimeEnvironment` e o import dinâmico do `app.config`. O pacote fica aqui, sem framework, para
106
- apps sem o spine (ex.: uma tela de login) não precisarem dele.
107
-
108
- ## Mais
109
-
110
- - Regras de camadas e de i18n: [`CLAUDE.md` §5 e §6](../../CLAUDE.md) e
111
- [`docs/architecture`](../../docs/architecture/README.md).
112
- - Páginas "Tema" e "Idiomas" do site de documentação (`docs/website`, rotas `/pages/theming` e `/pages/i18n`).
113
-
114
- ## Desenvolvimento do pacote
115
-
116
- `npm test` (Vitest) e `npm run build` (compila para `dist/`).
1
+ # @trismegisto/primitives
2
+
3
+ Comportamento e lógica do Hermes **sem framework**: stores de estado (tema, toast, abas, workspace, data
4
+ grid, árvore, kanban…), teclado e foco, posicionamento de menus e popovers, datas, máscaras, atalhos e os
5
+ catálogos de texto (pt-BR embutido, en/es à parte) com `formatMessage`/`pluralMessage`.
6
+
7
+ Na cadeia de camadas (`tokens ← icons ← primitives ← core ← angular ← maps · charts · spine`) é onde mora
8
+ toda regra de comportamento. O `@trismegisto/angular` só liga inputs e outputs a estas funções; um wrapper para
9
+ outro framework faria o mesmo.
10
+
11
+ ## Instalação
12
+
13
+ ```bash
14
+ npm install @trismegisto/primitives @trismegisto/icons @trismegisto/tokens
15
+ ```
16
+
17
+ `@trismegisto/icons` e `@trismegisto/tokens` são `peerDependencies`. Num app Angular, instale os cinco pacotes base
18
+ juntos e na mesma versão (ver [`@trismegisto/angular`](../angular/README.md)).
19
+
20
+ ## Pontos de entrada
21
+
22
+ | Import | Conteúdo |
23
+ | --- | --- |
24
+ | `@trismegisto/primitives` | Tudo abaixo, mais a reexportação de `@trismegisto/icons` (registro e desenho de ícones) e de `HERMES_FAMILIES`/`HermesFamily`/`HermesThemeName` do `@trismegisto/tokens` |
25
+ | `@trismegisto/primitives/messages/en` | `HERMES_MESSAGES_EN` |
26
+ | `@trismegisto/primitives/messages/es` | `HERMES_MESSAGES_ES` |
27
+
28
+ Só o catálogo pt-BR (`HERMES_MESSAGES_PT_BR`) está na entrada principal. en e es ficam em entradas próprias
29
+ para não pesarem no bundle de quem não usa; o `@trismegisto/angular` os baixa sob demanda no primeiro
30
+ `setLocale`.
31
+
32
+ ## Quando usar direto
33
+
34
+ Num app Angular, quase nunca: use `@trismegisto/angular`, que já envolve estas funções em serviços, signals e
35
+ componentes. O uso direto faz sentido para:
36
+
37
+ - **Funções utilitárias** que o app chama em validadores ou formatação: `applyMask`, `unmask`,
38
+ `isMaskComplete` (máscaras `cpf`/`cnpj`/`cep`/`phone` ou padrão), `toIsoDate`, `formatDisplayDate`,
39
+ `displayDatePattern`, `addDays`, `formatMessage`, `pluralMessage`.
40
+ - **Dado em HTML e em URL** (`html.ts`): `escapeHtml(valor)` para texto que vai a um sink de HTML (`[innerHTML]`,
41
+ tooltip do motor de gráficos); `formatMessageHtml`/`pluralMessageHtml` para mensagem do catálogo COM marcação
42
+ (`<strong>`) cujo parâmetro vem de dado — o template fica, o parâmetro é escapado; `urlPath` para caminho com id:
43
+ `` `${api}${urlPath`/apps/${id}`}` `` aplica `encodeURIComponent` a cada valor e recusa `''`, `.` e `..`.
44
+ - **Overlay que o app move para o `<body>`**: chame `copyThemeScope(origem, nó)` para o nó levar
45
+ `data-theme`, `data-family`, `data-density` e `data-font` do contexto (sem isso ele volta ao tema padrão).
46
+ - **Wrapper para outro framework**: os stores (`createThemeStore`, `createToastStore`,
47
+ `createShortcutRegistry`, `createWorkspaceStore`…) e os montadores de classe CSS (`buttonClass`,
48
+ `iconButtonClass`…) que geram as classes `hm-*` do `@trismegisto/core`.
49
+
50
+ ## Exemplo sem framework: tema
51
+
52
+ ```ts
53
+ import { createThemeStore, themeHostProps, DEFAULT_THEME_CONFIG } from '@trismegisto/primitives';
54
+
55
+ const store = createThemeStore(
56
+ { ...DEFAULT_THEME_CONFIG, storagePrefix: 'meuapp' },
57
+ { storage: localStorage, prefersDark: () => matchMedia('(prefers-color-scheme: dark)').matches },
58
+ );
59
+
60
+ function apply(root: HTMLElement) {
61
+ const { attributes, styles } = themeHostProps(store.getState());
62
+ for (const [name, value] of Object.entries(attributes)) root.setAttribute(name, value);
63
+ for (const [name, value] of Object.entries(styles)) root.style.setProperty(name, value);
64
+ }
65
+
66
+ apply(document.body);
67
+ store.subscribe(() => apply(document.body));
68
+ store.setMode('system'); // 'light' | 'dark' | 'system'
69
+ store.setDensity('compact');
70
+ ```
71
+
72
+ `themeHostProps` devolve os atributos `data-theme`/`data-family`/`data-density`/`data-font` e as custom
73
+ properties de cor da família. É exatamente o que a diretiva `hermesTheme` do Angular aplica. As escolhas
74
+ ficam salvas no `storage` com o prefixo (`<prefixo>_theme`, `<prefixo>_theme_family`, `<prefixo>_density`…).
75
+
76
+ ## Exemplo: textos
77
+
78
+ ```ts
79
+ import { HERMES_MESSAGES_PT_BR, formatMessage, pluralMessage } from '@trismegisto/primitives';
80
+
81
+ formatMessage('Remover {label}', { label: 'Arquivo.pdf' });
82
+ pluralMessage({ one: '{count} item', other: '{count} itens' }, 3, 'pt-BR');
83
+ ```
84
+
85
+ Texto com variável é sempre template nomeado (`{nome}`) e contagem é `PluralMessage` com
86
+ `Intl.PluralRules`: nunca prefixo + concatenação nem `if (n === 1)`.
87
+
88
+ ## Ambiente em tempo de execução (`config.json`)
89
+
90
+ `loadRuntimeConfig(environment, { file?, required? })` carrega o ambiente do app em tempo de execução, para
91
+ cada versão gerar **uma imagem só**: busca `config.json` (ou `file`) relativo ao base href, sem cache, e mescla o
92
+ JSON **no próprio** `environment`, em profundidade (objetos mesclam; arrays e valores simples substituem; chaves
93
+ novas entram). Sem o arquivo (404, rede, `index.html` do fallback de SPA): com `required` lança erro, sem ele
94
+ avisa e segue. JSON inválido lança sempre. Chame antes de iniciar o app:
95
+
96
+ ```ts
97
+ import { loadRuntimeConfig } from '@trismegisto/primitives';
98
+
99
+ loadRuntimeConfig(environment, { required: !isDevMode() })
100
+ .then(() => bootstrapApplication(AppComponent, appConfig))
101
+ .catch((e) => console.error(e));
102
+ ```
103
+
104
+ Num app com o `@trismegisto/spine`, importe dele (reexporta esta função) e siga o exemplo do README do spine,
105
+ com o `applyRuntimeEnvironment` e o import dinâmico do `app.config`. O pacote fica aqui, sem framework, para
106
+ apps sem o spine (ex.: uma tela de login) não precisarem dele.
107
+
108
+ ## Mais
109
+
110
+ - Regras de camadas e de i18n: [`CLAUDE.md` §5 e §6](../../CLAUDE.md) e
111
+ [`docs/architecture`](../../docs/architecture/README.md).
112
+ - Páginas "Tema" e "Idiomas" do site de documentação (`docs/website`, rotas `/pages/theming` e `/pages/i18n`).
113
+
114
+ ## Desenvolvimento do pacote
115
+
116
+ `npm test` (Vitest) e `npm run build` (compila para `dist/`).
@@ -21,6 +21,14 @@ export interface GridTreeNode<T> {
21
21
  /** Posição entre os irmãos (1-based) e quantos irmãos há. */
22
22
  readonly posInSet: number;
23
23
  readonly setSize: number;
24
+ /** Último filho mostrado de um pai com mais filhos do que o limite (`childLimit`): o que falta mostrar. */
25
+ readonly more?: GridTreeMore;
26
+ }
27
+ /** Filhos escondidos de um pai pelo limite (`childLimit`): a linha "Mostrar mais" sai depois do último mostrado. */
28
+ export interface GridTreeMore {
29
+ readonly parentId: string;
30
+ readonly shown: number;
31
+ readonly total: number;
24
32
  }
25
33
  export type GridTreeExpanded = ReadonlySet<string>;
26
34
  export declare const NO_EXPANDED_TREE_ROWS: GridTreeExpanded;
@@ -32,6 +40,11 @@ export interface GridTreeVisibleOptions<T> extends GridTreeOptions<T> {
32
40
  readonly matches?: ReadonlySet<string> | null;
33
41
  /** Ordena um grupo de irmãos (a ordenação da grade); padrão: a ordem de entrada. */
34
42
  readonly sort?: (siblings: readonly T[]) => readonly T[];
43
+ /**
44
+ * Quantos filhos de um pai aparecem (paginação interna); `null` = todos. Não vale com filtro (`matches`): um achado
45
+ * nunca fica escondido atrás do "Mostrar mais".
46
+ */
47
+ readonly childLimit?: ((parentId: string) => number | null) | null;
35
48
  }
36
49
  /**
37
50
  * Linhas visíveis na ordem de desenho: filhos só de quem está aberto. Com `matches`, uma linha aparece se
@@ -41,3 +54,10 @@ export declare function visibleGridTree<T>(roots: readonly T[], options: GridTre
41
54
  export declare function toggleGridTreeRow(expanded: GridTreeExpanded, id: string): GridTreeExpanded;
42
55
  /** Abre todas as linhas que têm filhos. */
43
56
  export declare function expandAllGridTree<T>(nodes: readonly GridTreeNode<T>[]): GridTreeExpanded;
57
+ /** Quantas raízes há na lista visível (o total da paginação por raízes). */
58
+ export declare function countGridTreeRoots<T>(nodes: readonly GridTreeNode<T>[]): number;
59
+ /**
60
+ * Página por raízes: as raízes de `page` (1-based, `size` por página) com todos os descendentes visíveis delas. Uma
61
+ * raiz nunca fica separada dos filhos, e os filhos não contam no tamanho da página.
62
+ */
63
+ export declare function pageGridTreeByRoots<T>(nodes: readonly GridTreeNode<T>[], page: number, size: number): readonly GridTreeNode<T>[];
@@ -49,10 +49,17 @@ export function visibleGridTree(roots, options) {
49
49
  const out = [];
50
50
  const walk = (rows, level, parentId) => {
51
51
  const visible = sort(rows.filter(kept));
52
- visible.forEach((data, index) => {
52
+ const limit = parentId !== null && matches === null ? (options.childLimit?.(parentId) ?? null) : null;
53
+ const shown = limit !== null && limit > 0 && visible.length > limit ? visible.slice(0, limit) : visible;
54
+ shown.forEach((data, index) => {
53
55
  const id = options.rowId(data);
54
56
  const kids = childrenOf(data, options);
55
- out.push({ data, id, level, parentId, hasChildren: nodeHasChildren(data, kids, options), posInSet: index + 1, setSize: visible.length });
57
+ const more = parentId !== null && index === shown.length - 1 && shown.length < visible.length
58
+ ? { parentId, shown: shown.length, total: visible.length } : undefined;
59
+ out.push({
60
+ data, id, level, parentId, hasChildren: nodeHasChildren(data, kids, options), posInSet: index + 1,
61
+ setSize: visible.length, ...(more ? { more } : {}),
62
+ });
56
63
  if (kids.length > 0 && (options.expanded.has(id) || descendantMatched(data)))
57
64
  walk(kids, level + 1, id);
58
65
  });
@@ -72,4 +79,22 @@ export function toggleGridTreeRow(expanded, id) {
72
79
  export function expandAllGridTree(nodes) {
73
80
  return new Set(nodes.filter((node) => node.hasChildren).map((node) => node.id));
74
81
  }
82
+ /** Quantas raízes há na lista visível (o total da paginação por raízes). */
83
+ export function countGridTreeRoots(nodes) {
84
+ return nodes.reduce((count, node) => count + (node.level === 1 ? 1 : 0), 0);
85
+ }
86
+ /**
87
+ * Página por raízes: as raízes de `page` (1-based, `size` por página) com todos os descendentes visíveis delas. Uma
88
+ * raiz nunca fica separada dos filhos, e os filhos não contam no tamanho da página.
89
+ */
90
+ export function pageGridTreeByRoots(nodes, page, size) {
91
+ const first = (Math.max(1, page) - 1) * size;
92
+ const last = first + size;
93
+ let root = -1;
94
+ return nodes.filter((node) => {
95
+ if (node.level === 1)
96
+ root += 1;
97
+ return root >= first && root < last;
98
+ });
99
+ }
75
100
  //# sourceMappingURL=data-grid-tree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-grid-tree.js","sourceRoot":"","sources":["../src/data-grid-tree.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyBH,MAAM,CAAC,MAAM,qBAAqB,GAAqB,IAAI,GAAG,EAAU,CAAC;AAEzE,SAAS,UAAU,CAAI,GAAM,EAAE,OAA2B;IACxD,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;AACrC,CAAC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C,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;IAC7C,MAAM,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC;IAC1B,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC;IACd,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3B,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC;YAAE,IAAI,IAAI,CAAC,CAAC;QAChC,OAAO,IAAI,IAAI,KAAK,IAAI,IAAI,GAAG,IAAI,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -195,17 +195,17 @@ const quote = (value) => `'${value.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'
195
195
  */
196
196
  export function familyToTypescript(draft, target = draft.id) {
197
197
  const name = constantName(draft.id);
198
- return `import type { HermesFamily } from '@trismegisto/tokens';
199
-
200
- export const ${name}: HermesFamily = {
201
- id: ${quote(draft.id)},
202
- label: ${quote(draft.label)},
203
- description: ${quote(draft.description)},
204
- light: { accent: '${draft.light.accent}', panelBg: '${draft.light.panelBg}' },
205
- dark: { accent: '${draft.dark.accent}', panelBg: '${draft.dark.panelBg}' },
206
- };
207
-
208
- // app.config.ts: sobrescreve a ${target} (nome e cores da ${name}, id salvo '${target}')
198
+ return `import type { HermesFamily } from '@trismegisto/tokens';
199
+
200
+ export const ${name}: HermesFamily = {
201
+ id: ${quote(draft.id)},
202
+ label: ${quote(draft.label)},
203
+ description: ${quote(draft.description)},
204
+ light: { accent: '${draft.light.accent}', panelBg: '${draft.light.panelBg}' },
205
+ dark: { accent: '${draft.dark.accent}', panelBg: '${draft.dark.panelBg}' },
206
+ };
207
+
208
+ // app.config.ts: sobrescreve a ${target} (nome e cores da ${name}, id salvo '${target}')
209
209
  provideUi({ theme: { replace: { ${quote(target)}: ${name} }, defaultFamily: ${quote(target)} } });`;
210
210
  }
211
211
  /**
@@ -214,11 +214,11 @@ provideUi({ theme: { replace: { ${quote(target)}: ${name} }, defaultFamily: ${qu
214
214
  */
215
215
  export function familyToCss(draft, target = draft.id) {
216
216
  const s = draft.surfaces;
217
- return `[data-family='${target}'][data-family][data-theme='dark'] {
218
- --hm-surface: ${s.surface};
219
- --hm-surface-raised: ${s.surfaceRaised};
220
- --hm-border: ${s.border};
221
- --hm-divider: ${s.divider};
217
+ return `[data-family='${target}'][data-family][data-theme='dark'] {
218
+ --hm-surface: ${s.surface};
219
+ --hm-surface-raised: ${s.surfaceRaised};
220
+ --hm-border: ${s.border};
221
+ --hm-divider: ${s.divider};
222
222
  }`;
223
223
  }
224
224
  /**
package/package.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "@trismegisto/primitives",
3
- "version": "3.3.10",
4
- "license": "SEE LICENSE IN LICENSE",
5
- "description": "Hermes — comportamento e lógica sem framework (foco, tema, i18n, geometria, classes).",
6
- "type": "module",
7
- "sideEffects": false,
8
- "main": "dist/index.js",
9
- "module": "dist/index.js",
10
- "types": "dist/index.d.ts",
11
- "exports": {
12
- ".": {
13
- "types": "./dist/index.d.ts",
14
- "default": "./dist/index.js"
15
- },
16
- "./messages/en": {
17
- "types": "./dist/messages-en.d.ts",
18
- "default": "./dist/messages-en.js"
19
- },
20
- "./messages/es": {
21
- "types": "./dist/messages-es.d.ts",
22
- "default": "./dist/messages-es.js"
23
- },
24
- "./*": {
25
- "types": "./dist/*.d.ts",
26
- "default": "./dist/*.js"
27
- }
28
- },
29
- "files": [
30
- "dist"
31
- ],
32
- "scripts": {
33
- "build": "tsc -p tsconfig.json",
34
- "test": "vitest run",
35
- "test:watch": "vitest",
36
- "test:coverage": "vitest run --coverage"
37
- },
38
- "devDependencies": {
39
- "@trismegisto/icons": "file:../icons",
40
- "@trismegisto/tokens": "file:../tokens",
41
- "@vitest/coverage-v8": "^3.2.7",
42
- "jsdom": "^26.1.0",
43
- "typescript": "~5.9.0",
44
- "vitest": "^3.2.7"
45
- },
46
- "peerDependencies": {
47
- "@trismegisto/icons": "^3.3.10",
48
- "@trismegisto/tokens": "^3.3.10"
49
- }
50
- }
1
+ {
2
+ "name": "@trismegisto/primitives",
3
+ "version": "3.3.11",
4
+ "license": "SEE LICENSE IN LICENSE",
5
+ "description": "Hermes — comportamento e lógica sem framework (foco, tema, i18n, geometria, classes).",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.js",
10
+ "types": "dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./messages/en": {
17
+ "types": "./dist/messages-en.d.ts",
18
+ "default": "./dist/messages-en.js"
19
+ },
20
+ "./messages/es": {
21
+ "types": "./dist/messages-es.d.ts",
22
+ "default": "./dist/messages-es.js"
23
+ },
24
+ "./*": {
25
+ "types": "./dist/*.d.ts",
26
+ "default": "./dist/*.js"
27
+ }
28
+ },
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "scripts": {
33
+ "build": "tsc -p tsconfig.json",
34
+ "test": "vitest run",
35
+ "test:watch": "vitest",
36
+ "test:coverage": "vitest run --coverage"
37
+ },
38
+ "devDependencies": {
39
+ "@trismegisto/icons": "file:../icons",
40
+ "@trismegisto/tokens": "file:../tokens",
41
+ "@vitest/coverage-v8": "^3.2.7",
42
+ "jsdom": "^26.1.0",
43
+ "typescript": "~5.9.0",
44
+ "vitest": "^3.2.7"
45
+ },
46
+ "peerDependencies": {
47
+ "@trismegisto/icons": "^3.3.11",
48
+ "@trismegisto/tokens": "^3.3.11"
49
+ }
50
+ }