1import { ThemeService, Theme } from '@primeuix/styled'; 2import { mergeKeys } from '@primeuix/utils'; 3import { FilterMatchMode } from '@primevue/core/api'; 4import BaseStyle from '@primevue/core/base/style'; 5import PrimeVueService from '@primevue/core/service'; 6import { inject, reactive, ref, watch } from 'vue'; 7 8function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 9function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } 10function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } 11function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; } 12function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } 13function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } 14var defaultOptions = { 15 ripple: false, 16 inputStyle: null, 17 inputVariant: null, 18 locale: { 19 startsWith: 'Starts with', 20 contains: 'Contains', 21 notContains: 'Not contains', 22 endsWith: 'Ends with', 23 equals: 'Equals', 24 notEquals: 'Not equals', 25 noFilter: 'No Filter', 26 lt: 'Less than', 27 lte: 'Less than or equal to', 28 gt: 'Greater than', 29 gte: 'Greater than or equal to', 30 dateIs: 'Date is', 31 dateIsNot: 'Date is not', 32 dateBefore: 'Date is before', 33 dateAfter: 'Date is after', 34 clear: 'Clear', 35 apply: 'Apply', 36 matchAll: 'Match All', 37 matchAny: 'Match Any', 38 addRule: 'Add Rule', 39 removeRule: 'Remove Rule', 40 accept: 'Yes', 41 reject: 'No', 42 choose: 'Choose', 43 upload: 'Upload', 44 cancel: 'Cancel', 45 completed: 'Completed', 46 pending: 'Pending', 47 fileSizeTypes: ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 48 dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], 49 dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], 50 dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], 51 monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], 52 monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], 53 chooseYear: 'Choose Year', 54 chooseMonth: 'Choose Month', 55 chooseDate: 'Choose Date', 56 prevDecade: 'Previous Decade', 57 nextDecade: 'Next Decade', 58 prevYear: 'Previous Year', 59 nextYear: 'Next Year', 60 prevMonth: 'Previous Month', 61 nextMonth: 'Next Month', 62 prevHour: 'Previous Hour', 63 nextHour: 'Next Hour', 64 prevMinute: 'Previous Minute', 65 nextMinute: 'Next Minute', 66 prevSecond: 'Previous Second', 67 nextSecond: 'Next Second', 68 am: 'am', 69 pm: 'pm', 70 today: 'Today', 71 weekHeader: 'Wk', 72 firstDayOfWeek: 0, 73 showMonthAfterYear: false, 74 dateFormat: 'mm/dd/yy', 75 weak: 'Weak', 76 medium: 'Medium', 77 strong: 'Strong', 78 passwordPrompt: 'Enter a password', 79 emptyFilterMessage: 'No results found', 80 searchMessage: '{0} results are available', 81 selectionMessage: '{0} items selected', 82 emptySelectionMessage: 'No selected item', 83 emptySearchMessage: 'No results found', 84 fileChosenMessage: '{0} files', 85 noFileChosenMessage: 'No file chosen', 86 emptyMessage: 'No available options', 87 aria: { 88 trueLabel: 'True', 89 falseLabel: 'False', 90 nullLabel: 'Not Selected', 91 star: '1 star', 92 stars: '{star} stars', 93 selectAll: 'All items selected', 94 unselectAll: 'All items unselected', 95 close: 'Close', 96 previous: 'Previous', 97 next: 'Next', 98 navigation: 'Navigation', 99 scrollTop: 'Scroll Top', 100 moveTop: 'Move Top', 101 moveUp: 'Move Up', 102 moveDown: 'Move Down', 103 moveBottom: 'Move Bottom', 104 moveToTarget: 'Move to Target', 105 moveToSource: 'Move to Source', 106 moveAllToTarget: 'Move All to Target', 107 moveAllToSource: 'Move All to Source', 108 pageLabel: 'Page {page}', 109 firstPageLabel: 'First Page', 110 lastPageLabel: 'Last Page', 111 nextPageLabel: 'Next Page', 112 prevPageLabel: 'Previous Page', 113 rowsPerPageLabel: 'Rows per page', 114 jumpToPageDropdownLabel: 'Jump to Page Dropdown', 115 jumpToPageInputLabel: 'Jump to Page Input', 116 selectRow: 'Row Selected', 117 unselectRow: 'Row Unselected', 118 expandRow: 'Row Expanded', 119 collapseRow: 'Row Collapsed', 120 showFilterMenu: 'Show Filter Menu', 121 hideFilterMenu: 'Hide Filter Menu', 122 filterOperator: 'Filter Operator', 123 filterConstraint: 'Filter Constraint', 124 editRow: 'Row Edit', 125 saveEdit: 'Save Edit', 126 cancelEdit: 'Cancel Edit', 127 listView: 'List View', 128 gridView: 'Grid View', 129 slide: 'Slide', 130 slideNumber: '{slideNumber}', 131 zoomImage: 'Zoom Image', 132 zoomIn: 'Zoom In', 133 zoomOut: 'Zoom Out', 134 rotateRight: 'Rotate Right', 135 rotateLeft: 'Rotate Left', 136 listLabel: 'Option List' 137 } 138 }, 139 filterMatchModeOptions: { 140 text: [FilterMatchMode.STARTS_WITH, FilterMatchMode.CONTAINS, FilterMatchMode.NOT_CONTAINS, FilterMatchMode.ENDS_WITH, FilterMatchMode.EQUALS, FilterMatchMode.NOT_EQUALS], 141 numeric: [FilterMatchMode.EQUALS, FilterMatchMode.NOT_EQUALS, FilterMatchMode.LESS_THAN, FilterMatchMode.LESS_THAN_OR_EQUAL_TO, FilterMatchMode.GREATER_THAN, FilterMatchMode.GREATER_THAN_OR_EQUAL_TO], 142 date: [FilterMatchMode.DATE_IS, FilterMatchMode.DATE_IS_NOT, FilterMatchMode.DATE_BEFORE, FilterMatchMode.DATE_AFTER] 143 }, 144 zIndex: { 145 modal: 1100, 146 overlay: 1000, 147 menu: 1000, 148 tooltip: 1100 149 }, 150 theme: undefined, 151 unstyled: false, 152 pt: undefined, 153 ptOptions: { 154 mergeSections: true, 155 mergeProps: false 156 }, 157 csp: { 158 nonce: undefined 159 } 160}; 161var PrimeVueSymbol = Symbol(); 162function usePrimeVue() { 163 var PrimeVue = inject(PrimeVueSymbol); 164 if (!PrimeVue) { 165 throw new Error('PrimeVue is not installed!'); 166 } 167 return PrimeVue; 168} 169function setup(app, options) { 170 var PrimeVue = { 171 config: reactive(options) 172 }; 173 app.config.globalProperties.$primevue = PrimeVue; 174 app.provide(PrimeVueSymbol, PrimeVue); 175 clearConfig(); 176 setupConfig(app, PrimeVue); 177 return PrimeVue; 178} 179var stopWatchers = []; 180function clearConfig() { 181 ThemeService.clear();
182 stopWatchers.forEach(function (fn) { 183 return fn === null || fn === void 0 ? void 0 : fn(); 184 }); 185 stopWatchers = []; 186} 187function setupConfig(app, PrimeVue) { 188 var isThemeChanged = ref(false); 189 190 /*** Methods and Services ***/ 191 var loadCommonTheme = function loadCommonTheme() { 192 var _PrimeVue$config; 193 if (((_PrimeVue$config = PrimeVue.config) === null || _PrimeVue$config === void 0 ? void 0 : _PrimeVue$config.theme) === 'none') return; 194 195 // common 196 if (!Theme.isStyleNameLoaded('common')) { 197 var _BaseStyle$getCommonT, _PrimeVue$config2; 198 var _ref = ((_BaseStyle$getCommonT = BaseStyle.getCommonTheme) === null || _BaseStyle$getCommonT === void 0 ? void 0 : _BaseStyle$getCommonT.call(BaseStyle)) || {}, 199 primitive = _ref.primitive, 200 semantic = _ref.semantic, 201 global = _ref.global, 202 style = _ref.style; 203 var styleOptions = { 204 nonce: (_PrimeVue$config2 = PrimeVue.config) === null || _PrimeVue$config2 === void 0 || (_PrimeVue$config2 = _PrimeVue$config2.csp) === null || _PrimeVue$config2 === void 0 ? void 0 : _PrimeVue$config2.nonce 205 }; 206 BaseStyle.load(primitive === null || primitive === void 0 ? void 0 : primitive.css, _objectSpread({ 207 name: 'primitive-variables' 208 }, styleOptions)); 209 BaseStyle.load(semantic === null || semantic === void 0 ? void 0 : semantic.css, _objectSpread({ 210 name: 'semantic-variables' 211 }, styleOptions)); 212 BaseStyle.load(global === null || global === void 0 ? void 0 : global.css, _objectSpread({ 213 name: 'global-variables' 214 }, styleOptions)); 215 BaseStyle.loadStyle(_objectSpread({ 216 name: 'global-style' 217 }, styleOptions), style); 218 Theme.setLoadedStyleName('common'); 219 } 220 }; 221 ThemeService.on('theme:change', function (newTheme) { 222 if (!isThemeChanged.value) { 223 app.config.globalProperties.$primevue.config.theme = newTheme; 224 isThemeChanged.value = true; 225 } 226 }); 227 228 /*** Watchers ***/ 229 var stopConfigWatcher = watch(PrimeVue.config, function (newValue, oldValue) { 230 PrimeVueService.emit('config:change', { 231 newValue: newValue, 232 oldValue: oldValue 233 }); 234 }, { 235 immediate: true, 236 deep: true 237 }); 238 var stopRippleWatcher = watch(function () { 239 return PrimeVue.config.ripple; 240 }, function (newValue, oldValue) { 241 PrimeVueService.emit('config:ripple:change', { 242 newValue: newValue, 243 oldValue: oldValue 244 }); 245 }, { 246 immediate: true, 247 deep: true 248 }); 249 var stopThemeWatcher = watch(function () { 250 return PrimeVue.config.theme; 251 }, function (newValue, oldValue) { 252 if (!isThemeChanged.value) { 253 Theme.setTheme(newValue); 254 } 255 if (!PrimeVue.config.unstyled) { 256 loadCommonTheme(); 257 } 258 isThemeChanged.value = false; 259 PrimeVueService.emit('config:theme:change', { 260 newValue: newValue, 261 oldValue: oldValue 262 }); 263 }, { 264 immediate: true, 265 deep: false 266 }); 267 var stopUnstyledWatcher = watch(function () { 268 return PrimeVue.config.unstyled; 269 }, function (newValue, oldValue) { 270 if (!newValue && PrimeVue.config.theme) { 271 loadCommonTheme(); 272 } 273 PrimeVueService.emit('config:unstyled:change', { 274 newValue: newValue, 275 oldValue: oldValue 276 }); 277 }, { 278 immediate: true, 279 deep: true 280 }); 281 stopWatchers.push(stopConfigWatcher); 282 stopWatchers.push(stopRippleWatcher); 283 stopWatchers.push(stopThemeWatcher); 284 stopWatchers.push(stopUnstyledWatcher); 285} 286var PrimeVue = { 287 install: function install(app, options) { 288 var configOptions = mergeKeys(defaultOptions, options); 289 setup(app, configOptions); 290 } 291}; 292 293export { clearConfig, PrimeVue as default, defaultOptions, setup, setupConfig, usePrimeVue }; 294//# sourceMappingURL=index.mjs.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.