PluginProbe
Gutenberg / trunk
Gutenberg vtrunk
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | build/scripts/nux/index.js +26 -204 23.3.0 → trunk View file →
@@ -1,4 +1,5 @@
1 +(function() {
1 2 var wp;
2 3 (wp ||= {}).nux = (() => {
3 4 var __create = Object.create;
4 5 var __defProp = Object.defineProperty;
@@ -44,50 +45,8 @@
44 45 module.exports = window.wp.data;
45 46 }
46 47 });
47 48
48 - // package-external:@wordpress/compose
49 - var require_compose = __commonJS({
50 - "package-external:@wordpress/compose"(exports, module) {
51 - module.exports = window.wp.compose;
52 - }
53 - });
54 -
55 - // package-external:@wordpress/components
56 - var require_components = __commonJS({
57 - "package-external:@wordpress/components"(exports, module) {
58 - module.exports = window.wp.components;
59 - }
60 - });
61 -
62 - // package-external:@wordpress/i18n
63 - var require_i18n = __commonJS({
64 - "package-external:@wordpress/i18n"(exports, module) {
65 - module.exports = window.wp.i18n;
66 - }
67 - });
68 -
69 - // package-external:@wordpress/element
70 - var require_element = __commonJS({
71 - "package-external:@wordpress/element"(exports, module) {
72 - module.exports = window.wp.element;
73 - }
74 - });
75 -
76 - // package-external:@wordpress/primitives
77 - var require_primitives = __commonJS({
78 - "package-external:@wordpress/primitives"(exports, module) {
79 - module.exports = window.wp.primitives;
80 - }
81 - });
82 -
83 - // vendor-external:react/jsx-runtime
84 - var require_jsx_runtime = __commonJS({
85 - "vendor-external:react/jsx-runtime"(exports, module) {
86 - module.exports = window.ReactJSXRuntime;
87 - }
88 - });
89 -
90 49 // packages/nux/build-module/index.mjs
91 50 var index_exports = {};
92 51 __export(index_exports, {
93 52 DotTip: () => dot_tip_default,
@@ -95,42 +54,21 @@
95 54 });
96 55 var import_deprecated = __toESM(require_deprecated(), 1);
97 56
98 57 // packages/nux/build-module/store/index.mjs
99 - var import_data3 = __toESM(require_data(), 1);
58 + var import_data = __toESM(require_data(), 1);
100 59
101 60 // packages/nux/build-module/store/reducer.mjs
102 - var import_data = __toESM(require_data(), 1);
103 - function guides(state = [], action) {
104 - switch (action.type) {
105 - case "TRIGGER_GUIDE":
106 - return [...state, action.tipIds];
61 + var DEFAULT_STATE = {
62 + guides: [],
63 + preferences: {
64 + areTipsEnabled: false,
65 + dismissedTips: {}
107 66 }
67 + };
68 + function reducer(state = DEFAULT_STATE) {
108 69 return state;
109 70 }
110 - function areTipsEnabled(state = true, action) {
111 - switch (action.type) {
112 - case "DISABLE_TIPS":
113 - return false;
114 - case "ENABLE_TIPS":
115 - return true;
116 - }
117 - return state;
118 - }
119 - function dismissedTips(state = {}, action) {
120 - switch (action.type) {
121 - case "DISMISS_TIP":
122 - return {
123 - ...state,
124 - [action.id]: true
125 - };
126 - case "ENABLE_TIPS":
127 - return {};
128 - }
129 - return state;
130 - }
131 - var preferences = (0, import_data.combineReducers)({ areTipsEnabled, dismissedTips });
132 - var reducer_default = (0, import_data.combineReducers)({ guides, preferences });
133 71
134 72 // packages/nux/build-module/store/actions.mjs
135 73 var actions_exports = {};
136 74 __export(actions_exports, {
@@ -164,57 +102,32 @@
164 102
165 103 // packages/nux/build-module/store/selectors.mjs
166 104 var selectors_exports = {};
167 105 __export(selectors_exports, {
168 - areTipsEnabled: () => areTipsEnabled2,
106 + areTipsEnabled: () => areTipsEnabled,
169 107 getAssociatedGuide: () => getAssociatedGuide,
170 108 isTipVisible: () => isTipVisible
171 109 });
172 - var import_data2 = __toESM(require_data(), 1);
173 - var getAssociatedGuide = (0, import_data2.createSelector)(
174 - (state, tipId) => {
175 - for (const tipIds of state.guides) {
176 - if (tipIds.includes(tipId)) {
177 - const nonDismissedTips = tipIds.filter(
178 - (tId) => !Object.keys(
179 - state.preferences.dismissedTips
180 - ).includes(tId)
181 - );
182 - const [currentTipId = null, nextTipId = null] = nonDismissedTips;
183 - return { tipIds, currentTipId, nextTipId };
184 - }
185 - }
186 - return null;
187 - },
188 - (state) => [state.guides, state.preferences.dismissedTips]
189 - );
190 - function isTipVisible(state, tipId) {
191 - if (!state.preferences.areTipsEnabled) {
192 - return false;
193 - }
194 - if (state.preferences.dismissedTips?.hasOwnProperty(tipId)) {
195 - return false;
196 - }
197 - const associatedGuide = getAssociatedGuide(state, tipId);
198 - if (associatedGuide && associatedGuide.currentTipId !== tipId) {
199 - return false;
200 - }
201 - return true;
110 + function getAssociatedGuide() {
111 + return null;
202 112 }
203 - function areTipsEnabled2(state) {
204 - return state.preferences.areTipsEnabled;
113 + function isTipVisible() {
114 + return false;
205 115 }
116 + function areTipsEnabled() {
117 + return false;
118 + }
206 119
207 120 // packages/nux/build-module/store/index.mjs
208 121 var STORE_NAME = "core/nux";
209 - var store = (0, import_data3.createReduxStore)(STORE_NAME, {
210 - reducer: reducer_default,
122 + var store = (0, import_data.createReduxStore)(STORE_NAME, {
123 + reducer,
211 124 actions: actions_exports,
212 125 selectors: selectors_exports,
213 126 persist: ["preferences"]
214 127 });
215 - (0, import_data3.registerStore)(STORE_NAME, {
216 - reducer: reducer_default,
128 + (0, import_data.registerStore)(STORE_NAME, {
129 + reducer,
217 130 actions: actions_exports,
218 131 selectors: selectors_exports,
219 132 persist: ["preferences"]
220 133 });
@@ -219,104 +132,12 @@
219 132 persist: ["preferences"]
220 133 });
221 134
222 135 // packages/nux/build-module/components/dot-tip/index.mjs
223 - var import_compose = __toESM(require_compose(), 1);
224 - var import_components = __toESM(require_components(), 1);
225 - var import_i18n = __toESM(require_i18n(), 1);
226 - var import_data4 = __toESM(require_data(), 1);
227 - var import_element = __toESM(require_element(), 1);
228 -
229 - // packages/icons/build-module/library/close.mjs
230 - var import_primitives = __toESM(require_primitives(), 1);
231 - var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
232 - var close_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { d: "m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z" }) });
233 -
234 - // packages/nux/build-module/components/dot-tip/index.mjs
235 - var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
236 - function onClick(event) {
237 - event.stopPropagation();
136 + function DotTip() {
137 + return null;
238 138 }
239 - function DotTip({
240 - position = "middle right",
241 - children,
242 - isVisible,
243 - hasNextTip,
244 - onDismiss,
245 - onDisable
246 - }) {
247 - const anchorParent = (0, import_element.useRef)(null);
248 - const onFocusOutsideCallback = (0, import_element.useCallback)(
249 - (event) => {
250 - if (!anchorParent.current) {
251 - return;
252 - }
253 - if (anchorParent.current.contains(event.relatedTarget)) {
254 - return;
255 - }
256 - onDisable();
257 - },
258 - [onDisable, anchorParent]
259 - );
260 - if (!isVisible) {
261 - return null;
262 - }
263 - return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
264 - import_components.Popover,
265 - {
266 - className: "nux-dot-tip",
267 - position,
268 - focusOnMount: true,
269 - role: "dialog",
270 - "aria-label": (0, import_i18n.__)("Editor tips"),
271 - onClick,
272 - onFocusOutside: onFocusOutsideCallback,
273 - children: [
274 - /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children }),
275 - /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
276 - import_components.Button,
277 - {
278 - __next40pxDefaultSize: true,
279 - variant: "link",
280 - onClick: onDismiss,
281 - children: hasNextTip ? (0, import_i18n.__)("See next tip") : (0, import_i18n.__)("Got it")
282 - }
283 - ) }),
284 - /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
285 - import_components.Button,
286 - {
287 - size: "small",
288 - className: "nux-dot-tip__disable",
289 - icon: close_default,
290 - label: (0, import_i18n.__)("Disable tips"),
291 - onClick: onDisable
292 - }
293 - )
294 - ]
295 - }
296 - );
297 - }
298 - var dot_tip_default = (0, import_compose.compose)(
299 - (0, import_data4.withSelect)((select, { tipId }) => {
300 - const { isTipVisible: isTipVisible2, getAssociatedGuide: getAssociatedGuide2 } = select(store);
301 - const associatedGuide = getAssociatedGuide2(tipId);
302 - return {
303 - isVisible: isTipVisible2(tipId),
304 - hasNextTip: !!(associatedGuide && associatedGuide.nextTipId)
305 - };
306 - }),
307 - (0, import_data4.withDispatch)((dispatch, { tipId }) => {
308 - const { dismissTip: dismissTip2, disableTips: disableTips2 } = dispatch(store);
309 - return {
310 - onDismiss() {
311 - dismissTip2(tipId);
312 - },
313 - onDisable() {
314 - disableTips2();
315 - }
316 - };
317 - })
318 - )(DotTip);
139 + var dot_tip_default = DotTip;
319 140
320 141 // packages/nux/build-module/index.mjs
321 142 (0, import_deprecated.default)("wp.nux", {
322 143 since: "5.4",
@@ -324,6 +145,7 @@
324 145 version: "6.2"
325 146 });
326 147 return __toCommonJS(index_exports);
327 148 })();
328 -if(wp.nux&&typeof wp.nux==='object'){wp.nux=Object.assign({},wp.nux);}
149 +(window.wp ||= {}).nux = wp.nux;
150 +})();
329 151 //# sourceMappingURL=index.js.map