@ultrst-armada/floks 1.1.1 → 1.1.2
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,25 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DockBar,
|
|
3
|
-
DockItem,
|
|
4
|
-
useDock
|
|
5
|
-
} from "./chunk-6VB74RCH.js";
|
|
6
1
|
import {
|
|
7
2
|
CanvasViewport,
|
|
8
3
|
InfiniteCanvas,
|
|
9
4
|
MiniMap,
|
|
10
5
|
useCanvas
|
|
11
6
|
} from "./chunk-34YRDZPJ.js";
|
|
7
|
+
import {
|
|
8
|
+
DockBar,
|
|
9
|
+
DockItem,
|
|
10
|
+
useDock
|
|
11
|
+
} from "./chunk-6VB74RCH.js";
|
|
12
12
|
import {
|
|
13
13
|
MonacoEditor,
|
|
14
14
|
skipoDarkTheme,
|
|
15
15
|
useMonaco
|
|
16
16
|
} from "./chunk-QTTWWBNN.js";
|
|
17
|
-
import {
|
|
18
|
-
PredictiveGhostNodeCard,
|
|
19
|
-
PredictiveHudToolbar,
|
|
20
|
-
PredictiveLayer2D,
|
|
21
|
-
usePredictiveGraph2D
|
|
22
|
-
} from "./chunk-OOTTFWXA.js";
|
|
23
17
|
import {
|
|
24
18
|
BIOME_CONFIGS,
|
|
25
19
|
COORD_SCALE,
|
|
@@ -36,6 +30,12 @@ import {
|
|
|
36
30
|
useCanvas2DCoordinates,
|
|
37
31
|
useCanvas2DMagnetic
|
|
38
32
|
} from "./chunk-XVAHT5WE.js";
|
|
33
|
+
import {
|
|
34
|
+
PredictiveGhostNodeCard,
|
|
35
|
+
PredictiveHudToolbar,
|
|
36
|
+
PredictiveLayer2D,
|
|
37
|
+
usePredictiveGraph2D
|
|
38
|
+
} from "./chunk-OOTTFWXA.js";
|
|
39
39
|
import {
|
|
40
40
|
NODE_CARD_WIDTH,
|
|
41
41
|
Node2DBase,
|
|
@@ -391,4 +391,117 @@ interface ThemeValidationResult {
|
|
|
391
391
|
declare function validateThemePackAgainstContract(themePack: ThemePack, contract?: ComponentThemeContract): ThemeValidationResult;
|
|
392
392
|
declare function loadThemePack(raw: unknown): ThemePack;
|
|
393
393
|
|
|
394
|
-
|
|
394
|
+
/**
|
|
395
|
+
* @file snapshot.ts
|
|
396
|
+
* @description Floks Contract Snapshot Generator, Diff Engine & Canonical Contract Definition.
|
|
397
|
+
* Enforces docs/04_THETA_COMPONENT_CONTRACTS.md and IMPLEMENTATION-SPEC.md:
|
|
398
|
+
* implementation_only => PATCH
|
|
399
|
+
* additive_compatible => MINOR
|
|
400
|
+
* breaking_contract_change => MAJOR
|
|
401
|
+
*/
|
|
402
|
+
|
|
403
|
+
declare const FLOKS_PUBLIC_SYMBOLS: string[];
|
|
404
|
+
declare const FloksContractSnapshotSchema: z.ZodObject<{
|
|
405
|
+
package: z.ZodLiteral<"@ultrst-armada/floks">;
|
|
406
|
+
version: z.ZodString;
|
|
407
|
+
timestamp: z.ZodNumber;
|
|
408
|
+
checksum: z.ZodString;
|
|
409
|
+
publicSymbols: z.ZodArray<z.ZodString, "many">;
|
|
410
|
+
components: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
411
|
+
componentId: z.ZodString;
|
|
412
|
+
componentVersion: z.ZodString;
|
|
413
|
+
slots: z.ZodArray<z.ZodString, "many">;
|
|
414
|
+
states: z.ZodArray<z.ZodString, "many">;
|
|
415
|
+
parameters: z.ZodArray<z.ZodString, "many">;
|
|
416
|
+
assets: z.ZodArray<z.ZodString, "many">;
|
|
417
|
+
}, "strip", z.ZodTypeAny, {
|
|
418
|
+
parameters?: string[];
|
|
419
|
+
componentId?: string;
|
|
420
|
+
componentVersion?: string;
|
|
421
|
+
slots?: string[];
|
|
422
|
+
states?: string[];
|
|
423
|
+
assets?: string[];
|
|
424
|
+
}, {
|
|
425
|
+
parameters?: string[];
|
|
426
|
+
componentId?: string;
|
|
427
|
+
componentVersion?: string;
|
|
428
|
+
slots?: string[];
|
|
429
|
+
states?: string[];
|
|
430
|
+
assets?: string[];
|
|
431
|
+
}>>;
|
|
432
|
+
errorCodes: z.ZodArray<z.ZodString, "many">;
|
|
433
|
+
}, "strip", z.ZodTypeAny, {
|
|
434
|
+
version?: string;
|
|
435
|
+
package?: "@ultrst-armada/floks";
|
|
436
|
+
timestamp?: number;
|
|
437
|
+
checksum?: string;
|
|
438
|
+
publicSymbols?: string[];
|
|
439
|
+
components?: Record<string, {
|
|
440
|
+
parameters?: string[];
|
|
441
|
+
componentId?: string;
|
|
442
|
+
componentVersion?: string;
|
|
443
|
+
slots?: string[];
|
|
444
|
+
states?: string[];
|
|
445
|
+
assets?: string[];
|
|
446
|
+
}>;
|
|
447
|
+
errorCodes?: string[];
|
|
448
|
+
}, {
|
|
449
|
+
version?: string;
|
|
450
|
+
package?: "@ultrst-armada/floks";
|
|
451
|
+
timestamp?: number;
|
|
452
|
+
checksum?: string;
|
|
453
|
+
publicSymbols?: string[];
|
|
454
|
+
components?: Record<string, {
|
|
455
|
+
parameters?: string[];
|
|
456
|
+
componentId?: string;
|
|
457
|
+
componentVersion?: string;
|
|
458
|
+
slots?: string[];
|
|
459
|
+
states?: string[];
|
|
460
|
+
assets?: string[];
|
|
461
|
+
}>;
|
|
462
|
+
errorCodes?: string[];
|
|
463
|
+
}>;
|
|
464
|
+
type FloksContractSnapshot = z.infer<typeof FloksContractSnapshotSchema>;
|
|
465
|
+
interface ContractDiffResult {
|
|
466
|
+
versionRecommendation: 'PATCH' | 'MINOR' | 'MAJOR';
|
|
467
|
+
hasBreakingChanges: boolean;
|
|
468
|
+
hasAdditiveChanges: boolean;
|
|
469
|
+
isIdentical: boolean;
|
|
470
|
+
removedSymbols: string[];
|
|
471
|
+
addedSymbols: string[];
|
|
472
|
+
removedComponents: string[];
|
|
473
|
+
addedComponents: string[];
|
|
474
|
+
changedComponents: string[];
|
|
475
|
+
summary: string;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Generate canonical contract snapshot for Floks.
|
|
479
|
+
*/
|
|
480
|
+
declare function createFloksSnapshot(version?: string, registry?: Record<string, ComponentThemeContract>, publicSymbols?: string[]): FloksContractSnapshot;
|
|
481
|
+
/**
|
|
482
|
+
* Computes semantic diff between previous and current Floks contract snapshots.
|
|
483
|
+
*/
|
|
484
|
+
declare function diffContractSnapshots(previous: FloksContractSnapshot, current: FloksContractSnapshot): ContractDiffResult;
|
|
485
|
+
declare const FLOKS_CANONICAL_CONTRACT: {
|
|
486
|
+
package: string;
|
|
487
|
+
version: string;
|
|
488
|
+
getSnapshot: () => {
|
|
489
|
+
version?: string;
|
|
490
|
+
package?: "@ultrst-armada/floks";
|
|
491
|
+
timestamp?: number;
|
|
492
|
+
checksum?: string;
|
|
493
|
+
publicSymbols?: string[];
|
|
494
|
+
components?: Record<string, {
|
|
495
|
+
parameters?: string[];
|
|
496
|
+
componentId?: string;
|
|
497
|
+
componentVersion?: string;
|
|
498
|
+
slots?: string[];
|
|
499
|
+
states?: string[];
|
|
500
|
+
assets?: string[];
|
|
501
|
+
}>;
|
|
502
|
+
errorCodes?: string[];
|
|
503
|
+
};
|
|
504
|
+
validateCompatibility: (themePack: ThemePack) => ThemeValidationResult;
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
export { type ComponentThemeContract, ComponentThemeContractSchema, type ContractDiffResult, FLOKS_CANONICAL_CONTRACT, FLOKS_COMPONENT_REGISTRY, FLOKS_PUBLIC_SYMBOLS, type FloksContractSnapshot, FloksContractSnapshotSchema, type ThemePack, ThemePackSchema, type ThemePackSlotBinding, ThemePackSlotBindingSchema, type ThemePackStateMapping, ThemePackStateMappingSchema, type ThemeTarget, ThemeTargetSchema, type ThemeValidationResult, type VisualParameter, VisualParameterSchema, type VisualSlot, VisualSlotSchema, type VisualState, VisualStateSchema, createFloksSnapshot, diffContractSnapshots, getComponentContract, listComponentContracts, loadThemePack, validateThemePackAgainstContract };
|
|
@@ -307,9 +307,171 @@ function loadThemePack(raw) {
|
|
|
307
307
|
}
|
|
308
308
|
return parsed;
|
|
309
309
|
}
|
|
310
|
+
|
|
311
|
+
// src/snapshot.ts
|
|
312
|
+
import { z as z2 } from "zod";
|
|
313
|
+
var FLOKS_PUBLIC_SYMBOLS = [
|
|
314
|
+
// UI Layout & Containers
|
|
315
|
+
"AppShell",
|
|
316
|
+
"TopToolbar",
|
|
317
|
+
"BottomStrip",
|
|
318
|
+
"FloatingDetailsPanel",
|
|
319
|
+
"SettingsTab",
|
|
320
|
+
"WorkspaceTilesMenu",
|
|
321
|
+
"UIParent",
|
|
322
|
+
"PanelModel",
|
|
323
|
+
"PanelProps",
|
|
324
|
+
// UI Base Primitives & Forms
|
|
325
|
+
"BaseButton",
|
|
326
|
+
"BaseCard",
|
|
327
|
+
"BaseInput",
|
|
328
|
+
"BaseSelect",
|
|
329
|
+
"BaseToggle",
|
|
330
|
+
"BaseBadge",
|
|
331
|
+
"ButtonModel",
|
|
332
|
+
"ButtonProps",
|
|
333
|
+
"CredentialField",
|
|
334
|
+
"LoginModal",
|
|
335
|
+
"ConfirmDialog",
|
|
336
|
+
"StatusIndicator",
|
|
337
|
+
// Canvas 2D
|
|
338
|
+
"InfiniteCanvas",
|
|
339
|
+
"DockBar",
|
|
340
|
+
"TileGrid",
|
|
341
|
+
"MonacoEditor",
|
|
342
|
+
// Contracts & Theta
|
|
343
|
+
"FLOKS_CANONICAL_CONTRACT",
|
|
344
|
+
"FLOKS_COMPONENT_REGISTRY",
|
|
345
|
+
"getComponentContract",
|
|
346
|
+
"listComponentContracts",
|
|
347
|
+
"validateThemePackAgainstContract",
|
|
348
|
+
"loadThemePack",
|
|
349
|
+
"createFloksSnapshot",
|
|
350
|
+
"diffContractSnapshots",
|
|
351
|
+
"ComponentThemeContractSchema",
|
|
352
|
+
"VisualSlotSchema",
|
|
353
|
+
"VisualStateSchema",
|
|
354
|
+
"VisualParameterSchema",
|
|
355
|
+
"ThemeTargetSchema",
|
|
356
|
+
"ThemePackSchema"
|
|
357
|
+
];
|
|
358
|
+
var FloksContractSnapshotSchema = z2.object({
|
|
359
|
+
package: z2.literal("@ultrst-armada/floks"),
|
|
360
|
+
version: z2.string(),
|
|
361
|
+
timestamp: z2.number(),
|
|
362
|
+
checksum: z2.string(),
|
|
363
|
+
publicSymbols: z2.array(z2.string()),
|
|
364
|
+
components: z2.record(
|
|
365
|
+
z2.object({
|
|
366
|
+
componentId: z2.string(),
|
|
367
|
+
componentVersion: z2.string(),
|
|
368
|
+
slots: z2.array(z2.string()),
|
|
369
|
+
states: z2.array(z2.string()),
|
|
370
|
+
parameters: z2.array(z2.string()),
|
|
371
|
+
assets: z2.array(z2.string())
|
|
372
|
+
})
|
|
373
|
+
),
|
|
374
|
+
errorCodes: z2.array(z2.string())
|
|
375
|
+
});
|
|
376
|
+
function createFloksSnapshot(version = "1.1.1", registry = FLOKS_COMPONENT_REGISTRY, publicSymbols = FLOKS_PUBLIC_SYMBOLS) {
|
|
377
|
+
const sortedSymbols = [...publicSymbols].sort();
|
|
378
|
+
const components = {};
|
|
379
|
+
for (const [compId, contract] of Object.entries(registry)) {
|
|
380
|
+
components[compId] = {
|
|
381
|
+
componentId: contract.componentId,
|
|
382
|
+
componentVersion: contract.componentVersion,
|
|
383
|
+
slots: contract.slots.map((s) => s.id).sort(),
|
|
384
|
+
states: contract.states.map((s) => s.id).sort(),
|
|
385
|
+
parameters: contract.parameters.map((p) => p.id).sort(),
|
|
386
|
+
assets: [...contract.assets].sort()
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
const errorCodes = [
|
|
390
|
+
"ERR_CONTRACT_VIOLATION",
|
|
391
|
+
"ERR_INTERNAL_IMPORT_FORBIDDEN",
|
|
392
|
+
"ERR_LOCAL_SHIM_DETECTED",
|
|
393
|
+
"ERR_THEME_TARGET_MISMATCH",
|
|
394
|
+
"ERR_SLOT_REJECTED",
|
|
395
|
+
"ERR_UNRECOGNIZED_STATE"
|
|
396
|
+
];
|
|
397
|
+
const rawJson = JSON.stringify({ sortedSymbols, components });
|
|
398
|
+
let hash = 0;
|
|
399
|
+
for (let i = 0; i < rawJson.length; i++) {
|
|
400
|
+
hash = (hash << 5) - hash + rawJson.charCodeAt(i);
|
|
401
|
+
hash |= 0;
|
|
402
|
+
}
|
|
403
|
+
const checksum = `sha256-${Math.abs(hash).toString(16)}`;
|
|
404
|
+
const snapshot = {
|
|
405
|
+
package: "@ultrst-armada/floks",
|
|
406
|
+
version,
|
|
407
|
+
timestamp: 176043e7,
|
|
408
|
+
checksum,
|
|
409
|
+
publicSymbols: sortedSymbols,
|
|
410
|
+
components,
|
|
411
|
+
errorCodes
|
|
412
|
+
};
|
|
413
|
+
return FloksContractSnapshotSchema.parse(snapshot);
|
|
414
|
+
}
|
|
415
|
+
function diffContractSnapshots(previous, current) {
|
|
416
|
+
const prevSymbols = new Set(previous.publicSymbols);
|
|
417
|
+
const currSymbols = new Set(current.publicSymbols);
|
|
418
|
+
const removedSymbols = previous.publicSymbols.filter((s) => !currSymbols.has(s));
|
|
419
|
+
const addedSymbols = current.publicSymbols.filter((s) => !prevSymbols.has(s));
|
|
420
|
+
const prevCompIds = Object.keys(previous.components);
|
|
421
|
+
const currCompIds = new Set(Object.keys(current.components));
|
|
422
|
+
const removedComponents = prevCompIds.filter((id) => !currCompIds.has(id));
|
|
423
|
+
const addedComponents = Object.keys(current.components).filter((id) => !previous.components[id]);
|
|
424
|
+
const changedComponents = [];
|
|
425
|
+
for (const compId of Object.keys(current.components)) {
|
|
426
|
+
if (previous.components[compId]) {
|
|
427
|
+
const prevC = previous.components[compId];
|
|
428
|
+
const currC = current.components[compId];
|
|
429
|
+
const removedSlots = prevC.slots.filter((s) => !currC.slots.includes(s));
|
|
430
|
+
const removedStates = prevC.states.filter((s) => !currC.states.includes(s));
|
|
431
|
+
if (removedSlots.length > 0 || removedStates.length > 0) {
|
|
432
|
+
changedComponents.push(
|
|
433
|
+
`${compId} breaking: removed slots [${removedSlots.join(", ")}], removed states [${removedStates.join(", ")}]`
|
|
434
|
+
);
|
|
435
|
+
} else if (prevC.slots.length !== currC.slots.length || prevC.states.length !== currC.states.length || prevC.parameters.length !== currC.parameters.length) {
|
|
436
|
+
changedComponents.push(`${compId} additive extension`);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
const hasBreakingChanges = removedSymbols.length > 0 || removedComponents.length > 0 || changedComponents.some((c) => c.includes("breaking"));
|
|
441
|
+
const hasAdditiveChanges = addedSymbols.length > 0 || addedComponents.length > 0 || changedComponents.some((c) => c.includes("additive"));
|
|
442
|
+
const isIdentical = !hasBreakingChanges && !hasAdditiveChanges;
|
|
443
|
+
let versionRecommendation = "PATCH";
|
|
444
|
+
if (hasBreakingChanges) {
|
|
445
|
+
versionRecommendation = "MAJOR";
|
|
446
|
+
} else if (hasAdditiveChanges) {
|
|
447
|
+
versionRecommendation = "MINOR";
|
|
448
|
+
}
|
|
449
|
+
const summary = isIdentical ? "Identical public contract surface (PATCH compatible)." : hasBreakingChanges ? `Breaking contract change detected: ${removedSymbols.length} removed symbols, ${removedComponents.length} removed components (MAJOR bump required).` : `Additive compatible changes: ${addedSymbols.length} added symbols, ${addedComponents.length} added components (MINOR bump required).`;
|
|
450
|
+
return {
|
|
451
|
+
versionRecommendation,
|
|
452
|
+
hasBreakingChanges,
|
|
453
|
+
hasAdditiveChanges,
|
|
454
|
+
isIdentical,
|
|
455
|
+
removedSymbols,
|
|
456
|
+
addedSymbols,
|
|
457
|
+
removedComponents,
|
|
458
|
+
addedComponents,
|
|
459
|
+
changedComponents,
|
|
460
|
+
summary
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
var FLOKS_CANONICAL_CONTRACT = {
|
|
464
|
+
package: "@ultrst-armada/floks",
|
|
465
|
+
version: "1.1.1",
|
|
466
|
+
getSnapshot: () => createFloksSnapshot("1.1.1"),
|
|
467
|
+
validateCompatibility: (themePack) => validateThemePackAgainstContract(themePack)
|
|
468
|
+
};
|
|
310
469
|
export {
|
|
311
470
|
ComponentThemeContractSchema,
|
|
471
|
+
FLOKS_CANONICAL_CONTRACT,
|
|
312
472
|
FLOKS_COMPONENT_REGISTRY,
|
|
473
|
+
FLOKS_PUBLIC_SYMBOLS,
|
|
474
|
+
FloksContractSnapshotSchema,
|
|
313
475
|
ThemePackSchema,
|
|
314
476
|
ThemePackSlotBindingSchema,
|
|
315
477
|
ThemePackStateMappingSchema,
|
|
@@ -317,6 +479,8 @@ export {
|
|
|
317
479
|
VisualParameterSchema,
|
|
318
480
|
VisualSlotSchema,
|
|
319
481
|
VisualStateSchema,
|
|
482
|
+
createFloksSnapshot,
|
|
483
|
+
diffContractSnapshots,
|
|
320
484
|
getComponentContract,
|
|
321
485
|
listComponentContracts,
|
|
322
486
|
loadThemePack,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://skipo.dev/schemas/floks-manifest.v1.json",
|
|
3
|
+
"package": "@floks/contracts",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"components": [
|
|
6
|
+
{
|
|
7
|
+
"id": "canonical-component-contracts",
|
|
8
|
+
"name": "Canonical Component Contracts & Snapshot Engine",
|
|
9
|
+
"export": "FLOKS_CANONICAL_CONTRACT",
|
|
10
|
+
"subpath": "contracts",
|
|
11
|
+
"targetTypes": ["App.contracts", "App.governance"]
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|