@selfhelp/shared 1.8.0 → 1.11.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/CHANGELOG.md +67 -0
- package/dist/{common-B96dASgu.d.mts → common-CJSHQL1E.d.mts} +13 -1
- package/dist/{common-B96dASgu.d.ts → common-CJSHQL1E.d.ts} +13 -1
- package/dist/index.d.mts +136 -44
- package/dist/index.d.ts +136 -44
- package/dist/index.js +395 -8
- package/dist/index.mjs +371 -8
- package/dist/plugin-sdk/index.d.mts +2 -2
- package/dist/plugin-sdk/index.d.ts +2 -2
- package/dist/plugin-sdk/index.js +10 -1
- package/dist/plugin-sdk/index.mjs +10 -1
- package/dist/registry/index.d.mts +42 -4
- package/dist/registry/index.d.ts +42 -4
- package/dist/registry/index.js +56 -3
- package/dist/registry/index.mjs +48 -2
- package/dist/{styles.registry-ClluRYkN.d.ts → styles.registry-BV1iF7k-.d.ts} +678 -461
- package/dist/{styles.registry-nl8uzvMN.d.mts → styles.registry-DkoT-FmN.d.mts} +678 -461
- package/dist/theme/index.d.mts +225 -4
- package/dist/theme/index.d.ts +225 -4
- package/dist/theme/index.js +343 -9
- package/dist/theme/index.mjs +325 -8
- package/dist/theme/tailwind.d.mts +2 -2
- package/dist/theme/tailwind.d.ts +2 -2
- package/package.json +1 -1
- package/src/registry/__tests__/platform.test.ts +187 -0
- package/src/registry/index.ts +73 -0
- package/src/registry/styles.registry.ts +60 -0
- package/src/theme/__tests__/mantineVariant.test.ts +87 -0
- package/src/theme/__tests__/semantic.test.ts +231 -0
- package/src/theme/index.ts +2 -0
- package/src/theme/mantineVariant.ts +145 -0
- package/src/theme/semantic.ts +472 -0
- package/src/theme/tailwind.ts +2 -2
- package/src/theme/tokens.ts +2 -2
- package/src/types/__tests__/mobile-adapters.test.ts +80 -0
- package/src/types/index.ts +1 -0
- package/src/types/mantine/common.ts +13 -0
- package/src/types/mobile-adapters.ts +144 -0
- package/src/types/styles/auth.ts +11 -11
- package/src/types/styles/base.ts +4 -4
- package/src/types/styles/composite.ts +59 -45
- package/src/types/styles/error.ts +24 -13
- package/src/types/styles/forms.ts +184 -184
- package/src/types/styles/interactive.ts +81 -76
- package/src/types/styles/layout.ts +103 -85
- package/src/types/styles/media.ts +20 -20
- package/src/types/styles/typography.ts +39 -39
- package/src/types/styles/unknown.ts +20 -2
- package/src/utils/spacing.ts +1 -1
package/dist/registry/index.js
CHANGED
|
@@ -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
|
|
|
@@ -124,7 +131,16 @@ var BASE_STYLE_REGISTRY = {
|
|
|
124
131
|
"entry-list": { description: "Data-driven list of entries (form-log table)", category: "composite", frontendOnly: true, canHaveChildren: true },
|
|
125
132
|
"entry-record": { description: "Single-record container", category: "composite", frontendOnly: true, canHaveChildren: true },
|
|
126
133
|
"entry-record-delete": { 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 }
|
|
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
|
});
|
package/dist/registry/index.mjs
CHANGED
|
@@ -88,7 +88,16 @@ var BASE_STYLE_REGISTRY = {
|
|
|
88
88
|
"entry-list": { description: "Data-driven list of entries (form-log table)", category: "composite", frontendOnly: true, canHaveChildren: true },
|
|
89
89
|
"entry-record": { description: "Single-record container", category: "composite", frontendOnly: true, canHaveChildren: true },
|
|
90
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 }
|
|
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
|
};
|