@selfhelp/shared 1.7.2 → 1.10.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/dist/{common-B96dASgu.d.mts → common-CJSHQL1E.d.mts} +13 -1
  3. package/dist/{common-B96dASgu.d.ts → common-CJSHQL1E.d.ts} +13 -1
  4. package/dist/index.d.mts +7 -44
  5. package/dist/index.d.ts +7 -44
  6. package/dist/index.js +400 -13
  7. package/dist/index.mjs +376 -13
  8. package/dist/plugin-sdk/index.d.mts +2 -2
  9. package/dist/plugin-sdk/index.d.ts +2 -2
  10. package/dist/plugin-sdk/index.js +15 -6
  11. package/dist/plugin-sdk/index.mjs +15 -6
  12. package/dist/registry/index.d.mts +42 -4
  13. package/dist/registry/index.d.ts +42 -4
  14. package/dist/registry/index.js +61 -8
  15. package/dist/registry/index.mjs +53 -7
  16. package/dist/{styles.registry-B147FVHY.d.mts → styles.registry-BV1iF7k-.d.ts} +695 -478
  17. package/dist/{styles.registry-D49K8F5z.d.ts → styles.registry-DkoT-FmN.d.mts} +695 -478
  18. package/dist/theme/index.d.mts +225 -4
  19. package/dist/theme/index.d.ts +225 -4
  20. package/dist/theme/index.js +343 -9
  21. package/dist/theme/index.mjs +325 -8
  22. package/dist/theme/tailwind.d.mts +2 -2
  23. package/dist/theme/tailwind.d.ts +2 -2
  24. package/package.json +1 -1
  25. package/src/registry/__tests__/platform.test.ts +187 -0
  26. package/src/registry/index.ts +73 -0
  27. package/src/registry/styles.registry.ts +65 -5
  28. package/src/theme/__tests__/mantineVariant.test.ts +87 -0
  29. package/src/theme/__tests__/semantic.test.ts +231 -0
  30. package/src/theme/index.ts +2 -0
  31. package/src/theme/mantineVariant.ts +145 -0
  32. package/src/theme/semantic.ts +472 -0
  33. package/src/theme/tailwind.ts +2 -2
  34. package/src/theme/tokens.ts +2 -2
  35. package/src/types/mantine/common.ts +13 -0
  36. package/src/types/styles/auth.ts +13 -13
  37. package/src/types/styles/base.ts +5 -5
  38. package/src/types/styles/composite.ts +62 -48
  39. package/src/types/styles/error.ts +26 -15
  40. package/src/types/styles/forms.ts +185 -185
  41. package/src/types/styles/interactive.ts +81 -76
  42. package/src/types/styles/layout.ts +103 -85
  43. package/src/types/styles/media.ts +20 -20
  44. package/src/types/styles/typography.ts +39 -39
  45. package/src/types/styles/unknown.ts +20 -2
  46. package/src/utils/spacing.ts +1 -1
@@ -28,9 +28,16 @@ __export(registry_exports, {
28
28
  getPluginStyleRegistry: () => getPluginStyleRegistry,
29
29
  getRegistryEntry: () => getRegistryEntry,
30
30
  getRegistryEntryAny: () => getRegistryEntryAny,
31
+ getStylePlacement: () => getStylePlacement,
32
+ getStylePlatforms: () => getStylePlatforms,
31
33
  getStylePluginId: () => getStylePluginId,
32
34
  isKnownStyleName: () => isKnownStyleName,
33
- isRegisteredStyleName: () => isRegisteredStyleName
35
+ isRegisteredStyleName: () => isRegisteredStyleName,
36
+ isStyleAllowedOnPage: () => isStyleAllowedOnPage,
37
+ isStylePlacementAllowed: () => isStylePlacementAllowed,
38
+ isStyleSupportedOnPlatform: () => isStyleSupportedOnPlatform,
39
+ setToStylePlatform: () => setToStylePlatform,
40
+ stylePlatformToSet: () => stylePlatformToSet
34
41
  });
35
42
  module.exports = __toCommonJS(registry_exports);
36
43
 
@@ -40,8 +47,8 @@ var BASE_STYLE_REGISTRY = {
40
47
  login: { description: "User login form", category: "auth", frontendOnly: true, canHaveChildren: false },
41
48
  register: { description: "User registration form", category: "auth", frontendOnly: true, canHaveChildren: false },
42
49
  validate: { description: "Email/account validation flow", category: "auth", frontendOnly: true, canHaveChildren: true },
43
- resetPassword: { description: "Reset password form", category: "auth", frontendOnly: true, canHaveChildren: false },
44
- twoFactorAuth: { description: "Two-factor auth code form", category: "auth", frontendOnly: true, canHaveChildren: false },
50
+ "reset-password": { description: "Reset password form", category: "auth", frontendOnly: true, canHaveChildren: false },
51
+ "two-factor-auth": { description: "Two-factor auth code form", category: "auth", frontendOnly: true, canHaveChildren: false },
45
52
  profile: { description: "User profile management", category: "auth", frontendOnly: true, canHaveChildren: false },
46
53
  // ===== layout =====
47
54
  container: { description: "Mantine Container with responsive max-width", category: "layout", frontendOnly: true, canHaveChildren: true },
@@ -121,10 +128,19 @@ var BASE_STYLE_REGISTRY = {
121
128
  timeline: { description: "Mantine Timeline", category: "composite", frontendOnly: true, canHaveChildren: true },
122
129
  list: { description: "Mantine List", category: "composite", frontendOnly: true, canHaveChildren: true },
123
130
  "list-item": { description: "Mantine List.Item", category: "composite", frontendOnly: true, canHaveChildren: true },
124
- entryList: { description: "Data-driven list of entries (form-log table)", category: "composite", frontendOnly: true, canHaveChildren: true },
125
- entryRecord: { description: "Single-record container", category: "composite", frontendOnly: true, canHaveChildren: true },
126
- entryRecordDelete: { description: "Inline delete confirmation for an entry", category: "composite", frontendOnly: true, canHaveChildren: false },
127
- loop: { description: "Loop / repeater over backend-provided rows", category: "composite", frontendOnly: true, canHaveChildren: true }
131
+ "entry-list": { description: "Data-driven list of entries (form-log table)", category: "composite", frontendOnly: true, canHaveChildren: true },
132
+ "entry-record": { description: "Single-record container", category: "composite", frontendOnly: true, canHaveChildren: true },
133
+ "entry-record-delete": { description: "Inline delete confirmation for an entry", category: "composite", frontendOnly: true, canHaveChildren: false },
134
+ loop: { description: "Loop / repeater over backend-provided rows", category: "composite", frontendOnly: true, canHaveChildren: true },
135
+ "timeline-item": { description: "A single entry inside a timeline (child-only)", category: "composite", frontendOnly: true, canHaveChildren: true },
136
+ // ===== system / data / reference (established backend catalog) =====
137
+ "no-access": { description: "Access-denied surface shown when the user lacks page access", category: "auth", frontendOnly: true, canHaveChildren: false },
138
+ missing: { description: 'Generic "content missing" system surface', category: "auth", frontendOnly: true, canHaveChildren: false },
139
+ "not-found": { description: "Page-not-found system surface", category: "auth", frontendOnly: true, canHaveChildren: false },
140
+ version: { description: "Build/version diagnostic surface", category: "auth", frontendOnly: true, canHaveChildren: false },
141
+ "ref-container": { description: "Renders content referenced from another section", category: "layout", frontendOnly: true, canHaveChildren: true },
142
+ "data-container": { description: "Data-scoped container (renders subtree against a data scope)", category: "layout", frontendOnly: true, canHaveChildren: true },
143
+ "show-user-input": { description: "Displays previously submitted user input as a list/card view", category: "forms", frontendOnly: true, canHaveChildren: false }
128
144
  };
129
145
  var STYLE_REGISTRY = BASE_STYLE_REGISTRY;
130
146
  var PLUGIN_STYLE_REGISTRY = {};
@@ -207,6 +223,36 @@ function getStylePluginId(name) {
207
223
  const plugin = getPluginStyleRegistry()[name];
208
224
  return plugin?.pluginId;
209
225
  }
226
+ var DEFAULT_PLATFORMS = ["web", "mobile"];
227
+ function getStylePlatforms(name) {
228
+ const entry = getRegistryEntryAny(name);
229
+ return entry?.platforms ?? DEFAULT_PLATFORMS;
230
+ }
231
+ function isStyleSupportedOnPlatform(name, platform) {
232
+ return getStylePlatforms(name).includes(platform);
233
+ }
234
+ function stylePlatformToSet(platform) {
235
+ return platform === "both" ? DEFAULT_PLATFORMS : [platform];
236
+ }
237
+ function setToStylePlatform(set) {
238
+ const web = set.includes("web");
239
+ const mobile = set.includes("mobile");
240
+ if (web && mobile) return "both";
241
+ return mobile ? "mobile" : "web";
242
+ }
243
+ function isStyleAllowedOnPage(name, pagePlatform) {
244
+ if (pagePlatform === "both") return true;
245
+ return isStyleSupportedOnPlatform(name, pagePlatform);
246
+ }
247
+ function getStylePlacement(name) {
248
+ return getRegistryEntryAny(name)?.placement ?? "any";
249
+ }
250
+ function isStylePlacementAllowed(name, isRoot) {
251
+ const placement = getStylePlacement(name);
252
+ if (placement === "rootOnly") return isRoot;
253
+ if (placement === "containerOnly") return !isRoot;
254
+ return true;
255
+ }
210
256
  // Annotate the CommonJS export names for ESM import in node:
211
257
  0 && (module.exports = {
212
258
  BASE_STYLE_REGISTRY,
@@ -217,7 +263,14 @@ function getStylePluginId(name) {
217
263
  getPluginStyleRegistry,
218
264
  getRegistryEntry,
219
265
  getRegistryEntryAny,
266
+ getStylePlacement,
267
+ getStylePlatforms,
220
268
  getStylePluginId,
221
269
  isKnownStyleName,
222
- isRegisteredStyleName
270
+ isRegisteredStyleName,
271
+ isStyleAllowedOnPage,
272
+ isStylePlacementAllowed,
273
+ isStyleSupportedOnPlatform,
274
+ setToStylePlatform,
275
+ stylePlatformToSet
223
276
  });
@@ -4,8 +4,8 @@ var BASE_STYLE_REGISTRY = {
4
4
  login: { description: "User login form", category: "auth", frontendOnly: true, canHaveChildren: false },
5
5
  register: { description: "User registration form", category: "auth", frontendOnly: true, canHaveChildren: false },
6
6
  validate: { description: "Email/account validation flow", category: "auth", frontendOnly: true, canHaveChildren: true },
7
- resetPassword: { description: "Reset password form", category: "auth", frontendOnly: true, canHaveChildren: false },
8
- twoFactorAuth: { description: "Two-factor auth code form", category: "auth", frontendOnly: true, canHaveChildren: false },
7
+ "reset-password": { description: "Reset password form", category: "auth", frontendOnly: true, canHaveChildren: false },
8
+ "two-factor-auth": { description: "Two-factor auth code form", category: "auth", frontendOnly: true, canHaveChildren: false },
9
9
  profile: { description: "User profile management", category: "auth", frontendOnly: true, canHaveChildren: false },
10
10
  // ===== layout =====
11
11
  container: { description: "Mantine Container with responsive max-width", category: "layout", frontendOnly: true, canHaveChildren: true },
@@ -85,10 +85,19 @@ var BASE_STYLE_REGISTRY = {
85
85
  timeline: { description: "Mantine Timeline", category: "composite", frontendOnly: true, canHaveChildren: true },
86
86
  list: { description: "Mantine List", category: "composite", frontendOnly: true, canHaveChildren: true },
87
87
  "list-item": { description: "Mantine List.Item", category: "composite", frontendOnly: true, canHaveChildren: true },
88
- entryList: { description: "Data-driven list of entries (form-log table)", category: "composite", frontendOnly: true, canHaveChildren: true },
89
- entryRecord: { description: "Single-record container", category: "composite", frontendOnly: true, canHaveChildren: true },
90
- entryRecordDelete: { description: "Inline delete confirmation for an entry", category: "composite", frontendOnly: true, canHaveChildren: false },
91
- loop: { description: "Loop / repeater over backend-provided rows", category: "composite", frontendOnly: true, canHaveChildren: true }
88
+ "entry-list": { description: "Data-driven list of entries (form-log table)", category: "composite", frontendOnly: true, canHaveChildren: true },
89
+ "entry-record": { description: "Single-record container", category: "composite", frontendOnly: true, canHaveChildren: true },
90
+ "entry-record-delete": { description: "Inline delete confirmation for an entry", category: "composite", frontendOnly: true, canHaveChildren: false },
91
+ loop: { description: "Loop / repeater over backend-provided rows", category: "composite", frontendOnly: true, canHaveChildren: true },
92
+ "timeline-item": { description: "A single entry inside a timeline (child-only)", category: "composite", frontendOnly: true, canHaveChildren: true },
93
+ // ===== system / data / reference (established backend catalog) =====
94
+ "no-access": { description: "Access-denied surface shown when the user lacks page access", category: "auth", frontendOnly: true, canHaveChildren: false },
95
+ missing: { description: 'Generic "content missing" system surface', category: "auth", frontendOnly: true, canHaveChildren: false },
96
+ "not-found": { description: "Page-not-found system surface", category: "auth", frontendOnly: true, canHaveChildren: false },
97
+ version: { description: "Build/version diagnostic surface", category: "auth", frontendOnly: true, canHaveChildren: false },
98
+ "ref-container": { description: "Renders content referenced from another section", category: "layout", frontendOnly: true, canHaveChildren: true },
99
+ "data-container": { description: "Data-scoped container (renders subtree against a data scope)", category: "layout", frontendOnly: true, canHaveChildren: true },
100
+ "show-user-input": { description: "Displays previously submitted user input as a list/card view", category: "forms", frontendOnly: true, canHaveChildren: false }
92
101
  };
93
102
  var STYLE_REGISTRY = BASE_STYLE_REGISTRY;
94
103
  var PLUGIN_STYLE_REGISTRY = {};
@@ -171,6 +180,36 @@ function getStylePluginId(name) {
171
180
  const plugin = getPluginStyleRegistry()[name];
172
181
  return plugin?.pluginId;
173
182
  }
183
+ var DEFAULT_PLATFORMS = ["web", "mobile"];
184
+ function getStylePlatforms(name) {
185
+ const entry = getRegistryEntryAny(name);
186
+ return entry?.platforms ?? DEFAULT_PLATFORMS;
187
+ }
188
+ function isStyleSupportedOnPlatform(name, platform) {
189
+ return getStylePlatforms(name).includes(platform);
190
+ }
191
+ function stylePlatformToSet(platform) {
192
+ return platform === "both" ? DEFAULT_PLATFORMS : [platform];
193
+ }
194
+ function setToStylePlatform(set) {
195
+ const web = set.includes("web");
196
+ const mobile = set.includes("mobile");
197
+ if (web && mobile) return "both";
198
+ return mobile ? "mobile" : "web";
199
+ }
200
+ function isStyleAllowedOnPage(name, pagePlatform) {
201
+ if (pagePlatform === "both") return true;
202
+ return isStyleSupportedOnPlatform(name, pagePlatform);
203
+ }
204
+ function getStylePlacement(name) {
205
+ return getRegistryEntryAny(name)?.placement ?? "any";
206
+ }
207
+ function isStylePlacementAllowed(name, isRoot) {
208
+ const placement = getStylePlacement(name);
209
+ if (placement === "rootOnly") return isRoot;
210
+ if (placement === "containerOnly") return !isRoot;
211
+ return true;
212
+ }
174
213
  export {
175
214
  BASE_STYLE_REGISTRY,
176
215
  STYLE_REGISTRY,
@@ -180,7 +219,14 @@ export {
180
219
  getPluginStyleRegistry,
181
220
  getRegistryEntry,
182
221
  getRegistryEntryAny,
222
+ getStylePlacement,
223
+ getStylePlatforms,
183
224
  getStylePluginId,
184
225
  isKnownStyleName,
185
- isRegisteredStyleName
226
+ isRegisteredStyleName,
227
+ isStyleAllowedOnPage,
228
+ isStylePlacementAllowed,
229
+ isStyleSupportedOnPlatform,
230
+ setToStylePlatform,
231
+ stylePlatformToSet
186
232
  };