tyrell-components 1.0.0-RC13 → 1.0.0-RC14
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/README.md +1 -1
- package/css/tyrell-theme.css +167 -178
- package/css/tyrell.css +19 -0
- package/dist/tyrell-theme.css +167 -178
- package/dist/tyrell.css +19 -0
- package/dist/tyrell.js +1 -1
- package/lib/base/ty-component.d.ts +20 -10
- package/lib/base/ty-component.js +21 -144
- package/lib/components/button.d.ts +2 -16
- package/lib/components/button.js +0 -36
- package/lib/components/calendar-month.d.ts +2 -48
- package/lib/components/calendar-month.js +4 -166
- package/lib/components/calendar-navigation.d.ts +3 -48
- package/lib/components/calendar-navigation.js +3 -126
- package/lib/components/calendar.d.ts +3 -80
- package/lib/components/calendar.js +8 -230
- package/lib/components/checkbox.d.ts +4 -71
- package/lib/components/checkbox.js +7 -151
- package/lib/components/copy.d.ts +3 -56
- package/lib/components/copy.js +1 -120
- package/lib/components/date-picker.d.ts +13 -162
- package/lib/components/date-picker.js +41 -592
- package/lib/components/file-upload.d.ts +9 -15
- package/lib/components/file-upload.js +19 -41
- package/lib/components/icon.d.ts +3 -24
- package/lib/components/icon.js +1 -90
- package/lib/components/input.d.ts +7 -107
- package/lib/components/input.js +5 -193
- package/lib/components/modal.d.ts +17 -26
- package/lib/components/modal.js +57 -201
- package/lib/components/option.d.ts +2 -9
- package/lib/components/option.js +0 -48
- package/lib/components/popup.d.ts +2 -17
- package/lib/components/popup.js +8 -139
- package/lib/components/radio.d.ts +3 -23
- package/lib/components/radio.js +10 -65
- package/lib/components/resize-observer.d.ts +3 -30
- package/lib/components/resize-observer.js +12 -46
- package/lib/components/scroll-container.d.ts +2 -12
- package/lib/components/scroll-container.js +3 -46
- package/lib/components/select.d.ts +22 -153
- package/lib/components/select.js +33 -590
- package/lib/components/selected-tags.d.ts +4 -47
- package/lib/components/selected-tags.js +1 -95
- package/lib/components/step.d.ts +1 -6
- package/lib/components/step.js +0 -6
- package/lib/components/switch.d.ts +0 -11
- package/lib/components/switch.js +2 -36
- package/lib/components/tab.d.ts +1 -6
- package/lib/components/tab.js +0 -7
- package/lib/components/tabs.d.ts +5 -63
- package/lib/components/tabs.js +20 -283
- package/lib/components/tag.d.ts +2 -36
- package/lib/components/tag.js +5 -105
- package/lib/components/textarea.d.ts +6 -86
- package/lib/components/textarea.js +2 -173
- package/lib/components/tooltip.d.ts +3 -11
- package/lib/components/tooltip.js +24 -160
- package/lib/components/wizard.d.ts +6 -54
- package/lib/components/wizard.js +15 -228
- package/lib/icons/fontawesome/brands.d.ts +0 -1
- package/lib/icons/fontawesome/brands.js +0 -8
- package/lib/icons/fontawesome/regular.d.ts +0 -1
- package/lib/icons/fontawesome/regular.js +0 -8
- package/lib/icons/fontawesome/solid.d.ts +0 -1
- package/lib/icons/fontawesome/solid.js +0 -8
- package/lib/icons/heroicons/micro.d.ts +0 -1
- package/lib/icons/heroicons/micro.js +0 -8
- package/lib/icons/heroicons/mini.d.ts +0 -1
- package/lib/icons/heroicons/mini.js +0 -8
- package/lib/icons/heroicons/outline.d.ts +0 -1
- package/lib/icons/heroicons/outline.js +0 -8
- package/lib/icons/heroicons/solid.d.ts +0 -1
- package/lib/icons/heroicons/solid.js +0 -8
- package/lib/icons/lucide.d.ts +0 -1
- package/lib/icons/lucide.js +0 -1872
- package/lib/icons/material/filled.d.ts +0 -1
- package/lib/icons/material/filled.js +0 -10
- package/lib/icons/material/outlined.d.ts +0 -1
- package/lib/icons/material/outlined.js +0 -10
- package/lib/icons/material/round.d.ts +0 -1
- package/lib/icons/material/round.js +0 -10
- package/lib/icons/material/sharp.d.ts +0 -1
- package/lib/icons/material/sharp.js +0 -10
- package/lib/icons/material/two-tone.d.ts +0 -1
- package/lib/icons/material/two-tone.js +0 -10
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -20
- package/lib/styles/button.d.ts +2 -20
- package/lib/styles/button.js +22 -122
- package/lib/styles/calendar-month.d.ts +1 -5
- package/lib/styles/calendar-month.js +4 -61
- package/lib/styles/calendar-navigation.d.ts +2 -6
- package/lib/styles/calendar-navigation.js +2 -27
- package/lib/styles/calendar.d.ts +1 -2
- package/lib/styles/calendar.js +1 -14
- package/lib/styles/checkbox.d.ts +0 -1
- package/lib/styles/checkbox.js +1 -23
- package/lib/styles/copy.d.ts +0 -1
- package/lib/styles/copy.js +2 -17
- package/lib/styles/custom-scrollbar.d.ts +1 -2
- package/lib/styles/custom-scrollbar.js +3 -18
- package/lib/styles/date-picker.d.ts +1 -5
- package/lib/styles/date-picker.js +35 -39
- package/lib/styles/file-upload.d.ts +1 -2
- package/lib/styles/file-upload.js +1 -16
- package/lib/styles/icon.d.ts +2 -6
- package/lib/styles/icon.js +7 -21
- package/lib/styles/input.d.ts +1 -6
- package/lib/styles/input.js +5 -54
- package/lib/styles/modal.d.ts +1 -2
- package/lib/styles/modal.js +21 -23
- package/lib/styles/option.d.ts +2 -6
- package/lib/styles/option.js +17 -12
- package/lib/styles/popup.d.ts +1 -2
- package/lib/styles/popup.js +26 -30
- package/lib/styles/radio.d.ts +0 -1
- package/lib/styles/radio.js +2 -16
- package/lib/styles/resize-observer.d.ts +1 -2
- package/lib/styles/resize-observer.js +0 -7
- package/lib/styles/scroll-container.d.ts +1 -2
- package/lib/styles/scroll-container.js +0 -19
- package/lib/styles/select-base.d.ts +0 -1
- package/lib/styles/select-base.js +68 -79
- package/lib/styles/select.d.ts +1 -2
- package/lib/styles/select.js +7 -15
- package/lib/styles/step.d.ts +1 -2
- package/lib/styles/step.js +0 -4
- package/lib/styles/switch.d.ts +0 -1
- package/lib/styles/switch.js +2 -20
- package/lib/styles/tab.d.ts +1 -2
- package/lib/styles/tab.js +0 -5
- package/lib/styles/tabs.d.ts +3 -11
- package/lib/styles/tabs.js +10 -48
- package/lib/styles/tag.d.ts +1 -5
- package/lib/styles/tag.js +2 -31
- package/lib/styles/textarea.d.ts +1 -2
- package/lib/styles/textarea.js +2 -45
- package/lib/styles/tooltip.d.ts +0 -1
- package/lib/styles/tooltip.js +0 -10
- package/lib/styles/wizard.d.ts +5 -21
- package/lib/styles/wizard.js +8 -88
- package/lib/types/common.d.ts +0 -2
- package/lib/types/common.js +0 -12
- package/lib/utils/calendar-utils.d.ts +4 -21
- package/lib/utils/calendar-utils.js +4 -177
- package/lib/utils/custom-scrollbar.d.ts +6 -20
- package/lib/utils/custom-scrollbar.js +1 -45
- package/lib/utils/flavor-sheet.d.ts +0 -1
- package/lib/utils/flavor-sheet.js +0 -23
- package/lib/utils/icon-registry.d.ts +0 -2
- package/lib/utils/icon-registry.js +1 -107
- package/lib/utils/icons.d.ts +0 -1
- package/lib/utils/icons.js +0 -9
- package/lib/utils/loader-registry.d.ts +0 -1
- package/lib/utils/loader-registry.js +0 -32
- package/lib/utils/locale.d.ts +2 -23
- package/lib/utils/locale.js +0 -86
- package/lib/utils/mobile.d.ts +0 -1
- package/lib/utils/mobile.js +0 -17
- package/lib/utils/number-format.d.ts +6 -3
- package/lib/utils/number-format.js +11 -67
- package/lib/utils/positioning.d.ts +50 -7
- package/lib/utils/positioning.js +52 -62
- package/lib/utils/property-capture.d.ts +5 -27
- package/lib/utils/property-capture.js +0 -108
- package/lib/utils/property-manager.d.ts +0 -1
- package/lib/utils/property-manager.js +0 -70
- package/lib/utils/resize-observer.d.ts +0 -1
- package/lib/utils/resize-observer.js +0 -36
- package/lib/utils/scroll-lock.d.ts +4 -11
- package/lib/utils/scroll-lock.js +0 -107
- package/lib/utils/styles.d.ts +0 -1
- package/lib/utils/styles.js +0 -24
- package/lib/version.d.ts +1 -2
- package/lib/version.js +1 -11
- package/package.json +2 -2
- package/lib/base/ty-component.d.ts.map +0 -1
- package/lib/base/ty-component.js.map +0 -1
- package/lib/components/button.d.ts.map +0 -1
- package/lib/components/button.js.map +0 -1
- package/lib/components/calendar-month.d.ts.map +0 -1
- package/lib/components/calendar-month.js.map +0 -1
- package/lib/components/calendar-navigation.d.ts.map +0 -1
- package/lib/components/calendar-navigation.js.map +0 -1
- package/lib/components/calendar.d.ts.map +0 -1
- package/lib/components/calendar.js.map +0 -1
- package/lib/components/checkbox.d.ts.map +0 -1
- package/lib/components/checkbox.js.map +0 -1
- package/lib/components/copy.d.ts.map +0 -1
- package/lib/components/copy.js.map +0 -1
- package/lib/components/date-picker.d.ts.map +0 -1
- package/lib/components/date-picker.js.map +0 -1
- package/lib/components/file-upload.d.ts.map +0 -1
- package/lib/components/file-upload.js.map +0 -1
- package/lib/components/icon.d.ts.map +0 -1
- package/lib/components/icon.js.map +0 -1
- package/lib/components/input.d.ts.map +0 -1
- package/lib/components/input.js.map +0 -1
- package/lib/components/modal.d.ts.map +0 -1
- package/lib/components/modal.js.map +0 -1
- package/lib/components/option.d.ts.map +0 -1
- package/lib/components/option.js.map +0 -1
- package/lib/components/popup.d.ts.map +0 -1
- package/lib/components/popup.js.map +0 -1
- package/lib/components/radio.d.ts.map +0 -1
- package/lib/components/radio.js.map +0 -1
- package/lib/components/resize-observer.d.ts.map +0 -1
- package/lib/components/resize-observer.js.map +0 -1
- package/lib/components/scroll-container.d.ts.map +0 -1
- package/lib/components/scroll-container.js.map +0 -1
- package/lib/components/select.d.ts.map +0 -1
- package/lib/components/select.js.map +0 -1
- package/lib/components/selected-tags.d.ts.map +0 -1
- package/lib/components/selected-tags.js.map +0 -1
- package/lib/components/step.d.ts.map +0 -1
- package/lib/components/step.js.map +0 -1
- package/lib/components/switch.d.ts.map +0 -1
- package/lib/components/switch.js.map +0 -1
- package/lib/components/tab.d.ts.map +0 -1
- package/lib/components/tab.js.map +0 -1
- package/lib/components/tabs.d.ts.map +0 -1
- package/lib/components/tabs.js.map +0 -1
- package/lib/components/tag.d.ts.map +0 -1
- package/lib/components/tag.js.map +0 -1
- package/lib/components/textarea.d.ts.map +0 -1
- package/lib/components/textarea.js.map +0 -1
- package/lib/components/tooltip.d.ts.map +0 -1
- package/lib/components/tooltip.js.map +0 -1
- package/lib/components/wizard.d.ts.map +0 -1
- package/lib/components/wizard.js.map +0 -1
- package/lib/icons/fontawesome/brands.d.ts.map +0 -1
- package/lib/icons/fontawesome/brands.js.map +0 -1
- package/lib/icons/fontawesome/regular.d.ts.map +0 -1
- package/lib/icons/fontawesome/regular.js.map +0 -1
- package/lib/icons/fontawesome/solid.d.ts.map +0 -1
- package/lib/icons/fontawesome/solid.js.map +0 -1
- package/lib/icons/heroicons/micro.d.ts.map +0 -1
- package/lib/icons/heroicons/micro.js.map +0 -1
- package/lib/icons/heroicons/mini.d.ts.map +0 -1
- package/lib/icons/heroicons/mini.js.map +0 -1
- package/lib/icons/heroicons/outline.d.ts.map +0 -1
- package/lib/icons/heroicons/outline.js.map +0 -1
- package/lib/icons/heroicons/solid.d.ts.map +0 -1
- package/lib/icons/heroicons/solid.js.map +0 -1
- package/lib/icons/lucide.d.ts.map +0 -1
- package/lib/icons/lucide.js.map +0 -1
- package/lib/icons/material/filled.d.ts.map +0 -1
- package/lib/icons/material/filled.js.map +0 -1
- package/lib/icons/material/outlined.d.ts.map +0 -1
- package/lib/icons/material/outlined.js.map +0 -1
- package/lib/icons/material/round.d.ts.map +0 -1
- package/lib/icons/material/round.js.map +0 -1
- package/lib/icons/material/sharp.d.ts.map +0 -1
- package/lib/icons/material/sharp.js.map +0 -1
- package/lib/icons/material/two-tone.d.ts.map +0 -1
- package/lib/icons/material/two-tone.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/styles/button.d.ts.map +0 -1
- package/lib/styles/button.js.map +0 -1
- package/lib/styles/calendar-month.d.ts.map +0 -1
- package/lib/styles/calendar-month.js.map +0 -1
- package/lib/styles/calendar-navigation.d.ts.map +0 -1
- package/lib/styles/calendar-navigation.js.map +0 -1
- package/lib/styles/calendar.d.ts.map +0 -1
- package/lib/styles/calendar.js.map +0 -1
- package/lib/styles/checkbox.d.ts.map +0 -1
- package/lib/styles/checkbox.js.map +0 -1
- package/lib/styles/copy.d.ts.map +0 -1
- package/lib/styles/copy.js.map +0 -1
- package/lib/styles/custom-scrollbar.d.ts.map +0 -1
- package/lib/styles/custom-scrollbar.js.map +0 -1
- package/lib/styles/date-picker.d.ts.map +0 -1
- package/lib/styles/date-picker.js.map +0 -1
- package/lib/styles/file-upload.d.ts.map +0 -1
- package/lib/styles/file-upload.js.map +0 -1
- package/lib/styles/icon.d.ts.map +0 -1
- package/lib/styles/icon.js.map +0 -1
- package/lib/styles/input.d.ts.map +0 -1
- package/lib/styles/input.js.map +0 -1
- package/lib/styles/modal.d.ts.map +0 -1
- package/lib/styles/modal.js.map +0 -1
- package/lib/styles/multiselect.d.ts +0 -8
- package/lib/styles/multiselect.d.ts.map +0 -1
- package/lib/styles/multiselect.js +0 -849
- package/lib/styles/multiselect.js.map +0 -1
- package/lib/styles/option.d.ts.map +0 -1
- package/lib/styles/option.js.map +0 -1
- package/lib/styles/popup.d.ts.map +0 -1
- package/lib/styles/popup.js.map +0 -1
- package/lib/styles/radio.d.ts.map +0 -1
- package/lib/styles/radio.js.map +0 -1
- package/lib/styles/resize-observer.d.ts.map +0 -1
- package/lib/styles/resize-observer.js.map +0 -1
- package/lib/styles/scroll-container.d.ts.map +0 -1
- package/lib/styles/scroll-container.js.map +0 -1
- package/lib/styles/select-base.d.ts.map +0 -1
- package/lib/styles/select-base.js.map +0 -1
- package/lib/styles/select.d.ts.map +0 -1
- package/lib/styles/select.js.map +0 -1
- package/lib/styles/step.d.ts.map +0 -1
- package/lib/styles/step.js.map +0 -1
- package/lib/styles/switch.d.ts.map +0 -1
- package/lib/styles/switch.js.map +0 -1
- package/lib/styles/tab.d.ts.map +0 -1
- package/lib/styles/tab.js.map +0 -1
- package/lib/styles/tabs.d.ts.map +0 -1
- package/lib/styles/tabs.js.map +0 -1
- package/lib/styles/tag.d.ts.map +0 -1
- package/lib/styles/tag.js.map +0 -1
- package/lib/styles/textarea.d.ts.map +0 -1
- package/lib/styles/textarea.js.map +0 -1
- package/lib/styles/tooltip.d.ts.map +0 -1
- package/lib/styles/tooltip.js.map +0 -1
- package/lib/styles/wizard.d.ts.map +0 -1
- package/lib/styles/wizard.js.map +0 -1
- package/lib/types/common.d.ts.map +0 -1
- package/lib/types/common.js.map +0 -1
- package/lib/utils/calendar-utils.d.ts.map +0 -1
- package/lib/utils/calendar-utils.js.map +0 -1
- package/lib/utils/custom-scrollbar.d.ts.map +0 -1
- package/lib/utils/custom-scrollbar.js.map +0 -1
- package/lib/utils/flavor-sheet.d.ts.map +0 -1
- package/lib/utils/flavor-sheet.js.map +0 -1
- package/lib/utils/icon-registry.d.ts.map +0 -1
- package/lib/utils/icon-registry.js.map +0 -1
- package/lib/utils/icons.d.ts.map +0 -1
- package/lib/utils/icons.js.map +0 -1
- package/lib/utils/loader-registry.d.ts.map +0 -1
- package/lib/utils/loader-registry.js.map +0 -1
- package/lib/utils/locale.d.ts.map +0 -1
- package/lib/utils/locale.js.map +0 -1
- package/lib/utils/mobile.d.ts.map +0 -1
- package/lib/utils/mobile.js.map +0 -1
- package/lib/utils/number-format.d.ts.map +0 -1
- package/lib/utils/number-format.js.map +0 -1
- package/lib/utils/parse-boolean.d.ts +0 -39
- package/lib/utils/parse-boolean.d.ts.map +0 -1
- package/lib/utils/parse-boolean.js +0 -58
- package/lib/utils/parse-boolean.js.map +0 -1
- package/lib/utils/positioning.d.ts.map +0 -1
- package/lib/utils/positioning.js.map +0 -1
- package/lib/utils/property-capture.d.ts.map +0 -1
- package/lib/utils/property-capture.js.map +0 -1
- package/lib/utils/property-manager.d.ts.map +0 -1
- package/lib/utils/property-manager.js.map +0 -1
- package/lib/utils/resize-observer.d.ts.map +0 -1
- package/lib/utils/resize-observer.js.map +0 -1
- package/lib/utils/scroll-lock.d.ts.map +0 -1
- package/lib/utils/scroll-lock.js.map +0 -1
- package/lib/utils/styles.d.ts.map +0 -1
- package/lib/utils/styles.js.map +0 -1
- package/lib/version.d.ts.map +0 -1
- package/lib/version.js.map +0 -1
|
@@ -1,50 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Property Capture Utility
|
|
3
|
-
*
|
|
4
|
-
* Solves the problem of frameworks (React, Reagent, etc.) setting properties
|
|
5
|
-
* on custom elements BEFORE connectedCallback runs.
|
|
6
|
-
*
|
|
7
|
-
* PROBLEM:
|
|
8
|
-
* 1. Framework creates element: document.createElement('ty-dropdown')
|
|
9
|
-
* 2. Framework sets properties: element.value = "foo"
|
|
10
|
-
* 3. Constructor runs and defines getters/setters
|
|
11
|
-
* 4. BUT properties were already set, creating instance properties
|
|
12
|
-
* 5. Instance properties shadow the class getters/setters
|
|
13
|
-
* 6. connectedCallback runs - too late!
|
|
14
|
-
*
|
|
15
|
-
* SOLUTION:
|
|
16
|
-
* In connectedCallback, capture any pre-set properties and apply them properly.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* connectedCallback(): void {
|
|
21
|
-
* const preSetProps = capturePreSetProperties(this, [
|
|
22
|
-
* 'value', 'clearable', 'disabled'
|
|
23
|
-
* ])
|
|
24
|
-
*
|
|
25
|
-
* if (preSetProps.value !== undefined) {
|
|
26
|
-
* this._value = preSetProps.value
|
|
27
|
-
* }
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
/**
|
|
32
|
-
* Capture properties that were set before connectedCallback
|
|
33
|
-
*
|
|
34
|
-
* @param element - The custom element instance
|
|
35
|
-
* @param propertyNames - Array of property names to check
|
|
36
|
-
* @param options - Capture options
|
|
37
|
-
* @returns Record of captured properties with metadata
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```typescript
|
|
41
|
-
* const captured = capturePreSetProperties(this, ['value', 'disabled'])
|
|
42
|
-
* // {
|
|
43
|
-
* // value: { name: 'value', value: 'foo', hadProperty: true },
|
|
44
|
-
* // disabled: { name: 'disabled', value: undefined, hadProperty: false }
|
|
45
|
-
* // }
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
1
|
export function capturePreSetProperties(element, propertyNames, options = { cleanup: true }) {
|
|
49
2
|
const captured = {};
|
|
50
3
|
for (const name of propertyNames) {
|
|
@@ -54,29 +7,12 @@ export function capturePreSetProperties(element, propertyNames, options = { clea
|
|
|
54
7
|
value: descriptor?.value,
|
|
55
8
|
hadProperty: descriptor !== undefined && descriptor.value !== undefined
|
|
56
9
|
};
|
|
57
|
-
// Clean up instance property so class getter/setter works
|
|
58
10
|
if (options.cleanup && captured[name].hadProperty) {
|
|
59
11
|
delete element[name];
|
|
60
12
|
}
|
|
61
13
|
}
|
|
62
14
|
return captured;
|
|
63
15
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Simpler API - just get the values that were pre-set
|
|
66
|
-
*
|
|
67
|
-
* @param element - The custom element instance
|
|
68
|
-
* @param propertyNames - Array of property names to check
|
|
69
|
-
* @param options - Capture options
|
|
70
|
-
* @returns Record of property names to values (only includes properties that were set)
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* ```typescript
|
|
74
|
-
* const values = getCapturedValues(this, ['value', 'disabled'])
|
|
75
|
-
* if (values.value !== undefined) {
|
|
76
|
-
* this._value = values.value
|
|
77
|
-
* }
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
16
|
export function getCapturedValues(element, propertyNames, options) {
|
|
81
17
|
const captured = capturePreSetProperties(element, propertyNames, options);
|
|
82
18
|
const values = {};
|
|
@@ -87,58 +23,15 @@ export function getCapturedValues(element, propertyNames, options) {
|
|
|
87
23
|
}
|
|
88
24
|
return values;
|
|
89
25
|
}
|
|
90
|
-
/**
|
|
91
|
-
* Automatically apply pre-set properties to private fields
|
|
92
|
-
*
|
|
93
|
-
* @param element - The custom element instance
|
|
94
|
-
* @param propertyNames - Array of property names to check
|
|
95
|
-
* @param propertyMap - Optional mapping of public names to private field names
|
|
96
|
-
* Default: adds underscore prefix (e.g., 'value' -> '_value')
|
|
97
|
-
* @param options - Capture options
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* ```typescript
|
|
101
|
-
* // Simple usage (uses _propertyName convention)
|
|
102
|
-
* applyPreSetProperties(this, ['value', 'disabled'])
|
|
103
|
-
* // Sets this._value and this._disabled
|
|
104
|
-
*
|
|
105
|
-
* // Custom mapping
|
|
106
|
-
* applyPreSetProperties(this, ['value'], { value: 'internalValue' })
|
|
107
|
-
* // Sets this.internalValue
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
26
|
export function applyPreSetProperties(element, propertyNames, propertyMap, options) {
|
|
111
27
|
const captured = capturePreSetProperties(element, propertyNames, options);
|
|
112
28
|
for (const [name, data] of Object.entries(captured)) {
|
|
113
29
|
if (data.hadProperty) {
|
|
114
|
-
// Determine the private field name
|
|
115
30
|
const privateName = propertyMap?.[name] || `_${name}`;
|
|
116
31
|
element[privateName] = data.value;
|
|
117
32
|
}
|
|
118
33
|
}
|
|
119
34
|
}
|
|
120
|
-
/**
|
|
121
|
-
* Helper for components with standard _propertyName pattern
|
|
122
|
-
*
|
|
123
|
-
* @param element - The custom element instance
|
|
124
|
-
* @param propertyNames - Array of property names to check
|
|
125
|
-
* @param transformer - Optional function to transform values before setting
|
|
126
|
-
* @param options - Capture options
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```typescript
|
|
130
|
-
* connectedCallback(): void {
|
|
131
|
-
* // Basic usage
|
|
132
|
-
* captureAndApplyProperties(this, ['value', 'disabled', 'required'])
|
|
133
|
-
*
|
|
134
|
-
* // With transformation
|
|
135
|
-
* captureAndApplyProperties(this, ['value'], (name, value) => {
|
|
136
|
-
* if (name === 'value') return this.parseValue(value)
|
|
137
|
-
* return value
|
|
138
|
-
* })
|
|
139
|
-
* }
|
|
140
|
-
* ```
|
|
141
|
-
*/
|
|
142
35
|
export function captureAndApplyProperties(element, propertyNames, transformer, options) {
|
|
143
36
|
const captured = capturePreSetProperties(element, propertyNames, options);
|
|
144
37
|
for (const [name, data] of Object.entries(captured)) {
|
|
@@ -149,4 +42,3 @@ export function captureAndApplyProperties(element, propertyNames, transformer, o
|
|
|
149
42
|
}
|
|
150
43
|
}
|
|
151
44
|
}
|
|
152
|
-
//# sourceMappingURL=property-capture.js.map
|
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Property Manager - Unified property lifecycle for web components
|
|
3
|
-
*
|
|
4
|
-
* Handles property/attribute synchronization, validation, coercion, and change tracking.
|
|
5
|
-
* All property updates flow through a single code path for consistency.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Manages component properties with unified lifecycle
|
|
9
|
-
*/
|
|
10
1
|
export class PropertyManager {
|
|
11
2
|
constructor(config) {
|
|
12
3
|
this._props = new Map();
|
|
13
4
|
this._config = config;
|
|
14
5
|
this._initializeDefaults();
|
|
15
6
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Initialize properties with default values
|
|
18
|
-
*/
|
|
19
7
|
_initializeDefaults() {
|
|
20
8
|
for (const [name, config] of Object.entries(this._config)) {
|
|
21
9
|
if (config.default !== undefined) {
|
|
@@ -23,38 +11,25 @@ export class PropertyManager {
|
|
|
23
11
|
}
|
|
24
12
|
}
|
|
25
13
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Check if a property name exists in the configuration
|
|
28
|
-
*/
|
|
29
14
|
hasConfig(name) {
|
|
30
15
|
return name in this._config;
|
|
31
16
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Update a property value
|
|
34
|
-
* Returns PropertyChange if value changed, null otherwise
|
|
35
|
-
*/
|
|
36
17
|
updateProperty(name, value, source = 'property') {
|
|
37
18
|
const config = this._config[name];
|
|
38
19
|
if (!config) {
|
|
39
20
|
console.warn(`[PropertyManager] Unknown property: ${name}`);
|
|
40
21
|
return null;
|
|
41
22
|
}
|
|
42
|
-
// Get old value
|
|
43
23
|
const oldValue = this._props.get(name);
|
|
44
|
-
// Coerce value to correct type
|
|
45
24
|
const coercedValue = this._coerceValue(name, value, config);
|
|
46
|
-
// Validate value
|
|
47
25
|
if (!this._validateValue(name, coercedValue, config)) {
|
|
48
26
|
console.warn(`[PropertyManager] Invalid value for ${name}:`, coercedValue);
|
|
49
27
|
return null;
|
|
50
28
|
}
|
|
51
|
-
// Check if value actually changed
|
|
52
29
|
if (this._valuesEqual(oldValue, coercedValue)) {
|
|
53
30
|
return null;
|
|
54
31
|
}
|
|
55
|
-
// Update internal map
|
|
56
32
|
this._props.set(name, coercedValue);
|
|
57
|
-
// Create change object
|
|
58
33
|
const change = {
|
|
59
34
|
name,
|
|
60
35
|
oldValue,
|
|
@@ -63,35 +38,23 @@ export class PropertyManager {
|
|
|
63
38
|
};
|
|
64
39
|
return change;
|
|
65
40
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Coerce value to the correct type
|
|
68
|
-
*/
|
|
69
41
|
_coerceValue(name, value, config) {
|
|
70
|
-
// Custom coercion
|
|
71
42
|
if (config.coerce) {
|
|
72
43
|
return config.coerce(value);
|
|
73
44
|
}
|
|
74
|
-
// Null/undefined handling
|
|
75
45
|
if (value === null || value === undefined) {
|
|
76
46
|
return config.default ?? null;
|
|
77
47
|
}
|
|
78
|
-
// Type coercion
|
|
79
48
|
switch (config.type) {
|
|
80
49
|
case 'boolean':
|
|
81
|
-
// HTML Standard: attribute present (even empty) = true, absent = false
|
|
82
|
-
// String handling:
|
|
83
50
|
if (typeof value === 'string') {
|
|
84
|
-
// Empty string = true (HTML boolean attribute: <input checked>)
|
|
85
51
|
if (value === '')
|
|
86
52
|
return true;
|
|
87
|
-
// Explicit false values
|
|
88
53
|
const normalized = value.toLowerCase().trim();
|
|
89
54
|
if (normalized === 'false' || normalized === '0')
|
|
90
55
|
return false;
|
|
91
|
-
// Everything else is truthy
|
|
92
56
|
return true;
|
|
93
57
|
}
|
|
94
|
-
// Non-string: standard truthy/falsy
|
|
95
58
|
return Boolean(value);
|
|
96
59
|
case 'number':
|
|
97
60
|
const num = Number(value);
|
|
@@ -114,29 +77,19 @@ export class PropertyManager {
|
|
|
114
77
|
return value;
|
|
115
78
|
}
|
|
116
79
|
}
|
|
117
|
-
/**
|
|
118
|
-
* Validate a property value
|
|
119
|
-
*/
|
|
120
80
|
_validateValue(name, value, config) {
|
|
121
81
|
if (config.validate) {
|
|
122
82
|
return config.validate(value);
|
|
123
83
|
}
|
|
124
84
|
return true;
|
|
125
85
|
}
|
|
126
|
-
/**
|
|
127
|
-
* Check if two values are equal
|
|
128
|
-
*/
|
|
129
86
|
_valuesEqual(a, b) {
|
|
130
|
-
// Simple equality for primitives
|
|
131
87
|
if (typeof a !== 'object' || typeof b !== 'object') {
|
|
132
88
|
return a === b;
|
|
133
89
|
}
|
|
134
|
-
// Null checks
|
|
135
90
|
if (a === null || b === null) {
|
|
136
91
|
return a === b;
|
|
137
92
|
}
|
|
138
|
-
// Deep equality for objects/arrays (simple implementation)
|
|
139
|
-
// For production, consider using a proper deep equality library
|
|
140
93
|
try {
|
|
141
94
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
142
95
|
}
|
|
@@ -144,47 +97,25 @@ export class PropertyManager {
|
|
|
144
97
|
return false;
|
|
145
98
|
}
|
|
146
99
|
}
|
|
147
|
-
/**
|
|
148
|
-
* Get a property value
|
|
149
|
-
*/
|
|
150
100
|
get(name) {
|
|
151
101
|
return this._props.get(name);
|
|
152
102
|
}
|
|
153
|
-
/**
|
|
154
|
-
* Get all properties as an object
|
|
155
|
-
*/
|
|
156
103
|
getAll() {
|
|
157
104
|
return Object.fromEntries(this._props);
|
|
158
105
|
}
|
|
159
|
-
/**
|
|
160
|
-
* Get property configuration
|
|
161
|
-
*/
|
|
162
106
|
getConfig(name) {
|
|
163
107
|
return this._config[name];
|
|
164
108
|
}
|
|
165
|
-
/**
|
|
166
|
-
* Check if a property is visual (requires render)
|
|
167
|
-
*/
|
|
168
109
|
isVisual(name) {
|
|
169
110
|
return this._config[name]?.visual ?? false;
|
|
170
111
|
}
|
|
171
|
-
/**
|
|
172
|
-
* Check if a property affects form value
|
|
173
|
-
*/
|
|
174
112
|
isFormValue(name) {
|
|
175
113
|
return this._config[name]?.formValue ?? false;
|
|
176
114
|
}
|
|
177
|
-
/**
|
|
178
|
-
* Check if a property should emit change events
|
|
179
|
-
*/
|
|
180
115
|
shouldEmitChange(name) {
|
|
181
116
|
return this._config[name]?.emitChange ?? false;
|
|
182
117
|
}
|
|
183
|
-
/**
|
|
184
|
-
* Handle property aliases (e.g., not-clearable → clearable: false)
|
|
185
|
-
*/
|
|
186
118
|
handleAlias(aliasName, value) {
|
|
187
|
-
// Find property with this alias
|
|
188
119
|
for (const [propName, config] of Object.entries(this._config)) {
|
|
189
120
|
if (config.aliases && aliasName in config.aliases) {
|
|
190
121
|
const aliasedValue = config.aliases[aliasName];
|
|
@@ -194,4 +125,3 @@ export class PropertyManager {
|
|
|
194
125
|
return null;
|
|
195
126
|
}
|
|
196
127
|
}
|
|
197
|
-
//# sourceMappingURL=property-manager.js.map
|
|
@@ -1,41 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resize Observer Registry & Callbacks
|
|
3
|
-
*
|
|
4
|
-
* Provides global registry for element sizes and optional callback subscriptions.
|
|
5
|
-
*/
|
|
6
|
-
// Global registry (Map-based storage)
|
|
7
1
|
const sizes = new Map();
|
|
8
2
|
const callbacks = new Map();
|
|
9
|
-
/**
|
|
10
|
-
* Get current size for element by ID (sync query)
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* const size = getSize('parent-container')
|
|
14
|
-
* if (size) console.log(`Width: ${size.width}px`)
|
|
15
|
-
*/
|
|
16
3
|
export function getSize(id) {
|
|
17
4
|
return sizes.get(id);
|
|
18
5
|
}
|
|
19
|
-
/**
|
|
20
|
-
* Subscribe to size changes for element by ID
|
|
21
|
-
* Returns unsubscribe function
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* const unsubscribe = onResize('parent', ({ width, height }) => {
|
|
25
|
-
* console.log(`Resized to ${width}x${height}`)
|
|
26
|
-
* })
|
|
27
|
-
* // Later: unsubscribe()
|
|
28
|
-
*/
|
|
29
6
|
export function onResize(id, callback) {
|
|
30
7
|
if (!callbacks.has(id)) {
|
|
31
8
|
callbacks.set(id, new Set());
|
|
32
9
|
}
|
|
33
10
|
callbacks.get(id).add(callback);
|
|
34
|
-
// Call immediately with current size if available
|
|
35
11
|
const current = sizes.get(id);
|
|
36
12
|
if (current)
|
|
37
13
|
callback(current);
|
|
38
|
-
// Return unsubscribe function
|
|
39
14
|
return () => {
|
|
40
15
|
callbacks.get(id)?.delete(callback);
|
|
41
16
|
if (callbacks.get(id)?.size === 0) {
|
|
@@ -43,29 +18,18 @@ export function onResize(id, callback) {
|
|
|
43
18
|
}
|
|
44
19
|
};
|
|
45
20
|
}
|
|
46
|
-
/**
|
|
47
|
-
* Get all registered sizes (for debugging/window API)
|
|
48
|
-
*/
|
|
49
21
|
export function getAllSizes() {
|
|
50
22
|
return Object.fromEntries(sizes);
|
|
51
23
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Internal: Update size in registry and notify callbacks
|
|
54
|
-
*/
|
|
55
24
|
export function updateSize(id, width, height) {
|
|
56
25
|
sizes.set(id, { width, height });
|
|
57
|
-
// Notify all subscribers
|
|
58
26
|
const cbs = callbacks.get(id);
|
|
59
27
|
if (cbs) {
|
|
60
28
|
const size = { width, height };
|
|
61
29
|
cbs.forEach(cb => cb(size));
|
|
62
30
|
}
|
|
63
31
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Internal: Remove size from registry and cleanup callbacks
|
|
66
|
-
*/
|
|
67
32
|
export function removeSize(id) {
|
|
68
33
|
sizes.delete(id);
|
|
69
34
|
callbacks.delete(id);
|
|
70
35
|
}
|
|
71
|
-
//# sourceMappingURL=resize-observer.js.map
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CSS-based scroll prevention
|
|
2
|
+
* CSS-based scroll prevention.
|
|
3
3
|
*
|
|
4
|
-
* Prevents
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Key benefits:
|
|
8
|
-
* - No event manipulation complexity
|
|
9
|
-
* - No interference with component keyboard navigation
|
|
10
|
-
* - Preserves scroll position perfectly
|
|
11
|
-
* - Standard industry technique
|
|
12
|
-
* - Multiple component support with proper cleanup
|
|
4
|
+
* Prevents page scrolling via CSS rather than event cancellation — no event
|
|
5
|
+
* manipulation, no interference with component keyboard navigation, scroll
|
|
6
|
+
* position preserved. Reference-counted so multiple components can lock at once.
|
|
13
7
|
*/
|
|
14
8
|
declare global {
|
|
15
9
|
interface Window {
|
|
@@ -76,4 +70,3 @@ export declare function getLockState(): Readonly<{
|
|
|
76
70
|
scrollY: number;
|
|
77
71
|
activeLocks: string[];
|
|
78
72
|
}>;
|
|
79
|
-
//# sourceMappingURL=scroll-lock.d.ts.map
|
package/lib/utils/scroll-lock.js
CHANGED
|
@@ -1,62 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSS-based scroll prevention using position: fixed.
|
|
3
|
-
*
|
|
4
|
-
* Prevents body/page scrolling by temporarily fixing the body position
|
|
5
|
-
* while preserving scroll position. Much more reliable than event prevention.
|
|
6
|
-
*
|
|
7
|
-
* Key benefits:
|
|
8
|
-
* - No event manipulation complexity
|
|
9
|
-
* - No interference with component keyboard navigation
|
|
10
|
-
* - Preserves scroll position perfectly
|
|
11
|
-
* - Standard industry technique
|
|
12
|
-
* - Multiple component support with proper cleanup
|
|
13
|
-
*/
|
|
14
|
-
// ============================================================================
|
|
15
|
-
// Global State Management
|
|
16
|
-
// ============================================================================
|
|
17
1
|
const lockState = {
|
|
18
2
|
locked: false,
|
|
19
3
|
scrollY: 0,
|
|
20
4
|
activeLocks: new Set(),
|
|
21
5
|
};
|
|
22
|
-
// ============================================================================
|
|
23
|
-
// DOM Helper Functions
|
|
24
|
-
// ============================================================================
|
|
25
|
-
/**
|
|
26
|
-
* Get the document body element
|
|
27
|
-
*/
|
|
28
6
|
function getBodyEl() {
|
|
29
7
|
return document.body;
|
|
30
8
|
}
|
|
31
|
-
/**
|
|
32
|
-
* Get the document element (html)
|
|
33
|
-
*/
|
|
34
9
|
function getDocEl() {
|
|
35
10
|
return document.documentElement;
|
|
36
11
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Get current vertical scroll position
|
|
39
|
-
*/
|
|
40
12
|
function getScrollY() {
|
|
41
13
|
return window.scrollY || getDocEl().scrollTop || 0;
|
|
42
14
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Calculate the width of the browser's scrollbar
|
|
45
|
-
*/
|
|
46
15
|
function getScrollbarWidth() {
|
|
47
|
-
// window.innerWidth - documentElement.clientWidth
|
|
48
16
|
return window.innerWidth - getDocEl().clientWidth;
|
|
49
17
|
}
|
|
50
|
-
// ============================================================================
|
|
51
|
-
// Core Lock/Unlock Functions
|
|
52
|
-
// ============================================================================
|
|
53
|
-
/**
|
|
54
|
-
* Lock body scrolling using overflow: hidden on <html>.
|
|
55
|
-
*
|
|
56
|
-
* Avoids position: fixed on <body> which breaks centered/max-width body layouts
|
|
57
|
-
* by snapping the body to the left edge. Using <html> instead leaves body layout
|
|
58
|
-
* untouched while still preventing scroll.
|
|
59
|
-
*/
|
|
60
18
|
function lockBodyFixed() {
|
|
61
19
|
if (lockState.locked)
|
|
62
20
|
return;
|
|
@@ -68,15 +26,11 @@ function lockBodyFixed() {
|
|
|
68
26
|
lockState.scrollY = getScrollY();
|
|
69
27
|
lockState.locked = true;
|
|
70
28
|
docEl.style.overflow = 'hidden';
|
|
71
|
-
// Compensate for scrollbar disappearing to prevent layout shift
|
|
72
29
|
if (scrollbarWidth > 0) {
|
|
73
30
|
docEl.style.paddingRight = `${scrollbarWidth}px`;
|
|
74
31
|
}
|
|
75
32
|
docEl.classList.add('ty-scroll-locked');
|
|
76
33
|
}
|
|
77
|
-
/**
|
|
78
|
-
* Unlock body scrolling
|
|
79
|
-
*/
|
|
80
34
|
function unlockBodyFixed() {
|
|
81
35
|
if (!lockState.locked)
|
|
82
36
|
return;
|
|
@@ -89,103 +43,43 @@ function unlockBodyFixed() {
|
|
|
89
43
|
docEl.style.paddingRight = '';
|
|
90
44
|
lockState.locked = false;
|
|
91
45
|
}
|
|
92
|
-
// ============================================================================
|
|
93
|
-
// Public API
|
|
94
|
-
// ============================================================================
|
|
95
|
-
/**
|
|
96
|
-
* Lock scrolling for a specific component.
|
|
97
|
-
*
|
|
98
|
-
* Multiple components can lock scrolling simultaneously.
|
|
99
|
-
* Scroll remains locked until ALL components unlock.
|
|
100
|
-
*
|
|
101
|
-
* @param componentId - Unique identifier for the component
|
|
102
|
-
*/
|
|
103
46
|
export function lockScroll(componentId) {
|
|
104
47
|
if (lockState.activeLocks.has(componentId))
|
|
105
48
|
return;
|
|
106
|
-
// Add this component to active locks
|
|
107
49
|
lockState.activeLocks.add(componentId);
|
|
108
|
-
// Lock body if this is the first lock
|
|
109
50
|
if (lockState.activeLocks.size === 1) {
|
|
110
51
|
lockBodyFixed();
|
|
111
52
|
}
|
|
112
53
|
}
|
|
113
|
-
/**
|
|
114
|
-
* Unlock scrolling for a specific component.
|
|
115
|
-
*
|
|
116
|
-
* Scroll remains locked if other components still have locks active.
|
|
117
|
-
*
|
|
118
|
-
* @param componentId - Unique identifier for the component
|
|
119
|
-
*/
|
|
120
54
|
export function unlockScroll(componentId) {
|
|
121
55
|
if (!lockState.activeLocks.has(componentId))
|
|
122
56
|
return;
|
|
123
|
-
// Remove this component from active locks
|
|
124
57
|
lockState.activeLocks.delete(componentId);
|
|
125
|
-
// Unlock body if this was the last lock
|
|
126
58
|
if (lockState.activeLocks.size === 0) {
|
|
127
59
|
unlockBodyFixed();
|
|
128
60
|
}
|
|
129
61
|
}
|
|
130
|
-
/**
|
|
131
|
-
* Emergency unlock - removes all scroll locks immediately.
|
|
132
|
-
*
|
|
133
|
-
* Use this for cleanup or error recovery scenarios.
|
|
134
|
-
*/
|
|
135
62
|
export function forceUnlockAll() {
|
|
136
63
|
lockState.activeLocks.clear();
|
|
137
64
|
unlockBodyFixed();
|
|
138
65
|
}
|
|
139
|
-
// ============================================================================
|
|
140
|
-
// Debug API
|
|
141
|
-
// ============================================================================
|
|
142
|
-
/**
|
|
143
|
-
* Enable scroll lock debugging - useful for testing and development
|
|
144
|
-
*/
|
|
145
66
|
export function enableDebug() {
|
|
146
67
|
console.log('🔍 CSS Scroll lock debugging enabled');
|
|
147
68
|
window.tyScrollDebug = true;
|
|
148
69
|
}
|
|
149
|
-
/**
|
|
150
|
-
* Disable scroll lock debugging
|
|
151
|
-
*/
|
|
152
70
|
export function disableDebug() {
|
|
153
71
|
console.log('🔍 CSS Scroll lock debugging disabled');
|
|
154
72
|
window.tyScrollDebug = false;
|
|
155
73
|
}
|
|
156
|
-
// ============================================================================
|
|
157
|
-
// State Inspection
|
|
158
|
-
// ============================================================================
|
|
159
|
-
/**
|
|
160
|
-
* Get the set of currently active component locks.
|
|
161
|
-
*
|
|
162
|
-
* @returns Set of component IDs that currently have scroll locked
|
|
163
|
-
*/
|
|
164
74
|
export function getActiveLocks() {
|
|
165
75
|
return new Set(lockState.activeLocks);
|
|
166
76
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Check if scrolling is currently locked.
|
|
169
|
-
*
|
|
170
|
-
* @returns true if any component has scroll locked
|
|
171
|
-
*/
|
|
172
77
|
export function isLocked() {
|
|
173
78
|
return lockState.locked;
|
|
174
79
|
}
|
|
175
|
-
/**
|
|
176
|
-
* Check if scrolling is locked by a specific component.
|
|
177
|
-
*
|
|
178
|
-
* @param componentId - Component identifier to check
|
|
179
|
-
* @returns true if this specific component has scroll locked
|
|
180
|
-
*/
|
|
181
80
|
export function isLockedBy(componentId) {
|
|
182
81
|
return lockState.activeLocks.has(componentId);
|
|
183
82
|
}
|
|
184
|
-
/**
|
|
185
|
-
* Get the complete lock state for debugging.
|
|
186
|
-
*
|
|
187
|
-
* @returns Current state including scroll position and active locks
|
|
188
|
-
*/
|
|
189
83
|
export function getLockState() {
|
|
190
84
|
return {
|
|
191
85
|
locked: lockState.locked,
|
|
@@ -193,4 +87,3 @@ export function getLockState() {
|
|
|
193
87
|
activeLocks: Array.from(lockState.activeLocks),
|
|
194
88
|
};
|
|
195
89
|
}
|
|
196
|
-
//# sourceMappingURL=scroll-lock.js.map
|
package/lib/utils/styles.d.ts
CHANGED
|
@@ -19,4 +19,3 @@ export declare function ensureStyles(shadowRoot: ShadowRoot, styleContent: Style
|
|
|
19
19
|
* @returns Space-separated class string
|
|
20
20
|
*/
|
|
21
21
|
export declare function buildClassList(...classes: (string | false | null | undefined)[]): string;
|
|
22
|
-
//# sourceMappingURL=styles.d.ts.map
|
package/lib/utils/styles.js
CHANGED
|
@@ -1,46 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSS Utilities for Ty Components
|
|
3
|
-
* Handles dynamic CSS loading into Shadow DOM
|
|
4
|
-
*/
|
|
5
|
-
/** Cache of loaded CSSStyleSheet objects */
|
|
6
1
|
const styleCache = new Map();
|
|
7
|
-
/**
|
|
8
|
-
* Ensure CSS is loaded into a shadow root
|
|
9
|
-
* Uses CSSStyleSheet API for efficient style sharing
|
|
10
|
-
*
|
|
11
|
-
* @param shadowRoot - The shadow root to attach styles to
|
|
12
|
-
* @param styleContent - Style content with CSS text and optional ID
|
|
13
|
-
*/
|
|
14
2
|
export function ensureStyles(shadowRoot, styleContent) {
|
|
15
3
|
const { css, id } = styleContent;
|
|
16
|
-
// Check cache first
|
|
17
4
|
let sheet;
|
|
18
5
|
if (id && styleCache.has(id)) {
|
|
19
6
|
sheet = styleCache.get(id);
|
|
20
7
|
}
|
|
21
8
|
else {
|
|
22
|
-
// Create new stylesheet
|
|
23
9
|
sheet = new CSSStyleSheet();
|
|
24
10
|
sheet.replaceSync(css);
|
|
25
|
-
// Cache it if ID provided
|
|
26
11
|
if (id) {
|
|
27
12
|
styleCache.set(id, sheet);
|
|
28
13
|
}
|
|
29
14
|
}
|
|
30
|
-
// Append only if not already adopted
|
|
31
15
|
const existing = shadowRoot.adoptedStyleSheets || [];
|
|
32
16
|
if (!existing.includes(sheet)) {
|
|
33
17
|
shadowRoot.adoptedStyleSheets = [...existing, sheet];
|
|
34
18
|
}
|
|
35
19
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Build CSS class list from properties
|
|
38
|
-
* Filters out falsy values
|
|
39
|
-
*
|
|
40
|
-
* @param classes - Array of class names or falsy values
|
|
41
|
-
* @returns Space-separated class string
|
|
42
|
-
*/
|
|
43
20
|
export function buildClassList(...classes) {
|
|
44
21
|
return classes.filter(Boolean).join(' ');
|
|
45
22
|
}
|
|
46
|
-
//# sourceMappingURL=styles.js.map
|
package/lib/version.d.ts
CHANGED
package/lib/version.js
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
// This file is generated from package.json by scripts/generate-version.js
|
|
3
|
-
// Run 'npm run generate:version' to regenerate
|
|
4
|
-
/**
|
|
5
|
-
* Current version of tyrell-components
|
|
6
|
-
*
|
|
7
|
-
* This is automatically synced with package.json during build.
|
|
8
|
-
* Use `npm version` to bump versions.
|
|
9
|
-
*/
|
|
10
|
-
export const VERSION = '1.0.0-RC13';
|
|
11
|
-
//# sourceMappingURL=version.js.map
|
|
1
|
+
export const VERSION = '1.0.0-RC14';
|