Compare commits

..

No commits in common. "58e8688bf71c67f20785a2b85d1811b6d7b5d5e1" and "4f830b07905a90a34a72192e4afe9e856ad70ed8" have entirely different histories.

13 changed files with 490 additions and 4092 deletions

View file

@ -1,11 +1,11 @@
/**
* @author fenris
*/
declare type int = number;
type int = number;
/**
* @author fenris
*/
declare type float = number;
type float = number;
declare class Buffer {
constructor(x: string, modifier?: string);
toString(modifier?: string): string;
@ -19,7 +19,7 @@ declare namespace lib_plankton.base {
/**
* @author fenris
*/
declare type type_pseudopointer<type_value> = {
type type_pseudopointer<type_value> = {
value: type_value;
};
/**
@ -1969,7 +1969,7 @@ declare namespace lib_plankton.storage.memory {
clear(): Promise<void>;
write(key: any, value: any): Promise<boolean>;
delete(key: any): Promise<void>;
read(key: any): Promise<type_item>;
read(key: any): Promise<Awaited<type_item>>;
search(term: any): Promise<{
key: string;
preview: string;
@ -2037,513 +2037,6 @@ declare namespace lib_plankton.storage.localstorage {
}[]>;
}
}
declare namespace lib_plankton.shape {
/**
* @todo
*/
type type_jsonschema = any;
/**
* @todo
*/
type type_oas_schema = any;
/**
* @author fenris
*/
type type_inspection = {
flaws: Array<string>;
sub: Array<{
position: string;
inspection: type_inspection;
}>;
};
/**
* @author fenris
*/
function inspection_create(): type_inspection;
/**
* @author fenris
*/
function inspection_add(main: type_inspection, flaw: string): void;
/**
* @author fenris
*/
function inspection_extend(main: type_inspection, prefix: string, sub: type_inspection): void;
/**
*/
type type_shape = {
kind: string;
parameters: Record<string, any>;
};
/**
* @author fenris
*/
type type_logic = {
inspect: ((sub_inspect: ((shape: type_shape, value: any) => type_inspection), value: any) => type_inspection);
show: ((sub_show: ((shape: type_shape) => string)) => string);
to_typescript_type: ((sub_to_typescript_type: ((shape: type_shape) => string)) => string);
to_jsonschema: ((sub_to_json_schema: ((shape: type_shape) => type_jsonschema)) => type_jsonschema);
to_oas_schema: ((sub_to_oas_schema: ((shape: type_shape) => type_oas_schema)) => type_oas_schema);
example: ((sub_example: ((shape: type_shape) => any)) => any);
};
/**
*/
function inspect(shape: type_shape, value: any): type_inspection;
/**
*/
function inspect_flat(shape: type_shape, value: any): Array<string>;
/**
*/
function show(shape: type_shape): string;
/**
*/
function to_typescript_type(shape: type_shape): string;
/**
*/
function to_jsonschema(shape: type_shape): type_jsonschema;
/**
*/
function to_oas_schema(shape: type_shape): type_oas_schema;
/**
*/
function example(shape: type_shape): any;
/**
*/
function register<type_parameters, type_subject>(name: string, construct: ((parameters: type_parameters) => type_subject), logic: ((subject: type_subject) => type_logic)): void;
}
declare namespace lib_plankton.shape.any {
/**
*/
type type_subject = {};
/**
*/
export function make(options?: {}): type_subject;
export {};
}
declare namespace lib_plankton.shape.null_ {
/**
*/
type type_subject = {};
/**
*/
export function make(options?: {}): type_subject;
export {};
}
declare namespace lib_plankton.shape.boolean {
/**
*/
type type_subject = {
soft: boolean;
defaultvalue: lib_plankton.pod.type_pod<any>;
description: lib_plankton.pod.type_pod<string>;
};
/**
*/
export function make(options?: {
soft?: boolean;
defaultvalue?: (null | boolean);
description?: string;
}): type_subject;
export {};
}
declare namespace lib_plankton.shape.integer {
/**
*/
type type_subject = {
soft: boolean;
defaultvalue: lib_plankton.pod.type_pod<any>;
description: lib_plankton.pod.type_pod<string>;
minimum: lib_plankton.pod.type_pod<int>;
maximum: lib_plankton.pod.type_pod<int>;
};
/**
*/
export function make(options?: {
soft?: boolean;
defaultvalue?: (null | int);
description?: string;
minimum?: int;
maximum?: int;
}): type_subject;
export {};
}
declare namespace lib_plankton.shape.float {
/**
*/
type type_subject = {
soft: boolean;
defaultvalue: lib_plankton.pod.type_pod<any>;
description: lib_plankton.pod.type_pod<string>;
minimum: lib_plankton.pod.type_pod<float>;
maximum: lib_plankton.pod.type_pod<float>;
};
/**
*/
export function make(options?: {
soft?: boolean;
defaultvalue?: (null | float);
description?: string;
minimum?: float;
maximum?: float;
}): type_subject;
export {};
}
declare namespace lib_plankton.shape.string {
/**
*/
type type_subject = {
soft: boolean;
defaultvalue: lib_plankton.pod.type_pod<any>;
description: lib_plankton.pod.type_pod<string>;
pattern: lib_plankton.pod.type_pod<string>;
min_length: lib_plankton.pod.type_pod<int>;
max_length: lib_plankton.pod.type_pod<int>;
};
/**
*/
export function make(options?: {
soft?: boolean;
defaultvalue?: (null | int);
description?: string;
pattern?: string;
min_length?: int;
max_length?: int;
}): type_subject;
export {};
}
declare namespace lib_plankton.shape.email {
/**
*/
type type_subject = {
core: type_shape;
};
/**
*/
export function make(options?: {
soft?: boolean;
defaultvalue?: (null | int);
description?: string;
}): type_subject;
export {};
}
declare namespace lib_plankton.shape.list_ {
/**
*/
type type_subject = {
shape_element: type_shape;
soft: boolean;
defaultvalue: lib_plankton.pod.type_pod<any>;
description: lib_plankton.pod.type_pod<string>;
};
/**
*/
export function make(shape_element: type_shape, options?: {
soft?: boolean;
defaultvalue?: any;
description?: string;
}): type_subject;
export {};
}
declare namespace lib_plankton.shape.map {
/**
*/
type type_subject = {
shape_key: type_shape;
shape_value: type_shape;
soft: boolean;
defaultvalue: lib_plankton.pod.type_pod<any>;
description: lib_plankton.pod.type_pod<string>;
};
/**
*/
export function make(shape_key: type_shape, shape_value: type_shape, options?: {
soft?: boolean;
defaultvalue?: any;
description?: string;
}): type_subject;
export {};
}
declare namespace lib_plankton.shape.record {
/**
*/
type type_field = {
name: string;
shape: type_shape;
required: boolean;
};
/**
*/
type type_subject = {
fields: Array<type_field>;
soft: boolean;
defaultvalue: lib_plankton.pod.type_pod<any>;
description: lib_plankton.pod.type_pod<string>;
};
/**
*/
export function make(fields_raw: Array<{
name: string;
shape: type_shape;
required?: boolean;
}>, options?: {
soft?: boolean;
defaultvalue?: any;
description?: string;
}): type_subject;
export {};
}
declare namespace lib_plankton.www_form {
/**
*/
type type_source = Record<string, string>;
/**
*/
type type_target = string;
/**
* @author fenris
*/
function encode(source: type_source): type_target;
/**
* @author fenris
*/
function decode(target: type_target): type_source;
}
declare namespace lib_plankton.www_form {
/**
* @author fenris
*/
class class_www_form implements lib_plankton.code.interface_code<type_source, type_target> {
/**
* @author fenris
*/
constructor();
/**
* @implementation
* @author fenris
*/
encode(source: type_source): type_target;
/**
* @implementation
* @author fenris
*/
decode(target: type_target): type_source;
}
}
declare namespace lib_plankton.url {
/**
* @author fenris
*/
type type_url = {
scheme: (null | string);
host: (null | string);
username: (null | string);
password: (null | string);
port: (null | int);
path: (null | string);
query: (null | string);
hash: (null | string);
};
}
declare namespace lib_plankton.url {
/**
* @author fenris
*/
function encode(url: type_url): string;
/**
* @author fenris
* @todo arguments
*/
function decode(url_raw: string): type_url;
/**
* @author fenris
*/
function implementation_code(): lib_plankton.code.type_code<type_url, string>;
}
declare namespace lib_plankton.url {
/**
* @author fenris
*/
class class_url implements lib_plankton.code.interface_code<type_url, string> {
/**
* @author fenris
*/
constructor();
/**
* @implementation
* @author fenris
*/
encode(x: any): string;
/**
* @implementation
* @author fenris
*/
decode(x: string): any;
}
}
declare namespace lib_plankton.random {
/**
* @author fenris
*/
type type_state = {
builtin: boolean;
seed?: int;
};
/**
* @author fenris
*/
function state_push(state: type_state): void;
/**
* @author fenris
*/
function state_pop(): type_state;
/**
* returns a random floating point number in the interval [0,1[
*
* @author fenris
*/
function generate_unit(): float;
/**
* returns a random boolean value
*
* @param {float} [probability] the probability for the return-value "true"; default: 0.5
* @author fenris
*/
function generate_boolean(options?: {
probability?: float;
}): boolean;
/**
* returns a random integer number in the interval [a,b]
*
* @param {int} [minimum] the left side of the halfopen interval (i.e. the smallest included value in the range)
* @param {int} [minimum] the right side of the halfopen interval (i.e. the smallest excluded value in the range)
* @author fenris
*/
function generate_integer(options?: {
minimum?: int;
maximum?: int;
}): int;
var generate_int: typeof generate_integer;
/**
* returns a random floating point number in the given interval
*
* @author fenris
*/
function generate_float(options?: {
minimum?: int;
maximum?: int;
}): float;
/**
* returns a random date
*
* @author fenris
*/
function generate_date(options?: {
minimum?: Date;
maximum?: Date;
}): Date;
/**
* @author fenris
*/
function generate_hexdigit(): string;
/**
* generates a random string with an optional prefix
*
* @author fenris
*/
function generate_string(options?: {
length?: int;
}): string;
/**
* chooses a value randomly from a list of values with weights (a higher weight means a higher probability to be chosen)
*
* @author fenris
*/
function choose_weighted<type_value>(sets: Array<{
weight: float;
value: type_value;
}>): type_value;
/**
* chooses a value randomly from a list of values with equal probabilities
*
* @author fenris
*/
function choose_uniformly<type_value>(values: Array<type_value>): type_value;
/**
* @author fenris
*/
function shuffle<type_element>(list: Array<type_element>): Array<type_element>;
/**
* @author fenris
*/
function generate_vowel(): string;
/**
* @author fenris
*/
function generate_halfvowel(): string;
/**
* @author fenris
*/
function generate_consonant(): string;
/**
* @author fenris
*/
function generate_letter(): string;
/**
* @author fenris
*/
function generate_syllable(): string;
/**
* @author fenris
*/
function generate_word(options?: {
syllable_count_minimum?: int;
syllable_count_maximum?: int;
}): string;
/**
* @author fenris
*/
function generate_text(options?: {
word_count?: int;
}): string;
/**
* @author fenris
*/
function generate_city(): string;
/**
* @author fenris
*/
function generate_street(): string;
/**
* @author fenris
*/
function generate_guid(options?: {
with_braces?: boolean;
}): string;
/**
* @author fenris
*/
function generate_url(): string;
/**
* @author fenris
*/
function generate_email_address(): string;
/**
* @author fenris
*/
function generate_telephone_number(): string;
/**
* @author fenris
*/
function generate_time(): any;
/**
* @author fenris
* @deprecated
* @todo remove
*/
function generate_for_shape(shape: any): any;
/**
* @author fenris
*/
}
declare namespace lib_plankton.map {
/**
*/
@ -3282,9 +2775,6 @@ declare namespace lib_plankton.color {
/**
*/
function make_rgb(model_rgb: type_model_rgb): type_color;
/**
*/
function from_hex(hex: string): type_color;
/**
*/
function to_hsv(color: type_color): type_model_hsv;
@ -3543,6 +3033,57 @@ declare namespace lib_plankton.http {
implementation?: ("fetch" | "http_module");
}): Promise<type_response>;
}
declare namespace lib_plankton.url {
/**
* @author fenris
*/
type type_url = {
scheme: (null | string);
host: (null | string);
username: (null | string);
password: (null | string);
port: (null | int);
path: (null | string);
query: (null | string);
hash: (null | string);
};
}
declare namespace lib_plankton.url {
/**
* @author fenris
*/
function encode(url: type_url): string;
/**
* @author fenris
* @todo arguments
*/
function decode(url_raw: string): type_url;
/**
* @author fenris
*/
function implementation_code(): lib_plankton.code.type_code<type_url, string>;
}
declare namespace lib_plankton.url {
/**
* @author fenris
*/
class class_url implements lib_plankton.code.interface_code<type_url, string> {
/**
* @author fenris
*/
constructor();
/**
* @implementation
* @author fenris
*/
encode(x: any): string;
/**
* @implementation
* @author fenris
*/
decode(x: string): any;
}
}
declare namespace lib_plankton.pit {
/**
*/
@ -3716,6 +3257,43 @@ declare namespace lib_plankton.pit {
omit_date?: boolean;
}): string;
}
declare namespace lib_plankton.www_form {
/**
*/
type type_source = Record<string, string>;
/**
*/
type type_target = string;
/**
* @author fenris
*/
function encode(source: type_source): type_target;
/**
* @author fenris
*/
function decode(target: type_target): type_source;
}
declare namespace lib_plankton.www_form {
/**
* @author fenris
*/
class class_www_form implements lib_plankton.code.interface_code<type_source, type_target> {
/**
* @author fenris
*/
constructor();
/**
* @implementation
* @author fenris
*/
encode(source: type_source): type_target;
/**
* @implementation
* @author fenris
*/
decode(target: type_target): type_source;
}
}
declare namespace lib_plankton.translate {
/**
* @author fenris
@ -3858,191 +3436,6 @@ declare namespace lib_plankton.zoo_page {
export function start(): void;
export {};
}
declare namespace lib_plankton.zoo_widget {
/**
*/
interface interface_widget {
/**
*/
load(target_element: HTMLElement): Promise<void>;
}
}
declare namespace lib_plankton.zoo_widget {
/**
*/
class class_empty implements interface_widget {
/**
*/
constructor();
/**
*/
load(target_element: HTMLElement): Promise<void>;
}
}
declare namespace lib_plankton.zoo_widget {
/**
*/
class class_string implements interface_widget {
/**
*/
private content;
/**
*/
constructor(content: string);
/**
*/
load(target_element: HTMLElement): Promise<void>;
}
}
declare namespace lib_plankton.zoo_widget {
/**
*/
class class_link implements interface_widget {
/**
*/
private target;
/**
*/
private text;
/**
*/
private open_in_new_tab;
/**
*/
constructor(target: string, { "text": text, "open_in_new_tab": open_in_new_tab, }?: {
text?: (null | string);
open_in_new_tab?: boolean;
});
/**
*/
load(target_element: HTMLElement): Promise<void>;
}
}
declare namespace lib_plankton.zoo_widget {
/**
*/
class class_text implements interface_widget {
/**
*/
private paragraphs;
/**
*/
constructor(paragraphs: Array<string>);
/**
*/
load(target_element: HTMLElement): Promise<void>;
}
}
declare namespace lib_plankton.zoo_widget {
/**
*/
class class_list implements interface_widget {
/**
*/
private elements;
/**
*/
constructor(elements: Array<interface_widget>);
/**
*/
load(target_element: HTMLElement): Promise<void>;
}
}
declare namespace lib_plankton.zoo_widget {
/**
*/
class class_panel implements interface_widget {
/**
*/
private content;
/**
*/
private collapseable;
/**
*/
private collapsed_initial_value;
/**
*/
private classes;
/**
*/
constructor(content: interface_widget, { "collapseable": collapseable, "collapsed_initial_value": collapsed_initial_value, "classes": classes, }?: {
collapseable?: boolean;
collapsed_initial_value?: boolean;
classes?: Array<string>;
});
/**
*/
load(target_element: HTMLElement): Promise<void>;
}
}
declare namespace lib_plankton.zoo_widget {
/**
*/
class class_panel_info extends class_panel {
/**
*/
constructor(content: interface_widget, { "collapseable": collapseable, "collapsed_initial_value": collapsed_initial_value, "classes": classes, }?: {
collapseable?: boolean;
collapsed_initial_value?: boolean;
classes?: Array<string>;
});
}
}
declare namespace lib_plankton.zoo_widget {
/**
*/
class class_panel_warning extends class_panel {
/**
*/
constructor(content: interface_widget, { "collapseable": collapseable, "collapsed_initial_value": collapsed_initial_value, "classes": classes, }?: {
collapseable?: boolean;
collapsed_initial_value?: boolean;
classes?: Array<string>;
});
}
}
declare namespace lib_plankton.zoo_widget {
/**
*/
class class_panel_error extends class_panel {
/**
*/
constructor(content: interface_widget, { "collapseable": collapseable, "collapsed_initial_value": collapsed_initial_value, "classes": classes, }?: {
collapseable?: boolean;
collapsed_initial_value?: boolean;
classes?: Array<string>;
});
}
}
declare namespace lib_plankton.zoo_widget {
/**
*/
class class_panel_success extends class_panel {
/**
*/
constructor(content: interface_widget, { "collapseable": collapseable, "collapsed_initial_value": collapsed_initial_value, "classes": classes, }?: {
collapseable?: boolean;
collapsed_initial_value?: boolean;
classes?: Array<string>;
});
}
}
declare namespace lib_plankton.zoo_widget {
/**
*/
class class_bunch implements interface_widget {
/**
*/
private elements;
/**
*/
constructor(elements: Array<interface_widget>);
/**
*/
load(target_element: HTMLElement): Promise<void>;
}
}
declare namespace lib_plankton.zoo_input {
/**
* @author fenris
@ -4496,31 +3889,12 @@ declare namespace lib_plankton.zoo_input {
* @author fenris
*/
class class_input_password implements interface_input<string> {
/**
*/
private exhibit;
/**
*/
private character_hide;
/**
*/
private character_show;
/**
*/
private dom_input;
/**
*/
private dom_exhibit;
/**
*/
constructor({ "exhibit_initial_value": exhibit_initial_value, "character_hide": character_hide, "character_show": character_show, }?: {
exhibit_initial_value?: boolean;
character_hide?: string;
character_show?: string;
});
/**
*/
private toggle_exhibition;
constructor();
/**
* [implementation]
*/
@ -4602,7 +3976,7 @@ declare namespace lib_plankton.zoo_input {
name: string;
input: interface_input<any>;
label?: (null | string);
help?: (null | lib_plankton.zoo_widget.interface_widget);
help?: (null | string);
}>);
/**
* [implementation]
@ -4695,39 +4069,6 @@ declare namespace lib_plankton.zoo_input {
write(value: lib_plankton.pit.type_datetime): Promise<void>;
}
}
declare namespace lib_plankton.zoo_input {
/**
*/
class class_input_color implements interface_input<(null | lib_plankton.color.type_color)> {
/**
*/
private dom_input;
/**
*/
constructor();
/**
* [implementation]
*/
setup(parent: HTMLElement): Promise<void>;
/**
* [implementation]
*/
read(): Promise<(null | lib_plankton.color.type_color)>;
/**
* [implementation]
*/
write(value: (null | lib_plankton.color.type_color)): Promise<void>;
}
}
declare namespace lib_plankton.zoo_input {
/**
*/
class class_input_hue extends class_input_wrapped<(null | lib_plankton.color.type_color), (null | float)> implements interface_input<(null | float)> {
/**
*/
constructor();
}
}
declare namespace lib_plankton.zoo_form {
/**
*/

File diff suppressed because it is too large Load diff

View file

@ -100,7 +100,6 @@ namespace _dali.type
*/
export type calendar_object = {
name : string;
hue : float;
access : {
public : boolean;
default_level : enum_access_level;

View file

@ -38,7 +38,6 @@
"resource.kinds.caldav.read_only": "nur lesen",
"calendar.calendar": "Kalender",
"calendar.name": "Name",
"calendar.hue": "Farbton",
"calendar.resource": "Resource",
"calendar.access.access": "Zugriff",
"calendar.access.public": "öffentlich",

View file

@ -38,7 +38,6 @@
"resource.kinds.caldav.read_only": "read-only",
"calendar.calendar": "Kalendar",
"calendar.name": "name",
"calendar.hue": "hue",
"calendar.resource": "resource",
"calendar.access.access": "access",
"calendar.access.public": "public",

View file

@ -15,6 +15,7 @@ namespace _dali.pages
}
);
const form : lib_plankton.zoo_form.class_form<
_dali.type.calendar_object,
{
name : string;
access : {
@ -26,22 +27,9 @@ namespace _dali.pages
>;
};
resource_kind : string;
hue : (null | float);
},
{
name : string;
access : {
public : boolean;
default_level : _dali.type.enum_access_level;
attributed : lib_plankton.map.type_map<
_dali.type.user_id,
_dali.type.enum_access_level
>;
};
resource_kind : string;
hue : (null | float);
}
> = new lib_plankton.zoo_form.class_form<
_dali.type.calendar_object,
{
name : string;
access : {
@ -53,24 +41,44 @@ namespace _dali.pages
>;
};
resource_kind : string;
hue : (null | float);
},
{
name : string;
access : {
public : boolean;
default_level : _dali.type.enum_access_level;
attributed : lib_plankton.map.type_map<
_dali.type.user_id,
_dali.type.enum_access_level
>;
};
resource_kind : string;
hue : (null | float);
}
>(
(value) => value,
(raw) => raw,
(calendar_object) => ({
"name": calendar_object.name,
"access": calendar_object.access,
"resource_kind": calendar_object.resource.kind,
}),
(raw) => ({
"name": raw.name,
"access": raw.access,
"resource": (() => {
switch (raw.resource_kind) {
case "local": {
return {
"kind": "local",
"data": {
"events": [],
}
};
break;
}
case "caldav": {
return {
"kind": "caldav",
"data": {
"url": "", // TODO
"read_only": true, // TODO
}
};
break;
}
default: {
throw (new Error("invalid resource kind: " + raw.resource_kind));
break;
}
}
}) (),
}),
new lib_plankton.zoo_input.class_input_group<any>(
[
{
@ -78,12 +86,6 @@ namespace _dali.pages
"input": new lib_plankton.zoo_input.class_input_text(),
"label": lib_plankton.translate.get("calendar.name")
},
{
"name": "hue",
"input": new lib_plankton.zoo_input.class_input_hue(
),
"label": lib_plankton.translate.get("calendar.hue"),
},
{
"name": "access",
"input": new lib_plankton.zoo_input.class_input_group(
@ -128,51 +130,12 @@ namespace _dali.pages
[
{
"label": lib_plankton.translate.get("page.calendar_add.actions.do"),
"target": "submit",
"procedure": async (get_value, get_representation) => {
const value : any = await get_value();
const calendar_object : _dali.type.calendar_object = {
"name": value.name,
"access": {
"public": value.access.public,
"default_level": value.access.default_level,
"attributed": value.access.attributed,
},
"resource": (() => {
switch (value.resource_kind) {
case "local":
{
return {
"kind": "local",
"data": {
"events": [],
}
};
break;
}
case "caldav":
{
return {
"kind": "caldav",
"data": {
"url": "", // TODO
"read_only": true, // TODO
}
};
break;
}
default:
{
throw (new Error("invalid resource kind: " + value.resource_kind));
break;
}
}
}) (),
"hue": value.hue,
};
try
{
try {
await _dali.backend.calendar_add(
calendar_object
value
);
lib_plankton.zoo_page.set(
{
@ -181,8 +144,7 @@ namespace _dali.pages
}
);
}
catch (error)
{
catch (error) {
// do nothing
/*
lib_plankton.zoo_page.set(
@ -199,28 +161,6 @@ namespace _dali.pages
]
);
await form.setup(document.querySelector("#calendar_add_form"));
await form.input_write(
{
"name": "",
"access": {
"public": false,
"default_level": _dali.type.enum_access_level.view,
"attributed": lib_plankton.map.hashmap.implementation_map<
_dali.type.user_id,
_dali.type.enum_access_level
>(
lib_plankton.map.hashmap.make<
_dali.type.user_id,
_dali.type.enum_access_level
>(
user_id => user_id.toFixed(0),
)
),
},
"resource_kind": "local",
"hue": lib_plankton.random.generate_unit(),
}
);
return Promise.resolve<void>(undefined);
}
);

View file

@ -17,21 +17,9 @@ namespace _dali.pages
}
);
const form : lib_plankton.zoo_form.class_form<
_dali.type.calendar_object,
{
name : string;
hue : float;
access : {
public : boolean;
default_level : _dali.type.enum_access_level;
attributed : lib_plankton.map.type_map<
_dali.type.user_id,
_dali.type.enum_access_level
>;
};
},
{
name : string;
hue : float;
access : {
public : boolean;
default_level : _dali.type.enum_access_level;
@ -42,21 +30,9 @@ namespace _dali.pages
};
}
> = new lib_plankton.zoo_form.class_form<
_dali.type.calendar_object,
{
name : string;
hue : float;
access : {
public : boolean;
default_level : _dali.type.enum_access_level;
attributed : lib_plankton.map.type_map<
_dali.type.user_id,
_dali.type.enum_access_level
>;
};
},
{
name : string;
hue : float;
access : {
public : boolean;
default_level : _dali.type.enum_access_level;
@ -67,8 +43,20 @@ namespace _dali.pages
};
}
>(
(value) => value,
(raw) => raw,
(calendar_object) => ({
"name": calendar_object.name,
"access": calendar_object.access,
}),
(raw) => ({
"name": raw.name,
"access": raw.access,
"resource": {
"kind": "local",
"data": {
"events": [],
}
},
}),
new lib_plankton.zoo_input.class_input_group<any>(
[
{
@ -76,12 +64,6 @@ namespace _dali.pages
"input": new lib_plankton.zoo_input.class_input_text(),
"label": lib_plankton.translate.get("calendar.name")
},
{
"name": "hue",
"input": new lib_plankton.zoo_input.class_input_hue(
),
"label": lib_plankton.translate.get("calendar.hue"),
},
{
"name": "access",
"input": new lib_plankton.zoo_input.class_input_group(
@ -116,12 +98,13 @@ namespace _dali.pages
[
{
"label": lib_plankton.translate.get("page.calendar_edit.actions.change"),
"target": "submit",
"procedure": async (get_value, get_representation) => {
const data : any = await get_value();
const value : any = await get_value();
try {
await _dali.backend.calendar_change(
calendar_id,
data
value
);
lib_plankton.zoo_page.set(
{
@ -146,6 +129,7 @@ namespace _dali.pages
},
{
"label": lib_plankton.translate.get("page.calendar_edit.actions.remove"),
"target": "submit",
"procedure": async (get_value, get_representation) => {
try {
await _dali.backend.calendar_remove(

View file

@ -76,7 +76,6 @@ namespace _dali.pages.overview
{
id : _dali.type.calendar_id;
name : string;
hue : float;
access_level : _dali.type.enum_access_level;
}
> = await _dali.backend.calendar_list(

View file

@ -310,7 +310,6 @@ namespace _dali.backend
{
id : int;
name : string;
hue : float;
access_level : _dali.type.enum_access_level;
}
>
@ -329,7 +328,6 @@ namespace _dali.backend
(entry) => ({
"id": entry.id,
"name": entry.name,
"hue": entry.hue,
"access_level": access_level_decode(entry.access_level),
})
)
@ -362,7 +360,6 @@ namespace _dali.backend
(raw) => Promise.resolve(
{
"name": raw.name,
"hue": raw.hue,
"access": {
"public": raw.access.public,
"default_level": access_level_decode(raw.access.default_level),
@ -390,7 +387,7 @@ namespace _dali.backend
"data": {
"events": []
}
},
}
}
)
)
@ -415,7 +412,6 @@ namespace _dali.backend
),
{
"name": calendar_object.name,
"hue": calendar_object.hue,
"access": {
"public": calendar_object.access.public,
"default_level": access_level_encode(calendar_object.access.default_level),
@ -439,18 +435,7 @@ namespace _dali.backend
*/
export async function calendar_change(
calendar_id : _dali.type.calendar_id,
data : {
name : string;
hue : float;
access : {
public : boolean;
default_level : _dali.type.enum_access_level;
attributed : lib_plankton.map.type_map<
_dali.type.user_id,
_dali.type.enum_access_level
>;
};
}
calendar_object : _dali.type.calendar_object
) : Promise<
void
>
@ -464,13 +449,12 @@ namespace _dali.backend
}
),
{
"name": data.name,
"hue": data.hue,
"name": calendar_object.name,
"access": {
"public": data.access.public,
"default_level": access_level_encode(data.access.default_level),
"public": calendar_object.access.public,
"default_level": access_level_encode(calendar_object.access.default_level),
"attributed": (
lib_plankton.map.dump(data.access.attributed)
lib_plankton.map.dump(calendar_object.access.attributed)
.map(
(pair) => ({
"user_id": pair.key,
@ -479,6 +463,7 @@ namespace _dali.backend
)
)
},
"resource": calendar_object.resource,
}
);
}
@ -603,7 +588,6 @@ namespace _dali.backend
{
calendar_id : _dali.type.calendar_id;
calendar_name : string;
hue : float;
access_level : _dali.type.enum_access_level;
event_id : (null | _dali.type.local_resource_event_id);
event_object : _dali.type.event_object;
@ -643,7 +627,6 @@ namespace _dali.backend
(entry) => ({
"calendar_id": entry.calendar_id,
"calendar_name": entry.calendar_name,
"hue": entry.hue,
"access_level": access_level_decode(entry.access_level),
"event_id": entry.event_id,
"event_object": entry.event_object,

View file

@ -6,7 +6,6 @@ namespace _dali.widgets.listview
type type_entry = {
calendar_id : _dali.type.calendar_id;
calendar_name : string;
hue : float;
access_level : _dali.type.enum_access_level;
event_id : (null | _dali.type.local_resource_event_id);
event_object : _dali.type.event_object;
@ -230,9 +229,9 @@ namespace _dali.widgets.listview
),
"raw": JSON.stringify(entry),
"color": lib_plankton.color.output_hex(
lib_plankton.color.make_hsv(
lib_plankton.color.give_generic(
(entry.calendar_id - 1),
{
"hue": entry.hue,
"saturation": 0.375,
"value": 0.375,
}

View file

@ -6,7 +6,6 @@ namespace _dali.widgets.sources
type type_entry = {
id : _dali.type.calendar_id;
name : string;
hue : float;
access_level : _dali.type.enum_access_level;
};
@ -102,18 +101,18 @@ namespace _dali.widgets.sources
// "access_level": entry.access_level, // TODO
// TODO centralize
"color_head": lib_plankton.color.output_hex(
lib_plankton.color.make_hsv(
lib_plankton.color.give_generic(
(entry.id - 1),
{
"hue": entry.hue,
"saturation": 0.375,
"value": 0.375,
}
),
),
"color_body": lib_plankton.color.output_hex(
lib_plankton.color.make_hsv(
lib_plankton.color.give_generic(
(entry.id - 1),
{
"hue": entry.hue,
"saturation": 0.375,
"value": 0.25,
}

View file

@ -6,7 +6,6 @@ namespace _dali.widgets.weekview
type type_entry = {
calendar_id : _dali.type.calendar_id;
calendar_name : string;
hue : float;
access_level : _dali.type.enum_access_level;
event_id : (null | _dali.type.local_resource_event_id);
event_object : _dali.type.event_object;
@ -224,7 +223,6 @@ namespace _dali.widgets.weekview
{
name : string;
access_level : _dali.type.enum_access_level;
hue : float;
}
>;
rows : Array<
@ -282,7 +280,6 @@ namespace _dali.widgets.weekview
{
name : string;
access_level : _dali.type.enum_access_level;
hue : float;
}
>;
rows : Array<
@ -317,7 +314,6 @@ namespace _dali.widgets.weekview
"value": {
"name": entry.calendar_name,
"access_level": entry.access_level,
"hue": entry.hue,
}
}
)
@ -512,7 +508,6 @@ namespace _dali.widgets.weekview
{
name : string;
access_level : _dali.type.enum_access_level;
hue : float;
}
>;
rows : Array<
@ -560,9 +555,9 @@ namespace _dali.widgets.weekview
"value": {
"name": pair.value.name,
"access_level": pair.value.access_level,
"color": lib_plankton.color.make_hsv(
"color": lib_plankton.color.give_generic(
(pair.key - 1),
{
"hue": pair.value.hue,
"saturation": 0.375,
"value": 0.375,
}

View file

@ -12,7 +12,6 @@ modules="${modules} storage"
modules="${modules} file"
modules="${modules} json"
modules="${modules} string"
modules="${modules} random"
modules="${modules} map"
modules="${modules} color"
# modules="${modules} xml"