@nordcraft/std-lib 1.0.77 → 1.0.79
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.
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { THEME_COOKIE_NAME } from '@nordcraft/core/dist/styling/theme.const';
|
|
2
|
+
const ONE_YEAR = 60 * 60 * 24 * 365;
|
|
3
|
+
const handler = async function ([name], ctx) {
|
|
4
|
+
if (typeof name !== 'string' && name !== null) {
|
|
5
|
+
ctx.triggerActionEvent('Error', new Error('The "Name" argument must be a string or null'));
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const shouldDelete = name === null || name === '';
|
|
9
|
+
try {
|
|
10
|
+
// Note that the cookie store API is used with event listeners to update
|
|
11
|
+
// the theme signal for reactive updates.
|
|
12
|
+
await cookieStore.set({
|
|
13
|
+
name: THEME_COOKIE_NAME,
|
|
14
|
+
value: name ?? '',
|
|
15
|
+
path: '/',
|
|
16
|
+
expires: shouldDelete ? 0 : Date.now() + ONE_YEAR,
|
|
17
|
+
sameSite: 'none',
|
|
18
|
+
});
|
|
19
|
+
ctx.triggerActionEvent('Success', undefined);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
ctx.triggerActionEvent('Error', error);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export default handler;
|
|
26
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../actions/setTheme/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAA;AAG5E,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAA;AAEnC,MAAM,OAAO,GAAkB,KAAK,WAAW,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE;IAC1D,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAC9C,GAAG,CAAC,kBAAkB,CACpB,OAAO,EACP,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAC1D,CAAA;QACD,OAAM;IACR,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE,CAAA;IACjD,IAAI,CAAC;QACH,wEAAwE;QACxE,yCAAyC;QACzC,MAAM,WAAW,CAAC,GAAG,CAAC;YACpB,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,IAAI,IAAI,EAAE;YACjB,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ;YACjD,QAAQ,EAAE,MAAM;SACjB,CAAC,CAAA;QACF,GAAG,CAAC,kBAAkB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE,KAAc,CAAC,CAAA;IACjD,CAAC;AAAA,CACF,CAAA;AAED,eAAe,OAAO,CAAA"}
|
package/dist/actions.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as deleteFromSessionStorage from "./actions/deleteFromSessionStorage/handler";
|
|
2
2
|
import * as saveToLocalStorage from "./actions/saveToLocalStorage/handler";
|
|
3
3
|
import * as interval from "./actions/interval/handler";
|
|
4
|
+
import * as setTheme from "./actions/setTheme/handler";
|
|
4
5
|
import * as deleteFromLocalStorage from "./actions/deleteFromLocalStorage/handler";
|
|
5
6
|
import * as setSessionCookies from "./actions/setSessionCookies/handler";
|
|
6
7
|
import * as clearLocalStorage from "./actions/clearLocalStorage/handler";
|
|
@@ -16,4 +17,4 @@ import * as preventDefault from "./actions/preventDefault/handler";
|
|
|
16
17
|
import * as share from "./actions/share/handler";
|
|
17
18
|
import * as sleep from "./actions/sleep/handler";
|
|
18
19
|
import * as gotToURL from "./actions/gotToURL/handler";
|
|
19
|
-
export { deleteFromSessionStorage, saveToLocalStorage, interval, deleteFromLocalStorage, setSessionCookies, clearLocalStorage, clearSessionStorage, logToConsole, setHttpOnlyCookie, saveToSessionStorage, copyToClipboard, stopPropagation, setCookie, focus, preventDefault, share, sleep, gotToURL };
|
|
20
|
+
export { deleteFromSessionStorage, saveToLocalStorage, interval, setTheme, deleteFromLocalStorage, setSessionCookies, clearLocalStorage, clearSessionStorage, logToConsole, setHttpOnlyCookie, saveToSessionStorage, copyToClipboard, stopPropagation, setCookie, focus, preventDefault, share, sleep, gotToURL };
|
package/dist/actions.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as deleteFromSessionStorage from "./actions/deleteFromSessionStorage/handler";
|
|
2
2
|
import * as saveToLocalStorage from "./actions/saveToLocalStorage/handler";
|
|
3
3
|
import * as interval from "./actions/interval/handler";
|
|
4
|
+
import * as setTheme from "./actions/setTheme/handler";
|
|
4
5
|
import * as deleteFromLocalStorage from "./actions/deleteFromLocalStorage/handler";
|
|
5
6
|
import * as setSessionCookies from "./actions/setSessionCookies/handler";
|
|
6
7
|
import * as clearLocalStorage from "./actions/clearLocalStorage/handler";
|
|
@@ -16,5 +17,5 @@ import * as preventDefault from "./actions/preventDefault/handler";
|
|
|
16
17
|
import * as share from "./actions/share/handler";
|
|
17
18
|
import * as sleep from "./actions/sleep/handler";
|
|
18
19
|
import * as gotToURL from "./actions/gotToURL/handler";
|
|
19
|
-
export { deleteFromSessionStorage, saveToLocalStorage, interval, deleteFromLocalStorage, setSessionCookies, clearLocalStorage, clearSessionStorage, logToConsole, setHttpOnlyCookie, saveToSessionStorage, copyToClipboard, stopPropagation, setCookie, focus, preventDefault, share, sleep, gotToURL };
|
|
20
|
+
export { deleteFromSessionStorage, saveToLocalStorage, interval, setTheme, deleteFromLocalStorage, setSessionCookies, clearLocalStorage, clearSessionStorage, logToConsole, setHttpOnlyCookie, saveToSessionStorage, copyToClipboard, stopPropagation, setCookie, focus, preventDefault, share, sleep, gotToURL };
|
|
20
21
|
//# sourceMappingURL=actions.js.map
|
package/dist/actions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,wBAAwB,MAAM,4CAA4C,CAAA;AACtF,OAAO,KAAK,kBAAkB,MAAM,sCAAsC,CAAA;AAC1E,OAAO,KAAK,QAAQ,MAAM,4BAA4B,CAAA;AACtD,OAAO,KAAK,sBAAsB,MAAM,0CAA0C,CAAA;AAClF,OAAO,KAAK,iBAAiB,MAAM,qCAAqC,CAAA;AACxE,OAAO,KAAK,iBAAiB,MAAM,qCAAqC,CAAA;AACxE,OAAO,KAAK,mBAAmB,MAAM,uCAAuC,CAAA;AAC5E,OAAO,KAAK,YAAY,MAAM,gCAAgC,CAAA;AAC9D,OAAO,KAAK,iBAAiB,MAAM,qCAAqC,CAAA;AACxE,OAAO,KAAK,oBAAoB,MAAM,wCAAwC,CAAA;AAC9E,OAAO,KAAK,eAAe,MAAM,mCAAmC,CAAA;AACpE,OAAO,KAAK,eAAe,MAAM,mCAAmC,CAAA;AACpE,OAAO,KAAK,SAAS,MAAM,6BAA6B,CAAA;AACxD,OAAO,KAAK,KAAK,MAAM,yBAAyB,CAAA;AAChD,OAAO,KAAK,cAAc,MAAM,kCAAkC,CAAA;AAClE,OAAO,KAAK,KAAK,MAAM,yBAAyB,CAAA;AAChD,OAAO,KAAK,KAAK,MAAM,yBAAyB,CAAA;AAChD,OAAO,KAAK,QAAQ,MAAM,4BAA4B,CAAA;AAEtD,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,QAAQ,EACR,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,SAAS,EAC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KAAK,EACL,KAAK,EACL,QAAQ,EACT,CAAA"}
|
package/dist/lib.ts
CHANGED
|
@@ -3074,6 +3074,35 @@
|
|
|
3074
3074
|
}
|
|
3075
3075
|
}
|
|
3076
3076
|
},
|
|
3077
|
+
"@toddle/setTheme": {
|
|
3078
|
+
"$schema": "../../schemas/libAction.schema.json",
|
|
3079
|
+
"name": "Set theme",
|
|
3080
|
+
"description": "Sets the application theme. Call with null to reset. This action automatically sets a theme-cookie so the theme persists across sessions. Note: This action is currently only supported when the \"style-variables-v2\" feature flag is enabled.",
|
|
3081
|
+
"group": "theming",
|
|
3082
|
+
"arguments": [
|
|
3083
|
+
{
|
|
3084
|
+
"name": "Name",
|
|
3085
|
+
"description": "The name of the theme.",
|
|
3086
|
+
"type": {
|
|
3087
|
+
"type": "String"
|
|
3088
|
+
},
|
|
3089
|
+
"formula": {
|
|
3090
|
+
"type": "value",
|
|
3091
|
+
"value": ""
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3094
|
+
],
|
|
3095
|
+
"events": {
|
|
3096
|
+
"Success": {
|
|
3097
|
+
"description": "This event is triggered once the theme has been set.",
|
|
3098
|
+
"actions": []
|
|
3099
|
+
},
|
|
3100
|
+
"Error": {
|
|
3101
|
+
"description": "This event is triggered if the theme could not be set. Usually due to an invalid theme name or a cookie issue.",
|
|
3102
|
+
"actions": []
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
},
|
|
3077
3106
|
"@toddle/deleteFromLocalStorage": {
|
|
3078
3107
|
"$schema": "../../schemas/libAction.schema.json",
|
|
3079
3108
|
"name": "Delete from local storage",
|
package/package.json
CHANGED
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"homepage": "https://github.com/nordcraftengine/nordcraft",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/nordcraftengine/nordcraft.git",
|
|
9
|
+
"directory": "packages/lib"
|
|
10
|
+
},
|
|
6
11
|
"dependencies": {
|
|
7
12
|
"fast-deep-equal": "3.1.3",
|
|
8
|
-
"@nordcraft/core": "1.0.
|
|
13
|
+
"@nordcraft/core": "1.0.79"
|
|
9
14
|
},
|
|
10
15
|
"devDependencies": {
|
|
11
16
|
"@types/node": "24.3.1",
|
|
12
|
-
"@happy-dom/global-registrator": "20.0.11",
|
|
13
|
-
"happy-dom": "20.0.10",
|
|
14
17
|
"jsonschema": "1.5.0"
|
|
15
18
|
},
|
|
16
19
|
"scripts": {
|
|
@@ -20,5 +23,5 @@
|
|
|
20
23
|
"watch": "tsgo --noEmit -w"
|
|
21
24
|
},
|
|
22
25
|
"files": ["dist"],
|
|
23
|
-
"version": "1.0.
|
|
26
|
+
"version": "1.0.79"
|
|
24
27
|
}
|