@selfhelp/shared 1.0.3 → 1.0.5
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 +86 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +92 -3
- package/dist/index.mjs +84 -3
- package/dist/plugin-sdk/index.d.mts +906 -0
- package/dist/plugin-sdk/index.d.ts +906 -0
- package/dist/plugin-sdk/index.js +490 -0
- package/dist/plugin-sdk/index.mjs +452 -0
- package/dist/registry/index.d.mts +56 -1
- package/dist/registry/index.d.ts +56 -1
- package/dist/registry/index.js +94 -5
- package/dist/registry/index.mjs +85 -4
- package/dist/{index-Bg60YTsF.d.mts → styles.registry-C3bux91U.d.mts} +569 -28
- package/dist/{index-DEOVT86P.d.ts → styles.registry-Cr961HQ0.d.ts} +569 -28
- package/package.json +19 -3
- package/src/plugin-sdk/define.ts +89 -0
- package/src/plugin-sdk/index.ts +91 -0
- package/src/plugin-sdk/lock.ts +124 -0
- package/src/plugin-sdk/manifest.ts +297 -0
- package/src/plugin-sdk/realtime.ts +277 -0
- package/src/plugin-sdk/registry.ts +95 -0
- package/src/plugin-sdk/types.ts +265 -0
- package/src/plugin-sdk/version.ts +209 -0
- package/src/registry/index.ts +68 -11
- package/src/registry/styles.registry.ts +149 -12
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,92 @@ All notable changes to `@selfhelp/shared` will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
This project follows semantic versioning.
|
|
6
6
|
|
|
7
|
-
## [1.0.
|
|
7
|
+
## [1.0.4] - 2026-05-22
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- New `plugin-sdk` surface for the SelfHelp plugin ecosystem:
|
|
12
|
+
- `definePlugin()` / `defineMobilePlugin()` helpers for typed plugin
|
|
13
|
+
manifests.
|
|
14
|
+
- `definePluginRealtimeTopic()` topic helpers with template expansion.
|
|
15
|
+
- `usePluginRealtime()` React hook for Mercure topic subscription. The
|
|
16
|
+
hook accepts a `transportFactory` so frontend hosts can inject
|
|
17
|
+
`EventSource` and mobile hosts can inject `react-native-sse` without
|
|
18
|
+
forcing the SDK to depend on either runtime.
|
|
19
|
+
- TypeScript mirrors for `IPluginManifest`, `IPluginRegistry`, and
|
|
20
|
+
`IPluginLock` plus the `scripts/check-schema-parity.mjs` script that
|
|
21
|
+
verifies the JSON schemas stay in lockstep with the TS types.
|
|
22
|
+
- React is now declared as an **optional peer dependency**
|
|
23
|
+
(`react ^18 || ^19`). Non-React consumers can keep using the package
|
|
24
|
+
without installing React; the `usePluginRealtime` hook is only required
|
|
25
|
+
if you opt into realtime updates.
|
|
26
|
+
|
|
27
|
+
### Changed (breaking type contracts)
|
|
28
|
+
|
|
29
|
+
These changes broaden the schema-mirroring types so they actually match
|
|
30
|
+
the canonical JSON Schemas the backend publishes. Plugin authors
|
|
31
|
+
upgrading from `1.0.3` need to update any code that constructed these
|
|
32
|
+
shapes literally:
|
|
33
|
+
|
|
34
|
+
- `IPluginRegistry`
|
|
35
|
+
- Renamed `schemaVersion` (string `'1.0'`) to **`registryVersion`**
|
|
36
|
+
(`number`, currently `1`).
|
|
37
|
+
- Added required field `name: string`.
|
|
38
|
+
- Added optional `homepage`, `publishedAt`, `trustKey`, and `channels`
|
|
39
|
+
fields to align with `plugin-registry.schema.json`.
|
|
40
|
+
- `IPluginLock`
|
|
41
|
+
- Added required field **`lockfileVersion: number`** (currently `1`).
|
|
42
|
+
- Added required nested object **`sdk: { version: string; pluginApiVersion: string }`**
|
|
43
|
+
so lockfiles always advertise which SDK version they were generated
|
|
44
|
+
against.
|
|
45
|
+
- `plugins` is now `Record<string, IPluginLockEntry>` instead of an
|
|
46
|
+
array — keyed by plugin id, which matches the schema and removes
|
|
47
|
+
the need for clients to do an extra lookup.
|
|
48
|
+
- `installMode` is now optional at the top level (per-entry
|
|
49
|
+
`installMode` already exists inside each plugin entry).
|
|
50
|
+
- `IPluginManifest`
|
|
51
|
+
- `dataAccess` gained `ownedTables: string[]` and
|
|
52
|
+
`ownedDataTablePrefix?: string` so plugins can declare their owned
|
|
53
|
+
tables for the install-time validator and the purger.
|
|
54
|
+
|
|
55
|
+
### Migration notes for plugin authors
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
// before (1.0.3)
|
|
59
|
+
const registry: IPluginRegistry = {
|
|
60
|
+
schemaVersion: '1.0',
|
|
61
|
+
plugins: [],
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// after (1.0.4)
|
|
65
|
+
const registry: IPluginRegistry = {
|
|
66
|
+
registryVersion: 1,
|
|
67
|
+
name: 'my-registry',
|
|
68
|
+
plugins: [],
|
|
69
|
+
};
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
// before (1.0.3)
|
|
74
|
+
const lock: IPluginLock = {
|
|
75
|
+
generatedAt: '...',
|
|
76
|
+
plugins: [],
|
|
77
|
+
installMode: 'managed',
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// after (1.0.4)
|
|
81
|
+
const lock: IPluginLock = {
|
|
82
|
+
lockfileVersion: 1,
|
|
83
|
+
generatedAt: '...',
|
|
84
|
+
sdk: { version: '1.0.4', pluginApiVersion: '1.0' },
|
|
85
|
+
plugins: {},
|
|
86
|
+
};
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Run `npm run check:schemas` (from `sh-selfhelp_shared`) to verify your
|
|
90
|
+
TypeScript matches the canonical JSON schemas after the upgrade.
|
|
91
|
+
|
|
92
|
+
## [1.0.3] - 2026-05-19
|
|
8
93
|
|
|
9
94
|
- Adjust types after the DB refactoring
|
|
10
95
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { T as TStyleName,
|
|
2
|
-
export {
|
|
1
|
+
import { T as TStyleName, f as IContentField } from './styles.registry-C3bux91U.mjs';
|
|
2
|
+
export { B as BASE_STYLE_REGISTRY, h as IAccordionItemStyle, i as IAccordionStyle, j as IActionIconStyle, k as IAlertStyle, l as IAspectRatioStyle, m as IAudioStyle, n as IAvatarStyle, o as IBackgroundImageStyle, p as IBadgeStyle, q as IBaseStyle, r as IBlockquoteStyle, s as IBoxStyle, t as IButtonStyle, u as ICardSegmentStyle, v as ICardStyle, w as ICarouselStyle, x as ICenterStyle, y as ICheckboxStyle, z as IChipStyle, A as ICodeStyle, C as IColorInputStyle, D as IColorPickerStyle, E as IComboboxStyle, F as IContainerStyle, G as IDatePickerStyle, H as IDividerStyle, J as IEntryListStyle, K as IEntryRecordDeleteStyle, L as IEntryRecordStyle, M as IFieldsetStyle, N as IFigureStyle, O as IFileInputStyle, P as IFlexStyle, Q as IFormLogStyle, R as IFormRecordStyle, U as IFormStyle, V as IGridColumnStyle, W as IGridStyle, X as IGroupStyle, Y as IHighlightStyle, Z as IHtmlTagStyle, $ as IImageStyle, a0 as IIndicatorStyle, a1 as IInputStyle, a2 as IKbdStyle, a3 as ILinkStyle, a4 as IListItemStyle, a5 as IListStyle, a6 as ILoginStyle, a7 as ILoopStyle, a8 as INotificationStyle, a9 as INumberInputStyle, aa as IPaperStyle, a as IPluginStyleRegistryEntry, ab as IProfileStyle, ac as IProgressRootStyle, ad as IProgressSectionStyle, ae as IProgressStyle, af as IRadioStyle, ag as IRangeSliderStyle, ah as IRatingStyle, ai as IRegisterStyle, aj as IResetPasswordStyle, ak as IRichTextEditorStyle, al as IScrollAreaStyle, am as ISegmentedControlStyle, an as ISelectStyle, ao as ISimpleGridStyle, ap as ISliderStyle, aq as ISpaceStyle, ar as ISpoilerStyle, as as IStackStyle, I as IStyleRegistryEntry, at as IStyleWithSpacing, au as ISwitchStyle, av as ITabStyle, aw as ITabsStyle, ax as ITextInputStyle, ay as ITextStyle, az as ITextareaStyle, aA as IThemeIconStyle, aB as ITimelineStyle, aC as ITitleStyle, aD as ITwoFactorAuthStyle, aE as ITypographyStyle, aF as IUnknownStyle, aG as IValidateStyle, aH as IVideoStyle, S as STYLE_REGISTRY, aI as TMantineAccordionChevronPosition, aJ as TMantineAccordionDisableChevronRotation, aK as TMantineAccordionLoop, aL as TMantineAccordionMultiple, aM as TMantineBorder, aN as TMantineCardShadow, aO as TMantineCheckboxLabelPosition, aP as TMantineCols, aQ as TMantineDividerVariant, aR as TMantineGap, aS as TMantineGridOffset, aT as TMantineGridOrder, aU as TMantineHeight, aV as TMantineIconSize, aW as TMantineImageFit, aX as TMantineLineClamp, aY as TMantineListCenter, aZ as TMantineListStyleType, a_ as TMantineListType, a$ as TMantineListWithPadding, b0 as TMantinePaperShadow, b1 as TMantineProgressTransition, b2 as TMantineScrollAreaSize, b3 as TMantineScrollAreaType, b4 as TMantineTextAlign, b5 as TMantineTextDecoration, b6 as TMantineTextFontStyle, b7 as TMantineTextFontWeight, b8 as TMantineTextInherit, b9 as TMantineTextInputVariant, ba as TMantineTextSpan, bb as TMantineTextTransform, bc as TMantineTextTruncate, bd as TMantineTextVariant, be as TMantineTextareaAutosize, bf as TMantineTextareaResize, bg as TMantineTextareaVariant, bh as TMantineTimelineAlign, bi as TMantineTitleLineClamp, bj as TMantineTitleTextWrap, bk as TMantineTranslatable, bl as TMantineUseInputWrapper, bm as TMantineWidth, bn as TStyle, b as TStyleRegistryKey, _ as _AssertRegistryMatchesStyleName, c as _resetPluginStyleRegistry, e as extendStyleRegistry, g as getMergedStyleRegistry, d as getPluginStyleRegistry } from './styles.registry-C3bux91U.mjs';
|
|
3
3
|
export { s as TMantineAccordionVariant, v as TMantineActionIconLoading, d as TMantineAlign, w as TMantineAllowNextClicks, x as TMantineAllowStepClick, y as TMantineAspectRatio, z as TMantineAutoContrast, o as TMantineAvatarVariant, n as TMantineBadgeVariant, A as TMantineBlock, B as TMantineCenterInline, C as TMantineChecked, D as TMantineChipChecked, E as TMantineChipMultiple, p as TMantineChipVariant, F as TMantineClampBehavior, G as TMantineCodeBlock, i as TMantineColor, H as TMantineColorFormat, I as TMantineColorInputSwatches, J as TMantineColorPickerSwatches, K as TMantineColorPickerSwatchesPerRow, L as TMantineCompact, M as TMantineContainerFluid, e as TMantineDirection, N as TMantineDisabled, k as TMantineFieldsetVariant, O as TMantineFileAccept, P as TMantineFileInputMultiple, Q as TMantineFluid, R as TMantineFullWidth, S as TMantineGridGrow, U as TMantineGridOverflow, g as TMantineGridSpan, V as TMantineGroupGrow, W as TMantineGroupWrap, X as TMantineGrow, Y as TMantineHighlight, q as TMantineIndicatorPosition, Z as TMantineInline, _ as TMantineIsLink, c as TMantineJustify, $ as TMantineKbdSize, a0 as TMantineLoading, a1 as TMantineMultiple, a2 as TMantineNotificationWithCloseButton, a3 as TMantineNumberInputDecimalScale, a4 as TMantineOpenInNewTab, h as TMantineOrientation, a5 as TMantineProcessing, T as TMantineRadius, a6 as TMantineRangeSliderMarks, a7 as TMantineRatingCount, a8 as TMantineRatingFractions, a9 as TMantineRatingReadonly, aa as TMantineReadonly, a as TMantineSize, ab as TMantineSpaceHorizontal, b as TMantineSpacing, l as TMantineSpoilerMaxHeight, ac as TMantineSwatches, ad as TMantineTabDisabled, t as TMantineTabsVariant, r as TMantineThemeIconVariant, u as TMantineTimelineLineVariant, j as TMantineTitleOrder, ae as TMantineUseMantineStyle, m as TMantineVariant, af as TMantineWithCloseButton, ag as TMantineWithIcon, f as TMantineWrap } from './common-B96dASgu.mjs';
|
|
4
|
+
export { TAnyStyleName, TPluginStyleImplMap, TStyleImplMap, getRegistryEntry, getRegistryEntryAny, getStylePluginId, isKnownStyleName, isRegisteredStyleName } from './registry/index.mjs';
|
|
4
5
|
export { COLOR_PALETTE, COLOR_SCALES, CONTAINER_SIZE_PX, FONT_SIZE_PX, ISpacingResolved, LINE_HEIGHT, RADIUS_PX, SPACING_PX, SPACING_TO_TAILWIND, TCanonicalColor, TCanonicalRadius, TCanonicalSpacing, colorToHex, radiusToPx, sizeToFontPx, spacingToPx } from './theme/index.mjs';
|
|
5
6
|
export { sharedTailwindExtend, sharedTailwindPreset } from './theme/tailwind.mjs';
|
|
6
7
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { T as TStyleName,
|
|
2
|
-
export {
|
|
1
|
+
import { T as TStyleName, f as IContentField } from './styles.registry-Cr961HQ0.js';
|
|
2
|
+
export { B as BASE_STYLE_REGISTRY, h as IAccordionItemStyle, i as IAccordionStyle, j as IActionIconStyle, k as IAlertStyle, l as IAspectRatioStyle, m as IAudioStyle, n as IAvatarStyle, o as IBackgroundImageStyle, p as IBadgeStyle, q as IBaseStyle, r as IBlockquoteStyle, s as IBoxStyle, t as IButtonStyle, u as ICardSegmentStyle, v as ICardStyle, w as ICarouselStyle, x as ICenterStyle, y as ICheckboxStyle, z as IChipStyle, A as ICodeStyle, C as IColorInputStyle, D as IColorPickerStyle, E as IComboboxStyle, F as IContainerStyle, G as IDatePickerStyle, H as IDividerStyle, J as IEntryListStyle, K as IEntryRecordDeleteStyle, L as IEntryRecordStyle, M as IFieldsetStyle, N as IFigureStyle, O as IFileInputStyle, P as IFlexStyle, Q as IFormLogStyle, R as IFormRecordStyle, U as IFormStyle, V as IGridColumnStyle, W as IGridStyle, X as IGroupStyle, Y as IHighlightStyle, Z as IHtmlTagStyle, $ as IImageStyle, a0 as IIndicatorStyle, a1 as IInputStyle, a2 as IKbdStyle, a3 as ILinkStyle, a4 as IListItemStyle, a5 as IListStyle, a6 as ILoginStyle, a7 as ILoopStyle, a8 as INotificationStyle, a9 as INumberInputStyle, aa as IPaperStyle, a as IPluginStyleRegistryEntry, ab as IProfileStyle, ac as IProgressRootStyle, ad as IProgressSectionStyle, ae as IProgressStyle, af as IRadioStyle, ag as IRangeSliderStyle, ah as IRatingStyle, ai as IRegisterStyle, aj as IResetPasswordStyle, ak as IRichTextEditorStyle, al as IScrollAreaStyle, am as ISegmentedControlStyle, an as ISelectStyle, ao as ISimpleGridStyle, ap as ISliderStyle, aq as ISpaceStyle, ar as ISpoilerStyle, as as IStackStyle, I as IStyleRegistryEntry, at as IStyleWithSpacing, au as ISwitchStyle, av as ITabStyle, aw as ITabsStyle, ax as ITextInputStyle, ay as ITextStyle, az as ITextareaStyle, aA as IThemeIconStyle, aB as ITimelineStyle, aC as ITitleStyle, aD as ITwoFactorAuthStyle, aE as ITypographyStyle, aF as IUnknownStyle, aG as IValidateStyle, aH as IVideoStyle, S as STYLE_REGISTRY, aI as TMantineAccordionChevronPosition, aJ as TMantineAccordionDisableChevronRotation, aK as TMantineAccordionLoop, aL as TMantineAccordionMultiple, aM as TMantineBorder, aN as TMantineCardShadow, aO as TMantineCheckboxLabelPosition, aP as TMantineCols, aQ as TMantineDividerVariant, aR as TMantineGap, aS as TMantineGridOffset, aT as TMantineGridOrder, aU as TMantineHeight, aV as TMantineIconSize, aW as TMantineImageFit, aX as TMantineLineClamp, aY as TMantineListCenter, aZ as TMantineListStyleType, a_ as TMantineListType, a$ as TMantineListWithPadding, b0 as TMantinePaperShadow, b1 as TMantineProgressTransition, b2 as TMantineScrollAreaSize, b3 as TMantineScrollAreaType, b4 as TMantineTextAlign, b5 as TMantineTextDecoration, b6 as TMantineTextFontStyle, b7 as TMantineTextFontWeight, b8 as TMantineTextInherit, b9 as TMantineTextInputVariant, ba as TMantineTextSpan, bb as TMantineTextTransform, bc as TMantineTextTruncate, bd as TMantineTextVariant, be as TMantineTextareaAutosize, bf as TMantineTextareaResize, bg as TMantineTextareaVariant, bh as TMantineTimelineAlign, bi as TMantineTitleLineClamp, bj as TMantineTitleTextWrap, bk as TMantineTranslatable, bl as TMantineUseInputWrapper, bm as TMantineWidth, bn as TStyle, b as TStyleRegistryKey, _ as _AssertRegistryMatchesStyleName, c as _resetPluginStyleRegistry, e as extendStyleRegistry, g as getMergedStyleRegistry, d as getPluginStyleRegistry } from './styles.registry-Cr961HQ0.js';
|
|
3
3
|
export { s as TMantineAccordionVariant, v as TMantineActionIconLoading, d as TMantineAlign, w as TMantineAllowNextClicks, x as TMantineAllowStepClick, y as TMantineAspectRatio, z as TMantineAutoContrast, o as TMantineAvatarVariant, n as TMantineBadgeVariant, A as TMantineBlock, B as TMantineCenterInline, C as TMantineChecked, D as TMantineChipChecked, E as TMantineChipMultiple, p as TMantineChipVariant, F as TMantineClampBehavior, G as TMantineCodeBlock, i as TMantineColor, H as TMantineColorFormat, I as TMantineColorInputSwatches, J as TMantineColorPickerSwatches, K as TMantineColorPickerSwatchesPerRow, L as TMantineCompact, M as TMantineContainerFluid, e as TMantineDirection, N as TMantineDisabled, k as TMantineFieldsetVariant, O as TMantineFileAccept, P as TMantineFileInputMultiple, Q as TMantineFluid, R as TMantineFullWidth, S as TMantineGridGrow, U as TMantineGridOverflow, g as TMantineGridSpan, V as TMantineGroupGrow, W as TMantineGroupWrap, X as TMantineGrow, Y as TMantineHighlight, q as TMantineIndicatorPosition, Z as TMantineInline, _ as TMantineIsLink, c as TMantineJustify, $ as TMantineKbdSize, a0 as TMantineLoading, a1 as TMantineMultiple, a2 as TMantineNotificationWithCloseButton, a3 as TMantineNumberInputDecimalScale, a4 as TMantineOpenInNewTab, h as TMantineOrientation, a5 as TMantineProcessing, T as TMantineRadius, a6 as TMantineRangeSliderMarks, a7 as TMantineRatingCount, a8 as TMantineRatingFractions, a9 as TMantineRatingReadonly, aa as TMantineReadonly, a as TMantineSize, ab as TMantineSpaceHorizontal, b as TMantineSpacing, l as TMantineSpoilerMaxHeight, ac as TMantineSwatches, ad as TMantineTabDisabled, t as TMantineTabsVariant, r as TMantineThemeIconVariant, u as TMantineTimelineLineVariant, j as TMantineTitleOrder, ae as TMantineUseMantineStyle, m as TMantineVariant, af as TMantineWithCloseButton, ag as TMantineWithIcon, f as TMantineWrap } from './common-B96dASgu.js';
|
|
4
|
+
export { TAnyStyleName, TPluginStyleImplMap, TStyleImplMap, getRegistryEntry, getRegistryEntryAny, getStylePluginId, isKnownStyleName, isRegisteredStyleName } from './registry/index.js';
|
|
4
5
|
export { COLOR_PALETTE, COLOR_SCALES, CONTAINER_SIZE_PX, FONT_SIZE_PX, ISpacingResolved, LINE_HEIGHT, RADIUS_PX, SPACING_PX, SPACING_TO_TAILWIND, TCanonicalColor, TCanonicalRadius, TCanonicalSpacing, colorToHex, radiusToPx, sizeToFontPx, spacingToPx } from './theme/index.js';
|
|
5
6
|
export { sharedTailwindExtend, sharedTailwindPreset } from './theme/tailwind.js';
|
|
6
7
|
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
API_VERSION_PREFIX: () => API_VERSION_PREFIX,
|
|
34
|
+
BASE_STYLE_REGISTRY: () => BASE_STYLE_REGISTRY,
|
|
34
35
|
CLASS_PATTERNS: () => CLASS_PATTERNS,
|
|
35
36
|
CLASS_REMAP: () => CLASS_REMAP,
|
|
36
37
|
CLIENT_TYPE_MOBILE: () => CLIENT_TYPE_MOBILE,
|
|
@@ -52,14 +53,21 @@ __export(index_exports, {
|
|
|
52
53
|
SPACING_TO_TAILWIND: () => SPACING_TO_TAILWIND,
|
|
53
54
|
SPACING_VALUES: () => SPACING_VALUES,
|
|
54
55
|
STYLE_REGISTRY: () => STYLE_REGISTRY,
|
|
56
|
+
_resetPluginStyleRegistry: () => _resetPluginStyleRegistry,
|
|
55
57
|
buildConditionContext: () => buildConditionContext,
|
|
56
58
|
classifyClass: () => classifyClass,
|
|
57
59
|
classifyClassString: () => classifyClassString,
|
|
58
60
|
colorToHex: () => colorToHex,
|
|
59
61
|
evaluateCondition: () => evaluateCondition,
|
|
62
|
+
extendStyleRegistry: () => extendStyleRegistry,
|
|
60
63
|
findRemap: () => findRemap,
|
|
64
|
+
getMergedStyleRegistry: () => getMergedStyleRegistry,
|
|
65
|
+
getPluginStyleRegistry: () => getPluginStyleRegistry,
|
|
61
66
|
getRegistryEntry: () => getRegistryEntry,
|
|
67
|
+
getRegistryEntryAny: () => getRegistryEntryAny,
|
|
68
|
+
getStylePluginId: () => getStylePluginId,
|
|
62
69
|
isKnownStyleName: () => isKnownStyleName,
|
|
70
|
+
isRegisteredStyleName: () => isRegisteredStyleName,
|
|
63
71
|
parseSpacing: () => parseSpacing,
|
|
64
72
|
radiusToPx: () => radiusToPx,
|
|
65
73
|
replaceCalcedValues: () => replaceCalcedValues,
|
|
@@ -127,7 +135,7 @@ var PERMISSIONS = {
|
|
|
127
135
|
};
|
|
128
136
|
|
|
129
137
|
// src/registry/styles.registry.ts
|
|
130
|
-
var
|
|
138
|
+
var BASE_STYLE_REGISTRY = {
|
|
131
139
|
// ===== auth =====
|
|
132
140
|
login: { description: "User login form", category: "auth", frontendOnly: true, canHaveChildren: false },
|
|
133
141
|
register: { description: "User registration form", category: "auth", frontendOnly: true, canHaveChildren: false },
|
|
@@ -218,13 +226,86 @@ var STYLE_REGISTRY = {
|
|
|
218
226
|
entryRecordDelete: { description: "Inline delete confirmation for an entry", category: "composite", frontendOnly: true, canHaveChildren: false },
|
|
219
227
|
loop: { description: "Loop / repeater over backend-provided rows", category: "composite", frontendOnly: true, canHaveChildren: true }
|
|
220
228
|
};
|
|
229
|
+
var STYLE_REGISTRY = BASE_STYLE_REGISTRY;
|
|
230
|
+
var PLUGIN_STYLE_REGISTRY = {};
|
|
231
|
+
var REGISTERED_PLUGIN_KEYS = /* @__PURE__ */ new Map();
|
|
232
|
+
function extendStyleRegistry(entries, options) {
|
|
233
|
+
const { pluginId, pluginVersion } = options;
|
|
234
|
+
const ownedKeys = REGISTERED_PLUGIN_KEYS.get(pluginId) ?? /* @__PURE__ */ new Set();
|
|
235
|
+
const addedKeys = [];
|
|
236
|
+
for (const [name, entry] of Object.entries(entries)) {
|
|
237
|
+
if (Object.prototype.hasOwnProperty.call(BASE_STYLE_REGISTRY, name)) {
|
|
238
|
+
throw new Error(
|
|
239
|
+
`[shared/registry] plugin '${pluginId}' tried to register core style '${name}'.`
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
const existing = PLUGIN_STYLE_REGISTRY[name];
|
|
243
|
+
if (existing && existing.pluginId !== pluginId) {
|
|
244
|
+
throw new Error(
|
|
245
|
+
`[shared/registry] plugin '${pluginId}' tried to register style '${name}' already owned by '${existing.pluginId}'.`
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
PLUGIN_STYLE_REGISTRY[name] = {
|
|
249
|
+
...entry,
|
|
250
|
+
pluginId,
|
|
251
|
+
pluginVersion
|
|
252
|
+
};
|
|
253
|
+
ownedKeys.add(name);
|
|
254
|
+
addedKeys.push(name);
|
|
255
|
+
}
|
|
256
|
+
REGISTERED_PLUGIN_KEYS.set(pluginId, ownedKeys);
|
|
257
|
+
return function dispose() {
|
|
258
|
+
for (const key of addedKeys) {
|
|
259
|
+
const existing = PLUGIN_STYLE_REGISTRY[key];
|
|
260
|
+
if (existing && existing.pluginId === pluginId) {
|
|
261
|
+
delete PLUGIN_STYLE_REGISTRY[key];
|
|
262
|
+
ownedKeys.delete(key);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (ownedKeys.size === 0) {
|
|
266
|
+
REGISTERED_PLUGIN_KEYS.delete(pluginId);
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function getMergedStyleRegistry() {
|
|
271
|
+
return {
|
|
272
|
+
...BASE_STYLE_REGISTRY,
|
|
273
|
+
...PLUGIN_STYLE_REGISTRY
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function getPluginStyleRegistry() {
|
|
277
|
+
return { ...PLUGIN_STYLE_REGISTRY };
|
|
278
|
+
}
|
|
279
|
+
function _resetPluginStyleRegistry() {
|
|
280
|
+
for (const key of Object.keys(PLUGIN_STYLE_REGISTRY)) {
|
|
281
|
+
delete PLUGIN_STYLE_REGISTRY[key];
|
|
282
|
+
}
|
|
283
|
+
REGISTERED_PLUGIN_KEYS.clear();
|
|
284
|
+
}
|
|
221
285
|
|
|
222
286
|
// src/registry/index.ts
|
|
223
287
|
function getRegistryEntry(name) {
|
|
224
|
-
|
|
288
|
+
if (Object.prototype.hasOwnProperty.call(BASE_STYLE_REGISTRY, name)) {
|
|
289
|
+
return BASE_STYLE_REGISTRY[name];
|
|
290
|
+
}
|
|
291
|
+
return void 0;
|
|
292
|
+
}
|
|
293
|
+
function getRegistryEntryAny(name) {
|
|
294
|
+
const merged = getMergedStyleRegistry();
|
|
295
|
+
return merged[name];
|
|
225
296
|
}
|
|
226
297
|
function isKnownStyleName(name) {
|
|
227
|
-
return Object.prototype.hasOwnProperty.call(
|
|
298
|
+
return Object.prototype.hasOwnProperty.call(BASE_STYLE_REGISTRY, name);
|
|
299
|
+
}
|
|
300
|
+
function isRegisteredStyleName(name) {
|
|
301
|
+
if (Object.prototype.hasOwnProperty.call(BASE_STYLE_REGISTRY, name)) {
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
return Object.prototype.hasOwnProperty.call(getPluginStyleRegistry(), name);
|
|
305
|
+
}
|
|
306
|
+
function getStylePluginId(name) {
|
|
307
|
+
const plugin = getPluginStyleRegistry()[name];
|
|
308
|
+
return plugin?.pluginId;
|
|
228
309
|
}
|
|
229
310
|
|
|
230
311
|
// src/api/endpoints.ts
|
|
@@ -753,6 +834,7 @@ function transformPagesData(pages) {
|
|
|
753
834
|
// Annotate the CommonJS export names for ESM import in node:
|
|
754
835
|
0 && (module.exports = {
|
|
755
836
|
API_VERSION_PREFIX,
|
|
837
|
+
BASE_STYLE_REGISTRY,
|
|
756
838
|
CLASS_PATTERNS,
|
|
757
839
|
CLASS_REMAP,
|
|
758
840
|
CLIENT_TYPE_MOBILE,
|
|
@@ -774,14 +856,21 @@ function transformPagesData(pages) {
|
|
|
774
856
|
SPACING_TO_TAILWIND,
|
|
775
857
|
SPACING_VALUES,
|
|
776
858
|
STYLE_REGISTRY,
|
|
859
|
+
_resetPluginStyleRegistry,
|
|
777
860
|
buildConditionContext,
|
|
778
861
|
classifyClass,
|
|
779
862
|
classifyClassString,
|
|
780
863
|
colorToHex,
|
|
781
864
|
evaluateCondition,
|
|
865
|
+
extendStyleRegistry,
|
|
782
866
|
findRemap,
|
|
867
|
+
getMergedStyleRegistry,
|
|
868
|
+
getPluginStyleRegistry,
|
|
783
869
|
getRegistryEntry,
|
|
870
|
+
getRegistryEntryAny,
|
|
871
|
+
getStylePluginId,
|
|
784
872
|
isKnownStyleName,
|
|
873
|
+
isRegisteredStyleName,
|
|
785
874
|
parseSpacing,
|
|
786
875
|
radiusToPx,
|
|
787
876
|
replaceCalcedValues,
|
package/dist/index.mjs
CHANGED
|
@@ -50,7 +50,7 @@ var PERMISSIONS = {
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
// src/registry/styles.registry.ts
|
|
53
|
-
var
|
|
53
|
+
var BASE_STYLE_REGISTRY = {
|
|
54
54
|
// ===== auth =====
|
|
55
55
|
login: { description: "User login form", category: "auth", frontendOnly: true, canHaveChildren: false },
|
|
56
56
|
register: { description: "User registration form", category: "auth", frontendOnly: true, canHaveChildren: false },
|
|
@@ -141,13 +141,86 @@ var STYLE_REGISTRY = {
|
|
|
141
141
|
entryRecordDelete: { description: "Inline delete confirmation for an entry", category: "composite", frontendOnly: true, canHaveChildren: false },
|
|
142
142
|
loop: { description: "Loop / repeater over backend-provided rows", category: "composite", frontendOnly: true, canHaveChildren: true }
|
|
143
143
|
};
|
|
144
|
+
var STYLE_REGISTRY = BASE_STYLE_REGISTRY;
|
|
145
|
+
var PLUGIN_STYLE_REGISTRY = {};
|
|
146
|
+
var REGISTERED_PLUGIN_KEYS = /* @__PURE__ */ new Map();
|
|
147
|
+
function extendStyleRegistry(entries, options) {
|
|
148
|
+
const { pluginId, pluginVersion } = options;
|
|
149
|
+
const ownedKeys = REGISTERED_PLUGIN_KEYS.get(pluginId) ?? /* @__PURE__ */ new Set();
|
|
150
|
+
const addedKeys = [];
|
|
151
|
+
for (const [name, entry] of Object.entries(entries)) {
|
|
152
|
+
if (Object.prototype.hasOwnProperty.call(BASE_STYLE_REGISTRY, name)) {
|
|
153
|
+
throw new Error(
|
|
154
|
+
`[shared/registry] plugin '${pluginId}' tried to register core style '${name}'.`
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
const existing = PLUGIN_STYLE_REGISTRY[name];
|
|
158
|
+
if (existing && existing.pluginId !== pluginId) {
|
|
159
|
+
throw new Error(
|
|
160
|
+
`[shared/registry] plugin '${pluginId}' tried to register style '${name}' already owned by '${existing.pluginId}'.`
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
PLUGIN_STYLE_REGISTRY[name] = {
|
|
164
|
+
...entry,
|
|
165
|
+
pluginId,
|
|
166
|
+
pluginVersion
|
|
167
|
+
};
|
|
168
|
+
ownedKeys.add(name);
|
|
169
|
+
addedKeys.push(name);
|
|
170
|
+
}
|
|
171
|
+
REGISTERED_PLUGIN_KEYS.set(pluginId, ownedKeys);
|
|
172
|
+
return function dispose() {
|
|
173
|
+
for (const key of addedKeys) {
|
|
174
|
+
const existing = PLUGIN_STYLE_REGISTRY[key];
|
|
175
|
+
if (existing && existing.pluginId === pluginId) {
|
|
176
|
+
delete PLUGIN_STYLE_REGISTRY[key];
|
|
177
|
+
ownedKeys.delete(key);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (ownedKeys.size === 0) {
|
|
181
|
+
REGISTERED_PLUGIN_KEYS.delete(pluginId);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function getMergedStyleRegistry() {
|
|
186
|
+
return {
|
|
187
|
+
...BASE_STYLE_REGISTRY,
|
|
188
|
+
...PLUGIN_STYLE_REGISTRY
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function getPluginStyleRegistry() {
|
|
192
|
+
return { ...PLUGIN_STYLE_REGISTRY };
|
|
193
|
+
}
|
|
194
|
+
function _resetPluginStyleRegistry() {
|
|
195
|
+
for (const key of Object.keys(PLUGIN_STYLE_REGISTRY)) {
|
|
196
|
+
delete PLUGIN_STYLE_REGISTRY[key];
|
|
197
|
+
}
|
|
198
|
+
REGISTERED_PLUGIN_KEYS.clear();
|
|
199
|
+
}
|
|
144
200
|
|
|
145
201
|
// src/registry/index.ts
|
|
146
202
|
function getRegistryEntry(name) {
|
|
147
|
-
|
|
203
|
+
if (Object.prototype.hasOwnProperty.call(BASE_STYLE_REGISTRY, name)) {
|
|
204
|
+
return BASE_STYLE_REGISTRY[name];
|
|
205
|
+
}
|
|
206
|
+
return void 0;
|
|
207
|
+
}
|
|
208
|
+
function getRegistryEntryAny(name) {
|
|
209
|
+
const merged = getMergedStyleRegistry();
|
|
210
|
+
return merged[name];
|
|
148
211
|
}
|
|
149
212
|
function isKnownStyleName(name) {
|
|
150
|
-
return Object.prototype.hasOwnProperty.call(
|
|
213
|
+
return Object.prototype.hasOwnProperty.call(BASE_STYLE_REGISTRY, name);
|
|
214
|
+
}
|
|
215
|
+
function isRegisteredStyleName(name) {
|
|
216
|
+
if (Object.prototype.hasOwnProperty.call(BASE_STYLE_REGISTRY, name)) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
return Object.prototype.hasOwnProperty.call(getPluginStyleRegistry(), name);
|
|
220
|
+
}
|
|
221
|
+
function getStylePluginId(name) {
|
|
222
|
+
const plugin = getPluginStyleRegistry()[name];
|
|
223
|
+
return plugin?.pluginId;
|
|
151
224
|
}
|
|
152
225
|
|
|
153
226
|
// src/api/endpoints.ts
|
|
@@ -675,6 +748,7 @@ function transformPagesData(pages) {
|
|
|
675
748
|
}
|
|
676
749
|
export {
|
|
677
750
|
API_VERSION_PREFIX,
|
|
751
|
+
BASE_STYLE_REGISTRY,
|
|
678
752
|
CLASS_PATTERNS,
|
|
679
753
|
CLASS_REMAP,
|
|
680
754
|
CLIENT_TYPE_MOBILE,
|
|
@@ -696,14 +770,21 @@ export {
|
|
|
696
770
|
SPACING_TO_TAILWIND,
|
|
697
771
|
SPACING_VALUES,
|
|
698
772
|
STYLE_REGISTRY,
|
|
773
|
+
_resetPluginStyleRegistry,
|
|
699
774
|
buildConditionContext,
|
|
700
775
|
classifyClass,
|
|
701
776
|
classifyClassString,
|
|
702
777
|
colorToHex,
|
|
703
778
|
evaluateCondition,
|
|
779
|
+
extendStyleRegistry,
|
|
704
780
|
findRemap,
|
|
781
|
+
getMergedStyleRegistry,
|
|
782
|
+
getPluginStyleRegistry,
|
|
705
783
|
getRegistryEntry,
|
|
784
|
+
getRegistryEntryAny,
|
|
785
|
+
getStylePluginId,
|
|
706
786
|
isKnownStyleName,
|
|
787
|
+
isRegisteredStyleName,
|
|
707
788
|
parseSpacing,
|
|
708
789
|
radiusToPx,
|
|
709
790
|
replaceCalcedValues,
|