@mosaicoo/kanban 0.1.0 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mosaicoo/kanban",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Flexible board engine and Angular UI for Kanban-style visual organization — configurable columns, swimlanes and dynamic grouping, with a headless zero-dependency core.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/mosaicoo/mosaicoo-kanban#readme",
@@ -40,6 +40,10 @@
40
40
  "types": "./types/mosaicoo-kanban-core.d.ts",
41
41
  "default": "./fesm2022/mosaicoo-kanban-core.mjs"
42
42
  },
43
+ "./designer": {
44
+ "types": "./types/mosaicoo-kanban-designer.d.ts",
45
+ "default": "./fesm2022/mosaicoo-kanban-designer.mjs"
46
+ },
43
47
  "./ui": {
44
48
  "types": "./types/mosaicoo-kanban-ui.d.ts",
45
49
  "default": "./fesm2022/mosaicoo-kanban-ui.mjs"
@@ -48,7 +52,17 @@
48
52
  "peerDependencies": {
49
53
  "@angular/cdk": ">=21.0.0 <23.0.0",
50
54
  "@angular/common": ">=21.0.0 <23.0.0",
51
- "@angular/core": ">=21.0.0 <23.0.0"
55
+ "@angular/core": ">=21.0.0 <23.0.0",
56
+ "@angular/forms": ">=21.0.0 <23.0.0",
57
+ "@angular/material": ">=21.0.0 <23.0.0"
58
+ },
59
+ "peerDependenciesMeta": {
60
+ "@angular/forms": {
61
+ "optional": true
62
+ },
63
+ "@angular/material": {
64
+ "optional": true
65
+ }
52
66
  },
53
67
  "dependencies": {
54
68
  "tslib": "^2.3.0"
@@ -4,7 +4,7 @@
4
4
  * Mantida em sincronia com projects/kanban/package.json pelo processo de
5
5
  * release (standard-version updater — mesmo mecanismo do @mosaicoo/svg-engine).
6
6
  */
7
- declare const MKB_VERSION = "0.1.0";
7
+ declare const MKB_VERSION = "0.2.0";
8
8
 
9
9
  /**
10
10
  * Modelo DECLARATIVO de cartão — serializável (docs/01 §4). O cartão é uma
@@ -0,0 +1,139 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { OnDestroy } from '@angular/core';
3
+ import * as _mosaicoo_kanban_core from '@mosaicoo/kanban/core';
4
+ import { BoardConfig, KanbanRegistry, ValidationIssue, KanbanBoard, KanbanAxisConfig, KanbanGroupDef, KanbanBlockType } from '@mosaicoo/kanban/core';
5
+
6
+ /** Tema do designer: só os tokens ALTERADOS em relação ao default. */
7
+ type KanbanDesignTheme = Record<string, string>;
8
+ /** Arquivo de design completo (round-trip do designer). O `config` sozinho
9
+ * também é aceito na importação — é o BoardConfig puro do runtime. */
10
+ interface KanbanDesignFile {
11
+ version: 1;
12
+ config: BoardConfig;
13
+ theme?: KanbanDesignTheme;
14
+ }
15
+ /** Eixo em forma canônica de edição (sempre objeto). */
16
+ interface DraftAxis extends KanbanAxisConfig {
17
+ groups?: KanbanGroupDef[];
18
+ }
19
+ /**
20
+ * Estado do Designer — instância POR componente (provider do
21
+ * MosKanbanDesigner; nunca singleton de módulo). Fonte da verdade é um
22
+ * BoardConfig serializável em forma canônica de edição (eixos como objeto);
23
+ * toda mutação passa por `update()` (clone → muta → valida → re-preview).
24
+ */
25
+ declare class DesignerStore {
26
+ readonly config: _angular_core.WritableSignal<BoardConfig>;
27
+ readonly theme: _angular_core.WritableSignal<KanbanDesignTheme>;
28
+ registry: KanbanRegistry | undefined;
29
+ /** Validação contínua da config em edição. */
30
+ readonly validation: _angular_core.Signal<_mosaicoo_kanban_core.ValidationResult>;
31
+ readonly errors: _angular_core.Signal<ValidationIssue[]>;
32
+ /** Board do preview — recriado a cada config VÁLIDA (a inválida mantém o
33
+ * último preview bom, com os erros listados ao lado). */
34
+ private lastGood;
35
+ readonly previewBoard: _angular_core.Signal<KanbanBoard | null>;
36
+ /** String de estilo com os tokens alterados (aplicada no preview). */
37
+ readonly themeStyle: _angular_core.Signal<string>;
38
+ /** Toda mutação: clona, aplica, publica (imutável p/ OnPush). */
39
+ update(mutator: (draft: BoardConfig) => void): void;
40
+ load(config: BoardConfig, theme?: KanbanDesignTheme): void;
41
+ setToken(token: string, value: string): void;
42
+ resetTheme(): void;
43
+ /** Eixo de colunas SEMPRE como objeto (açúcar de array normalizado). */
44
+ columnsAxis(): DraftAxis;
45
+ lanesAxis(): DraftAxis | null;
46
+ private axisOf;
47
+ /** Importa qualquer config para a forma canônica de edição. */
48
+ private canonicalize;
49
+ /** Aceita BoardConfig puro OU KanbanDesignFile; retorna erros sem aplicar
50
+ * quando a config é inválida. */
51
+ import(json: string): {
52
+ ok: boolean;
53
+ errors: ValidationIssue[];
54
+ };
55
+ exportConfigJson(): string;
56
+ exportDesignJson(): string;
57
+ /** Snippet CSS só com os tokens alterados (nada = string vazia). */
58
+ exportThemeCss(): string;
59
+ saveDraft(storageKey: string): void;
60
+ loadDraft(storageKey: string): boolean;
61
+ clearDraft(storageKey: string): void;
62
+ destroy(): void;
63
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DesignerStore, never>;
64
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<DesignerStore>;
65
+ }
66
+
67
+ /**
68
+ * Designer do Board — tela OPT-IN (entry point isolado
69
+ * `@mosaicoo/kanban/designer`): edita visualmente o BoardConfig (pipeline,
70
+ * cartão, dados, tema) com preview ao vivo e importa/exporta no formato que
71
+ * o kanban consome em runtime. Exige @angular/material + @angular/forms
72
+ * (peers opcionais do pacote — quem não usa o designer não paga por eles).
73
+ */
74
+ declare class MosKanbanDesigner implements OnDestroy {
75
+ protected readonly store: DesignerStore;
76
+ /** Config inicial (senão: rascunho salvo → default). */
77
+ readonly config: _angular_core.InputSignal<BoardConfig | null>;
78
+ /** Tema inicial (tokens alterados). */
79
+ readonly theme: _angular_core.InputSignal<KanbanDesignTheme | null>;
80
+ /** Registry do host — deixa o preview resolver rule:, icon: e format:. */
81
+ readonly registry: _angular_core.InputSignal<KanbanRegistry | undefined>;
82
+ /** Chave do rascunho automático em localStorage; '' desliga. */
83
+ readonly storageKey: _angular_core.InputSignal<string>;
84
+ /** Config a cada mudança VÁLIDA (para persistência pelo host). */
85
+ readonly configChange: _angular_core.OutputEmitterRef<BoardConfig>;
86
+ readonly themeChange: _angular_core.OutputEmitterRef<KanbanDesignTheme>;
87
+ protected readonly importErrors: _angular_core.WritableSignal<ValidationIssue[]>;
88
+ private initialized;
89
+ constructor();
90
+ protected hasTheme(): boolean;
91
+ protected onImportFile(event: Event): void;
92
+ protected applyJson(area: HTMLTextAreaElement): void;
93
+ protected exportConfig(): void;
94
+ protected exportDesign(): void;
95
+ protected exportCss(): void;
96
+ protected clearDraft(): void;
97
+ private download;
98
+ ngOnDestroy(): void;
99
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MosKanbanDesigner, never>;
100
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<MosKanbanDesigner, "mos-kanban-designer", never, { "config": { "alias": "config"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; "registry": { "alias": "registry"; "required": false; "isSignal": true; }; "storageKey": { "alias": "storageKey"; "required": false; "isSignal": true; }; }, { "configChange": "configChange"; "themeChange": "themeChange"; }, never, never, true, never>;
101
+ }
102
+
103
+ /**
104
+ * Metadados do Designer — a tela é GERADA a partir destas tabelas, não de
105
+ * formulários escritos à mão por tipo. Adicionar um token ou um campo de
106
+ * bloco aqui é o suficiente para ele aparecer na tela.
107
+ */
108
+ interface TokenDef {
109
+ /** Nome CSS completo (--mkb-…). */
110
+ token: string;
111
+ label: string;
112
+ kind: 'color' | 'text';
113
+ /** Default de fábrica (para reset e para exportar só o que mudou). */
114
+ default: string;
115
+ }
116
+ interface TokenGroup {
117
+ label: string;
118
+ tokens: TokenDef[];
119
+ }
120
+ /** Espelho de styles/kanban-tokens.css (defaults de fábrica). */
121
+ declare const TOKEN_GROUPS: TokenGroup[];
122
+ type FieldKind = 'text' | 'number' | 'toggle' | 'select' | 'csv' | 'json' | 'facts' | 'card-actions' | 'capabilities';
123
+ interface BlockFieldDef {
124
+ key: string;
125
+ label: string;
126
+ kind: FieldKind;
127
+ options?: string[];
128
+ hint?: string;
129
+ }
130
+ /** Descritores dos campos editáveis de cada tipo de bloco. */
131
+ declare const BLOCK_FIELDS: Record<KanbanBlockType, BlockFieldDef[]>;
132
+ /** Tipos de bloco oferecidos no "adicionar bloco" (ordem de exibição). */
133
+ declare const BLOCK_TYPE_LABELS: Array<{
134
+ type: KanbanBlockType;
135
+ label: string;
136
+ }>;
137
+
138
+ export { BLOCK_FIELDS, BLOCK_TYPE_LABELS, DesignerStore, MosKanbanDesigner, TOKEN_GROUPS };
139
+ export type { BlockFieldDef, FieldKind, KanbanDesignFile, KanbanDesignTheme, TokenDef, TokenGroup };
@@ -373,7 +373,7 @@ declare class MosKanbanBoard {
373
373
  readonly dragStarted: _angular_core.OutputEmitterRef<KanbanDragInfo>;
374
374
  readonly dragEnded: _angular_core.OutputEmitterRef<KanbanDragInfo>;
375
375
  readonly dragCanceled: _angular_core.OutputEmitterRef<KanbanDragInfo>;
376
- protected readonly version = "0.1.0";
376
+ protected readonly version = "0.2.0";
377
377
  protected readonly cardDef: _angular_core.Signal<MosKanbanCardDef | undefined>;
378
378
  protected readonly menu: _angular_core.WritableSignal<MenuState | null>;
379
379
  /** Mensagem do aria-live (movimentos por teclado e recusas). */