@cmssy/types 0.5.0 → 0.5.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/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/platform-context.d.ts +83 -0
- package/dist/platform-context.d.ts.map +1 -0
- package/dist/platform-context.js +2 -0
- package/dist/platform-context.js.map +1 -0
- package/dist/template.d.ts +11 -4
- package/dist/template.d.ts.map +1 -1
- package/dist/template.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
export { FieldType, fieldTypeValues, type FieldValidation, type ValidationPattern, type ShowWhenCondition, type BaseFieldConfig, type SelectFieldConfig, type MultiselectFieldConfig, type RepeaterFieldConfig, type MediaFieldConfig, type SliderFieldConfig, type PageSelectorFieldConfig, type FieldConfig, } from "./block-fields.js";
|
|
8
8
|
export { LayoutPosition, layoutPositionValues, LayoutOverrideAction, type LayoutOverride, } from "./layout.js";
|
|
9
9
|
export { WorkspaceModule, workspaceModuleValues, FeatureFlag, featureFlagValues, type BlockRequires, } from "./modules.js";
|
|
10
|
-
export { type BlockConfig, BlockSource, PackageType
|
|
11
|
-
export
|
|
10
|
+
export { type BlockConfig, BlockSource, PackageType } from "./block.js";
|
|
11
|
+
export type { BlockMemberProfile, BlockMember, BlockAuthContext, BlockI18nContext, PlatformContext, BlockProps, } from "./platform-context.js";
|
|
12
|
+
export { type TemplateBlockContent, type TemplateBlockInstance, type TemplatePageBlueprint, type TemplateLayoutPosition, type TemplateTheme, type TemplateConfig, type ResourceConfig, isTemplateConfig, } from "./template.js";
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,SAAS,EACT,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,WAAW,GACjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,SAAS,EACT,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,WAAW,GACjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,KAAK,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGxE,YAAY,EACV,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,UAAU,GACX,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,gBAAgB,GACjB,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ export { LayoutPosition, layoutPositionValues, LayoutOverrideAction, } from "./l
|
|
|
11
11
|
// Modules & features
|
|
12
12
|
export { WorkspaceModule, workspaceModuleValues, FeatureFlag, featureFlagValues, } from "./modules.js";
|
|
13
13
|
// Block config
|
|
14
|
-
export { BlockSource, PackageType
|
|
14
|
+
export { BlockSource, PackageType } from "./block.js";
|
|
15
15
|
// Template config
|
|
16
16
|
export { isTemplateConfig, } from "./template.js";
|
|
17
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAe;AACf,OAAO,EACL,SAAS,EACT,eAAe,GAYhB,MAAM,mBAAmB,CAAC;AAE3B,SAAS;AACT,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,oBAAoB,GAErB,MAAM,aAAa,CAAC;AAErB,qBAAqB;AACrB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,WAAW,EACX,iBAAiB,GAElB,MAAM,cAAc,CAAC;AAEtB,eAAe;AACf,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAe;AACf,OAAO,EACL,SAAS,EACT,eAAe,GAYhB,MAAM,mBAAmB,CAAC;AAE3B,SAAS;AACT,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,oBAAoB,GAErB,MAAM,aAAa,CAAC;AAErB,qBAAqB;AACrB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,WAAW,EACX,iBAAiB,GAElB,MAAM,cAAc,CAAC;AAEtB,eAAe;AACf,OAAO,EAAoB,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAYxE,kBAAkB;AAClB,OAAO,EAQL,gBAAgB,GACjB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Member profile data available to blocks
|
|
3
|
+
*/
|
|
4
|
+
export interface BlockMemberProfile {
|
|
5
|
+
firstName?: string | null;
|
|
6
|
+
lastName?: string | null;
|
|
7
|
+
displayName?: string | null;
|
|
8
|
+
avatarUrl?: string | null;
|
|
9
|
+
phone?: string | null;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Member data available to blocks (simplified from SiteMember)
|
|
13
|
+
*/
|
|
14
|
+
export interface BlockMember {
|
|
15
|
+
id: string;
|
|
16
|
+
email: string;
|
|
17
|
+
profile: BlockMemberProfile;
|
|
18
|
+
role: string;
|
|
19
|
+
isVerified: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Authentication context for blocks that need auth state
|
|
23
|
+
*/
|
|
24
|
+
export interface BlockAuthContext {
|
|
25
|
+
/** Whether a member is currently logged in */
|
|
26
|
+
isAuthenticated: boolean;
|
|
27
|
+
/** Current member data (null if not authenticated) */
|
|
28
|
+
member: BlockMember | null;
|
|
29
|
+
/** Logout function - clears token and redirects */
|
|
30
|
+
logout: () => Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* i18n context passed to blocks for language switching support.
|
|
34
|
+
* Blocks in cmssy-packages use this data to render their own language switchers.
|
|
35
|
+
*/
|
|
36
|
+
export interface BlockI18nContext {
|
|
37
|
+
/** All languages enabled for this workspace */
|
|
38
|
+
enabledLanguages: string[];
|
|
39
|
+
/** The workspace default language (clean URLs, no prefix) */
|
|
40
|
+
defaultLanguage: string;
|
|
41
|
+
/** Currently active language resolved from URL */
|
|
42
|
+
currentLanguage: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Platform context passed to blocks.
|
|
46
|
+
* Blocks can declare which context features they need via block.config.ts `requires` field.
|
|
47
|
+
*/
|
|
48
|
+
export interface PlatformContext {
|
|
49
|
+
/** Auth context - available when memberAuth is enabled in workspace */
|
|
50
|
+
auth?: BlockAuthContext;
|
|
51
|
+
/** Current language code (e.g., "en", "pl") */
|
|
52
|
+
language: string;
|
|
53
|
+
/** i18n context — available when workspace has multiple languages */
|
|
54
|
+
i18n?: BlockI18nContext;
|
|
55
|
+
/** Whether the page is being viewed in draft/preview mode */
|
|
56
|
+
isPreview?: boolean;
|
|
57
|
+
/** Workspace information */
|
|
58
|
+
workspace?: {
|
|
59
|
+
id: string;
|
|
60
|
+
name?: string;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Build a localized href for internal page links.
|
|
64
|
+
* Prepends the current language prefix when not the default language.
|
|
65
|
+
* Use this in blocks for all internal navigation links.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* <a href={context.localizeHref("/about")}>About</a>
|
|
69
|
+
* // default lang (en) → "/about"
|
|
70
|
+
* // non-default (pl) → "/pl/about"
|
|
71
|
+
*/
|
|
72
|
+
localizeHref?: (href: string) => string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Standard props interface for all blocks
|
|
76
|
+
*/
|
|
77
|
+
export interface BlockProps<T = Record<string, unknown>> {
|
|
78
|
+
/** User-defined content from the page editor */
|
|
79
|
+
content: T;
|
|
80
|
+
/** Platform-provided context (auth, language, etc.) */
|
|
81
|
+
context?: PlatformContext | null;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=platform-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-context.d.ts","sourceRoot":"","sources":["../src/platform-context.ts"],"names":[],"mappings":"AAAA;;G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,CAAC;IACF;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrD,gDAAgD;IAChD,OAAO,EAAE,CAAC,CAAC;IACX,uDAAuD;IACvD,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-context.js","sourceRoot":"","sources":["../src/platform-context.ts"],"names":[],"mappings":""}
|
package/dist/template.d.ts
CHANGED
|
@@ -3,14 +3,21 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { FieldConfig } from "./block-fields.js";
|
|
5
5
|
import type { LayoutPosition } from "./layout.js";
|
|
6
|
+
/**
|
|
7
|
+
* Block content — flat object in config authoring, language-keyed after CLI processing.
|
|
8
|
+
*
|
|
9
|
+
* Flat (config.ts): { title: "Hello", logo: "/img.png" }
|
|
10
|
+
* Language-keyed (API): { en: { title: "Hello" }, pl: { title: "Cześć" } }
|
|
11
|
+
*/
|
|
12
|
+
export type TemplateBlockContent = Record<string, unknown> | Record<string, Record<string, unknown>>;
|
|
6
13
|
/**
|
|
7
14
|
* A block instance within a template page.
|
|
8
15
|
*/
|
|
9
16
|
export interface TemplateBlockInstance {
|
|
10
17
|
/** Block type reference */
|
|
11
18
|
type: string;
|
|
12
|
-
/** Block content/props
|
|
13
|
-
content?:
|
|
19
|
+
/** Block content/props — flat or language-keyed */
|
|
20
|
+
content?: TemplateBlockContent;
|
|
14
21
|
/** Block settings */
|
|
15
22
|
settings?: Record<string, unknown>;
|
|
16
23
|
}
|
|
@@ -37,8 +44,8 @@ export interface TemplateLayoutPosition {
|
|
|
37
44
|
position: LayoutPosition;
|
|
38
45
|
/** Block type to use */
|
|
39
46
|
type: string;
|
|
40
|
-
/** Block content/props
|
|
41
|
-
content?:
|
|
47
|
+
/** Block content/props — flat or language-keyed */
|
|
48
|
+
content?: TemplateBlockContent;
|
|
42
49
|
/** Block order within the position */
|
|
43
50
|
order?: number;
|
|
44
51
|
/** Whether this block is active */
|
package/dist/template.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMlD
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMlD;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAM5C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,qBAAqB;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAChC,oBAAoB;IACpB,QAAQ,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,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,cAAc,CAAC;AAE1D;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,cAAc,GACrB,MAAM,IAAI,cAAc,CAE1B"}
|
package/dist/template.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AAAA;;GAEG;AAyHH;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAsB;IAEtB,OAAO,OAAO,IAAI,MAAM,IAAI,KAAK,CAAC,OAAO,CAAE,MAAyB,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|