JSPM

  • Created
  • Published
  • Downloads 135
  • Score
    100M100P100Q88180F
  • License MIT

Incept is a content management framework.

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stackpress) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Incept

    Incept is a content management framework.

    Usage

    See Example for use case.

    Model Spec

    The following attributes can be applied to model types in an idea file.

    model User @icon("user") @label("User" "Users") {}
    Attribute Description Attributes Example
    @icon(string) An icon representation of a model. Uses font awesome names.   @icon("user")
    @template(string) Used to describe each row in a model   @template("User {{name}}")
    @label(string string) A friendly name that represents the model   @label("User" "Users")
    @active A flag that represents the active field. Active fields are changed when deleting or restoring a row, as an alternative to actually deleting the row in the database.    
    @default(string|number|boolean) The default value applied when creating a row if no value was provided.   @default(1)
    @default("user")
    @default(true)
    @default("now()")
    @default("nanoid()")
    @default("nanoid(10)")
    @default("cuid()")
    @default("cuid(10)")
    @generated A flag that represents that the value of this column is generated, bypassing the need to be validated    
    @id A flag that represents the models identifier. If multiple ids then the combination will be used to determine each rows uniqueness.    
    @searchable A flag deonoting this column is searchable and will be considered in a search field for example. Also used to know which columns need to be optimized in the database.    
    @sortable A flag deonoting this column is sortable. Also used to know which columns need to be optimized in the database.    
    @label(string) A label that will be shown to represent this column instead of the actual column name.   @label("Name")
    @min(number) The minimum number value that will be accepted. This is also a consideration when determining the database type.   @min(10)
    @max(number) The maximum number value that will be accepted. This is also a consideration when determining the database type.   @max(100)
    @step(number) The incremental amount value that will be used when changing the columns value. This is also a consideration when determining the database type.   @step(1)
    @step(0.01)
    @relation(config) Maps columns in the model that is related to another model. local: string
    foreign: string
    name?: string
    @relation({ local "userId" foreign "id" })
    @relation({ name "memberships" local "ownerId" foreign "id" })
    @relation({ name "connections" local "memberId" foreign "id" })
    @unique A flag that ensures no duplicate value can be added to the model    
    @updated A flag that will automatically update the timestamp whenever a row is changed.    

    Validation Spec

    The following validation attributes can be applied to model columns in an idea file.

    name String @is.required @is.cgt(10)
    Attribute Description Example
    @is.required Validates that a value must be given before being inserted.  
    @is.notempty Validates that a value is something as opposed to an empty string.  
    @is.eq(string|number) Validates that the value is explicitly equal to the given argument @is.eq(10)
    @is.eq("foobar")
    @is.ne(string|number) Validates that the value is explicitly not equal to the given argument @is.neq(10)
    @is.neq("foobar")
    @is.option(string|number[]) Validates that the value is one of the given options @is.option([ 1 2 "foo" 3 "bar" ])
    @is.regex(string) Validates that the value matches the given regular expression @is.regex("[a-z]$")
    @is.date Validates that the value is a date  
    @is.future Validates that the value is a future date  
    @is.past Validates that the value is a past date  
    @is.present Validates that the value is the present date  
    @is.gt(number) Validate that the value is greater than the given number @is.gt(10)
    @is.ge(number) Validate that the value is greater than or equal to the given number @is.ge(10)
    @is.lt(number) Validate that the value is less than the given number @is.lt(10)
    @is.le(number) Validate that the value is less than or equal to the given number @is.le(10)
    @is.ceq(number) Validate that the character count of the value is equal to the given number @is.ceq(10)
    @is.cgt(number) Validate that the character count of the value is greater than or equal to the given number @is.cle(10)
    @is.cge(number) Validate that the character count of the value is less than the given number @is.cge(10)
    @is.clt(number) Validate that the character count of the value is less than or equal to the given number @is.clt(10)
    @is.cle(number) Validate that the character count of the value is less than or equal to the given number @is.cle(10)
    @is.weq(number) Validate that the word count of the value is equal to the given number @is.weq(10)
    @is.wgt(number) Validate that the word count of the value is greater than or equal to the given number @is.wle(10)
    @is.wge(number) Validate that the word count of the value is less than the given number @is.wge(10)
    @is.wlt(number) Validate that the word count of the value is less than or equal to the given number @is.wlt(10)
    @is.wle(number) Validate that the word count of the value is less than or equal to the given number @is.wle(10)
    @is.cc Validates that the value is a credit card  
    @is.color Validates that the value is a color value (color name or hex)  
    @is.email Validates that the value is an email  
    @is.hex Validates that the value is a hexidecimal  
    @is.price Validates that the value is a price number (ie. 2 decimal numbers)  
    @is.url Validates that the value is a URL  
    @is.boolean Validates that the value is a boolean  
    @is.number Validates that the value is a number format  
    @is.float Validates that the value is a float format  
    @is.integer Validates that the value is an integer format  
    @is.object Validates that the value is an object  

    Field Spec

    The following fields can be applied to model columns in an idea file.

    name String @field.text
    Attribute Description Attributes Example
    @field.color Use a color field to represent this column in a form    
    @field.checkbox(attributes?) Use a checkbox to represent this column in a form label: string
    check: boolean
    circle: boolean
    square: boolean
    rounded: boolean
    blue: boolean
    orange: boolean
    @field.checkbox
    @field.checkbox({ label "Enabled" circle true })
    @field.country(attributes?) Use a country dropdown to represent this column in a form placeholder: string @field.country
    @field.country({ placeholder "Select Country" })
    @field.currency(attributes?) Use a currency dropdown to represent this column in a form placeholder: string @field.currency
    @field.currency({ placeholder "Select Currency" })
    @field.date Use a date field to represent this column in a form    
    @field.datetime Use a date time field to represent this column in a form    
    @field.editor(attributes?) Use a code editor to represent this column in a form lang: html|md|css|js|ts
    numbers: boolean
    @field.editor
    @field.editor({ lang "html" numbers true })
    @field.file Use a file input to represent this column in a form    
    @field.filelist Use a file list fieldset to represent this column in a form    
    @field.input Use an input field to represent this column in a form    
    @field.markdown(attributes?) Use a markdown editor to represent this column in a form numbers: boolean @field.markdown
    @field.markdown({ numbers true })
    @field.mask(attributes) Use an input mask to represent this column in a form mask: string @field.mask
    @field.mask({ mask "999-999-999" })
    @field.metadata Use a key value fieldset to represent this column in a form    
    @field.number(attributes?) Uses a number field to represent this column in a form min: number
    max: number
    step: number
    separator: string
    decimal: string
    absolute: boolean
    @field.number
    @field.number({ min 0 max 10 step 0.01 separator "," decimal "." absolute true })
    @field.password Uses a password field to represent this column in a form    
    @field.range(attributes?) Uses a range field to represent this column in a form min: number
    max: number
    step: number
    width: number
    @field.range
    @field.range({ min 0 max 10 step 0.01 width 100 })
    @field.rating(attributes?) Uses a rating field to represent this column in a form max: number @field.rating
    @field.rating({ max 5 })
    @field.select(attributes?) Uses a select dropdown to represent this column in a form placeholder: string @field.select
    @field.select({ placeholder "Select Country" })
    @field.slug Uses an input field that transforms the value into a slug to represent this column in a form    
    @field.switch(attributes?) Uses a switch toggle to represent this column in a form rounded: boolean
    onoff: boolean
    yesno: boolean
    checkex: boolean
    sunmoon: boolean
    ridge: boolean
    smooth: boolean
    blue: boolean
    orange: boolean
    green: boolean
    @field.switch
    @field.switch({ label "Enabled" yesno true })
    @field.textarea(attributes?) Uses a textarea field to represent this column in a form rows: number @field.textarea
    @field.textarea({ rows 10 })
    @field.taglist Uses a tag field to represent this column in a form    
    @field.textlist Uses a text list fieldset to represent this column in a form    
    @field.time Uses a time field to represent this column in a form    
    @field.wysiwyg(attributes?) Uses a WYSIWYG to represent this column in a form history: boolean
    font: boolean
    size: boolean
    format: boolean
    paragraph: boolean
    blockquote: boolean
    style: boolean
    color: boolean
    highlight: boolean
    text: boolean
    remove: boolean
    indent: boolean
    align: boolean
    rule: boolean
    list: boolean
    lineheight: boolean
    table: boolean
    link: boolean
    image: boolean
    video: boolean
    audio: boolean
    fullscreen: boolean
    showblocks: boolean
    code: boolean
    dir: boolean
    @field.wysiwyg
    @field.wysiwyg({ font true size true format true })

    Filter Spec

    The following filter fields can be applied to model columns in an idea file.

    name String @field.text
    Attribute Description Attributes Example
    @filter.color Use a color field to represent this column in a filter form    
    @filter.checkbox(attributes?) Use a checkbox to represent this column in a filter form label: string
    check: boolean
    circle: boolean
    square: boolean
    rounded: boolean
    blue: boolean
    orange: boolean
    @filter.checkbox
    @filter.checkbox({ label "Enabled" circle true })
    @filter.country(attributes?) Use a country dropdown to represent this column in a filter form placeholder: string @filter.select
    @filter.select({ placeholder "Select Country" })
    @filter.currency(attributes?) Use a currency dropdown to represent this column in a filter form placeholder: string @filter.currency
    @filter.currency({ placeholder "Select Currency" })
    @filter.date Use a date field to represent this column in a filter form    
    @filter.datetime Use a date time field to represent this column in a filter form    
    @filter.file Use a file input to represent this column in a filter form    
    @filter.input Use an input field to represent this column in a filter form    
    @filter.mask(attributes) Use an input mask to represent this column in a filter form mask: string @filter.mask
    @filter.mask({ mask "999-999-999" })
    @filter.number(attributes?) Uses a number field to represent this column in a filter form min: number
    max: number
    step: number
    separator: string
    decimal: string
    absolute: boolean
    @filter.number
    @filter.number({ min 0 max 10 step 0.01 separator "," decimal "." absolute true })
    @filter.password Uses a password field to represent this column in a filter form    
    @filter.range(attributes?) Uses a range field to represent this column in a filter form min: number
    max: number
    step: number
    width: number
    @filter.range
    @filter.range({ min 0 max 10 step 0.01 width 100 })
    @filter.rating(attributes?) Uses a rating field to represent this column in a filter form max: number @filter.rating
    @filter.rating({ max 5 })
    @filter.select(attributes?) Uses a select dropdown to represent this column in a filter form placeholder: string @filter.select
    @filter.select({ placeholder "Select Country" })
    @filter.slug Uses an input field that transforms the value into a slug to represent this column in a filter form    
    @filter.switch(attributes?) Uses a switch toggle to represent this column in a filter form rounded: boolean
    onoff: boolean
    yesno: boolean
    checkex: boolean
    sunmoon: boolean
    ridge: boolean
    smooth: boolean
    blue: boolean
    orange: boolean
    green: boolean
    @filter.switch
    @filter.switch({ label "Enabled" yesno true })
    @filter.time Uses a time field to represent this column in a filter form    

    Spans

    Attribute Description Attributes Example
    @span.date Use a pair of date fields as a span to represent this column in a filter form    
    @span.datetime Use a pair of date time fields as a span to represent this column in a filter form    
    @span.input Use a pair of input fields as a span to represent this column in a filter form    
    @span.number(attributes?) Use a pair of number fields as a span to represent this column in a filter form min: number
    max: number
    step: number
    separator: string
    decimal: string
    absolute: boolean
    @span.number
    @span.number({ min 0 max 10 step 0.01 separator "," decimal "." absolute true })
    @span.range(attributes?) Use a range field as a span to represent this column in a filter form min: number
    max: number
    step: number
    width: number
    @span.range
    @span.range({ min 0 max 10 step 0.01 width 100 })
    @span.rating(attributes?) Use a pair of rating fields as a span to represent this column in a filter form max: number @span.rating
    @span.rating({ max 5 })
    @span.select(attributes?) Use a pair of select dropdowns as a span to represent this column in a filter form placeholder: string @span.select
    @span.select({ placeholder "Select Country" })
    @span.time Use a pair of time fields as a span to represent this column in a filter form    

    List Spec

    The following list format fields can be applied to model columns in an idea file.

    created Datetime @list.date({ locale "en" })
    Attribute Description Attributes Example
    @list.hide Hides this column in a formatted list of results    
    @list.code(attributes?) Uses a code format to represent this column in a formatted list of results lang: string
    numbers: boolean
    inline: boolean
    trim: boolean
    ltrim: boolean
    rtrim: boolean
    @list.code
    @list.code(lang "en" trim true)
    @list.color(attributes?) Uses a code color to represent this column in a formatted list of results box: boolean
    text: boolean
    @list.color
    @list.color(box true text true)
    @list.country(attributes?) Uses a country format to represent this column in a formatted list of results flag: boolean
    text: boolean
    @list.country
    @list.country(flag true text true)
    @list.currency(attributes?) Uses a currency format to represent this column in a formatted list of results flag: boolean
    text: boolean
    @list.currency
    @list.currency(flag true text true)
    @list.date(attributes?) Uses a date format to represent this column in a formatted list of results locale: string
    format: string
    @list.date
    @list.date(locale "en" format "MMMM D, YYYY, h:mm:ss a")
    @list.email Uses an email format to represent this column in a formatted list of results    
    @list.formula(attributes) Outputs the value of the given formula in a formatted list of results formula: string
    data: object
    @list.formula(formula "{x} + {this} + {y}" data { x 3 y 4 })
    @list.html(attributes?) Uses a raw HTML format to represent this column in a formatted list of results ordered: boolean
    indent: number
    spacing: number
    @list.html
    @list.html({ ordered true indent 10 spacing 10 })
    @list.image Uses a image format to represent this column in a formatted list of results    
    @list.imagelist Uses an image carousel to represent this column in a formatted list of results. Ideally for an array of strings.    
    @list.json Uses a json format to represent this column in a formatted list of results. Ideally for arrays or objects.    
    @list.link Uses a clickable link to represent this column in a formatted list of results    
    @list.list Uses a list (ordered or unordered) to represent this column in a formatted list of results. Ideally for an array of strings    
    @list.markdown Converts the column value from markdown to raw HTML to represent this column in a formatted list of results    
    @list.metadata(attributes?) Outputs the keys and values of the columns value in tabular format. Ideally for a key value object. padding: number
    align: left|right|center
    format: boolean
    @list.metadata
    @list.metadata({ padding 10 align "left" format true })
    @list.number(attributes?) Uses a number format to represent this column in a formatted list of results separator: string
    decimal: string
    decimals: number
    absolute: boolean
    @list.number
    @list.number({ separator "," decimal "." decimals 4 absolute true })
    @list.overflow(attributes?) Uses a format that considers text overflows to represent this column in a formatted list of results length: number
    words: boolean
    hellip: boolean
    @list.overflow
    @list.overflow({ length 10 words true hellip true})
    @list.phone(attributes?) Uses a phone format to represent this column in a formatted list of results label: string @list.phone
    @list.phone({ label "Call Me Maybe" })
    @list.rating(attributes?) Uses a rating format to represent this column in a formatted list of results max: number
    remainder: boolean
    round: round|ceil|floor
    spacing: number
    @list.rating
    @list.rating({ max 5 remainder true round "floor" spacing 10 })
    @list.separated(attributes?) Uses a separator format to represent this column in a formatted list of results. Ideally for an array of strings. separator: string @list.separated
    @list.separated({ separator ", " })
    @list.table(attributes?) Uses a tablular format to represent this column in a formatted list of results. Ideally for an array of objects. top: boolean
    left: boolean
    right: boolean
    padding: number
    align: left|right|center
    background: color
    border: color
    header: color
    stripe: color
    @list.table
    @list.table({ align "left" top true padding 100 background "blue" header "#CCC" })
    @list.taglist(attributes?) Uses a tag list format to represent this column in a formatted list of results. Ideally for an array of strings. curved: boolean
    rounded: boolean
    pill: boolean
    info: boolean
    warning: boolean
    success: boolean
    error: boolean
    muted: boolean
    primary: boolean
    color: color
    secondary: boolean
    outline: boolean
    solid: boolean
    transparent: boolean
    @list.taglist
    @list.taglist({ curved true info true outline true })
    @list.template(attributes) Uses a template to generate a text to represent this column in a formatted list of results template: string @list.template({ template "{{foo}} and {{bar}}" })
    @list.text(attributes?) Uses a text format to represent this column in a formatted list of results upper: boolean
    lower: boolean
    capital: boolean
    @list.text
    @list.text({ upper true })
    @list.yesno(attributes?) Converts a boolean to a string representation to represent this column in a formatted list of results yes: string
    no: string
    @list.yesno
    @list.yesno({ yes "Yep" no "Nah" })

    View Spec

    The following view format fields can be applied to model columns in an idea file.

    created Datetime @view.date({ locale "en" })
    Attribute Description Attributes Example
    @view.hide Hides this column in a view    
    @view.code(attributes?) Uses a code format to represent this column in a view lang: string
    numbers: boolean
    inline: boolean
    trim: boolean
    ltrim: boolean
    rtrim: boolean
    @view.code
    @view.code(lang "en" trim true)
    @view.color(attributes?) Uses a code color to represent this column in a view box: boolean
    text: boolean
    @view.color
    @view.color(box true text true)
    @view.country(attributes?) Uses a country format to represent this column in a view flag: boolean
    text: boolean
    @view.country
    @view.country(flag true text true)
    @view.currency(attributes?) Uses a currency format to represent this column in a view flag: boolean
    text: boolean
    @view.currency
    @view.currency(flag true text true)
    @view.date(attributes?) Uses a date format to represent this column in a view locale: string
    format: string
    @view.date
    @view.date(locale "en" format "MMMM D, YYYY, h:mm:ss a")
    @view.email Uses an email format to represent this column in a view    
    @view.formula(attributes?) Outputs the value of the given formula in a view formula: string @view.formula(formula "{x} + {this} + {y}" data { x 3 y 4 })
    @view.html(attributes?) Uses a raw HTML format to represent this column in a view ordered: boolean
    indent: number
    spacing: number
    @view.html
    @view.html({ ordered true indent 10 spacing 10 })
    @view.image Uses a image format to represent this column in a view    
    @view.imagelist Uses an image carousel to represent this column in a view. Ideally for an array of strings.    
    @view.json Uses a json format to represent this column in a view. Ideally for arrays or objects.    
    @view.link Uses a clickable link to represent this column in a view    
    @view.list Uses a list (ordered or unordered) to represent this column in a view. Ideally for an array of strings    
    @view.markdown Converts the column value from markdown to raw HTML to represent this column in a view    
    @view.metadata(attributes?) Outputs the keys and values of the columns value in tabular format. Ideally for a key value object. padding: number
    align: left|right|center
    format: boolean
    @view.metadata
    @view.metadata({ padding 10 align "left" format true })
    @view.number(attributes?) Uses a number format to represent this column in a view separator: string
    decimal: string
    decimals: boolean
    absolute: boolean
    @view.number
    @view.number({ separator "," decimal "." decimals 4 absolute true })
    @view.overflow(attributes?) Uses a format that considers text overflows to represent this column in a view length: number
    words: boolean
    hellip: boolean
    @view.overflow
    @view.overflow({ length 10 words true hellip true})
    @view.phone(attributes?) Uses a phone format to represent this column in a view label: string @view.phone
    @view.phone({ label "Call Me Maybe" })
    @view.rating(attributes?) Uses a rating format to represent this column in a view max: number
    remainder: boolean
    round: round|ceil|floor
    spacing: number
    @view.rating
    @view.rating({ max 5 remainder true round "floor" spacing 10 })
    @view.separated(attributes?) Uses a separator format to represent this column in a view. Ideally for an array of strings. separator: string @view.separated
    @view.separated({ separator ", " })
    @view.table(attributes?) Uses a tablular format to represent this column in a view. Ideally for an array of objects. top: boolean
    left: boolean
    right: boolean
    padding: number
    align: left|right|center
    background: color
    border: color
    header: color
    stripe: color
    @view.table
    @view.table({ align "left" top true padding 100 background "blue" header "#CCC" })
    @view.taglist(attributes?) Uses a tag list format to represent this column in a view. Ideally for an array of strings. curved: boolean
    rounded: boolean
    pill: boolean
    info: boolean
    warning: boolean
    success: boolean
    error: boolean
    muted: boolean
    primary: boolean
    color: boolean
    secondary: boolean
    outline: boolean
    solid: boolean
    transparent: boolean
    @view.taglist
    @view.taglist({ curved true info true outline true })
    @view.template(attributes?) Uses a template to generate a text to represent this column in a view template: string @view.template({ template "{{foo}} and {{bar}}" })
    @view.text(attributes?) Uses a text format to represent this column in a view upper: boolean
    lower: boolean
    capital: boolean
    @view.text
    @view.text({ upper true })
    @view.yesno(attributes?) Converts a boolean to a string representation to represent this column in a view yes: string
    no: string
    @view.yesno
    @view.yesno({ yes "Yep" no "Nah" })