diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-02-03 21:27:21 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-02-03 21:27:21 -0400 |
commit | f8e4c8e3ffc6da224699db15d13a02ed8b4e49e5 (patch) | |
tree | f207d75a6a81f7137902b407ca8887a0ae1c475f /src/thing | |
parent | 9bfc97404a08fd5ad79a6a6fa2d46e5118acfc15 (diff) |
static page data
Diffstat (limited to 'src/thing')
-rw-r--r-- | src/thing/static-page.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/thing/static-page.js b/src/thing/static-page.js new file mode 100644 index 00000000..18e9d142 --- /dev/null +++ b/src/thing/static-page.js @@ -0,0 +1,52 @@ +import Thing from './thing.js'; + +import { + isBoolean, + isDirectory, + isName, + isString, +} from './validators.js'; + +export default class StaticPage extends Thing { + static [Thing.referenceType] = 'static'; + + static propertyDescriptors = { + // Update & expose + + name: { + flags: {update: true, expose: true}, + update: {validate: isName} + }, + + nameShort: { + flags: {update: true, expose: true}, + update: {validate: isName}, + + expose: { + dependencies: ['name'], + transform: (value, { name }) => value ?? name + } + }, + + directory: { + flags: {update: true, expose: true}, + update: {validate: isDirectory}, + expose: Thing.directoryExpose + }, + + content: { + flags: {update: true, expose: true}, + update: {validate: isString} + }, + + stylesheet: { + flags: {update: true, expose: true}, + update: {validate: isString} + }, + + showInNavigationBar: { + flags: {update: true, expose: true}, + update: {validate: isBoolean, default: true} + }, + }; +} |